.TH "KJS::UString" 3 "28 Jan 2004" "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
.RI "\fIConstructs a null string. \fP"
.ti -1c
.RI "\fBUString\fP (char c)"
.br
.RI "\fIConstructs a string from the single character c. \fP"
.ti -1c
.RI "\fBUString\fP (const  char *c)"
.br
.RI "\fIConstructs a string from a classical zero determined char string. \fP"
.ti -1c
.RI "\fBUString\fP (const  \fBUChar\fP *c, int length)"
.br
.RI "\fIConstructs a string from an array of Unicode characters of the specified length. \fP"
.ti -1c
.RI "\fBUString\fP (\fBUChar\fP *c, int length, bool copy)"
.br
.RI "\fIIf copy is false a shallow copy of the string will be created. \fP"
.ti -1c
.RI "\fBUString\fP (const  \fBUString\fP &)"
.br
.RI "\fICopy constructor. \fP"
.ti -1c
.RI "\fBUString\fP (const  \fBQString\fP &)"
.br
.RI "\fIConvenience declaration only ! You'll be on your own to write the implementation for a construction from \fBQString\fP. \fP"
.ti -1c
.RI "\fBUString\fP (const  DOM::DOMString &)"
.br
.RI "\fIConvenience declaration only ! See \fBUString\fP(const \fBQString\fP&). \fP"
.ti -1c
.RI "\fB~UString\fP ()"
.br
.RI "\fIDestructor. \fP"
.ti -1c
.RI "\fBUString\fP & \fBappend\fP (const  \fBUString\fP &)"
.br
.RI "\fIAppend another string. \fP"
.ti -1c
.RI "\fBCString\fP \fBcstring\fP () const "
.br
.ti -1c
.RI "char * \fBascii\fP () const "
.br
.RI "\fIConvert the Unicode string to plain ASCII chars chopping of any higher bytes. \fP"
.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
.RI "\fIAssignment operator. \fP"
.ti -1c
.RI "\fBUString\fP & \fBoperator=\fP (const  \fBUString\fP &)"
.br
.RI "\fIAssignment operator. \fP"
.ti -1c
.RI "\fBUString\fP & \fBoperator+=\fP (const  \fBUString\fP &s)"
.br
.RI "\fIAppends the specified string. \fP"
.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
.RI "\fIUse this if you want to make sure that this string is a plain ASCII string. \fP"
.ti -1c
.RI "int \fBsize\fP () const "
.br
.ti -1c
.RI "\fBUChar\fP \fBoperator[]\fP (int pos) const "
.br
.RI "\fIConst character at specified position. \fP"
.ti -1c
.RI "\fBUCharReference\fP \fBoperator[]\fP (int pos)"
.br
.RI "\fIWritable reference to character at specified position. \fP"
.ti -1c
.RI "double \fBtoDouble\fP (bool tolerant=false) const "
.br
.RI "\fIAttempts an conversion to a number. \fP"
.ti -1c
.RI "unsigned long \fBtoULong\fP (bool *ok=0L) const "
.br
.RI "\fIAttempts an conversion to an unsigned long integer. \fP"
.ti -1c
.RI "\fBUString\fP \fBtoLower\fP () const "
.br
.RI "\fIReturns this string converted to lower case characters. \fP"
.ti -1c
.RI "\fBUString\fP \fBtoUpper\fP () const "
.br
.RI "\fIReturns this string converted to upper case characters. \fP"
.ti -1c
.RI "int \fBfind\fP (const  \fBUString\fP &f, int pos=0) const "
.br
.ti -1c
.RI "int \fBrfind\fP (const  \fBUString\fP &f, 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 "\fBUString\fP \fBfrom\fP (int i)"
.br
.RI "\fIConstructs a string from an int. \fP"
.ti -1c
.RI "\fBUString\fP \fBfrom\fP (unsigned int u)"
.br
.RI "\fIConstructs a string from an unsigned int. \fP"
.ti -1c
.RI "\fBUString\fP \fBfrom\fP (double d)"
.br
.RI "\fIConstructs a string from a double. \fP"
.in -1c
.SS "Static Public Attributes"

.in +1c
.ti -1c
.RI "\fBUString\fP \fBnull\fP"
.br
.RI "\fIStatic instance of a null string. \fP"
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBUCharReference\fP"
.br
.ti -1c
.RI "bool \fBoperator==\fP (const  \fBUString\fP &, const  \fBUString\fP &)"
.br
.in -1c
.SH "Detailed Description"
.PP 
Unicode string class. Definition at line 187 of file ustring.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "UString::UString ()"
.PP
Constructs a null string. Definition at line 182 of file ustring.cpp.
.PP
References null, and rep.
.PP
Referenced by from(), and substr().
.SS "UString::UString (char c)"
.PP
Constructs a string from the single character c. Definition at line 188 of file ustring.cpp.
.SS "UString::UString (const char * c)"
.PP
Constructs a string from a classical zero determined char string. Definition at line 195 of file ustring.cpp.
.PP
References operator=().
.SS "UString::UString (const \fBUChar\fP * c, int length)"
.PP
Constructs a string from an array of Unicode characters of the specified length. Definition at line 201 of file ustring.cpp.
.SS "UString::UString (\fBUChar\fP * c, int length, bool copy)"
.PP
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 \fBUString\fP object. Behaviour defaults to a deep copy if copy is true. Definition at line 208 of file ustring.cpp.
.PP
References KStdAccel::copy().
.SS "UString::UString (const \fBUString\fP &)"
.PP
Copy constructor. Makes a shallow copy only. Definition at line 219 of file ustring.cpp.
.PP
References rep.
.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. Note: feel free to contact me if you want to see a dummy header for your favourite FooString class here ! 
.SS "KJS::UString::UString (const DOM::DOMString &)"
.PP
Convenience declaration only ! See \fBUString\fP(const \fBQString\fP&). 
.SS "UString::~\fBUString\fP ()"
.PP
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.
.SH "Member Function Documentation"
.PP 
.SS "\fBUString\fP UString::from (int i)\fC [static]\fP"
.PP
Constructs a string from an int. Definition at line 229 of file ustring.cpp.
.PP
References UString().
.SS "\fBUString\fP UString::from (unsigned int u)\fC [static]\fP"
.PP
Constructs a string from an unsigned int. Definition at line 237 of file ustring.cpp.
.PP
References UString().
.SS "\fBUString\fP UString::from (double d)\fC [static]\fP"
.PP
Constructs a string from a double. Definition at line 245 of file ustring.cpp.
.PP
References UString().
.SS "\fBUString\fP & UString::append (const \fBUString\fP &)"
.PP
Append another string. Definition at line 270 of file ustring.cpp.
.PP
References data(), and size().
.PP
Referenced by operator+=().
.SS "\fBCString\fP UString::cstring () const"
.PP
\fBReturns:\fP
.RS 4
The string converted to the 8-bit string type \fBCString\fP(). 
.RE
.PP
Definition at line 282 of file ustring.cpp.
.PP
References ascii().
.PP
Referenced by toDouble().
.SS "char * UString::ascii () const"
.PP
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 \fBUString\fP instances. Definition at line 287 of file ustring.cpp.
.PP
References data(), KJS::UChar::low(), and size().
.PP
Referenced by cstring().
.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. Definition at line 308 of file ustring.cpp.
.PP
References KJS::UChar::uc.
.PP
Referenced by UString().
.SS "\fBUString\fP & UString::operator= (const \fBUString\fP &)"
.PP
Assignment operator. Definition at line 320 of file ustring.cpp.
.PP
References rep.
.SS "\fBUString\fP & UString::operator+= (const \fBUString\fP & s)"
.PP
Appends the specified string. Definition at line 329 of file ustring.cpp.
.PP
References append().
.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
Definition at line 315 of file ustring.h.
.PP
Referenced by append(), ascii(), find(), KJS::Lookup::find(), KJS::Lookup::findEntry(), is8Bit(), operator[](), rfind(), and substr().
.SS "bool KJS::UString::isNull () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
True if null. 
.RE
.PP
Definition at line 319 of file ustring.h.
.PP
Referenced by find(), rfind(), and substr().
.SS "bool KJS::UString::isEmpty () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
True if null or zero length. 
.RE
.PP
Definition at line 323 of file ustring.h.
.PP
Referenced by KJS::LabelStack::contains(), and KJS::LabelStack::push().
.SS "bool UString::is8Bit () const"
.PP
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 \fBcstring\fP() or \fBascii\fP().
.PP
\fBReturns:\fP
.RS 4
True if the string doesn't contain any non-ASCII characters. 
.RE
.PP
Definition at line 334 of file ustring.cpp.
.PP
References data(), size(), and KJS::UChar::uc.
.PP
Referenced by toDouble().
.SS "int KJS::UString::size () const\fC [inline]\fP"
.PP
\fBReturns:\fP
.RS 4
The length of the string. 
.RE
.PP
Definition at line 335 of file ustring.h.
.PP
Referenced by append(), ascii(), find(), KJS::Lookup::find(), KJS::Lookup::findEntry(), is8Bit(), operator[](), rfind(), substr(), toLower(), and toUpper().
.SS "\fBUChar\fP UString::operator[] (int pos) const"
.PP
Const character at specified position. Definition at line 344 of file ustring.cpp.
.PP
References data(), and size().
.SS "\fBUCharReference\fP UString::operator[] (int pos)"
.PP
Writable reference to character at specified position. Definition at line 352 of file ustring.cpp.
.SS "double UString::toDouble (bool tolerant = false) const"
.PP
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. 
.PP
\fBParameters:\fP
.RS 4
\fItolerant\fP if true, toDouble can tolerate garbage after the number. 
.RE
.PP
Definition at line 358 of file ustring.cpp.
.PP
References KJS::CString::c_str(), cstring(), KStdAccel::end(), and is8Bit().
.PP
Referenced by toULong().
.SS "unsigned long UString::toULong (bool * ok = 0L) const"
.PP
Attempts an conversion to an unsigned long integer. ok will be set according to the success. Definition at line 420 of file ustring.cpp.
.PP
References toDouble().
.SS "\fBUString\fP UString::toLower () const"
.PP
Returns this string converted to lower case characters. Definition at line 436 of file ustring.cpp.
.PP
References size().
.SS "\fBUString\fP UString::toUpper () const"
.PP
Returns this string converted to upper case characters. Definition at line 444 of file ustring.cpp.
.PP
References size().
.SS "int UString::find (const \fBUString\fP & f, int pos = 0) const"
.PP
\fBReturns:\fP
.RS 4
Position of first occurence of f starting at position pos. -1 if the search was not successful. 
.RE
.PP
Definition at line 452 of file ustring.cpp.
.PP
References data(), KStdAccel::end(), isNull(), and size().
.SS "int UString::rfind (const \fBUString\fP & f, int pos) const"
.PP
\fBReturns:\fP
.RS 4
Position of first occurence of f searching backwards from position pos. -1 if the search was not successful. 
.RE
.PP
Definition at line 467 of file ustring.cpp.
.PP
References data(), isNull(), and size().
.SS "\fBUString\fP UString::substr (int pos = 0, int len = -1) const"
.PP
\fBReturns:\fP
.RS 4
The sub string starting at position pos and length len. 
.RE
.PP
Definition at line 482 of file ustring.cpp.
.PP
References data(), isNull(), size(), and UString().
.SH "Member Data Documentation"
.PP 
.SS "\fBUString\fP \fBUString::null\fP\fC [static]\fP"
.PP
Static instance of a null string. Definition at line 123 of file ustring.cpp.
.PP
Referenced by UString().

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