commore
1.0.6-SNAPSHOT
|
#include <AString.h>
Public Member Functions | |
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) | |
AString & | operator= (const AString &str) |
AString & | operator= (const AChar *str) |
AString & | operator= (AChar c) |
operator const AChar * () const | |
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 |
AString & | operator+= (const AString &str) |
AString | operator+ (const AString &str) const |
AString & | operator+= (const AChar *str) |
AString & | operator+= (AChar c) |
AString & | append (const AString &str) |
AString & | append (const AString &str, size_t pos, size_t n) |
AString & | append (const AChar *str, size_t n) |
AString & | append (const AChar *str) |
AString & | append (size_t n, AChar c) |
bool | validate_range (size_t pos, size_t *len) const |
AString & | assign (const AString &other) |
AString & | assign (const AString &str, size_t pos, size_t n) |
AString & | assign (const AChar *str, size_t n) |
AString & | assign (const AChar *str) |
AString & | assign (size_t n, AChar c) |
void | swap (AString &str) |
void | splice (AString &str) |
AString & | insert (size_t pos1, const AString &str) |
AString & | insert (size_t pos1, const AString &str, size_t pos2, size_t n) |
AString & | insert (size_t pos, const AChar *str, size_t n) |
AString & | insert (size_t pos, const AChar *str) |
AString & | insert (size_t pos, size_t n, AChar c) |
AString & | clear () |
AString & | erase (size_t pos=0, size_t n=(size_t) npos) |
void | Delete (size_t pos=0, size_t n=1) |
AString & | replace (size_t pos1, size_t n, const AString &str) |
AString & | replace (size_t pos1, size_t n1, const AString &str, size_t pos2, size_t n2) |
AString & | replace (size_t pos1, size_t n1, const AChar *str, size_t n2) |
AString & | replace (size_t pos, size_t n1, const AChar *str) |
AString & | replace (size_t pos, size_t n1, size_t n2, AChar c) |
AString & | replace (const AChar *s1, const AChar *s2, bool case_sensitive=true) |
AString & | Replace (const AChar *s1, const AChar *s2, bool case_sensitive=true) |
AChar | operator[] (size_t pos) const |
AChar & | operator[] (size_t pos) |
AChar | operator[] (int pos) const |
AChar & | operator[] (int pos) |
AChar | at (size_t pos) const |
AChar & | at (size_t pos) |
const AChar * | c_str () const |
const AChar * | data () 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) | |
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 |
AString & | make_upper () |
AString & | MakeUpper () |
AString & | make_lower () |
AString & | MakeLower () |
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 AChar * | find (const AChar *s, int n, const AChar &a) |
static size_t | length (const AChar *s) |
static AChar * | copy (AChar *dest, const AChar *src, size_t n) |
static AChar * | move (AChar *dest, const AChar *src, size_t n) |
static AChar * | assign (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 |
Ascii string class. Is inspired by stl::string
commore::AString::AString | ( | const AString & | str, |
size_t | pos, | ||
size_t | n = (size_t) npos |
||
) |
Constuctor with a substring
str | source string |
pos | start position |
n | size of substrins |
commore::AString::AString | ( | const AChar * | str, |
size_t | n | ||
) |
Constuctor with a substring
str | source null terminated string |
n | size of substrins |
commore::AString::AString | ( | const AChar * | str | ) |
Constuctor with a null terminated string
str | source null terminated string |
commore::AString::AString | ( | const Char * | str | ) |
Constuctor with a null terminated unicode string
str | source null terminated unicode string |
commore::AString::AString | ( | size_t | n, |
AChar | c | ||
) |
Fill Constructor Fills the string with n consecutive copies of character c.
n | |
c |
commore::AString::AString | ( | const void * | v, |
size_t | n, | ||
size_t | base = 16 |
||
) |
Raw data encoding Constructor
v | pointer to raw data |
n | size in byte of raw data |
base | encodig base count (default is hexadecima) |
Append substring
str | source string |
pos | start position |
n | size of substring |
|
inline |
Append substring
str | source null terminated string |
n | size of substring |
|
inline |
Append null terminated string
str | source null terminated string |
|
inline |
Append n consecutive copies of character c.
n | |
c |
Assign string content with a substring
|
inline |
Assign string content with a null terminated substring
|
inline |
Assign string content with null terminated string
|
inline |
Assign string content with n consecutive copies of character c.
|
static |
Base assignement implementation
|
inline |
|
inline |
|
inline |
Get C string equivalent
|
inline |
Return size of allocated storage.
|
inline |
Clear string content
|
inline |
Compare string.
str | Another string object, used entirely (or partially) as the comparing string. |
pos | Position 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). |
len | Length 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,sublen | Same as pos and len above, but for the comparing string. |
s | Pointer 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. |
n | Number of characters to compare. |
|
static |
Compare base implementation
|
inline |
|
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.
str | Pointer to an array of characters. The array shall contain enough storage for the copied characters. |
n | Number of characters to copy (if the string is shorter, as many characters as possible are copied). |
pos | Position of the first character to be copied. |
|
static |
Base strcpy implementation
|
inline |
|
inline |
|
inlinestatic |
Return the end of string caracter (0)
|
inline |
Delete substring
pos | start position |
n | substring size |
|
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.
str | Another string with the subject to search for. |
pos | Position 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. |
s | Pointer 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. |
n | Length of sequence of characters to match. |
c | Individual character to be searched for. |
|
static |
Find base implementation
|
static |
Compare base implementation non case sensitive
Insert string
pos1 | insert position |
str | string to insert |
|
inline |
Insert substring
pos1 | insert position |
str | string to insert |
pos2 | start substring position |
n | substring size |
|
inline |
Insert null terminated substring
pos | insert position |
str | null terminated string to insert |
n | substring size |
|
inline |
Insert null terminated substring
pos | insert position |
str | null terminated string to insert |
|
inline |
Insert n consecutive copies of character c.
pos | insert position |
n | |
c |
|
inline |
|
inline |
Both AString::size and AString::length are synonyms and return the same value.
|
static |
The AString strlen implemention
bool commore::AString::match | ( | const AString & | pattern | ) | const |
Utilities string Pattern matching function
pattern | use simple wilcards * and ? (escape caracter is ) |
a | wilcard maching result string = "commore in a nutshell" pattern = "commore * nutshell" will return true and a0="in" |
|
inline |
|
static |
Base move implementation
|
inline |
Implicit convesion operator to null terminated string
|
inline |
Tests the inequality of string
|
inline |
Test the inequality with null terminated string
|
inline |
Append null terminated string
|
inline |
Append caracter
|
inline |
Compare string operator with lexical order
|
inline |
Assigment operator with null terminated sting
str | source nult terminated string |
|
inline |
Assigment operator with a caracter
c | source caracter |
|
inline |
Tests the equality of string
|
inline |
Test the equality with null terminated string
|
inline |
Compare string operator with lexical order
|
inline |
Get character of string
|
inline |
Get character of string
|
inline |
Get character of string
|
inline |
Get character of string
long commore::AString::read_xml | ( | IBStream & | i | ) |
Read AString from xml stream
Replace a substring
pos | start position |
n | substring size |
str | replacement string |
|
inline |
Replace a substring
pos1 | start position |
n1 | substring size |
str | replacement string |
pos2 | substring start position |
n2 | substring size |
|
inline |
Replace a substring
pos1 | start position |
n1 | substring size |
str | replacement null terminated string |
n2 | substring size |
|
inline |
Replace a substring
pos1 | start position |
n1 | substring size |
str | replacement null terminated string |
|
inline |
Replace a substring by n2 consecutive copies of character c.
pos1 | start position |
n1 | substring size |
n2 | |
c |
AString& commore::AString::replace | ( | const AChar * | s1, |
const AChar * | s2, | ||
bool | case_sensitive = true |
||
) |
Replace a substring s1 by null terminated string s2
case_sensitive |
|
inline |
|
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.
size | Planned length for the string. Note that the resulting string capacity may be equal or greater than n. |
|
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).
n | New string length, expressed in number of characters |
c | Character used to fill the new character space added to the string (in case the string is expanded). |
|
inline |
Not standard string method (inherited from older string class) Same as reserve. Allows direction manipulation on string content.
|
inline |
void commore::AString::splice | ( | AString & | str | ) |
Swap string content
AString commore::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).
pos | Position of the first character to be copied as a substring |
n | Number of characters to include in the substring |
void commore::AString::swap | ( | AString & | str | ) |
Swap string content
Int commore::AString::to_int | ( | ) | const |
Convert to int
|
inline |
Check that interval is a substring
pos | interval start position |
len | interval length |
long commore::AString::write_xml | ( | OBStream & | o | ) | const |
Write AString to xml stream