Logo Search packages:      
Sourcecode: djvulibre version File versions

GBaseString Class Reference

#include <GString.h>

Inheritance diagram for GBaseString:

GP< GStringRep > GPBase GNativeString GUTF8String

List of all members.


Detailed Description

General purpose character string. Each dirivied instance of class GBaseString# represents a character string. Overloaded operators provide a value semantic to GBaseString# objects. Conversion operators and constructors transparently convert between GBaseString# objects and const char*# pointers. The GBaseString# class has no public constructors, since a dirived type should always be used to specify the desired multibyte character encoding.

Functions taking strings as arguments should declare their arguments as "#const char*#". Such functions will work equally well with dirived GBaseString# objects since there is a fast conversion operator from the dirivied GBaseString# objects 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 464 of file GString.h.


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 char s2) const
int cmp (const char *s2, const int len=(-1)) const
int cmp (const GBaseString &s2, const int len=(-1)) 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
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 ncopy (wchar_t *const buf, const int buflen) const
 copy to a wchar_t buffer
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 char *s2) const
bool operator!= (const GBaseString &s2) const
GNativeString operator+ (const GNativeString &s2) const
GUTF8String operator+ (const GUTF8String &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 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
char operator[] (int n) const
int rcontains (const char accept[], const int from=0) const
int rsearch (const char *str, const int from=0) const
int rsearch (char c, 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 GNativeString &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)

Protected Member Functions

GPBaseassign (GPEnabled *nptr)
GPBaseassign (const GPBase &sptr)
int CheckSubscript (int n) const
 GBaseString (void)
GPEnabledget () const
GBaseStringinit (const GP< GStringRep > &rep)
void init (void)
 operator GStringRep * () const
int operator!= (GStringRep *nptr) const
GStringRep & operator* () const
GStringRep * operator-> () 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
GPEnabledptr

Static Protected Attributes

static const char * nullstr = ""

Friends

class GNativeString
class GStringRep
class GUTF8String
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)

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

Generated by  Doxygen 1.6.0   Back to index