commore  1.0.6-SNAPSHOT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
commore::AString Class Reference

#include <AString.h>

+ Inheritance diagram for commore::AString:

Public Types

enum  { STRING_INCREMENT_SIZE = 16 }
 
typedef AChar value_type
 
typedef size_t size_type
 
typedef ACharreference
 
typedef const ACharconst_reference
 
typedef ACharpointer
 
typedef const ACharconst_pointer
 

Public Member Functions

 AString ()
 
 AString (const AString &str)
 
 AString (const AString &str, size_t pos, size_t n=(size_t) npos)
 
 AString (const AChar *str, size_t n)
 
 AString (const AChar *str)
 
 AString (const Char *str)
 
 AString (size_t n, AChar c)
 
 AString (AChar c, size_t n)
 
 AString (const void *v, size_t n, size_t base=16)
 
AStringoperator= (const AString &str)
 
AStringoperator= (const AChar *str)
 
AStringoperator= (AChar c)
 
 operator const AChar * () const
 
 ~AString ()
 
bool operator== (const AString &str) const
 
bool operator== (const AChar *str) const
 
bool operator!= (const AString &str) const
 
bool operator!= (const AChar *str) const
 
bool operator< (const commore::AString &str) const
 
bool operator> (const commore::AString &str) const
 
AStringoperator+= (const AString &str)
 
AString operator+ (const AString &str) const
 
AStringoperator+= (const AChar *str)
 
AStringoperator+= (AChar c)
 
AStringappend (const AString &str)
 
AStringappend (const AString &str, size_t pos, size_t n)
 
AStringappend (const AChar *str, size_t n)
 
AStringappend (const AChar *str)
 
AStringappend (size_t n, AChar c)
 
bool validate_range (size_t pos, size_t *len) const
 
AStringassign (const AString &other)
 
AStringassign (const AString &str, size_t pos, size_t n)
 
AStringassign (const AChar *str, size_t n)
 
AStringassign (const AChar *str)
 
AStringassign (size_t n, AChar c)
 
void swap (AString &str)
 
void splice (AString &str)
 
AStringinsert (size_t pos1, const AString &str)
 
AStringinsert (size_t pos1, const AString &str, size_t pos2, size_t n)
 
AStringinsert (size_t pos, const AChar *str, size_t n)
 
AStringinsert (size_t pos, const AChar *str)
 
AStringinsert (size_t pos, size_t n, AChar c)
 
AStringclear ()
 
AStringerase (size_t pos=0, size_t n=(size_t) npos)
 
void Delete (size_t pos=0, size_t n=1)
 
AStringreplace (size_t pos1, size_t n, const AString &str)
 
AStringreplace (size_t pos1, size_t n1, const AString &str, size_t pos2, size_t n2)
 
AStringreplace (size_t pos1, size_t n1, const AChar *str, size_t n2)
 
AStringreplace (size_t pos, size_t n1, const AChar *str)
 
AStringreplace (size_t pos, size_t n1, size_t n2, AChar c)
 
AStringreplace (const AChar *s1, const AChar *s2, bool case_sensitive=true)
 
AStringReplace (const AChar *s1, const AChar *s2, bool case_sensitive=true)
 
AChar operator[] (size_t pos) const
 
ACharoperator[] (size_t pos)
 
AChar operator[] (int pos) const
 
ACharoperator[] (int pos)
 
AChar at (size_t pos) const
 
ACharat (size_t pos)
 
const ACharc_str () const
 
const AChardata () const
 
size_t size () const
 
size_t length () const
 
size_t max_size () const
 
bool is_empty () const
 
void resize (size_t n, AChar c)
 
void resize (size_t n)
 
void resize ()
 
size_t capacity () const
 Return size of allocated storage. More...
 
void reserve (size_t size)
 Request a change in capacity Requests that the string capacity be adapted to a planned change in size to a length of up to n characters. If n is greater than the current string capacity, the function causes the container to increase its capacity to n characters (or greater). In all other cases, it is taken as a non-binding request to shrink the string capacity: the container implementation is free to optimize otherwise and leave the string with a capacity greater than n. This function has no effect on the string length and cannot alter its content. More...
 
char * set_buffer (size_t size)
 
size_t copy (AChar *str, size_t n, size_t pos=0) const
 Copy sequence of characters from string Copies a substring of the current value of the string object into the array pointed by s. This substring contains the len characters that start at position pos. The function does not append a null character at the end of the copied content. More...
 
size_t find (const AString &str, size_t pos=0) const
 Find content in string Searches the string for the first occurrence of the sequence specified by its arguments. When pos is specified, the search only includes characters at or after position pos, ignoring any possible occurrences that include characters before pos. Notice that unlike member find_first_of, whenever more than one character is being searched for, it is not enough that just one of these characters match, but the entire sequence must match. More...
 
size_t find (const AChar *s, size_t pos, size_t n) const
 
size_t find (const AChar *str, size_t pos=0) const
 
size_t find (AChar c, size_t pos=0) const
 
size_t find_first_of (const AString &str, size_t pos=0) const
 
size_t find_first_of (const AChar *s, size_t pos, size_t n) const
 
size_t find_first_of (const AChar *str, size_t pos=0) const
 
size_t find_first_of (AChar c, size_t pos=0) const
 
size_t find_first_not_of (const AString &str, size_t pos=0) const
 
size_t find_first_not_of (const AChar *s, size_t pos, size_t n) const
 
size_t find_first_not_of (AChar c, size_t pos=0) const
 
size_t find_first_not_of (const AChar *str, size_t pos=0) const
 
size_t rfind (const AChar *str, size_t pos, size_t n) const
 
size_t find_last_of (const AChar *s, size_t pos, size_t n) const
 
size_t find_last_not_of (const AChar *s, size_t pos, size_t n) const
 
size_t rfind (const AString &str, size_t pos=(size_t) npos) const
 
size_t rfind (const AChar *str, size_t pos=(size_t) npos) const
 
size_t rfind (AChar c, size_t pos=(size_t) npos) const
 
size_t find_last_of (const AString &str, size_t pos=(size_t) npos) const
 
size_t find_last_of (AChar c, size_t pos=(size_t) npos) const
 
size_t find_last_of (const AChar *str, size_t pos=(size_t) npos) const
 
size_t find_last_not_of (const AString &str, size_t pos=(size_t) npos) const
 
size_t find_last_not_of (const AChar &c, size_t pos=(size_t) npos) const
 
size_t find_last_not_of (const AChar *str, size_t pos=(size_t) npos) const
 
AString substr (size_t pos=0, size_t n=(size_t) npos) const
 Generate substring Returns a newly constructed string object with its value initialized to a copy of a substring of this object. The substring is the portion of the object that starts at character position pos and spans len characters (or until the end of the string, whichever comes first). More...
 
Int to_int () const
 
bool match (const AString &pattern) const
 
bool match (const AString &pattern, AString &a0) const
 
bool match (const AString &pattern, AString &a0, AString &a1) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2, AString &a3) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2, AString &a3, AString &a4) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2, AString &a3, AString &a4, AString &a5) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2, AString &a3, AString &a4, AString &a5, AString &a6) const
 
bool match (const AString &pattern, AString &a0, AString &a1, AString &a2, AString &a3, AString &a4, AString &a5, AString &a6, AString &a7) const
 
long write_xml (OBStream &o) const
 
long read_xml (IBStream &i)
 
int compare (const AString &str) const
 Compare string. More...
 
int compare (size_t pos, size_t n, const AString &str) const
 
int compare (size_t pos1, size_t n1, const AString &str, size_t pos2, size_t n2) const
 
int compare (const AChar *s) const
 
int compare (size_t pos, size_t n1, const AChar *str, size_t n2=(size_t) npos) const
 
int icompare (const AString &str) const
 Compare string but do not care caracter case (acii charecter only) More...
 
int icompare (size_t pos, size_t n, const AString &str) const
 
int icompare (size_t pos1, size_t n1, const AString &str, size_t pos2, size_t n2) const
 
int icompare (const AChar *s) const
 
int icompare (size_t pos, size_t n1, const AChar *str, size_t n2=(size_t) npos) const
 
int CompareNoCase (const AChar *s) const
 
AStringmake_upper ()
 
AStringMakeUpper ()
 
AStringmake_lower ()
 
AStringMakeLower ()
 

Static Public Member Functions

static AChar eos ()
 
static int compare (const AChar *s1, const AChar *s2, size_t n)
 
static int icompare (const AChar *s1, const AChar *s2, size_t n)
 
static const ACharfind (const AChar *s, int n, const AChar &a)
 
static size_t length (const AChar *s)
 
static ACharcopy (AChar *dest, const AChar *src, size_t n)
 
static ACharmove (AChar *dest, const AChar *src, size_t n)
 
static ACharassign (AChar *dest, size_t n, const AChar &c)
 
static void assign (AChar &c1, const AChar &c2)
 
static bool eq (const AChar &c1, const AChar &c2)
 
static bool ne (const AChar &c1, const AChar &c2)
 
static bool lt (const AChar &c1, const AChar &c2)
 
static bool ieq (const AChar &c1, const AChar &c2)
 
static bool ine (const AChar &c1, const AChar &c2)
 
static bool ilt (const AChar &c1, const AChar &c2)
 

Friends

class Iterator
 

Detailed Description

Ascii string class. Is inspired by stl::string

Remarks
does not manage the character encoding
Todo:
keep only usefull method
Examples:
/examples/coding/Listener.cpp, and /examples/coding/Sender.cpp.

Member Typedef Documentation

Member Enumeration Documentation

anonymous enum
Enumerator
STRING_INCREMENT_SIZE 

Constructor & Destructor Documentation

AString::AString ( )
AString::AString ( const AString str)
AString::AString ( const AString str,
size_t  pos,
size_t  n = (size_t)npos 
)

Constuctor with a substring

Parameters
strsource string
posstart position
nsize of substrins
AString::AString ( const AChar str,
size_t  n 
)

Constuctor with a substring

Parameters
strsource null terminated string
nsize of substrins
AString::AString ( const AChar str)

Constuctor with a null terminated string

Parameters
strsource null terminated string
AString::AString ( const Char str)

Constuctor with a null terminated unicode string

Parameters
strsource null terminated unicode string
AString::AString ( size_t  n,
AChar  c 
)

Fill Constructor Fills the string with n consecutive copies of character c.

Parameters
n
c
AString::AString ( AChar  c,
size_t  n 
)
AString::AString ( const void *  v,
size_t  n,
size_t  base = 16 
)

Raw data encoding Constructor

Parameters
vpointer to raw data
nsize in byte of raw data
baseencodig base count (default is hexadecima)
AString::~AString ( )

Member Function Documentation

AString& commore::AString::append ( const AString str)
inline

Append string

AString& commore::AString::append ( const AString str,
size_t  pos,
size_t  n 
)
inline

Append substring

Parameters
strsource string
posstart position
nsize of substring
AString& commore::AString::append ( const AChar str,
size_t  n 
)
inline

Append substring

Parameters
strsource null terminated string
nsize of substring
AString& commore::AString::append ( const AChar str)
inline

Append null terminated string

Parameters
strsource null terminated string
AString& commore::AString::append ( size_t  n,
AChar  c 
)
inline

Append n consecutive copies of character c.

Parameters
n
c
AString & AString::assign ( const AString other)

Assign string content

AString& commore::AString::assign ( const AString str,
size_t  pos,
size_t  n 
)
inline

Assign string content with a substring

AString& commore::AString::assign ( const AChar str,
size_t  n 
)
inline

Assign string content with a null terminated substring

AString& commore::AString::assign ( const AChar str)
inline

Assign string content with null terminated string

AString& commore::AString::assign ( size_t  n,
AChar  c 
)
inline

Assign string content with n consecutive copies of character c.

AChar * AString::assign ( AChar dest,
size_t  n,
const AChar c 
)
static

Base assignement implementation

static void commore::AString::assign ( AChar c1,
const AChar c2 
)
inlinestatic
AChar commore::AString::at ( size_t  pos) const
inline
See also
get_at
AChar& commore::AString::at ( size_t  pos)
inline
See also
get_at
const AChar* commore::AString::c_str ( ) const
inline

Get C string equivalent

Returns
a pointer to an array that contains a null-terminated sequence of characters (i.e., a C-string) representing the current value of the string object.
size_t commore::AString::capacity ( ) const
inline

Return size of allocated storage.

Returns
the size of the storage space currently allocated for the string, expressed in terms of characters.
Remarks
This capacity is not necessarily equal to the string length. It can be equal or greater, with the extra space allowing the object to optimize its operations when new characters are added to the string. Notice that this capacity does not suppose a limit on the length of the string. When this capacity is exhausted and more is needed, it is automatically expanded by the object (reallocating it storage space). The theoretical limit on the length of a string is given by member max_size. The capacity of a string can be altered any time the object is modified, even if this modification implies a reduction in size or if the capacity has not been exhausted (this is in contrast with the guarantees given to capacity in vector containers). The capacity of a string can be explicitly altered by calling member reserve.
AString& commore::AString::clear ( )
inline

Clear string content

int commore::AString::compare ( const AString str) const
inline

Compare string.

Returns
0 They compare equal <0 Either the value of the first character that does not match is lower in the compared string, or all compared characters match but the compared string is shorter. >0 Either the value of the first character that does not match is greater in the compared string, or all compared characters match but the compared string is longer.
Parameters
strAnother string object, used entirely (or partially) as the comparing string.
posPosition of the first character in the compared string. If this is greater than the string length, it throws out_of_range. Note: The first character is denoted by a value of 0 (not 1).
lenLength of compared string (if the string is shorter, as many characters as possible). A value of string::npos indicates all characters until the end of the string.
subpos,sublenSame as pos and len above, but for the comparing string.
sPointer to an array of characters. If argument n is specified (4), the first n characters in the array are used as the comparing string. Otherwise (3), a null-terminated sequence is expected: the length of the sequence with the characters to use as comparing string is determined by the first occurrence of a null character.
nNumber of characters to compare.
int commore::AString::compare ( size_t  pos,
size_t  n,
const AString str 
) const
inline
int commore::AString::compare ( size_t  pos1,
size_t  n1,
const AString str,
size_t  pos2,
size_t  n2 
) const
inline
int commore::AString::compare ( const AChar s) const
inline
int AString::compare ( size_t  pos,
size_t  n1,
const AChar str,
size_t  n2 = (size_t)npos 
) const
int AString::compare ( const AChar s1,
const AChar s2,
size_t  n 
)
static

Compare base implementation

int commore::AString::CompareNoCase ( const AChar s) const
inline
Todo:
remove this method
size_t commore::AString::copy ( AChar str,
size_t  n,
size_t  pos = 0 
) const
inline

Copy sequence of characters from string Copies a substring of the current value of the string object into the array pointed by s. This substring contains the len characters that start at position pos. The function does not append a null character at the end of the copied content.

Parameters
strPointer to an array of characters. The array shall contain enough storage for the copied characters.
nNumber of characters to copy (if the string is shorter, as many characters as possible are copied).
posPosition of the first character to be copied.
AChar * AString::copy ( AChar dest,
const AChar src,
size_t  n 
)
static

Base strcpy implementation

Warning
no memory allocation is done
const AChar* commore::AString::data ( ) const
inline
See also
c_str
void commore::AString::Delete ( size_t  pos = 0,
size_t  n = 1 
)
inline
Todo:
to remove
static AChar commore::AString::eos ( )
inlinestatic

Return the end of string caracter (0)

static bool commore::AString::eq ( const AChar c1,
const AChar c2 
)
inlinestatic
AString& commore::AString::erase ( size_t  pos = 0,
size_t  n = (size_t)npos 
)
inline

Delete substring

Parameters
posstart position
nsubstring size
size_t commore::AString::find ( const AString str,
size_t  pos = 0 
) const
inline

Find content in string Searches the string for the first occurrence of the sequence specified by its arguments. When pos is specified, the search only includes characters at or after position pos, ignoring any possible occurrences that include characters before pos. Notice that unlike member find_first_of, whenever more than one character is being searched for, it is not enough that just one of these characters match, but the entire sequence must match.

Parameters
strAnother string with the subject to search for.
posPosition of the first character in the string to be considered in the search. If this is greater than the string length, the function never finds matches. Note: The first character is denoted by a value of 0 (not 1): A value of 0 means that the entire string is searched.
sPointer to an array of characters. If argument n is specified (3), the sequence to match are the first n characters in the array. Otherwise (2), a null-terminated sequence is expected: the length of the sequence to match is determined by the first occurrence of a null character.
nLength of sequence of characters to match.
cIndividual character to be searched for.
size_t AString::find ( const AChar s,
size_t  pos,
size_t  n 
) const
size_t commore::AString::find ( const AChar str,
size_t  pos = 0 
) const
inline
size_t commore::AString::find ( AChar  c,
size_t  pos = 0 
) const
inline
static const AChar* commore::AString::find ( const AChar s,
int  n,
const AChar a 
)
static

Find base implementation

size_t commore::AString::find_first_not_of ( const AString str,
size_t  pos = 0 
) const
inline
size_t AString::find_first_not_of ( const AChar s,
size_t  pos,
size_t  n 
) const
size_t commore::AString::find_first_not_of ( AChar  c,
size_t  pos = 0 
) const
inline
size_t commore::AString::find_first_not_of ( const AChar str,
size_t  pos = 0 
) const
inline
size_t commore::AString::find_first_of ( const AString str,
size_t  pos = 0 
) const
inline
size_t AString::find_first_of ( const AChar s,
size_t  pos,
size_t  n 
) const
size_t commore::AString::find_first_of ( const AChar str,
size_t  pos = 0 
) const
inline
size_t commore::AString::find_first_of ( AChar  c,
size_t  pos = 0 
) const
inline
size_t AString::find_last_not_of ( const AChar s,
size_t  pos,
size_t  n 
) const
size_t commore::AString::find_last_not_of ( const AString str,
size_t  pos = (size_t)npos 
) const
inline
size_t commore::AString::find_last_not_of ( const AChar c,
size_t  pos = (size_t)npos 
) const
inline
size_t commore::AString::find_last_not_of ( const AChar str,
size_t  pos = (size_t)npos 
) const
inline
size_t AString::find_last_of ( const AChar s,
size_t  pos,
size_t  n 
) const
size_t commore::AString::find_last_of ( const AString str,
size_t  pos = (size_t)npos 
) const
inline
size_t commore::AString::find_last_of ( AChar  c,
size_t  pos = (size_t)npos 
) const
inline
size_t commore::AString::find_last_of ( const AChar str,
size_t  pos = (size_t)npos 
) const
inline
int commore::AString::icompare ( const AString str) const
inline

Compare string but do not care caracter case (acii charecter only)

int commore::AString::icompare ( size_t  pos,
size_t  n,
const AString str 
) const
inline
int commore::AString::icompare ( size_t  pos1,
size_t  n1,
const AString str,
size_t  pos2,
size_t  n2 
) const
inline
int commore::AString::icompare ( const AChar s) const
inline
int AString::icompare ( size_t  pos,
size_t  n1,
const AChar str,
size_t  n2 = (size_t)npos 
) const
int AString::icompare ( const AChar s1,
const AChar s2,
size_t  n 
)
static

Compare base implementation non case sensitive

bool AString::ieq ( const AChar c1,
const AChar c2 
)
static
bool AString::ilt ( const AChar c1,
const AChar c2 
)
static
static bool commore::AString::ine ( const AChar c1,
const AChar c2 
)
inlinestatic
AString& commore::AString::insert ( size_t  pos1,
const AString str 
)
inline

Insert string

Parameters
pos1insert position
strstring to insert
AString& commore::AString::insert ( size_t  pos1,
const AString str,
size_t  pos2,
size_t  n 
)
inline

Insert substring

Parameters
pos1insert position
strstring to insert
pos2start substring position
nsubstring size
AString& commore::AString::insert ( size_t  pos,
const AChar str,
size_t  n 
)
inline

Insert null terminated substring

Parameters
posinsert position
strnull terminated string to insert
nsubstring size
AString& commore::AString::insert ( size_t  pos,
const AChar str 
)
inline

Insert null terminated substring

Parameters
posinsert position
strnull terminated string to insert
AString& commore::AString::insert ( size_t  pos,
size_t  n,
AChar  c 
)
inline

Insert n consecutive copies of character c.

Parameters
posinsert position
n
c
bool commore::AString::is_empty ( ) const
inline
Returns
true if string is empty
size_t commore::AString::length ( ) const
inline

Both AString::size and AString::length are synonyms and return the same value.

size_t AString::length ( const AChar s)
static

The AString strlen implemention

static bool commore::AString::lt ( const AChar c1,
const AChar c2 
)
inlinestatic
AString & AString::make_lower ( )
AString & AString::make_upper ( )

Convert AString to upper case or lower case

AString& commore::AString::MakeLower ( )
inline
Todo:
remove
AString& commore::AString::MakeUpper ( )
inline
Todo:
remove
bool AString::match ( const AString pattern) const

Utilities string Pattern matching function

Parameters
patternuse simple wilcards * and ? (escape caracter is )
awilcard maching result string = "commore in a nutshell" pattern = "commore * nutshell" will return true and a0="in"
bool AString::match ( const AString pattern,
AString a0 
) const
bool AString::match ( const AString pattern,
AString a0,
AString a1 
) const
bool AString::match ( const AString pattern,
AString a0,
AString a1,
AString a2 
) const
bool AString::match ( const AString pattern,
AString a0,
AString a1,
AString a2,
AString a3 
) const
bool AString::match ( const AString pattern,
AString a0,
AString a1,
AString a2,
AString a3,
AString a4 
) const
bool AString::match ( const AString pattern,
AString a0,
AString a1,
AString a2,
AString a3,
AString a4,
AString a5 
) const
bool AString::match ( const AString pattern,
AString a0,
AString a1,
AString a2,
AString a3,
AString a4,
AString a5,
AString a6 
) const
bool AString::match ( const AString pattern,
AString a0,
AString a1,
AString a2,
AString a3,
AString a4,
AString a5,
AString a6,
AString a7 
) const
size_t commore::AString::max_size ( ) const
inline
Returns
the maximum length the string can reach. This is the maximum potential length the string can reach due to known system or library implementation limitations, but the object is not guaranteed to be able to reach that length: it can still fail to allocate storage at any point before that length is reached.
AChar * AString::move ( AChar dest,
const AChar src,
size_t  n 
)
static

Base move implementation

Warning
no memory allocation is done
static bool commore::AString::ne ( const AChar c1,
const AChar c2 
)
inlinestatic
commore::AString::operator const AChar * ( ) const
inline

Implicit convesion operator to null terminated string

bool commore::AString::operator!= ( const AString str) const
inline

Tests the inequality of string

bool commore::AString::operator!= ( const AChar str) const
inline

Test the inequality with null terminated string

AString AString::operator+ ( const AString str) const

String concatenation operator

AString& commore::AString::operator+= ( const AString str)
inline

Append string operator

AString& commore::AString::operator+= ( const AChar str)
inline

Append null terminated string

AString& commore::AString::operator+= ( AChar  c)
inline

Append caracter

bool commore::AString::operator< ( const commore::AString str) const
inline

Compare string operator with lexical order

AString& commore::AString::operator= ( const AString str)
inline

Assigment operator

AString& commore::AString::operator= ( const AChar str)
inline

Assigment operator with null terminated sting

Parameters
strsource nult terminated string
AString& commore::AString::operator= ( AChar  c)
inline

Assigment operator with a caracter

Parameters
csource caracter
bool commore::AString::operator== ( const AString str) const
inline

Tests the equality of string

bool commore::AString::operator== ( const AChar str) const
inline

Test the equality with null terminated string

bool commore::AString::operator> ( const commore::AString str) const
inline

Compare string operator with lexical order

AChar commore::AString::operator[] ( size_t  pos) const
inline

Get character of string

Returns
the character at position pos in the string.
AChar& commore::AString::operator[] ( size_t  pos)
inline

Get character of string

Returns
a reference to the character at position pos in the string.
AChar commore::AString::operator[] ( int  pos) const
inline

Get character of string

Returns
the character at position pos in the string.
AChar& commore::AString::operator[] ( int  pos)
inline

Get character of string

Returns
a reference to the character at position pos in the string.
long AString::read_xml ( IBStream i)

Read AString from xml stream

Warning
this method read just compatible CDATA
AString& commore::AString::replace ( size_t  pos1,
size_t  n,
const AString str 
)
inline

Replace a substring

Parameters
posstart position
nsubstring size
strreplacement string
AString& commore::AString::replace ( size_t  pos1,
size_t  n1,
const AString str,
size_t  pos2,
size_t  n2 
)
inline

Replace a substring

Parameters
pos1start position
n1substring size
strreplacement string
pos2substring start position
n2substring size
AString& commore::AString::replace ( size_t  pos1,
size_t  n1,
const AChar str,
size_t  n2 
)
inline

Replace a substring

Parameters
pos1start position
n1substring size
strreplacement null terminated string
n2substring size
AString& commore::AString::replace ( size_t  pos,
size_t  n1,
const AChar str 
)
inline

Replace a substring

Parameters
pos1start position
n1substring size
strreplacement null terminated string
AString& commore::AString::replace ( size_t  pos,
size_t  n1,
size_t  n2,
AChar  c 
)
inline

Replace a substring by n2 consecutive copies of character c.

Parameters
pos1start position
n1substring size
n2
c
AString & AString::replace ( const AChar s1,
const AChar s2,
bool  case_sensitive = true 
)

Replace a substring s1 by null terminated string s2

Parameters
case_sensitive
AString& commore::AString::Replace ( const AChar s1,
const AChar s2,
bool  case_sensitive = true 
)
inline
Todo:
remove this method
void commore::AString::reserve ( size_t  size)
inline

Request a change in capacity Requests that the string capacity be adapted to a planned change in size to a length of up to n characters. If n is greater than the current string capacity, the function causes the container to increase its capacity to n characters (or greater). In all other cases, it is taken as a non-binding request to shrink the string capacity: the container implementation is free to optimize otherwise and leave the string with a capacity greater than n. This function has no effect on the string length and cannot alter its content.

Parameters
sizePlanned length for the string. Note that the resulting string capacity may be equal or greater than n.
void commore::AString::resize ( size_t  n,
AChar  c 
)
inline

Resizes the string to a length of n characters. If n is smaller than the current string length, the current value is shortened to its first n character, removing the characters beyond the nth. If n is greater than the current string length, the current content is extended by inserting at the end as many characters as needed to reach a size of n. If c is specified, the new elements are initialized as copies of c, otherwise, they are value-initialized characters (null characters).

Parameters
nNew string length, expressed in number of characters
cCharacter used to fill the new character space added to the string (in case the string is expanded).
void commore::AString::resize ( size_t  n)
inline
void AString::resize ( )
size_t AString::rfind ( const AChar str,
size_t  pos,
size_t  n 
) const
size_t commore::AString::rfind ( const AString str,
size_t  pos = (size_t)npos 
) const
inline
size_t commore::AString::rfind ( const AChar str,
size_t  pos = (size_t)npos 
) const
inline
size_t commore::AString::rfind ( AChar  c,
size_t  pos = (size_t)npos 
) const
inline
char* commore::AString::set_buffer ( size_t  size)
inline

Not standard string method (inherited from older string class) Same as reserve. Allows direction manipulation on string content.

Returns
a pointer on mutable char array string content
Warning
should be used with caution. If returned C string is modified return size() method can become inconsistent.
size_t commore::AString::size ( ) const
inline
Returns
the length of the string, in terms of number of characters. This is the number of actual characters that conform the contents of the string, which is not necessarily equal to its storage capacity.
void AString::splice ( AString str)

Swap string content

AString AString::substr ( size_t  pos = 0,
size_t  n = (size_t)npos 
) const

Generate substring Returns a newly constructed string object with its value initialized to a copy of a substring of this object. The substring is the portion of the object that starts at character position pos and spans len characters (or until the end of the string, whichever comes first).

Parameters
posPosition of the first character to be copied as a substring
nNumber of characters to include in the substring
void AString::swap ( AString str)

Swap string content

Int AString::to_int ( ) const

Convert to int

bool commore::AString::validate_range ( size_t  pos,
size_t *  len 
) const
inline

Check that interval is a substring

Parameters
posinterval start position
leninterval length
Returns
true if interval is in string
Remarks
this methode should be private
long AString::write_xml ( OBStream o) const

Write AString to xml stream

Warning
this method write just compatible CDATA (entities & > < ' )

Friends And Related Function Documentation

friend class Iterator
friend

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