#include <mstring.h>
Inheritance diagram for MagiC::String::
Public Types | |
enum | quoteflags { QUOTE_NORMAL = 0, QUOTE_HTML = 1 } |
Public Methods | |
String () | |
String (const String &orig) | |
String (const char *) | |
String (char *str, bool own) | |
String (const char *, int n) | |
String (char *, uint n, bool own) | |
String (int i, int base=10) | |
String (uint i, int base=10) | |
String (long i, int base=10) | |
String (float f, char fmt='g', int prec=6) | |
String (double f, char fmt='g', int prec=6) | |
virtual | ~String () |
String& | assign (char c) |
String& | operator= (const String &) |
String& | operator= (const char *) |
String& | operator= (char c) |
int | operator!= (const char *b) const |
int | operator== (const char *) const |
int | operator== (const String &b) const |
int | operator== (const Comparable &other) const |
String& | operator+= (const String &str) |
String& | operator+= (char c) |
String | operator+ (const String &str) const |
String | operator+ (const char *str) const |
const char | operator[] (uint n) const |
char& | operator[] (uint n) |
bool | isNull () const |
void | nullify () |
bool | isEmpty () const |
void | empty () |
uint | length () const |
int | maxLength () const |
String | arg (const String &str, int fieldwidth=0) const |
String | arg (const char *str, int fieldwidth=0) const |
String | arg (const char c, int fieldwidth=0) const |
String | arg (float x, int fieldwidth=0, char fmt='g', int prec=-1) const |
String | arg (double x, int fieldwidth=0, char fmt='g', int prec=-1) const |
String | arg (int x, int fieldwidth=0, int base=10) const |
String | arg (long x, int fieldwidth=0, int base=10) const |
int | find (const String &, uint start=0) const |
int | find (const char c, uint start=0) const |
int | findRev (const String &, int start=-1) const |
int | regmatch (const char *regexpr) const |
int | regmatch (const char *regexpr, Array< String > &target) const |
int | regmatch (RegExp &compiled, Array< String > &target) const |
String | mid (uint start, int len=-1) const |
String | left (uint n) const |
String | right (uint n) const |
void | upper () const |
void | lower () const |
void | split (Array< String > &target, const char delim='') const |
void | join (const Array< String > &source, const char delim='') |
String& | dellast (uint n) |
void | chop () |
String | stripWhiteSpace () const |
String | simplifyWhiteSpace () const |
void | reserve (int amount) |
void | ensure (int amount) |
void | ensure_spontane (int amount) |
void | grow_spontane () |
char | checksum () |
int | fast_isequal (const String &other) const |
String& | hexcode (const String &other) |
void | quote (char quotechar='%', int flags=0) |
void | unquote (char quotechar='%', int flags=0) |
ostream& | dump (ostream &) const |
ostream& | operator>> (ostream &) const |
istream& | operator<< (istream &) |
CArchive& | operator>> (CArchive &) const |
IStream& | operator<< (IStream &) |
int | toInt () const |
uint | toUInt () const |
long | toLong () const |
float | toFloat () const |
double | toDouble () const |
operator const char * () const | |
char* | getbuffer () const |
virtual String* | clone () const |
virtual int | hashfunc (int hashsize) const |
Friends | |
class | MagiC::strformat |
Supports cached hash-number calculation.
Definition at line 77 of file mstring.h.
|
Copy constructor.
Definition at line 60 of file mstring.cc. Referenced by arg(), operator+(), and simplifyWhiteSpace(). |
|
Create from a NULL-terminated string.
Definition at line 75 of file mstring.cc. |
|
Create String from a NULL-terminated char buffer.
Definition at line 93 of file mstring.cc. |
|
Create from a NULL-terminated string with given maximum length.
Definition at line 101 of file mstring.cc. |
|
Create String from a NULL-terminated char buffer.
Definition at line 123 of file mstring.cc. |
|
Conversion from an integer.
Definition at line 168 of file mstring.cc. |
|
Conversion from an integer.
Definition at line 175 of file mstring.cc. |
|
Conversion from an integer.
Definition at line 182 of file mstring.cc. |
|
Conversion from a float.
Definition at line 205 of file mstring.cc. |
|
Conversion from a double.
Definition at line 212 of file mstring.cc. |
|
Replaces the lowest occurrence of n in the string.
|
|
Replaces the lowest occurrence of n in the string.
Definition at line 423 of file mstring.cc. |
|
Assignment from a single character.
Definition at line 219 of file mstring.cc. |
|
Calculates an 8-bit checksum for the string.
Definition at line 973 of file mstring.cc. |
|
Removes all trailing newline (\r,
Definition at line 484 of file mstring.cc. |
|
Clone should perform a full recursive cloning of the object. The return type should vary by implementor. Reimplemented from Object. |
|
Deletes the last n characters from the string.
Definition at line 470 of file mstring.cc. Referenced by chop(). |
|
Ensures that at least the given length is reserved for the string.
Definition at line 152 of file mstring.h. Referenced by hexcode(), and operator+=(). |
|
Ensures that at least the given amount is reserved for the string, preferably a little (50%+4 characters) more.
Definition at line 153 of file mstring.h. Referenced by operator+=(), and operator<<(). |
|
Fast comparison operator, based on cached checksum (hash value). Very quick if the hash values differ. OBSERVE! This method doesn't calculate the checksums for the strings; you must calculate them manually! Definition at line 495 of file mstring.cc. |
|
Searches for a single character.
Definition at line 677 of file mstring.cc. |
|
Searches for a substring.
Definition at line 666 of file mstring.cc. |
|
Reverse substring search. If start<0, it is calculated from the end of the string.
Definition at line 689 of file mstring.cc. |
|
Returns a non-const pointer to the string buffer. Dangerous. |
|
Grows the string somewhat (50%+4 characters).
|
|
Computes hash value for the string. Defined for the use of Comparable::hashfunc. The hash function is simply h(c)=chashsize. Once the hash number has been calculated for the string, it is cached. This gives a considerable speedup for evaluating this method. Reimplemented from Comparable. Definition at line 992 of file mstring.cc. Referenced by checksum(). |
|
Encodes the given string in two-character hex code.
Definition at line 508 of file mstring.cc. |
|
Is the string empty (can be empty without being NULL)?
|
|
Is the string NULL?
|
|
Forms the string by joining the substrings in the given array with the given delimiter.
Definition at line 836 of file mstring.cc. |
|
Returns new string that contains n leftmost letters of the string.
Definition at line 646 of file mstring.cc. |
|
Definition at line 114 of file mstring.h. Referenced by arg(). |
|
Returns the current maximum length of the buffer.
|
|
Returns a substring (0-based indexing).
Definition at line 618 of file mstring.cc. Referenced by left(), right(), and stripWhiteSpace(). |
|
Concatenates a C-string to the string and returns the result.
Definition at line 369 of file mstring.cc. |
|
Concatenates a String to the string and returns the result.
Definition at line 362 of file mstring.cc. |
|
Concatenates a single character to the string. This operation is O(1), as it uses the ensure_spontane() to grow the allocated the length of the string buffer. Definition at line 746 of file mstring.cc. |
|
Concatenates another String to the string.
Definition at line 703 of file mstring.cc. |
|
Loads the object from an archive. Overload this to make the class readable. Reimplemented from Object. |
|
Standard input operation from stream.
Reimplemented from Object. Definition at line 307 of file mstring.cc. |
|
Assignment from a null-terminated C-style string.
Definition at line 260 of file mstring.cc. |
|
Assignment from another String.
Definition at line 233 of file mstring.cc. |
|
Checks if the String equals another Comparable, which *MUST* be a string. This implements the Comparable::operator== that is used for sorting Reimplemented from Comparable. Definition at line 734 of file mstring.cc. |
|
Returns true if the string equals with the given char string.
Definition at line 720 of file mstring.cc. Referenced by fast_isequal(), and operator==(). |
|
Standard output operation to stream.
Reimplemented from Object. Definition at line 296 of file mstring.cc. |
|
Quote non-printable characters with given escape character.
Definition at line 526 of file mstring.cc. |
|
As above, but uses a precompiled regular expression.
Definition at line 955 of file mstring.cc. |
|
Tries to match the given regular expression to the string. The second version supports parameters in the regular expression.
Definition at line 946 of file mstring.cc. |
|
Tries to match the given regular expression to the string.
Definition at line 929 of file mstring.cc. |
|
Reserves exactly the given length for the string (shortens the string if necessary).
Definition at line 757 of file mstring.cc. Referenced by join(). |
|
Returns new string that contains n rightmost letters of the string.
Definition at line 651 of file mstring.cc. |
|
Returns the string without any whitespace (space, tab, newline cr, ff, vt) characters in the beginning or the end, or any duplicates within the string.
Definition at line 873 of file mstring.cc. |
|
Splits the string into an array according to the given delimiter.
Definition at line 816 of file mstring.cc. |
|
Returns the string without any whitespace (space, tab, newline, cr, ff, vt) characters in the beginning or the end.
Definition at line 860 of file mstring.cc. |
|
Unquote non-printable characters with given escape character.
Definition at line 537 of file mstring.cc. |