<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>ucommon: ucommon/unicode.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="main.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <h1>ucommon/unicode.h</h1><a href="a00205.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (C) 2009-2010 David Sugar, Tycho Softworks.</span> <a name="l00002"></a>00002 <span class="comment">//</span> <a name="l00003"></a>00003 <span class="comment">// This file is part of GNU uCommon C++.</span> <a name="l00004"></a>00004 <span class="comment">//</span> <a name="l00005"></a>00005 <span class="comment">// GNU uCommon C++ is free software: you can redistribute it and/or modify</span> <a name="l00006"></a>00006 <span class="comment">// it under the terms of the GNU Lesser General Public License as published</span> <a name="l00007"></a>00007 <span class="comment">// by the Free Software Foundation, either version 3 of the License, or</span> <a name="l00008"></a>00008 <span class="comment">// (at your option) any later version.</span> <a name="l00009"></a>00009 <span class="comment">//</span> <a name="l00010"></a>00010 <span class="comment">// GNU uCommon C++ is distributed in the hope that it will be useful,</span> <a name="l00011"></a>00011 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00012"></a>00012 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00013"></a>00013 <span class="comment">// GNU Lesser General Public License for more details.</span> <a name="l00014"></a>00014 <span class="comment">//</span> <a name="l00015"></a>00015 <span class="comment">// You should have received a copy of the GNU Lesser General Public License</span> <a name="l00016"></a>00016 <span class="comment">// along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>.</span> <a name="l00017"></a>00017 <a name="l00032"></a>00032 <span class="preprocessor">#ifndef _UCOMMON_UNICODE_H_</span> <a name="l00033"></a>00033 <span class="preprocessor"></span><span class="preprocessor">#define _UCOMMON_UNICODE_H_</span> <a name="l00034"></a>00034 <span class="preprocessor"></span> <a name="l00035"></a>00035 <span class="preprocessor">#ifndef _UCOMMON_STRING_H_</span> <a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#include <<a class="code" href="a00201.html" title="A common string class and character string support functions.">ucommon/string.h</a>></span> <a name="l00037"></a>00037 <span class="preprocessor">#endif</span> <a name="l00038"></a>00038 <span class="preprocessor"></span> <a name="l00039"></a>00039 NAMESPACE_UCOMMON <a name="l00040"></a>00040 <a name="l00045"></a><a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e">00045</a> <span class="keyword">typedef</span> int32_t <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a>; <a name="l00046"></a>00046 <a name="l00050"></a><a class="code" href="a00208.html#ad62b38285d5dfd20839751626aab25c3">00050</a> <span class="keyword">typedef</span> int16_t <a class="code" href="a00208.html#ad62b38285d5dfd20839751626aab25c3" title="16 bit unicode character code.">ucs2_t</a>; <a name="l00051"></a>00051 <a name="l00055"></a><a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f">00055</a> <span class="keyword">typedef</span> <span class="keywordtype">void</span> *<a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a>; <a name="l00056"></a>00056 <a name="l00062"></a><a class="code" href="a00170.html">00062</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00170.html" title="A core class of ut8 encoded string functions.">utf8</a> <a name="l00063"></a>00063 { <a name="l00064"></a>00064 <span class="keyword">public</span>: <a name="l00068"></a><a class="code" href="a00170.html#a4dc93ad2de1e83e3e6a1f771cfc2069d">00068</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> ucsize; <a name="l00069"></a>00069 <a name="l00073"></a><a class="code" href="a00170.html#a216379172109ff6d14ecb94d50764af1">00073</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *nil; <a name="l00074"></a>00074 <a name="l00080"></a>00080 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> size(<span class="keyword">const</span> <span class="keywordtype">char</span> *codepoint); <a name="l00081"></a>00081 <a name="l00087"></a>00087 <span class="keyword">static</span> <span class="keywordtype">size_t</span> count(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>); <a name="l00088"></a>00088 <a name="l00095"></a>00095 <span class="keyword">static</span> <span class="keywordtype">char</span> *offset(<span class="keywordtype">char</span> *<span class="keywordtype">string</span>, ssize_t position); <a name="l00096"></a>00096 <a name="l00102"></a>00102 <span class="keyword">static</span> <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> codepoint(<span class="keyword">const</span> <span class="keywordtype">char</span> *encoded); <a name="l00103"></a>00103 <a name="l00109"></a>00109 <span class="keyword">static</span> <span class="keywordtype">size_t</span> chars(<span class="keyword">const</span> <a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> <span class="keywordtype">string</span>); <a name="l00110"></a>00110 <a name="l00116"></a>00116 <span class="keyword">static</span> <span class="keywordtype">size_t</span> chars(<a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> character); <a name="l00117"></a>00117 <a name="l00124"></a>00124 <span class="keyword">static</span> <span class="keywordtype">size_t</span> unpack(<span class="keyword">const</span> <a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> <span class="keywordtype">string</span>, <a class="code" href="a00030.html" title="Common character processing protocol.">CharacterProtocol</a>& buffer); <a name="l00125"></a>00125 <a name="l00133"></a>00133 <span class="keyword">static</span> <span class="keywordtype">size_t</span> pack(<a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> unicode, <a class="code" href="a00030.html" title="Common character processing protocol.">CharacterProtocol</a>& buffer, <span class="keywordtype">size_t</span> size); <a name="l00134"></a>00134 <a name="l00138"></a>00138 <span class="keyword">static</span> <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> *udup(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>); <a name="l00139"></a>00139 <a name="l00143"></a>00143 <span class="keyword">static</span> <a class="code" href="a00208.html#ad62b38285d5dfd20839751626aab25c3" title="16 bit unicode character code.">ucs2_t</a> *wdup(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>); <a name="l00144"></a>00144 <a name="l00152"></a>00152 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *find(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>, <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> character, <span class="keywordtype">size_t</span> <a class="code" href="a00208.html#a3c62610106837fc4ebbe70e9001bdb2f" title="Convenience function to start a joinable thread.">start</a> = 0); <a name="l00153"></a>00153 <a name="l00161"></a>00161 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *rfind(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>, <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> character, <span class="keywordtype">size_t</span> end = (<span class="keywordtype">size_t</span>)-1l); <a name="l00162"></a>00162 <a name="l00169"></a>00169 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> ccount(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>, <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> character); <a name="l00170"></a>00170 <a name="l00176"></a>00176 <span class="keyword">static</span> <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> <span class="keyword">get</span>(<a class="code" href="a00030.html" title="Common character processing protocol.">CharacterProtocol</a>& buffer); <a name="l00177"></a>00177 <a name="l00184"></a>00184 <span class="keyword">static</span> <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> put(<a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> character, <a class="code" href="a00030.html" title="Common character processing protocol.">CharacterProtocol</a>& buffer); <a name="l00185"></a>00185 }; <a name="l00186"></a>00186 <a name="l00193"></a><a class="code" href="a00169.html">00193</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a> : <span class="keyword">public</span> <a class="code" href="a00148.html" title="A copy-on-write string class that operates by reference count.">String</a>, <span class="keyword">public</span> <a class="code" href="a00170.html" title="A core class of ut8 encoded string functions.">utf8</a> <a name="l00194"></a>00194 { <a name="l00195"></a>00195 <span class="keyword">protected</span>: <a name="l00199"></a>00199 <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a>(); <a name="l00200"></a>00200 <a name="l00205"></a>00205 <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a>(<a class="code" href="a00208.html#aff28e825082cbb9ec24f288f210f34c6" title="A convenience class for size of strings.">strsize_t</a> size); <a name="l00206"></a>00206 <a name="l00211"></a>00211 <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a>(<span class="keyword">const</span> <a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> text); <a name="l00212"></a>00212 <a name="l00219"></a>00219 <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *text, <a class="code" href="a00208.html#aff28e825082cbb9ec24f288f210f34c6" title="A convenience class for size of strings.">strsize_t</a> size); <a name="l00220"></a>00220 <a name="l00227"></a>00227 <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a>(<span class="keyword">const</span> <a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> *text, <span class="keyword">const</span> <a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> *end); <a name="l00228"></a>00228 <a name="l00234"></a>00234 <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a>(<span class="keyword">const</span> <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a>& existing); <a name="l00235"></a>00235 <a name="l00240"></a>00240 <span class="keyword">virtual</span> ~<a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a>(); <a name="l00241"></a>00241 <a name="l00248"></a>00248 <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a> <span class="keyword">get</span>(<a class="code" href="a00208.html#aff28e825082cbb9ec24f288f210f34c6" title="A convenience class for size of strings.">strsize_t</a> codepoint, <a class="code" href="a00208.html#aff28e825082cbb9ec24f288f210f34c6" title="A convenience class for size of strings.">strsize_t</a> size = 0) <span class="keyword">const</span>; <a name="l00249"></a>00249 <a name="l00256"></a>00256 <span class="keywordtype">size_t</span> <span class="keyword">get</span>(<a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> unicode, <span class="keywordtype">size_t</span> size) <span class="keyword">const</span>; <a name="l00257"></a>00257 <a name="l00262"></a>00262 <span class="keywordtype">void</span> <span class="keyword">set</span>(<span class="keyword">const</span> <a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> unicode); <a name="l00263"></a>00263 <a name="l00268"></a>00268 <span class="keywordtype">void</span> <a class="code" href="a00148.html#a4cba3bb894982985844e05b62f1d0253" title="Append null terminated text to our string buffer.">add</a>(<span class="keyword">const</span> <a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> unicode); <a name="l00269"></a>00269 <a name="l00275"></a>00275 <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> <a class="code" href="a00148.html#aa9dcf23de080193f9d5f4089a9d3236b" title="Return character found at a specific position in the string.">at</a>(<span class="keywordtype">int</span> position) <span class="keyword">const</span>; <a name="l00276"></a>00276 <a name="l00283"></a><a class="code" href="a00169.html#a94d0ace6224e9cc5563c94e77ab714a5">00283</a> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a class="code" href="a00148.html#a4836156a7833e37354a0773c0427de04" title="Get a new substring through object expression.">operator()</a>(<a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> unicode, <span class="keywordtype">size_t</span> size)<span class="keyword"> const</span> <a name="l00284"></a>00284 <span class="keyword"> </span>{<span class="keywordflow">return</span> <span class="keyword">get</span>(unicode, size);}; <a name="l00285"></a>00285 <a name="l00292"></a>00292 <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a> <a class="code" href="a00148.html#a4836156a7833e37354a0773c0427de04" title="Get a new substring through object expression.">operator()</a>(<span class="keywordtype">int</span> codepoint, <a class="code" href="a00208.html#aff28e825082cbb9ec24f288f210f34c6" title="A convenience class for size of strings.">strsize_t</a> size) <span class="keyword">const</span>; <a name="l00293"></a>00293 <a name="l00301"></a>00301 <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a00148.html#a4836156a7833e37354a0773c0427de04" title="Get a new substring through object expression.">operator()</a>(<span class="keywordtype">int</span> offset) <span class="keyword">const</span>; <a name="l00302"></a>00302 <a name="l00308"></a><a class="code" href="a00169.html#ac1e4964d8304356efebf7f43476caa40">00308</a> <span class="keyword">inline</span> <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> <a class="code" href="a00148.html#a5345c861dff19ab98d28a8f4a1d6b74c" title="Reference a single character in string object by array offset.">operator[]</a>(<span class="keywordtype">int</span> position)<span class="keyword"> const</span> <a name="l00309"></a>00309 <span class="keyword"> </span>{<span class="keywordflow">return</span> UString::at(position);}; <a name="l00310"></a>00310 <a name="l00315"></a><a class="code" href="a00169.html#a775a5940fcb10992645c12b786ee00c2">00315</a> <span class="keyword">inline</span> <a class="code" href="a00208.html#aff28e825082cbb9ec24f288f210f34c6" title="A convenience class for size of strings.">strsize_t</a> <a class="code" href="a00148.html#a178d708f8c2019954ea86a3688f77e3b" title="Count all characters in the string (strlen).">count</a>(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00316"></a>00316 <span class="keyword"> </span>{<span class="keywordflow">return</span> utf8::count(str->text);} <a name="l00317"></a>00317 <a name="l00323"></a>00323 <span class="keywordtype">unsigned</span> <a class="code" href="a00148.html#aba570af28140a5fb90e7751bdb71a985" title="Count number of occurrences of characters in string.">ccount</a>(<a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> character) <span class="keyword">const</span>; <a name="l00324"></a>00324 <a name="l00331"></a>00331 <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a00148.html#a5b04cb01741b58bb0623573777bc1c51" title="Find a character in the string.">find</a>(<a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> character, <a class="code" href="a00208.html#aff28e825082cbb9ec24f288f210f34c6" title="A convenience class for size of strings.">strsize_t</a> <a class="code" href="a00208.html#a3c62610106837fc4ebbe70e9001bdb2f" title="Convenience function to start a joinable thread.">start</a> = 0) <span class="keyword">const</span>; <a name="l00332"></a>00332 <a name="l00339"></a>00339 <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="a00148.html#a8f9e25ef7349850629ec848aa255cf9e" title="Find last occurrence of character in the string.">rfind</a>(<a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> character, <a class="code" href="a00208.html#aff28e825082cbb9ec24f288f210f34c6" title="A convenience class for size of strings.">strsize_t</a> end = npos) <span class="keyword">const</span>; <a name="l00340"></a>00340 }; <a name="l00341"></a>00341 <a name="l00347"></a><a class="code" href="a00171.html">00347</a> <span class="keyword">class </span>__EXPORT <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a> <a name="l00348"></a>00348 { <a name="l00349"></a>00349 <span class="keyword">protected</span>: <a name="l00350"></a>00350 uint8_t *text; <a name="l00351"></a>00351 <a name="l00352"></a>00352 <span class="keyword">public</span>: <a name="l00356"></a>00356 <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a>(); <a name="l00357"></a>00357 <a name="l00362"></a>00362 <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>); <a name="l00363"></a>00363 <a name="l00368"></a>00368 <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a>(<span class="keyword">const</span> <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a>& <a class="code" href="a00208.html#aa948d5926268ce79c22778bd81cc6ed9" title="Convenience function to access object copy.">copy</a>); <a name="l00369"></a>00369 <a name="l00374"></a>00374 <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a>& operator ++(); <a name="l00375"></a>00375 <a name="l00380"></a>00380 <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a>& operator --(); <a name="l00381"></a>00381 <a name="l00387"></a>00387 <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a>& operator +=(<span class="keywordtype">long</span> offset); <a name="l00388"></a>00388 <a name="l00394"></a>00394 <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a>& operator -=(<span class="keywordtype">long</span> offset); <a name="l00395"></a>00395 <a name="l00401"></a>00401 <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a> operator+(<span class="keywordtype">long</span> offset) <span class="keyword">const</span>; <a name="l00402"></a>00402 <a name="l00408"></a>00408 <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a> operator-(<span class="keywordtype">long</span> offset) <span class="keyword">const</span>; <a name="l00409"></a>00409 <a name="l00414"></a><a class="code" href="a00171.html#a20306a91be2274552ce5d23ca83f6a34">00414</a> <span class="keyword">inline</span> operator bool()<span class="keyword"> const</span> <a name="l00415"></a>00415 <span class="keyword"> </span>{<span class="keywordflow">return</span> text != NULL;}; <a name="l00416"></a>00416 <a name="l00421"></a><a class="code" href="a00171.html#a23519b3e2f40c5728b247003ed2ca5ad">00421</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator!()<span class="keyword"> const</span> <a name="l00422"></a>00422 <span class="keyword"> </span>{<span class="keywordflow">return</span> text == NULL;}; <a name="l00423"></a>00423 <a name="l00429"></a>00429 <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> operator[](<span class="keywordtype">long</span> codepoint) <span class="keyword">const</span>; <a name="l00430"></a>00430 <a name="l00436"></a>00436 <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a>& operator=(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>); <a name="l00437"></a>00437 <a name="l00441"></a>00441 <span class="keywordtype">void</span> inc(<span class="keywordtype">void</span>); <a name="l00442"></a>00442 <a name="l00446"></a>00446 <span class="keywordtype">void</span> dec(<span class="keywordtype">void</span>); <a name="l00447"></a>00447 <a name="l00453"></a><a class="code" href="a00171.html#aaebd0112e288c459e6b1590973d8d7b0">00453</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>)<span class="keyword"> const</span> <a name="l00454"></a>00454 <span class="keyword"> </span>{<span class="keywordflow">return</span> (<span class="keyword">const</span> <span class="keywordtype">char</span> *)text == string;}; <a name="l00455"></a>00455 <a name="l00461"></a><a class="code" href="a00171.html#af07b961a8da2707dad8f3785ce93f313">00461</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>)<span class="keyword"> const</span> <a name="l00462"></a>00462 <span class="keyword"> </span>{<span class="keywordflow">return</span> (<span class="keyword">const</span> <span class="keywordtype">char</span> *)text != string;}; <a name="l00463"></a>00463 <a name="l00468"></a><a class="code" href="a00171.html#a92825ca16fecd34d156cc87fd52bd6d7">00468</a> <span class="keyword">inline</span> <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> operator*()<span class="keyword"> const</span> <a name="l00469"></a>00469 <span class="keyword"> </span>{<span class="keywordflow">return</span> utf8::codepoint((<span class="keyword">const</span> <span class="keywordtype">char</span> *)text);}; <a name="l00470"></a>00470 <a name="l00475"></a><a class="code" href="a00171.html#a17fff0579e317c3773f8b62a5f802623">00475</a> <span class="keyword">inline</span> <span class="keywordtype">char</span> *c_str(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00476"></a>00476 <span class="keyword"> </span>{<span class="keywordflow">return</span> (<span class="keywordtype">char</span> *)text;}; <a name="l00477"></a>00477 <a name="l00482"></a><a class="code" href="a00171.html#a7241ea9da52bb4af8b39bd3a0f80e12c">00482</a> <span class="keyword">inline</span> operator char*()<span class="keyword"> const</span> <a name="l00483"></a>00483 <span class="keyword"> </span>{<span class="keywordflow">return</span> (<span class="keywordtype">char</span> *)text;}; <a name="l00484"></a>00484 <a name="l00489"></a><a class="code" href="a00171.html#af4c0e37c5401da6f65ff92b2ec9a6d46">00489</a> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> len(<span class="keywordtype">void</span>)<span class="keyword"> const</span> <a name="l00490"></a>00490 <span class="keyword"> </span>{<span class="keywordflow">return</span> utf8::count((<span class="keyword">const</span> <span class="keywordtype">char</span> *)text);}; <a name="l00491"></a>00491 }; <a name="l00492"></a>00492 <a name="l00493"></a>00493 <span class="keyword">inline</span> <a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> *strudup(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>) <a name="l00494"></a>00494 {<span class="keywordflow">return</span> utf8::udup(<span class="keywordtype">string</span>);} <a name="l00495"></a>00495 <a name="l00496"></a>00496 <span class="keyword">inline</span> <a class="code" href="a00208.html#ad62b38285d5dfd20839751626aab25c3" title="16 bit unicode character code.">ucs2_t</a> *strwdup(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>) <a name="l00497"></a>00497 {<span class="keywordflow">return</span> utf8::wdup(<span class="keywordtype">string</span>);} <a name="l00498"></a>00498 <a name="l00499"></a>00499 __EXPORT <a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> unidup(<span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span>); <a name="l00500"></a>00500 <a name="l00501"></a>00501 <span class="keyword">template</span><> <a name="l00502"></a>00502 <span class="keyword">inline</span> <span class="keywordtype">void</span> dupfree<ucs2_t*>(<a class="code" href="a00208.html#ad62b38285d5dfd20839751626aab25c3" title="16 bit unicode character code.">ucs2_t</a> *string) <a name="l00503"></a>00503 {::free(string);} <a name="l00504"></a>00504 <a name="l00505"></a>00505 <span class="keyword">template</span><> <a name="l00506"></a>00506 <span class="keyword">inline</span> <span class="keywordtype">void</span> dupfree<ucs4_t*>(<a class="code" href="a00208.html#aaa2499ef76785d12d303b525ad1a042e" title="32 bit unicode character code.">ucs4_t</a> *string) <a name="l00507"></a>00507 {::free(string);} <a name="l00508"></a>00508 <a name="l00509"></a>00509 <span class="keyword">template</span><> <a name="l00510"></a>00510 <span class="keyword">inline</span> <span class="keywordtype">void</span> dupfree<unicode_t>(<a class="code" href="a00208.html#adca8b750ad72af446956b5a97570b53f" title="Resolves issues where wchar_t is not defined.">unicode_t</a> string) <a name="l00511"></a>00511 {::free(string);} <a name="l00512"></a>00512 <a name="l00516"></a><a class="code" href="a00208.html#a2ad1cc10ef952a7614ea5a8e58c398f2">00516</a> <span class="keyword">typedef</span> <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">UString</a> <a class="code" href="a00169.html" title="A copy-on-write utf8 string class that operates by reference count.">ustring_t</a>; <a name="l00517"></a>00517 <a name="l00521"></a><a class="code" href="a00208.html#a3271a380c7adf37492cce13c4586b78a">00521</a> <span class="keyword">typedef</span> <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_pointer</a> <a class="code" href="a00171.html" title="Pointer to utf8 encoded character data.">utf8_t</a>; <a name="l00522"></a>00522 <a name="l00523"></a>00523 END_NAMESPACE <a name="l00524"></a>00524 <a name="l00525"></a>00525 <span class="preprocessor">#endif</span> </pre></div></div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Jul 14 16:38:57 2011 for ucommon by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>