Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends

GNativeString Class Reference

#include <GString.h>

Inheritance diagram for GNativeString:
Inheritance graph
[legend]
Collaboration diagram for GNativeString:
Collaboration graph
[legend]

List of all members.

Public Types

enum  EscapeMode { UNKNOWN_ESCAPED = GStringRep::UNKNOWN_ESCAPED, IS_ESCAPED = GStringRep::IS_ESCAPED, NOT_ESCAPED = GStringRep::NOT_ESCAPED }

Public Member Functions

int cmp (const GBaseString &s2, const int len=(-1)) const
int cmp (const char *s2, const int len=(-1)) const
int cmp (const char s2) const
int contains (const char accept[], const int from=0) const
void empty (void)
 Reinitializes a string with the null string.
int firstEndSpace (const int from=0, const int len=(-1)) const
 return the position after the last non-whitespace character.
GUTF8String getNative2UTF8 (void) const
GNativeString getUTF82Native (EscapeMode escape=UNKNOWN_ESCAPED) const
 GNativeString (const char *str)
 Constructs a string from a null terminated character array.
 GNativeString (const int number)
 GNativeString (const double number)
 GNativeString (const char *dat, unsigned int len)
 GNativeString (const uint16_t *dat, unsigned int len)
 GNativeString (const unsigned char *str)
 Constructs a string from a null terminated character array.
 GNativeString (const uint32_t *dat, unsigned int len)
 GNativeString (const GP< GStringRep > &str)
 Construct from base class.
 GNativeString (const char dat)
 Constructs a string from a character.
 GNativeString (const GBaseString &str)
 GNativeString (const uint16_t *str)
 GNativeString (void)
 GNativeString (const GNativeString &str)
 GNativeString (const GBaseString &gs, int from, int len)
 GNativeString (const uint32_t *str)
 GNativeString (const GNativeString &fmt, va_list &args)
bool is_float (void) const
 Returns TRUE# if the string contains a float number.
bool is_int (void) const
 Returns TRUE# if the string contains an integer number.
bool is_valid (void) const
 Tests if the string is legally encoded in the current codepage.
unsigned int length (void) const
 Returns the string length.
GUTF8String NativeToUTF8 (void) const
int nextChar (const int from=0) const
 Returns next character position.
int nextNonSpace (const int from=0, const int len=(-1)) const
 Returns next non space position.
int nextSpace (const int from=0, const int len=(-1)) const
 Returns next non space position.
 operator const char * (void) const
bool operator! (void) const
bool operator!= (const GBaseString &s2) const
bool operator!= (const char *s2) const
GUTF8String operator+ (const GUTF8String &s2) const
GNativeString operator+ (const GNativeString &s2) const
bool operator< (const GBaseString &s2) const
bool operator< (const char *s2) const
bool operator< (const char s2) const
bool operator<= (const char s2) const
bool operator<= (const GBaseString &s2) const
bool operator<= (const char *s2) const
bool operator== (const char *s2) const
bool operator== (const GBaseString &s2) const
bool operator> (const char s2) const
bool operator> (const char *s2) const
bool operator> (const GBaseString &s2) const
bool operator>= (const GBaseString &s2) const
bool operator>= (const char s2) const
bool operator>= (const char *s2) const
char operator[] (int n) const
int rcontains (const char accept[], const int from=0) const
int rsearch (char c, const int from=0) const
int rsearch (const char *str, const int from=0) const
int search (const char *str, int from=0) const
int search (char c, int from=0) const
double toDouble (const int pos, int &endpos) const
int toInt (void) const
long toLong (const int pos, int &endpos, const int base=10) const
unsigned long toULong (const int pos, int &endpos, const int base=10) const
GNativeString UTF8ToNative (const bool currentlocale=false, const EscapeMode escape=UNKNOWN_ESCAPED) const

Static Public Member Functions

static int cmp (const char *s1, const char *s2, const int len=(-1))
static double toDouble (const GNativeString &src, const int pos, int &endpos)
static double toDouble (const GUTF8String &src, const int pos, int &endpos)
static long toLong (const GNativeString &src, const int pos, int &endpos, const int base=10)
static long toLong (const GUTF8String &src, const int pos, int &endpos, const int base=10)
static unsigned long toULong (const GUTF8String &src, const int pos, int &endpos, const int base=10)
static unsigned long toULong (const GNativeString &src, const int pos, int &endpos, const int base=10)

Protected Member Functions

GPBaseassign (const GPBase &sptr)
GPBaseassign (GPEnabled *nptr)
int CheckSubscript (int n) const
GPEnabledget () const
GBaseStringinit (const GP< GStringRep > &rep)
void init (void)
 operator GStringRep * () const
int operator!= (GStringRep *nptr) const
GStringRepoperator* () const
GStringRepoperator-> () const
int operator== (const GPBase &g2) const
int operator== (GStringRep *nptr) const

Static Protected Member Functions

static void throw_illegal_subscript () no_return

Protected Attributes

const char * gstr
 copy to a wchar_t buffer
GPEnabledptr

Static Protected Attributes

static const char * nullstr = ""

Friends

class GNativeString
class GStringRep
class GUTF8String
DJVUAPI unsigned int hash (const GBaseString &ref)
bool operator!= (const char *s1, const GBaseString &s2)
bool operator< (const char *s1, const GBaseString &s2)
bool operator< (const char s1, const GBaseString &s2)
bool operator<= (const char s1, const GBaseString &s2)
bool operator<= (const char *s1, const GBaseString &s2)
bool operator== (const char *s1, const GBaseString &s2)
bool operator> (const char s1, const GBaseString &s2)
bool operator> (const char *s1, const GBaseString &s2)
bool operator>= (const char s1, const GBaseString &s2)
bool operator>= (const char *s1, const GBaseString &s2)

Detailed Description

General purpose character string. Each instance of class GNativeString# represents a character string. Overloaded operators provide a value semantic to GNativeString# objects. Conversion operators and constructors transparently convert between GNativeString# objects and const char*# pointers.

Functions taking strings as arguments should declare their arguments as "#const char*#". Such functions will work equally well with GNativeString# objects since there is a fast conversion operator from GNativeString# to "#const char*#". Functions returning strings should return GUTF8String# or GNativeString# objects because the class will automatically manage the necessary memory.

Characters in the string can be identified by their position. The first character of a string is numbered zero. Negative positions represent characters relative to the end of the string (i.e. position #-1# accesses the last character of the string, position #-2# represents the second last character, etc.)

Definition at line 952 of file GString.h.


The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index