#include <ustring.h>
Classes | |
struct | Rep |
Public Types | |
enum | Empty { empty } |
Public Member Functions | |
UString () | |
UString (Empty) | |
UString (char c) | |
UString (const char *c) | |
UString (const char *c, size_t length) | |
UString (const UChar *c, int length) | |
UString (UChar *c, int length, bool copy) | |
UString (const UString &s) | |
UString (const Vector< UChar > &buffer) | |
KJS_EXTERNAL_EXPORT | UString (const QString &) |
KJS_EXTERNAL_EXPORT | UString (const DOM::DOMString &) |
UString (const UString &, const UString &) | |
UString (PassRefPtr< Rep > r) | |
~UString () | |
UString & | append (const UString &subStr, int subPos, int subLength=-1) |
UString & | append (const UString &t) |
UString & | append (const char *t) |
UString & | append (const char *t, int tSize) |
UString & | append (unsigned short) |
UString & | append (char c) |
UString & | append (UChar c) |
char * | ascii () const |
void | copyForWriting () |
size_t | cost () const |
CString | cstring () const |
const UChar * | data () const |
KJS_EXTERNAL_EXPORT DOM::DOMString | domString () const |
int | find (const UString &f, int pos=0) const |
int | find (UChar, int pos=0) const |
bool | is8Bit () const |
bool | isEmpty () const |
bool | isNull () const |
UString & | operator+= (const UString &s) |
UString & | operator+= (const char *s) |
UString & | operator= (const char *c) |
UString & | operator= (Empty) |
const UChar | operator[] (int pos) const |
KJS_EXTERNAL_EXPORT QConstString | qconststring () const |
KJS_EXTERNAL_EXPORT QString | qstring () const |
Rep * | rep () const |
int | rfind (const UString &f, int pos) const |
int | rfind (UChar, int pos) const |
int | size () const |
UString | spliceSubstringsWithSeparators (const Range *substringRanges, int rangeCount, const UString *separators, int separatorCount) const |
UString | substr (int pos=0, int len=-1) const |
unsigned | toArrayIndex (bool *ok=nullptr) const |
double | toDouble (bool tolerateTrailingJunk, bool tolerateEmptyString) const |
double | toDouble (bool tolerateTrailingJunk) const |
double | toDouble () const |
uint32_t | toStrictUInt32 (bool *ok=nullptr) const |
CString | UTF8String () const |
Static Public Member Functions | |
static bool | equal (const UString::Rep *a, const UString::Rep *b) |
static UString | from (int i) |
static UString | from (unsigned int u) |
static UString | from (long u) |
static UString | from (double d) |
static size_t | maxUChars () |
static const UString & | null () |
Friends | |
KJS_EXPORT friend bool | operator== (const UString &, const UString &) |
Detailed Description
Member Enumeration Documentation
enum KJS::UString::Empty |
Constructor & Destructor Documentation
|
inline |
|
explicit |
Constructs a string from the single character c.
Definition at line 417 of file ustring.cpp.
KJS::UString::UString | ( | const char * | c | ) |
Constructs a string from a classical zero determined char string.
Definition at line 423 of file ustring.cpp.
KJS::UString::UString | ( | const UChar * | c, |
int | length | ||
) |
Constructs a string from an array of Unicode characters of the specified length.
Definition at line 470 of file ustring.cpp.
KJS::UString::UString | ( | UChar * | c, |
int | length, | ||
bool | copy | ||
) |
If copy is false the string data will be adopted.
That means that the data will NOT be copied and the pointer will be deleted when the UString object is modified or destroyed. Behaviour defaults to a deep copy if copy is true.
Definition at line 479 of file ustring.cpp.
|
inline |
KJS_EXTERNAL_EXPORT KJS::UString::UString | ( | const QString & | ) |
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 favorite FooString class here !
KJS_EXTERNAL_EXPORT KJS::UString::UString | ( | const DOM::DOMString & | ) |
Convenience declaration only ! See UString(const QString&).
Concatenation constructor.
Makes operator+ more efficient.
Definition at line 499 of file ustring.cpp.
Member Function Documentation
Append another string.
Definition at line 764 of file ustring.cpp.
char * KJS::UString::ascii | ( | ) | const |
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 937 of file ustring.cpp.
CString KJS::UString::cstring | ( | ) | const |
- Returns
- The string converted to the 8-bit string type CString().
Definition at line 932 of file ustring.cpp.
|
inline |
KJS_EXTERNAL_EXPORT DOM::DOMString KJS::UString::domString | ( | ) | const |
- See also
- UString(const QString&).
int KJS::UString::find | ( | const UString & | f, |
int | pos = 0 |
||
) | const |
- Returns
- Position of first occurrence of f starting at position pos. -1 if the search was not successful.
Definition at line 1191 of file ustring.cpp.
|
static |
Constructs a string from an int.
Definition at line 562 of file ustring.cpp.
|
static |
Constructs a string from an unsigned int.
Definition at line 592 of file ustring.cpp.
|
static |
Constructs a string from a long int.
Definition at line 610 of file ustring.cpp.
|
static |
Constructs a string from a double.
Definition at line 640 of file ustring.cpp.
bool KJS::UString::is8Bit | ( | ) | const |
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().
- Returns
- True if the string doesn't contain any non-ASCII characters.
Definition at line 1009 of file ustring.cpp.
|
inline |
|
inline |
|
static |
|
static |
Static instance of a null string.
Definition at line 556 of file ustring.cpp.
UString & KJS::UString::operator= | ( | const char * | c | ) |
Assignment operator.
Definition at line 972 of file ustring.cpp.
const UChar KJS::UString::operator[] | ( | int | pos | ) | const |
Const character at specified position.
Definition at line 1023 of file ustring.cpp.
KJS_EXTERNAL_EXPORT QConstString KJS::UString::qconststring | ( | ) | const |
- See also
- UString(const QString&).
KJS_EXTERNAL_EXPORT QString KJS::UString::qstring | ( | ) | const |
- See also
- UString(const QString&).
int KJS::UString::rfind | ( | const UString & | f, |
int | pos | ||
) | const |
- Returns
- Position of first occurrence of f searching backwards from position pos. -1 if the search was not successful.
Definition at line 1233 of file ustring.cpp.
|
inline |
UString KJS::UString::substr | ( | int | pos = 0 , |
int | len = -1 |
||
) | const |
- Returns
- The sub string starting at position pos and length len.
Definition at line 1279 of file ustring.cpp.
|
inline |
Attempts an conversion to an array index.
The "ok" boolean will be set to true if it is a valid array index according to the rule from ECMA 15.2 about what an array index is. It must exactly match the string form of an unsigned integer, and be less than 2^32 - 1.
double KJS::UString::toDouble | ( | bool | tolerateTrailingJunk, |
bool | tolerateEmptyString | ||
) | const |
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.
- Parameters
-
tolerateTrailingJunk if true, toDouble can tolerate garbage after the number. tolerateEmptyString if false, toDouble will turn an empty string into NaN rather than 0.
Definition at line 1031 of file ustring.cpp.
uint32_t KJS::UString::toStrictUInt32 | ( | bool * | ok = nullptr | ) | const |
Attempts an conversion to a 32-bit integer.
ok will be set according to the success.
Definition at line 1134 of file ustring.cpp.
CString KJS::UString::UTF8String | ( | ) | const |
Convert the string to UTF-8, assuming it is UTF-16 encoded.
Since this function is tolerant of badly formed UTF-16, it can create UTF-8 strings that are invalid because they have characters in the range U+D800-U+DDFF, U+FFFE, or U+FFFF, but the UTF-8 string is guaranteed to be otherwise valid.
Definition at line 1534 of file ustring.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2019 The KDE developers.
Generated on Sat Dec 7 2019 03:27:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.