DynStr Class Reference
[DynI derived classes]

#include <DynStr.h>

Inheritance diagram for DynStr:

DynObj DynI VObj

List of all members.

Public Member Functions

Virtuals
Interface members

virtual DynObjType *docall doGetType (const DynI **pself=0) const
virtual DynStr &docall AssignA (const char *s, int l=-1)
virtual int docall Strcmp (const char *s) const
virtual int docall Stricmp (const char *s) const
virtual const char *docall Get () const
virtual int docall GetByte (int ix) const
virtual int docall GetUniChar (int ix) const
virtual bool docall SetByte (int ix, char ch)
virtual bool docall SetUniChar (int ix, int ch)
virtual int docall Length () const
virtual int docall ByteSize () const
virtual DynStr &docall Insert (int at, const char *s, int byte_len)
virtual DynStr &docall InsertChar (int at, int ch)
virtual DynStr &docall Remove (int pos, int cnt)
virtual DynStr &docall AppendW (const wchar_t *s, int l=-1)
virtual DynStr &docall Reset ()
virtual const char *docall Right (int from_pos) const
virtual DynStr &docall Strip (bool left=true, bool right=true)
virtual bool docall IsEmpty () const
virtual int docall SubstChar (int ch_find, int ch_repl)
virtual int docall Subst (const char *s_find, const char *s_repl)
virtual int docall Find (const char *str) const
virtual bool docall FindAt (const char *str, int pos=0) const
virtual int docall FindBytePos (const char *str) const
virtual bool docall FindAtBytePos (const char *str, int pos=0) const
virtual int docall BytePos2Index (int pb)
virtual int docall Index2BytePos (int pi)
virtual void docall Concat_CannotUse (const char *str)
virtual wchar_t *docall ToWideChar (DynArrI< wchar_t > &wa)
Inlines
Inline convenience functions

DynStroperator= (const char *s)
DynStroperator= (const wchar_t *s)
bool operator== (const char *s) const
bool operator!= (const char *s) const
 operator const char * () const
const char * c_str () const
DynStrAssignW (const wchar_t *pws, int l=-1)
DynStrPrepend (const char *s)
DynStrAppend (const char *s)
DynStrPrepend (int ch)
DynStrAppend (int ch)
DynStrInsert (int at, const char *s)
DynStroperator+= (const char *s)
DynStroperator+= (const wchar_t *ws)
DynStroperator+= (int ch)
bool StartsWith (const char *str) const
bool EndsWith (const char *str) const
DynStrSuffix (const char *str)
DynStrPrefix (const char *str)
DynStrTrunc (int at)
int operator[] (int ix) const
DynStrAppendArg (bool b, const char *fmt=NULL)
DynStrAppendArg (int i, const char *fmt="%d")
DynStrAppendArg (unsigned int i, const char *fmt="%u")
DynStrAppendArg (char ch, const char *fmt="%c")
DynStrAppendArg (unsigned char ch, const char *fmt="%c")
DynStrAppendArg (double d, const char *fmt="%e")
DynStrAppendArg (const void *pv, const char *fmt="%p")
DynStrAppendArg (const char *s, const char *fmt="%s")
DynStrAppendArg (const wchar_t *ws, const char *fmt="%s")


Detailed Description

Interface to a string class that handles Unicode. Internally it stores strings in UTF8 format. It does on-the-fly conversion from wchar_t in constructor and in assignments. The array of charcters can be accessed both as a Unicode characters and as 8-bit char:s. A Unicode character has the int type, except for in assignments (for compatibility with 16-bit wchar_t on Windows).

Member Function Documentation

virtual DynObjType* docall DynStr::doGetType ( const DynI **  pself = 0  )  const [virtual]

Returns type of this object. Each type that wants to make itself known should override this method. DynI knows its own type so we get the type without any lookup. It is faster and works without registration.

Parameters:
pself allows fetching the actual 'this' used inside doGetType (from a side base, this will be different to the 'this' of the caller).
Returns:
A DynObjType pointer

Reimplemented from DynObj.

virtual DynStr& docall DynStr::AssignA ( const char *  s,
int  l = -1 
) [inline, virtual]

Assign function for char string

virtual int docall DynStr::Strcmp ( const char *  s  )  const [inline, virtual]

Compare with another string, 0 on equal.

virtual int docall DynStr::Stricmp ( const char *  s  )  const [inline, virtual]

Compare (case insensitive) with another string, 0 on equal.

virtual const char* docall DynStr::Get (  )  const [inline, virtual]

Return pointer to char data.

virtual int docall DynStr::GetByte ( int  ix  )  const [inline, virtual]

Return 8-bit char at offset ix. Use negative index to access from the end.

virtual int docall DynStr::GetUniChar ( int  ix  )  const [inline, virtual]

Return Unicode character at offset ix. Use negative index to access from the end.

virtual bool docall DynStr::SetByte ( int  ix,
char  ch 
) [inline, virtual]

Set 8-bit char at offset ix.

virtual bool docall DynStr::SetUniChar ( int  ix,
int  ch 
) [inline, virtual]

Set Unicode character at offset ix.

virtual int docall DynStr::Length (  )  const [inline, virtual]

Length of string in Unicode characters.

virtual int docall DynStr::ByteSize (  )  const [inline, virtual]

Number of bytes needed to hold string.

virtual DynStr& docall DynStr::Insert ( int  at,
const char *  s,
int  byte_len 
) [inline, virtual]

Insert string at offset. Note: len is byte length or -1 if not known

virtual DynStr& docall DynStr::InsertChar ( int  at,
int  ch 
) [inline, virtual]

Insert character at offset.

virtual DynStr& docall DynStr::Remove ( int  pos,
int  cnt 
) [inline, virtual]

Remove characters at position. cnt=1 => remove all after

virtual DynStr& docall DynStr::AppendW ( const wchar_t *  s,
int  l = -1 
) [inline, virtual]

Append function for wchar_t string

virtual DynStr& docall DynStr::Reset (  )  [inline, virtual]

Reset the string.

virtual const char* docall DynStr::Right ( int  from_pos  )  const [inline, virtual]

Return the right hand side string starting at position from_pos.

virtual DynStr& docall DynStr::Strip ( bool  left = true,
bool  right = true 
) [inline, virtual]

Strip space at either lor both of left/right sides of the string.

virtual bool docall DynStr::IsEmpty (  )  const [inline, virtual]

Query if empty.

virtual int docall DynStr::SubstChar ( int  ch_find,
int  ch_repl 
) [inline, virtual]

Substitute a Unicode character in the string.

virtual int docall DynStr::Subst ( const char *  s_find,
const char *  s_repl 
) [inline, virtual]

Substitute a full string in the string.

virtual int docall DynStr::Find ( const char *  str  )  const [inline, virtual]

Search for a string in the string.

virtual bool docall DynStr::FindAt ( const char *  str,
int  pos = 0 
) const [inline, virtual]

Looks for given string at offset 'pos' (Unicode offset). Use pos=STR_AT_END to check at at the end

virtual int docall DynStr::FindBytePos ( const char *  str  )  const [inline, virtual]

Search for a string in the string. Returns byte position.

virtual bool docall DynStr::FindAtBytePos ( const char *  str,
int  pos = 0 
) const [inline, virtual]

Looks for given string at offset 'pos' (Byte offset). Use pos=STR_AT_END to check at at the end

virtual int docall DynStr::BytePos2Index ( int  pb  )  [inline, virtual]

Converts byte position in current string to Unicode character index

virtual int docall DynStr::Index2BytePos ( int  pi  )  [inline, virtual]

Converts Unicode character index to byte position in current string

virtual void docall DynStr::Concat_CannotUse ( const char *  str  )  [inline, virtual]

Concatenate two strings and return a new one

virtual wchar_t* docall DynStr::ToWideChar ( DynArrI< wchar_t > &  wa  )  [inline, virtual]

Convert current string to an array of wchar_t (it will append to the array)

DynStr& DynStr::operator= ( const char *  s  )  [inline]

Assign operator, for UTF8 char*

DynStr& DynStr::operator= ( const wchar_t *  s  )  [inline]

Assign operator, for wchar_t*

bool DynStr::operator== ( const char *  s  )  const [inline]

Test for equality

bool DynStr::operator!= ( const char *  s  )  const [inline]

Test for non equality

DynStr::operator const char * (  )  const [inline]

Return pointer to internal string

const char* DynStr::c_str (  )  const [inline]

Return pointer to internal string

DynStr& DynStr::AssignW ( const wchar_t *  pws,
int  l = -1 
) [inline]

Set string to empty.

DynStr& DynStr::Prepend ( const char *  s  )  [inline]

Insert a string at the beginning of the string

DynStr& DynStr::Append ( const char *  s  )  [inline]

Insert a string at the end of the string

DynStr& DynStr::Prepend ( int  ch  )  [inline]

Prepend a charcter at the beginning of the string

DynStr& DynStr::Append ( int  ch  )  [inline]

Prepend a character at the end of the string

DynStr& DynStr::Insert ( int  at,
const char *  s 
) [inline]

Insert a string at arbitrary position in the string

DynStr& DynStr::operator+= ( const char *  s  )  [inline]

Append a string

DynStr& DynStr::operator+= ( int  ch  )  [inline]

Concatenate two strings to a new one Append a character

bool DynStr::StartsWith ( const char *  str  )  const [inline]

Check if the string starts with given string

bool DynStr::EndsWith ( const char *  str  )  const [inline]

Check if the string ends with given string

DynStr& DynStr::Suffix ( const char *  str  )  [inline]

If the string does not end with the given suffix, then append it

DynStr& DynStr::Prefix ( const char *  str  )  [inline]

If the string does not start with the given suffix, then prepend it

DynStr& DynStr::Trunc ( int  at  )  [inline]

Truncate at position

int DynStr::operator[] ( int  ix  )  const [inline]

Return Unicode character at index ix. Use -1 to access last character.


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

Generated on Sun Feb 15 16:35:57 2009 for DynObj by  doxygen 1.5.6