\section{KJS::UString Class Reference}
\label{classKJS_1_1UString}\index{KJS::UString@{KJS::UString}}
Unicode string class.  


{\tt \#include $<$ustring.h$>$}

Collaboration diagram for KJS::UString:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=71pt]{classKJS_1_1UString__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf UString} ()
\item 
{\bf UString} (char c)
\item 
{\bf UString} (const char $\ast$c)
\item 
{\bf UString} (const {\bf UChar} $\ast$c, int length)
\item 
{\bf UString} ({\bf UChar} $\ast$c, int length, bool copy)
\item 
{\bf UString} (const {\bf UString} \&s)
\item 
{\bf UString} (const {\bf QString} \&)
\item 
{\bf UString} (const DOM::DOMString \&)
\item 
{\bf UString} (const {\bf UString} \&, const {\bf UString} \&)
\item 
{\bf $\sim$UString} ()
\item 
{\bf UString} \& {\bf append} (const {\bf UString} \&)
\item 
{\bf CString} {\bf cstring} () const 
\item 
char $\ast$ {\bf ascii} () const 
\item 
DOM::DOMString {\bf string} () const 
\item 
{\bf QString} {\bf qstring} () const 
\item 
{\bf QConst\-String} {\bf qconststring} () const 
\item 
{\bf UString} \& {\bf operator=} (const char $\ast$c)
\item 
{\bf UString} \& {\bf operator=} (const {\bf UString} \&)\label{classKJS_1_1UString_a17}

\item 
{\bf UString} \& {\bf operator+=} (const {\bf UString} \&s)
\item 
const {\bf UChar} $\ast$ {\bf data} () const 
\item 
bool {\bf is\-Null} () const 
\item 
bool {\bf is\-Empty} () const 
\item 
bool {\bf is8Bit} () const 
\item 
int {\bf size} () const 
\item 
{\bf UChar} {\bf operator[$\,$]} (int pos) const 
\item 
{\bf UChar\-Reference} {\bf operator[$\,$]} (int pos)
\item 
double {\bf to\-Double} (bool tolerate\-Trailing\-Junk, bool tolerate\-Empty\-String) const 
\item 
double {\bf to\-Double} (bool tolerate\-Trailing\-Junk) const \label{classKJS_1_1UString_a27}

\item 
double {\bf to\-Double} () const \label{classKJS_1_1UString_a28}

\item 
unsigned long {\bf to\-ULong} (bool $\ast$ok, bool tolerate\-Empty\-String) const 
\item 
unsigned long {\bf to\-ULong} (bool $\ast$ok=0) const \label{classKJS_1_1UString_a30}

\item 
unsigned int {\bf to\-UInt32} (bool $\ast$ok=0) const \label{classKJS_1_1UString_a31}

\item 
unsigned int {\bf to\-Strict\-UInt32} (bool $\ast$ok=0) const \label{classKJS_1_1UString_a32}

\item 
unsigned {\bf to\-Array\-Index} (bool $\ast$ok=0) const 
\item 
{\bf UString} {\bf to\-Lower} () const 
\item 
{\bf UString} {\bf to\-Upper} () const 
\item 
int {\bf find} (const {\bf UString} \&f, int pos=0) const 
\item 
int {\bf find} ({\bf UChar}, int pos=0) const \label{classKJS_1_1UString_a37}

\item 
int {\bf rfind} (const {\bf UString} \&f, int pos) const 
\item 
int {\bf rfind} ({\bf UChar}, int pos) const \label{classKJS_1_1UString_a39}

\item 
{\bf UString} {\bf substr} (int pos=0, int len=-1) const 
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf UString} {\bf from} (int i)
\item 
static {\bf UString} {\bf from} (unsigned int u)
\item 
static {\bf UString} {\bf from} (long l)
\item 
static {\bf UString} {\bf from} (double d)
\end{CompactItemize}
\subsection*{Static Public Attributes}
\begin{CompactItemize}
\item 
static {\bf UString} {\bf null}
\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf UChar\-Reference}\label{classKJS_1_1UString_n0}

\item 
class {\bf Identifier}\label{classKJS_1_1UString_n1}

\item 
class {\bf Property\-Map}\label{classKJS_1_1UString_n2}

\item 
class {\bf Property\-Map\-Hash\-Table\-Entry}\label{classKJS_1_1UString_n3}

\item 
bool {\bf operator==} (const {\bf UString} \&, const {\bf UString} \&)\label{classKJS_1_1UString_n4}

\end{CompactItemize}


\subsection{Detailed Description}
Unicode string class. 



Definition at line 189 of file ustring.h.

\subsection{Constructor \& Destructor Documentation}
\index{KJS::UString@{KJS::UString}!UString@{UString}}
\index{UString@{UString}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}UString::UString ()}\label{classKJS_1_1UString_a0}


Constructs a null string. 



Definition at line 264 of file ustring.cpp.

Referenced by from().\index{KJS::UString@{KJS::UString}!UString@{UString}}
\index{UString@{UString}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}UString::UString (char {\em c})\hspace{0.3cm}{\tt  [explicit]}}\label{classKJS_1_1UString_a1}


Constructs a string from the single character c. 



Definition at line 270 of file ustring.cpp.\index{KJS::UString@{KJS::UString}!UString@{UString}}
\index{UString@{UString}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}UString::UString (const char $\ast$ {\em c})}\label{classKJS_1_1UString_a2}


Constructs a string from a classical zero determined char string. 



Definition at line 277 of file ustring.cpp.

References KJS::UChar::uc.\index{KJS::UString@{KJS::UString}!UString@{UString}}
\index{UString@{UString}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}UString::UString (const {\bf UChar} $\ast$ {\em c}, int {\em length})}\label{classKJS_1_1UString_a3}


Constructs a string from an array of Unicode characters of the specified length. 



Definition at line 294 of file ustring.cpp.\index{KJS::UString@{KJS::UString}!UString@{UString}}
\index{UString@{UString}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}UString::UString ({\bf UChar} $\ast$ {\em c}, int {\em length}, bool {\em copy})}\label{classKJS_1_1UString_a4}


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 {\bf UString}{\rm (p.\,\pageref{classKJS_1_1UString})} object is modified or destroyed. Behaviour defaults to a deep copy if copy is true. 

Definition at line 305 of file ustring.cpp.\index{KJS::UString@{KJS::UString}!UString@{UString}}
\index{UString@{UString}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KJS::UString::UString (const {\bf UString} \& {\em s})\hspace{0.3cm}{\tt  [inline]}}\label{classKJS_1_1UString_a5}


Copy constructor. 

Makes a shallow copy only. 

Definition at line 256 of file ustring.h.\index{KJS::UString@{KJS::UString}!UString@{UString}}
\index{UString@{UString}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KJS::UString::UString (const {\bf QString} \&)}\label{classKJS_1_1UString_a6}


Convenience declaration only ! You'll be on your own to write the implementation for a construction from {\bf QString}. 

Note: feel free to contact me if you want to see a dummy header for your favorite Foo\-String class here ! \index{KJS::UString@{KJS::UString}!UString@{UString}}
\index{UString@{UString}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KJS::UString::UString (const DOM::DOMString \&)}\label{classKJS_1_1UString_a7}


Convenience declaration only ! See {\bf UString(const QString\&)}{\rm (p.\,\pageref{classKJS_1_1UString_a6})}. 

\index{KJS::UString@{KJS::UString}!UString@{UString}}
\index{UString@{UString}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}UString::UString (const {\bf UString} \&, const {\bf UString} \&)}\label{classKJS_1_1UString_a8}


Concatenation constructor. 

Makes operator+ more efficient. 

Definition at line 320 of file ustring.cpp.\index{KJS::UString@{KJS::UString}!~UString@{$\sim$UString}}
\index{~UString@{$\sim$UString}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KJS::UString::$\sim${\bf UString} ()\hspace{0.3cm}{\tt  [inline]}}\label{classKJS_1_1UString_a9}


Destructor. 

If this handle was the only one holding a reference to the string the data will be freed. 

Definition at line 277 of file ustring.h.

\subsection{Member Function Documentation}
\index{KJS::UString@{KJS::UString}!from@{from}}
\index{from@{from}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UString} UString::from (int {\em i})\hspace{0.3cm}{\tt  [static]}}\label{classKJS_1_1UString_e0}


Constructs a string from an int. 



Definition at line 335 of file ustring.cpp.\index{KJS::UString@{KJS::UString}!from@{from}}
\index{from@{from}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UString} UString::from (unsigned int {\em u})\hspace{0.3cm}{\tt  [static]}}\label{classKJS_1_1UString_e1}


Constructs a string from an unsigned int. 



Definition at line 340 of file ustring.cpp.

References UString().\index{KJS::UString@{KJS::UString}!from@{from}}
\index{from@{from}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UString} UString::from (long {\em l})\hspace{0.3cm}{\tt  [static]}}\label{classKJS_1_1UString_e2}


Constructs a string from a long. 



Definition at line 358 of file ustring.cpp.

References UString().\index{KJS::UString@{KJS::UString}!from@{from}}
\index{from@{from}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UString} UString::from (double {\em d})\hspace{0.3cm}{\tt  [static]}}\label{classKJS_1_1UString_e3}


Constructs a string from a double. 



Definition at line 384 of file ustring.cpp.

References UString().\index{KJS::UString@{KJS::UString}!append@{append}}
\index{append@{append}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UString} \& UString::append (const {\bf UString} \&)}\label{classKJS_1_1UString_a10}


Append another string. 



Definition at line 452 of file ustring.cpp.

References data(), and size().\index{KJS::UString@{KJS::UString}!cstring@{cstring}}
\index{cstring@{cstring}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf CString} UString::cstring () const}\label{classKJS_1_1UString_a11}


\begin{Desc}
\item[Returns:]The string converted to the 8-bit string type CString(). \end{Desc}


Definition at line 475 of file ustring.cpp.

References ascii().\index{KJS::UString@{KJS::UString}!ascii@{ascii}}
\index{ascii@{ascii}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char $\ast$ UString::ascii () const}\label{classKJS_1_1UString_a12}


Convert the Unicode string to plain ASCII chars chopping of any higher bytes. 

This method should only be used for $\ast$debugging$\ast$ 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 $\ast$shared$\ast$ by all {\bf UString}{\rm (p.\,\pageref{classKJS_1_1UString})} instances. 

Definition at line 480 of file ustring.cpp.

References data(), size(), and KJS::UChar::uc.

Referenced by cstring(), and KJS::Reference::get\-Value().\index{KJS::UString@{KJS::UString}!string@{string}}
\index{string@{string}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}DOM::DOMString KJS::UString::string () const}\label{classKJS_1_1UString_a13}


\begin{Desc}
\item[See also:]{\bf UString(const QString\&)}{\rm (p.\,\pageref{classKJS_1_1UString_a6})}. \end{Desc}
\index{KJS::UString@{KJS::UString}!qstring@{qstring}}
\index{qstring@{qstring}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KJS::UString::qstring () const}\label{classKJS_1_1UString_a14}


\begin{Desc}
\item[See also:]{\bf UString(const QString\&)}{\rm (p.\,\pageref{classKJS_1_1UString_a6})}. \end{Desc}
\index{KJS::UString@{KJS::UString}!qconststring@{qconststring}}
\index{qconststring@{qconststring}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QConst\-String} KJS::UString::qconststring () const}\label{classKJS_1_1UString_a15}


\begin{Desc}
\item[See also:]{\bf UString(const QString\&)}{\rm (p.\,\pageref{classKJS_1_1UString_a6})}. \end{Desc}
\index{KJS::UString@{KJS::UString}!operator=@{operator=}}
\index{operator=@{operator=}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UString} \& UString::operator= (const char $\ast$ {\em c})}\label{classKJS_1_1UString_a16}


Assignment operator. 



Definition at line 517 of file ustring.cpp.

References KJS::UChar::uc.\index{KJS::UString@{KJS::UString}!operator+=@{operator+=}}
\index{operator+=@{operator+=}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UString}\& KJS::UString::operator+= (const {\bf UString} \& {\em s})\hspace{0.3cm}{\tt  [inline]}}\label{classKJS_1_1UString_a18}


Appends the specified string. 



Definition at line 334 of file ustring.h.\index{KJS::UString@{KJS::UString}!data@{data}}
\index{data@{data}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf UChar}$\ast$ KJS::UString::data () const\hspace{0.3cm}{\tt  [inline]}}\label{classKJS_1_1UString_a19}


\begin{Desc}
\item[Returns:]A pointer to the internal Unicode data. \end{Desc}


Definition at line 339 of file ustring.h.

Referenced by append(), ascii(), find(), is8Bit(), operator[$\,$](), rfind(), and substr().\index{KJS::UString@{KJS::UString}!isNull@{isNull}}
\index{isNull@{isNull}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KJS::UString::is\-Null () const\hspace{0.3cm}{\tt  [inline]}}\label{classKJS_1_1UString_a20}


\begin{Desc}
\item[Returns:]True if null. \end{Desc}


Definition at line 343 of file ustring.h.\index{KJS::UString@{KJS::UString}!isEmpty@{isEmpty}}
\index{isEmpty@{isEmpty}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KJS::UString::is\-Empty () const\hspace{0.3cm}{\tt  [inline]}}\label{classKJS_1_1UString_a21}


\begin{Desc}
\item[Returns:]True if null or zero length. \end{Desc}


Definition at line 347 of file ustring.h.\index{KJS::UString@{KJS::UString}!is8Bit@{is8Bit}}
\index{is8Bit@{is8Bit}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool UString::is8Bit () const}\label{classKJS_1_1UString_a22}


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 {\bf cstring()}{\rm (p.\,\pageref{classKJS_1_1UString_a11})} or {\bf ascii()}{\rm (p.\,\pageref{classKJS_1_1UString_a12})}.

\begin{Desc}
\item[Returns:]True if the string doesn't contain any non-ASCII characters. \end{Desc}


Definition at line 544 of file ustring.cpp.

References data(), size(), and KJS::UChar::uc.\index{KJS::UString@{KJS::UString}!size@{size}}
\index{size@{size}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KJS::UString::size () const\hspace{0.3cm}{\tt  [inline]}}\label{classKJS_1_1UString_a23}


\begin{Desc}
\item[Returns:]The length of the string. \end{Desc}


Definition at line 359 of file ustring.h.

Referenced by append(), ascii(), find(), is8Bit(), operator[$\,$](), rfind(), substr(), to\-Lower(), and to\-Upper().\index{KJS::UString@{KJS::UString}!operator[]@{operator[]}}
\index{operator[]@{operator[]}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UChar} UString::operator[$\,$] (int {\em pos}) const}\label{classKJS_1_1UString_a24}


Const character at specified position. 



Definition at line 557 of file ustring.cpp.

References data(), and size().\index{KJS::UString@{KJS::UString}!operator[]@{operator[]}}
\index{operator[]@{operator[]}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UChar\-Reference} UString::operator[$\,$] (int {\em pos})}\label{classKJS_1_1UString_a25}


Writable reference to character at specified position. 



Definition at line 565 of file ustring.cpp.\index{KJS::UString@{KJS::UString}!toDouble@{toDouble}}
\index{toDouble@{toDouble}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double UString::to\-Double (bool {\em tolerate\-Trailing\-Junk}, bool {\em tolerate\-Empty\-String}) const}\label{classKJS_1_1UString_a26}


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 Na\-N if the conversion failed. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em tolerate\-Trailing\-Junk}]if true, to\-Double can tolerate garbage after the number. \item[{\em tolerate\-Empty\-String}]if false, to\-Double will turn an empty string into Na\-N rather than 0. \end{description}
\end{Desc}


Definition at line 597 of file ustring.cpp.

Referenced by to\-ULong().\index{KJS::UString@{KJS::UString}!toULong@{toULong}}
\index{toULong@{toULong}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned long UString::to\-ULong (bool $\ast$ {\em ok}, bool {\em tolerate\-Empty\-String}) const}\label{classKJS_1_1UString_a29}


Attempts an conversion to an unsigned long integer. 

ok will be set according to the success. @ \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ok}]make this point to a bool in case you need to know whether the conversion succeeded. \item[{\em tolerate\-Empty\-String}]if false, to\-ULong will return false for $\ast$ok for an empty string. \end{description}
\end{Desc}


Definition at line 675 of file ustring.cpp.

References to\-Double().\index{KJS::UString@{KJS::UString}!toArrayIndex@{toArrayIndex}}
\index{toArrayIndex@{toArrayIndex}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned UString::to\-Array\-Index (bool $\ast$ {\em ok} = {\tt 0}) const}\label{classKJS_1_1UString_a33}


Attempts an conversion to an array index. 

The \char`\"{}ok\char`\"{} 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$^\wedge$32 - 1. 

Definition at line 780 of file ustring.cpp.\index{KJS::UString@{KJS::UString}!toLower@{toLower}}
\index{toLower@{toLower}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UString} UString::to\-Lower () const}\label{classKJS_1_1UString_a34}


Returns this string converted to lower case characters. 



Definition at line 696 of file ustring.cpp.

References size().\index{KJS::UString@{KJS::UString}!toUpper@{toUpper}}
\index{toUpper@{toUpper}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UString} UString::to\-Upper () const}\label{classKJS_1_1UString_a35}


Returns this string converted to upper case characters. 



Definition at line 704 of file ustring.cpp.

References size().\index{KJS::UString@{KJS::UString}!find@{find}}
\index{find@{find}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int UString::find (const {\bf UString} \& {\em f}, int {\em pos} = {\tt 0}) const}\label{classKJS_1_1UString_a36}


\begin{Desc}
\item[Returns:]Position of first occurrence of f starting at position pos. -1 if the search was not successful. \end{Desc}


Definition at line 788 of file ustring.cpp.

References data(), and size().\index{KJS::UString@{KJS::UString}!rfind@{rfind}}
\index{rfind@{rfind}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int UString::rfind (const {\bf UString} \& {\em f}, int {\em pos}) const}\label{classKJS_1_1UString_a38}


\begin{Desc}
\item[Returns:]Position of first occurrence of f searching backwards from position pos. -1 if the search was not successful. \end{Desc}


Definition at line 820 of file ustring.cpp.

References data(), and size().\index{KJS::UString@{KJS::UString}!substr@{substr}}
\index{substr@{substr}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UString} UString::substr (int {\em pos} = {\tt 0}, int {\em len} = {\tt -1}) const}\label{classKJS_1_1UString_a40}


\begin{Desc}
\item[Returns:]The sub string starting at position pos and length len. \end{Desc}


Definition at line 856 of file ustring.cpp.

References data(), and size().

\subsection{Member Data Documentation}
\index{KJS::UString@{KJS::UString}!null@{null}}
\index{null@{null}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf UString} {\bf UString::null}\hspace{0.3cm}{\tt  [static]}}\label{classKJS_1_1UString_s0}


Static instance of a null string. 



Definition at line 126 of file ustring.cpp.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
ustring.h\item 
ustring.cpp\end{CompactItemize}
