.TH "KJS::UString" kde3 "11 Jun 2005" "Version Version 3.4.1" "kjs Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KJS::UString \- Unicode string class.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <ustring.h>\fP
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBUString\fP ()"
.br
.ti -1c
.RI "\fBUString\fP (char c)"
.br
.ti -1c
.RI "\fBUString\fP (const char *c)"
.br
.ti -1c
.RI "\fBUString\fP (const \fBUChar\fP *c, int length)"
.br
.ti -1c
.RI "\fBUString\fP (\fBUChar\fP *c, int length, bool copy)"
.br
.ti -1c
.RI "\fBUString\fP (const \fBUString\fP &s)"
.br
.ti -1c
.RI "\fBUString\fP (const \fBQString\fP &)"
.br
.ti -1c
.RI "\fBUString\fP (const DOM::DOMString &)"
.br
.ti -1c
.RI "\fBUString\fP (const \fBUString\fP &, const \fBUString\fP &)"
.br
.ti -1c
.RI "\fB~UString\fP ()"
.br
.ti -1c
.RI "\fBUString\fP & \fBappend\fP (const \fBUString\fP &)"
.br
.ti -1c
.RI "\fBCString\fP \fBcstring\fP () const "
.br
.ti -1c
.RI "char * \fBascii\fP () const "
.br
.ti -1c
.RI "DOM::DOMString \fBstring\fP () const "
.br
.ti -1c
.RI "\fBQString\fP \fBqstring\fP () const "
.br
.ti -1c
.RI "\fBQConstString\fP \fBqconststring\fP () const "
.br
.ti -1c
.RI "\fBUString\fP & \fBoperator=\fP (const char *c)"
.br
.ti -1c
.RI "\fBUString\fP & \fBoperator=\fP (const \fBUString\fP &)"
.br
.ti -1c
.RI "\fBUString\fP & \fBoperator+=\fP (const \fBUString\fP &s)"
.br
.ti -1c
.RI "const \fBUChar\fP * \fBdata\fP () const "
.br
.ti -1c
.RI "bool \fBisNull\fP () const "
.br
.ti -1c
.RI "bool \fBisEmpty\fP () const "
.br
.ti -1c
.RI "bool \fBis8Bit\fP () const "
.br
.ti -1c
.RI "int \fBsize\fP () const "
.br
.ti -1c
.RI "\fBUChar\fP \fBoperator[]\fP (int pos) const "
.br
.ti -1c
.RI "\fBUCharReference\fP \fBoperator[]\fP (int pos)"
.br
.ti -1c
.RI "double \fBtoDouble\fP (bool tolerateTrailingJunk, bool tolerateEmptyString) const "
.br
.ti -1c
.RI "double \fBtoDouble\fP (bool tolerateTrailingJunk) const "
.br
.ti -1c
.RI "double \fBtoDouble\fP () const "
.br
.ti -1c
.RI "unsigned long \fBtoULong\fP (bool *ok, bool tolerateEmptyString) const "
.br
.ti -1c
.RI "unsigned long \fBtoULong\fP (bool *ok=0) const "
.br
.ti -1c
.RI "unsigned int \fBtoUInt32\fP (bool *ok=0) const "
.br
.ti -1c
.RI "unsigned int \fBtoStrictUInt32\fP (bool *ok=0) const "
.br
.ti -1c
.RI "unsigned \fBtoArrayIndex\fP (bool *ok=0) const "
.br
.ti -1c
.RI "\fBUString\fP \fBtoLower\fP () const "
.br
.ti -1c
.RI "\fBUString\fP \fBtoUpper\fP () const "
.br
.ti -1c
.RI "int \fBfind\fP (const \fBUString\fP &f, int pos=0) const "
.br
.ti -1c
.RI "int \fBfind\fP (\fBUChar\fP, int pos=0) const "
.br
.ti -1c
.RI "int \fBrfind\fP (const \fBUString\fP &f, int pos) const "
.br
.ti -1c
.RI "int \fBrfind\fP (\fBUChar\fP, int pos) const "
.br
.ti -1c
.RI "\fBUString\fP \fBsubstr\fP (int pos=0, int len=-1) const "
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static \fBUString\fP \fBfrom\fP (int i)"
.br
.ti -1c
.RI "static \fBUString\fP \fBfrom\fP (unsigned int u)"
.br
.ti -1c
.RI "static \fBUString\fP \fBfrom\fP (long l)"
.br
.ti -1c
.RI "static \fBUString\fP \fBfrom\fP (double d)"
.br
.in -1c
.SS "Static Public Attributes"

.in +1c
.ti -1c
.RI "static \fBUString\fP \fBnull\fP"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBUCharReference\fP"
.br
.ti -1c
.RI "class \fBIdentifier\fP"
.br
.ti -1c
.RI "class \fBPropertyMap\fP"
.br
.ti -1c
.RI "class \fBPropertyMapHashTableEntry\fP"
.br
.ti -1c
.RI "bool \fBoperator==\fP (const \fBUString\fP &, const \fBUString\fP &)"
.br
.in -1c
.SH "Detailed Description"
.PP 
Unicode string class. 
.PP
Definition at line 189 of file ustring.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "UString::UString ()"
.PP
Constructs a null string. 
.PP
Definition at line 264 of file ustring.cpp.
.PP
Referenced by from().
.SS "UString::UString (char c)\fC [explicit]\fP"
.PP
Constructs a string from the single character c. 
.PP
Definition at line 270 of file ustring.cpp.
.SS "UString::UString (const char * c)"
.PP
Constructs a string from a classical zero determined char string. 
.PP
Definition at line 277 of file ustring.cpp.
.PP
References KJS::UChar::uc.
.SS "UString::UString (const \fBUChar\fP * c, int length)"
.PP
Constructs a string from an array of Unicode characters of the specified length. 
.PP
Definition at line 294 of file ustring.cpp.
.SS "UString::UString (\fBUChar\fP * c, int length, bool copy)"
.PP
If copy is false the string data will be adopted. 
.PP
That means that the data will NOT be copied and the pointer will be deleted when the \fBUString\fP object is modified or destroyed. Behaviour defaults to a deep copy if copy is true. 
.PP
Definition at line 305 of file ustring.cpp.
.SS "KJS::UString::UString (const \fBUString\fP & s)\fC [inline]\fP"
.PP
Copy constructor. 
.PP
Makes a shallow copy only. 
.PP
Definition at line 256 of file ustring.h.
.SS "KJS::UString::UString (const \fBQString\fP &)"
.PP
Convenience declaration only ! You'll be on your own to write the implementation for a construction from \fBQString\fP. 
.PP
Note: feel free to contact me if you want to see a dummy header for your favorite FooString class here ! 
.SS "KJS::UString::UString (const DOM::DOMString &)"
.PP
Convenience declaration only ! See \fBUString(const QString&)\fP. 
.PP
.SS "UString::UString (const \fBUString\fP &, const \fBUString\fP &)"
.PP
Concatenation constructor. 
.PP
Makes operator+ more efficient. 
.PP
Definition at line 320 of file ustring.cpp.
.SS "KJS::UString::~\fBUString\fP ()\fC [inline]\fP"
.PP
Destructor. 
.PP
If this handle was the only one holding a reference to the string the data will be freed. 
.PP
Definition at line 277 of file ustring.h.
.SH "Member Function Documentation"
.PP 
.SS "\fBUString\fP UString::from (int i)\fC [static]\fP"
.PP
Constructs a string from an int. 
.PP
Definition at line 335 of file ustring.cpp.
.SS "\fBUString\fP UString::from (unsigned int u)\fC [static]\fP"
.PP
Constructs a string from an unsigned int. 
.PP
Definition at line 340 of file ustring.cpp.
.PP
References UString().
.SS "\fBUString\fP UString::from (long l)\fC [static]\fP"
.PP
Constructs a string from a long. 
.PP
Definition at line 358 of file ustring.cpp.
.PP
References UString().
.SS "\fBUString\fP UString::from (double d)\fC [static]\fP"
.PP
Constructs a string from a double. 
.PP
Definition at line 384 of file ustring.cpp.
.PP
References UString().
.SS "\fBUString\fP & UString::append (const \fBUString\fP &)"
.PP
Append another string. 
.PP
Definition at line 452 of file ustring.cpp.
.PP
References data(), and size().
.SS "\fBCString\fP UString::cstring () const"
.PP
\fBReturns:\fP
.RS 4
The string converted to the 8-bit string type CString(). 
.RE
.PP

.PP
Definition at line 475 of file ustring.cpp.
.PP
References ascii().
.SS "char * UString::ascii () const"
.PP
Convert the Unicode string to plain ASCII chars chopping of any higher bytes. 
.PP
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 \fBUString\fP instances. 
.PP
Definition at line 480 of file ustring.cpp.
.PP
References data(), size(), and KJS::UChar::uc.
.PP
Referenced by cstring(), and KJS::Reference::getValue().
.SS "DOM::DOMString KJS::UString::string () const"
.PP
\fBSee also:\fP
.RS 4
\fBUString(const QString&)\fP. 
.RE
.PP

.SS "\fBQString\fP KJS::UString::qstring () const"
.PP
\fBSee also:\fP
.RS 4
\fBUString(const QString&)\fP. 
.RE
.PP

.SS "\fBQConstString\fP KJS::UString::qconststring () const"
.PP
\fBSee also:\fP
.RS 4
\fBUString(const QString&)\fP. 
.RE
.PP

.SS "\fBUString\fP & UString::operator= (const char * c)"
.PP
Assignment operator. 
.PP
Definition at line 517 of file ustring.cpp.
.PP
References KJS::UChar::uc.
.SS "\fBUString\fP& KJS::UString::operator+= (const \fBUString\fP & s)\fC [inline]\fP"
.PP
Appends the specified string. 
.PP
Definition at line 334 of file ustring.h.
.SS "const \fBUChar\fP* KJS::UString::data () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
A pointer to the internal Unicode data. 
.RE
.PP

.PP
Definition at line 339 of file ustring.h.
.PP
Referenced by append(), ascii(), find(), is8Bit(), operator[](), rfind(), and substr().
.SS "bool KJS::UString::isNull () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
True if null. 
.RE
.PP

.PP
Definition at line 343 of file ustring.h.
.SS "bool KJS::UString::isEmpty () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
True if null or zero length. 
.RE
.PP

.PP
Definition at line 347 of file ustring.h.
.SS "bool UString::is8Bit () const"
.PP
Use this if you want to make sure that this string is a plain ASCII string. 
.PP
For example, if you don't want to lose any information when using \fBcstring()\fP or \fBascii()\fP.
.PP
\fBReturns:\fP
.RS 4
True if the string doesn't contain any non-ASCII characters. 
.RE
.PP

.PP
Definition at line 544 of file ustring.cpp.
.PP
References data(), size(), and KJS::UChar::uc.
.SS "int KJS::UString::size () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
The length of the string. 
.RE
.PP

.PP
Definition at line 359 of file ustring.h.
.PP
Referenced by append(), ascii(), find(), is8Bit(), operator[](), rfind(), substr(), toLower(), and toUpper().
.SS "\fBUChar\fP UString::operator[] (int pos) const"
.PP
Const character at specified position. 
.PP
Definition at line 557 of file ustring.cpp.
.PP
References data(), and size().
.SS "\fBUCharReference\fP UString::operator[] (int pos)"
.PP
Writable reference to character at specified position. 
.PP
Definition at line 565 of file ustring.cpp.
.SS "double UString::toDouble (bool tolerateTrailingJunk, bool tolerateEmptyString) const"
.PP
Attempts an conversion to a number. 
.PP
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. 
.PP
\fBParameters:\fP
.RS 4
\fItolerateTrailingJunk\fP if true, toDouble can tolerate garbage after the number. 
.br
\fItolerateEmptyString\fP if false, toDouble will turn an empty string into NaN rather than 0. 
.RE
.PP

.PP
Definition at line 597 of file ustring.cpp.
.PP
Referenced by toULong().
.SS "unsigned long UString::toULong (bool * ok, bool tolerateEmptyString) const"
.PP
Attempts an conversion to an unsigned long integer. 
.PP
ok will be set according to the success. @ 
.PP
\fBParameters:\fP
.RS 4
\fIok\fP make this point to a bool in case you need to know whether the conversion succeeded. 
.br
\fItolerateEmptyString\fP if false, toULong will return false for *ok for an empty string. 
.RE
.PP

.PP
Definition at line 675 of file ustring.cpp.
.PP
References toDouble().
.SS "unsigned UString::toArrayIndex (bool * ok = \fC0\fP) const"
.PP
Attempts an conversion to an array index. 
.PP
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. 
.PP
Definition at line 780 of file ustring.cpp.
.SS "\fBUString\fP UString::toLower () const"
.PP
Returns this string converted to lower case characters. 
.PP
Definition at line 696 of file ustring.cpp.
.PP
References size().
.SS "\fBUString\fP UString::toUpper () const"
.PP
Returns this string converted to upper case characters. 
.PP
Definition at line 704 of file ustring.cpp.
.PP
References size().
.SS "int UString::find (const \fBUString\fP & f, int pos = \fC0\fP) const"
.PP
\fBReturns:\fP
.RS 4
Position of first occurrence of f starting at position pos. -1 if the search was not successful. 
.RE
.PP

.PP
Definition at line 788 of file ustring.cpp.
.PP
References data(), and size().
.SS "int UString::rfind (const \fBUString\fP & f, int pos) const"
.PP
\fBReturns:\fP
.RS 4
Position of first occurrence of f searching backwards from position pos. -1 if the search was not successful. 
.RE
.PP

.PP
Definition at line 820 of file ustring.cpp.
.PP
References data(), and size().
.SS "\fBUString\fP UString::substr (int pos = \fC0\fP, int len = \fC-1\fP) const"
.PP
\fBReturns:\fP
.RS 4
The sub string starting at position pos and length len. 
.RE
.PP

.PP
Definition at line 856 of file ustring.cpp.
.PP
References data(), and size().
.SH "Member Data Documentation"
.PP 
.SS "\fBUString\fP \fBUString::null\fP\fC [static]\fP"
.PP
Static instance of a null string. 
.PP
Definition at line 126 of file ustring.cpp.

.SH "Author"
.PP 
Generated automatically by Doxygen for kjs Library from the source code.
