\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=78pt]{classKJS_1_1UString__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf UString} ()
\begin{CompactList}\small\item\em Constructs a null string. \item\end{CompactList}\item 
{\bf UString} (char c)
\begin{CompactList}\small\item\em Constructs a string from the single character c. \item\end{CompactList}\item 
{\bf UString} (const  char $\ast$c)
\begin{CompactList}\small\item\em Constructs a string from a classical zero determined char string. \item\end{CompactList}\item 
{\bf UString} (const  {\bf UChar} $\ast$c, int length)
\begin{CompactList}\small\item\em Constructs a string from an array of Unicode characters of the specified length. \item\end{CompactList}\item 
{\bf UString} ({\bf UChar} $\ast$c, int length, bool copy)
\begin{CompactList}\small\item\em If copy is false a shallow copy of the string will be created. \item\end{CompactList}\item 
{\bf UString} (const  {\bf UString} \&)
\begin{CompactList}\small\item\em Copy constructor. \item\end{CompactList}\item 
{\bf UString} (const  {\bf QString} \&)
\begin{CompactList}\small\item\em Convenience declaration only ! You'll be on your own to write the implementation for a construction from {\bf QString}. \item\end{CompactList}\item 
{\bf UString} (const  DOM::DOMString \&)
\begin{CompactList}\small\item\em Convenience declaration only ! See {\bf UString}{\rm (p.\,\pageref{classKJS_1_1UString})}(const {\bf QString}\&). \item\end{CompactList}\item 
{\bf $\sim$UString} ()
\begin{CompactList}\small\item\em Destructor. \item\end{CompactList}\item 
{\bf UString} \& {\bf append} (const  {\bf UString} \&)
\begin{CompactList}\small\item\em Append another string. \item\end{CompactList}\item 
{\bf CString} {\bf cstring} () const 
\item 
char $\ast$ {\bf ascii} () const 
\begin{CompactList}\small\item\em Convert the Unicode string to plain ASCII chars chopping of any higher bytes. \item\end{CompactList}\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)
\begin{CompactList}\small\item\em Assignment operator. \item\end{CompactList}\item 
{\bf UString} \& {\bf operator=} (const  {\bf UString} \&)
\begin{CompactList}\small\item\em Assignment operator. \item\end{CompactList}\item 
{\bf UString} \& {\bf operator+=} (const  {\bf UString} \&s)
\begin{CompactList}\small\item\em Appends the specified string. \item\end{CompactList}\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 
\begin{CompactList}\small\item\em Use this if you want to make sure that this string is a plain ASCII string. \item\end{CompactList}\item 
int {\bf size} () const 
\item 
{\bf UChar} {\bf operator[$\,$]} (int pos) const 
\begin{CompactList}\small\item\em Const character at specified position. \item\end{CompactList}\item 
{\bf UChar\-Reference} {\bf operator[$\,$]} (int pos)
\begin{CompactList}\small\item\em Writable reference to character at specified position. \item\end{CompactList}\item 
double {\bf to\-Double} (bool tolerant=false) const 
\begin{CompactList}\small\item\em Attempts an conversion to a number. \item\end{CompactList}\item 
unsigned long {\bf to\-ULong} (bool $\ast$ok=0L) const 
\begin{CompactList}\small\item\em Attempts an conversion to an unsigned long integer. \item\end{CompactList}\item 
{\bf UString} {\bf to\-Lower} () const 
\begin{CompactList}\small\item\em Returns this string converted to lower case characters. \item\end{CompactList}\item 
{\bf UString} {\bf to\-Upper} () const 
\begin{CompactList}\small\item\em Returns this string converted to upper case characters. \item\end{CompactList}\item 
int {\bf find} (const  {\bf UString} \&f, int pos=0) const 
\item 
int {\bf rfind} (const  {\bf UString} \&f, int pos) const 
\item 
{\bf UString} {\bf substr} (int pos=0, int len=-1) const 
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
{\bf UString} {\bf from} (int i)
\begin{CompactList}\small\item\em Constructs a string from an int. \item\end{CompactList}\item 
{\bf UString} {\bf from} (unsigned int u)
\begin{CompactList}\small\item\em Constructs a string from an unsigned int. \item\end{CompactList}\item 
{\bf UString} {\bf from} (double d)
\begin{CompactList}\small\item\em Constructs a string from a double. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Attributes}
\begin{CompactItemize}
\item 
{\bf UString} {\bf null}
\begin{CompactList}\small\item\em Static instance of a null string. \item\end{CompactList}\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf UChar\-Reference}\label{classKJS_1_1UString_n0}

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

\end{CompactItemize}


\subsection{Detailed Description}
Unicode string class. 



Definition at line 187 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 182 of file ustring.cpp.

References null, and rep.

Referenced by from(), and substr().\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})}\label{classKJS_1_1UString_a1}


Constructs a string from the single character c. 



Definition at line 188 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 195 of file ustring.cpp.

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

Definition at line 208 of file ustring.cpp.

References KStd\-Accel::copy().\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} \&)}\label{classKJS_1_1UString_a5}


Copy constructor. 

Makes a shallow copy only. 

Definition at line 219 of file ustring.cpp.

References rep.\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 favourite 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}{\rm (p.\,\pageref{classKJS_1_1UString})}(const {\bf QString}\&). 

\index{KJS::UString@{KJS::UString}!~UString@{$\sim$UString}}
\index{~UString@{$\sim$UString}!KJS::UString@{KJS::UString}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}UString::$\sim${\bf UString} ()}\label{classKJS_1_1UString_a8}


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.

\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 229 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 (unsigned int {\em u})\hspace{0.3cm}{\tt  [static]}}\label{classKJS_1_1UString_e1}


Constructs a string from an unsigned int. 



Definition at line 237 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_e2}


Constructs a string from a double. 



Definition at line 245 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_a9}


Append another string. 



Definition at line 270 of file ustring.cpp.

References data(), and size().

Referenced by operator+=().\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_a10}


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


Definition at line 282 of file ustring.cpp.

References ascii().

Referenced by to\-Double().\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_a11}


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 287 of file ustring.cpp.

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

Referenced by cstring().\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_a12}


\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_a13}


\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_a14}


\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_a15}


Assignment operator. 



Definition at line 308 of file ustring.cpp.

References KJS::UChar::uc.

Referenced by UString().\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 {\bf UString} \&)}\label{classKJS_1_1UString_a16}


Assignment operator. 



Definition at line 320 of file ustring.cpp.

References rep.\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 {\bf UString} \& {\em s})}\label{classKJS_1_1UString_a17}


Appends the specified string. 



Definition at line 329 of file ustring.cpp.

References append().\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_a18}


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


Definition at line 315 of file ustring.h.

Referenced by append(), ascii(), find(), KJS::Lookup::find(), KJS::Lookup::find\-Entry(), 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_a19}


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


Definition at line 319 of file ustring.h.

Referenced by find(), rfind(), and substr().\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_a20}


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


Definition at line 323 of file ustring.h.

Referenced by KJS::Label\-Stack::contains(), and KJS::Label\-Stack::push().\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_a21}


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

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


Definition at line 334 of file ustring.cpp.

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

Referenced by to\-Double().\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_a22}


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


Definition at line 335 of file ustring.h.

Referenced by append(), ascii(), find(), KJS::Lookup::find(), KJS::Lookup::find\-Entry(), 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_a23}


Const character at specified position. 



Definition at line 344 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_a24}


Writable reference to character at specified position. 



Definition at line 352 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 tolerant} = false) const}\label{classKJS_1_1UString_a25}


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 tolerant}]if true, to\-Double can tolerate garbage after the number. \end{description}
\end{Desc}


Definition at line 358 of file ustring.cpp.

References KJS::CString::c\_\-str(), cstring(), KStd\-Accel::end(), and is8Bit().

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} = 0L) const}\label{classKJS_1_1UString_a26}


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 to\-Double().\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_a27}


Returns this string converted to lower case characters. 



Definition at line 436 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_a28}


Returns this string converted to upper case characters. 



Definition at line 444 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} = 0) const}\label{classKJS_1_1UString_a29}


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


Definition at line 452 of file ustring.cpp.

References data(), KStd\-Accel::end(), is\-Null(), 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_a30}


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


Definition at line 467 of file ustring.cpp.

References data(), is\-Null(), 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} = 0, int {\em len} = -1) const}\label{classKJS_1_1UString_a31}


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


Definition at line 482 of file ustring.cpp.

References data(), is\-Null(), size(), and UString().

\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 123 of file ustring.cpp.

Referenced by UString().

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