KJS::UString Class Reference
Unicode string class. More...
#include <ustring.h>
Public Methods | |
UString () | |
Constructs a null string. | |
UString (char c) | |
Constructs a string from the single character c. | |
UString (const char *c) | |
Constructs a string from a classical zero determined char string. | |
UString (const UChar *c, int length) | |
Constructs a string from an array of Unicode characters of the specified length. | |
UString (UChar *c, int length, bool copy) | |
If copy is false a shallow copy of the string will be created. | |
UString (const UString &) | |
Copy constructor. | |
UString (const QString &) | |
Convenience declaration only ! You'll be on your own to write the implementation for a construction from QString. | |
UString (const DOM::DOMString &) | |
Convenience declaration only ! See UString(const QString&). | |
~UString () | |
Destructor. | |
UString & | append (const UString &) |
Append another string. | |
CString | cstring () const |
char * | ascii () const |
Convert the Unicode string to plain ASCII chars chopping of any higher bytes. | |
DOM::DOMString | string () const |
QString | qstring () const |
QConstString | qconststring () const |
UString & | operator= (const char *c) |
Assignment operator. | |
UString & | operator= (const UString &) |
Assignment operator. | |
UString & | operator+= (const UString &s) |
Appends the specified string. | |
const UChar * | data () const |
bool | isNull () const |
bool | isEmpty () const |
bool | is8Bit () const |
Use this if you want to make sure that this string is a plain ASCII string. | |
int | size () const |
UChar | operator[] (int pos) const |
Const character at specified position. | |
UCharReference | operator[] (int pos) |
Writable reference to character at specified position. | |
double | toDouble (bool tolerant=false) const |
Attempts an conversion to a number. | |
unsigned long | toULong (bool *ok=0L) const |
Attempts an conversion to an unsigned long integer. | |
UString | toLower () const |
Returns this string converted to lower case characters. | |
UString | toUpper () const |
Returns this string converted to upper case characters. | |
int | find (const UString &f, int pos=0) const |
int | rfind (const UString &f, int pos) const |
UString | substr (int pos=0, int len=-1) const |
Static Public Methods | |
UString | from (int i) |
Constructs a string from an int. | |
UString | from (unsigned int u) |
Constructs a string from an unsigned int. | |
UString | from (double d) |
Constructs a string from a double. | |
Static Public Attributes | |
UString | null |
Static instance of a null string. |
Detailed Description
Unicode string class.
Definition at line 187 of file ustring.h.
Constructor & Destructor Documentation
|
Constructs a null string.
Definition at line 182 of file ustring.cpp. |
|
Constructs a string from the single character c.
Definition at line 188 of file ustring.cpp. |
|
Constructs a string from a classical zero determined char string.
Definition at line 195 of file ustring.cpp. References operator=(). |
|
Constructs a string from an array of Unicode characters of the specified length.
Definition at line 201 of file ustring.cpp. |
|
If copy is false a shallow copy of the string will be created. That means that the data will NOT be copied and you'll have to guarantee that it doesn't get deleted during the lifetime of the UString object. Behaviour defaults to a deep copy if copy is true. Definition at line 208 of file ustring.cpp. References KStdAccel::copy(). |
|
Copy constructor. Makes a shallow copy only. Definition at line 219 of file ustring.cpp. References rep. |
|
Convenience declaration only ! You'll be on your own to write the implementation for a construction from QString. Note: feel free to contact me if you want to see a dummy header for your favourite FooString class here ! |
|
Convenience declaration only ! See UString(const QString&).
|
|
Destructor. If this handle was the only one holding a reference to the string the data will be freed. Definition at line 224 of file ustring.cpp. |
Member Function Documentation
|
Constructs a string from an int.
Definition at line 229 of file ustring.cpp. References UString(). |
|
Constructs a string from an unsigned int.
Definition at line 237 of file ustring.cpp. References UString(). |
|
Constructs a string from a double.
Definition at line 245 of file ustring.cpp. References UString(). |
|
Append another string.
Definition at line 270 of file ustring.cpp. References data(), and size(). Referenced by operator+=(). |
|
Definition at line 282 of file ustring.cpp. References ascii(). Referenced by toDouble(). |
|
Convert the Unicode string to plain ASCII chars chopping of any higher bytes. This method should only be used for *debugging* purposes as it is neither Unicode safe nor free from side effects. In order not to waste any memory the char buffer is static and *shared* by all UString instances. Definition at line 287 of file ustring.cpp. References data(), KJS::UChar::low(), and size(). Referenced by cstring(). |
|
|
|
|
|
|
|
Assignment operator.
Definition at line 308 of file ustring.cpp. References KJS::UChar::uc. Referenced by UString(). |
|
Assignment operator.
Definition at line 320 of file ustring.cpp. References rep. |
|
Appends the specified string.
Definition at line 329 of file ustring.cpp. References append(). |
|
Definition at line 315 of file ustring.h. Referenced by append(), ascii(), find(), KJS::Lookup::find(), KJS::Lookup::findEntry(), KJS::Lookup::hash(), is8Bit(), operator[](), rfind(), and substr(). |
|
|
|
Definition at line 323 of file ustring.h. Referenced by KJS::LabelStack::contains(), and KJS::LabelStack::push(). |
|
Use this if you want to make sure that this string is a plain ASCII string. For example, if you don't want to lose any information when using cstring() or ascii().
Definition at line 334 of file ustring.cpp. References data(), size(), and KJS::UChar::uc. Referenced by toDouble(). |
|
Definition at line 335 of file ustring.h. Referenced by append(), ascii(), find(), KJS::Lookup::find(), KJS::Lookup::findEntry(), KJS::Lookup::hash(), is8Bit(), operator[](), rfind(), substr(), toLower(), and toUpper(). |
|
Const character at specified position.
Definition at line 344 of file ustring.cpp. |
|
Writable reference to character at specified position.
Definition at line 352 of file ustring.cpp. |
|
Attempts an conversion to a number. Apart from floating point numbers, the algorithm will recognize hexadecimal representations (as indicated by a 0x or 0X prefix) and +/- Infinity. Returns NaN if the conversion failed.
Definition at line 358 of file ustring.cpp. References KJS::CString::c_str(), cstring(), KStdAccel::end(), and is8Bit(). Referenced by toULong(). |
|
Attempts an conversion to an unsigned long integer. ok will be set according to the success. Definition at line 420 of file ustring.cpp. References toDouble(). |
|
Returns this string converted to lower case characters.
Definition at line 436 of file ustring.cpp. References size(). |
|
Returns this string converted to upper case characters.
Definition at line 444 of file ustring.cpp. References size(). |
|
Definition at line 452 of file ustring.cpp. References data(), KStdAccel::end(), isNull(), and size(). |
|
Definition at line 467 of file ustring.cpp. |
|
Definition at line 482 of file ustring.cpp. |
Member Data Documentation
|
Static instance of a null string.
Definition at line 123 of file ustring.cpp. Referenced by UString(). |
The documentation for this class was generated from the following files: