#include <utils.h>
Inheritance diagram for CB2::PString< Tchar >:
Public Types | |
typedef PString< Tchar > | this_type |
Template type alias. | |
typedef Array< Tchar > | storage_type |
Data storage type. | |
typedef storage_type::size_type | size_type |
Size type. | |
typedef storage_type::ref_type | ref_type |
Item reference type. | |
typedef Iterator< this_type, ref_type, Tchar > | iterator |
Iterator. | |
typedef RevIterator< this_type, ref_type, Tchar > | rev_iterator |
Iterator. | |
Public Member Functions | |
PString () | |
Default constructor. | |
PString (const this_type &prev) | |
Copy constructors. | |
PString (const Tchar *dt, const size_type ln) | |
PString (const Tchar *prev) | |
PString (const std::basic_string< Tchar > &prev) | |
PString (const Tchar prev) | |
PString (const signed int prev, const size_type base=10) | |
PString (const unsigned int prev, const size_type base=10) | |
PString (const signed long int prev, const size_type base=10) | |
PString (const unsigned long int prev, const size_type base=10) | |
PString (const signed long long int prev, const size_type base=10) | |
PString (const unsigned long long int prev, const size_type base=10) | |
PString (const float prev) | |
PString (const double prev) | |
const this_type & | operator= (const this_type &prev) |
Assignment operator. | |
const this_type & | operator= (const Tchar *prev) |
const this_type & | operator= (const std::basic_string< Tchar > prev) |
const this_type & | operator= (const Tchar prev) |
const this_type & | operator= (const signed int prev) |
const this_type & | operator= (const unsigned int prev) |
const this_type & | operator= (const signed long int prev) |
const this_type & | operator= (const unsigned long int prev) |
const this_type & | operator= (const signed long long int prev) |
const this_type & | operator= (const unsigned long long int prev) |
const this_type & | operator= (const float prev) |
const this_type & | operator= (const double prev) |
const this_type & | operator<< (const Tchar &right) |
Append a character. | |
const this_type & | operator+= (const this_type &right) |
Concatenation operators. | |
const this_type & | operator+ (const this_type &right) |
operator const Tchar * () const | |
Implicit conversion operators. | |
operator std::basic_string () const | |
operator Tchar () const | |
operator signed int () const | |
operator unsigned int () const | |
operator signed long int () const | |
operator unsigned long int () const | |
operator signed long long int () const | |
operator unsigned long long int () const | |
operator float () const | |
operator double () const | |
size_type | Len () const |
Number of Tchar elements. | |
size_type | Size () const |
Real size of the string in bytes. | |
Tchar & | operator[] (const size_type pos) const |
Indexaation operator. | |
bool | operator== (const this_type &str) const |
Compare strings. | |
bool | operator!= (const this_type &str) const |
bool | operator== (const Tchar *str) const |
bool | operator!= (const Tchar *str) const |
this_type | Substr (const size_type base, const size_type length=(size_type)-1) const |
Get substring. | |
bool | Empty () const |
Check for empty. | |
void | Discart (const bool shrink=false) |
Discart the string. | |
bool | Pos (const this_type &needle, size_type &pos, const size_type from=0) const |
Find position of substring. | |
size_type | Subst (const this_type &needle, const this_type &replacement) |
Substitute substring. | |
this_type | HTML (const this_type &nl="") const |
Escape HTML special characters. | |
this_type | HTMLdecode () const |
Decode HTML special characters. | |
this_type | SQL () const |
Escape SQL special characters. | |
this_type | SQLdecode () const |
Decode SQL special characters. | |
this_type | URL () const |
Escape URL special characters. | |
this_type | URLdecode () const |
Decode URL special characters. | |
ref_type | RefBegin () const |
Get starting reference. | |
ref_type | RefEnd () const |
Get final reference. | |
ref_type | RevRefBegin () const |
Get starting reverse reference. | |
ref_type | RevRefEnd () const |
Get final reverse reference. | |
ref_type | RefNext (const ref_type &prev) const |
Get succeding reference. | |
ref_type | RefPrev (const ref_type &prev) const |
Get predecessing reference. | |
const Tchar & | Deref (const ref_type &ref) const |
Dereference. | |
const Tchar & | RevDeref (const ref_type &ref) const |
Reverse dereference. | |
iterator | Begin () const |
Get starting iterator. | |
iterator | End () const |
Get final iterator. | |
rev_iterator | RevBegin () const |
Get starting reverse iterator. | |
rev_iterator | RevEnd () const |
Get final reverse iterator. | |
Public Attributes | |
int | tag |
Tag for user-specific data. | |
Private Member Functions | |
void | cpy (const Tchar *prev) |
Copy string. | |
void | cpy (const std::basic_string< Tchar > &prev) |
void | cpy (const Tchar prev) |
template<class Tnum> void | cpy_numeric_int (const Tnum prev, const size_type base) |
Copy string from integer numeric data type. | |
template<class Tnum> void | cpy_numeric_float (const Tnum prev) |
Copy string from floating point numeric data type. | |
template<class Tnum> Tnum | numeric_int (const bool signed_type, const Tnum zero) const |
Convert to integer data type. | |
template<class Tnum> Tnum | numeric_float (const Tnum zero) const |
Convert to floating point data type. | |
Private Attributes | |
storage_type | data |
Data storage. | |
Static Private Attributes | |
const size_type | def_frag = 1024 |
Default array fragment size. | |
Friends | |
PString< Tchar > | operator+ (const PString< Tchar > &left, const PString< Tchar > &right) |
Binary concatenation operator (friend variant). | |
std::basic_ostream< Tchar, std::char_traits< Tchar > > & | operator<< (std::basic_ostream< Tchar, std::char_traits< Tchar > > &stream, const PString< Tchar > &str) |
Stream output friend operator. |
Template for representing character strings. Supports many features not even available by STL's string template.
NB: The character (Tchar) type should be "primitive" (i.e. char, int, wchar_t, etc.), because Array< Tchar> is used as underlying data storage (which stores characters as bit copies).
|
|
|
Item reference type.
|
|
|
|
Size type.
|
|
Data storage type.
|
|
Template type alias.
|
|
Default constructor. Create an empty string. |
|
Copy constructors. Copy string data from another string repersentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Get starting iterator.
|
|
|
|
|
|
Copy string. Do the conversion from another data type.
< From NULL-terminated string |
|
Copy string from floating point numeric data type. Do the conversion from floating point numeric data type.
|
|
Copy string from integer numeric data type. Do the conversion from integer numeric data type. NB: The numeric base is not stored in the string
|
|
Dereference. Get the character referenced by 'ref'. If the reference is out of range, ExceptionMemory is thrown.
|
|
Discart the string. Discart the contents of the string.
|
|
Check for empty.
|
|
Get final iterator.
|
|
Escape HTML special characters. Escape special HTML characters by its equivalents. Currently &, <, > and " are handled.
|
|
Decode HTML special characters. Currently &, <, > and " are interpreted.
|
|
Number of Tchar elements.
|
|
Convert to floating point data type. Convert current string value to floating point numeric data type. Just simple representations are accepted.
|
|
Convert to integer data type. Convert current string value to numeric data type.
|
|
Implicit conversion operators. These operators do the implicit conversion to various data types. If the destination type cannot represent the current string value, ExceptionConversion is thrown. If the range of the destination type is not sufficient, ExceptionRange is thrown.
< To NULL-terminated string |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Concatenation operators. Unary and binary concatenation operators
< Unary concatenation (+=) |
|
Append a character. Append a single character to the end of the string. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assignment operator. Copy string data from another string repersentation.
< From PString |
|
|
|
Compare strings. Compare string contents with another string.
< With PString< Tchar> |
|
Indexaation operator. Access to a random character of the string. If out of range, ExceptionRange is thrown.
|
|
Find position of substring. Get the position of the nearest appearance of 'needle' beginning at index 'from'. If 'needle' or this string are empty, false is returned.
|
|
Get starting reference. Get the reference to the first character in the string (as a reference to the array).
|
|
Get final reference. Get the final reference. This is the reference to the last character in the array (NULL-termination).
|
|
Get succeding reference. Get the reference to a character succeding the character referenced by 'prev'. If the reference is final or invalid, final reference is returned).
|
|
Get predecessing reference. Get the reference to a character predecessing the character referenced by 'prev'. If the reference is final or invalid, final reference is returned).
|
|
Get starting reverse iterator.
|
|
Reverse dereference. Get the character referenced by 'ref'. If the reference is out of range, ExceptionMemory is thrown.
|
|
Get final reverse iterator.
|
|
Get starting reverse reference. Get the reference to the last character.
|
|
Get final reverse reference. Get the reference to the first character.
|
|
Real size of the string in bytes.
|
|
Escape SQL special characters. Escape special SQL characters by its equivalents. Currently ', ", \ and NULL are handled.
|
|
Decode SQL special characters. Simply all characters escaped as are decoded as given symbol (except , which is interpreted as NULL character).
|
|
Substitute substring. Substitute all appearances of 'needle' by 'replacement'.
|
|
Get substring. Get substring from the current string. The substring is defined by the index of the first character and length. If 'base' is out of range or the string is empty, an empty string is returned. If 'length' is too long (or contains special value (size_type) -1, which is default), it is truncated to the maximal possible length.
|
|
Escape URL special characters. Escape all non-alphanumeric characters as xx (where xx is the hexadecimal representation of the character) as defined by RFC1738, but leave '-' and '_' untouched and substitute space by '+'.
|
|
Decode URL special characters. Decode string according to RFC1738 (interpreting xx as hexadecimal representation of characters). Plus interpreting '+' as space.
|
|
Binary concatenation operator (friend variant). Concatenate two strings and get the output string.
|
|
Stream output friend operator. Outpus the contents of a PString object to an output stream using the same basic type (Tchar). |
|
Data storage.
|
|
Default array fragment size.
|
|
Tag for user-specific data.
|