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

GUTF8String Class Reference

#include <GString.h>

Inheritance diagram for GUTF8String:

GBaseString GP< GStringRep > GPBase

List of all members.


Detailed Description

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

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


Public Types

typedef enum GStringRep::EncodeType EncodeType
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
GUTF8String downcase (void) 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.
GUTF8Stringformat (const char *fmt,...)
GUTF8String fromEscaped (const GMap< GUTF8String, GUTF8String > ConvMap) const
GUTF8String fromEscaped (void) const
GP< GStringRep::Unicode > get_remainder (void) const
char * getbuf (int n=-1)
GUTF8String getNative2UTF8 (void) const
GNativeString getUTF82Native (EscapeMode escape=UNKNOWN_ESCAPED) const
 GUTF8String (const double number)
 GUTF8String (const int number)
 Constructs a string from a character.
 GUTF8String (const GUTF8String &fmt, va_list &args)
 GUTF8String (const GBaseString &gs, int from, int len)
 GUTF8String (const GNativeString &str)
 GUTF8String (const GUTF8String &str)
 GUTF8String (const GBaseString &str)
 GUTF8String (const GP< GStringRep > &str)
 Construct from base class.
 GUTF8String (const unsigned long *dat, unsigned int len)
 GUTF8String (const unsigned short *dat, unsigned int len)
 GUTF8String (const char *dat, unsigned int len)
 GUTF8String (const unsigned long *dat)
 GUTF8String (const unsigned short *dat)
 GUTF8String (const unsigned char *str)
 Constructs a string from a null terminated character array.
 GUTF8String (const char *str)
 Constructs a string from a null terminated character array.
 GUTF8String (const char dat)
 Constructs a string from a character.
 GUTF8String (void)
GUTF8Stringinit (const GP< GStringRep > &rep)
void init (void)
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
GUTF8String operator+ (const char *s2) const
GUTF8String operator+ (const GNativeString &s2) const
GUTF8String operator+ (const GUTF8String &s2) const
GUTF8String operator+ (const GBaseString &s2) const
GUTF8Stringoperator+= (const GBaseString &str)
 Appends the specified GBaseString to the string.
GUTF8Stringoperator+= (const char *str)
 Appends the null terminated character array str# to the string.
GUTF8Stringoperator+= (char ch)
 Appends character ch# to the string.
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
GUTF8Stringoperator= (const GNativeString &str)
GUTF8Stringoperator= (const GUTF8String &str)
GUTF8Stringoperator= (const GBaseString &str)
GUTF8Stringoperator= (const GP< GStringRep > &str)
GUTF8Stringoperator= (const char *str)
GUTF8Stringoperator= (const char str)
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
void setat (const int n, const char ch)
GUTF8String substr (int from, int len) const
double toDouble (const int pos, int &endpos) const
GUTF8String toEscaped (const bool tosevenbit=false) 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
GUTF8String upcase (void) const
GNativeString UTF8ToNative (const bool currentlocale=false, const EscapeMode escape=UNKNOWN_ESCAPED) const
GUTF8Stringvformat (const GUTF8String &fmt, va_list &args)

Static Public Member Functions

static int cmp (const char *s1, const char *s2, const int len=(-1))
static GUTF8String create (const unsigned long *buf, const unsigned int bufsize)
static GUTF8String create (const unsigned short *buf, const unsigned int bufsize)
static GUTF8String create (const char *buf, const unsigned int bufsize)
static GUTF8String create (void const *const buf, const unsigned int size, const GP< GStringRep::Unicode > &remainder)
static GUTF8String create (void const *const buf, const unsigned int size, const GUTF8String &encoding)
static GUTF8String create (void const *const buf, unsigned int size, const EncodeType encodetype)
static GUTF8String create (void const *const buf, const unsigned int size, const EncodeType encodetype, const GUTF8String &encoding)
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
GPEnabledget () const
 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)
GUTF8String operator+ (const char *s1, const GUTF8String &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