aboutsummaryrefslogtreecommitdiffstats
path: root/doc/api-documentation/html/utf8nfkd_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/api-documentation/html/utf8nfkd_8cpp-source.html')
-rw-r--r--doc/api-documentation/html/utf8nfkd_8cpp-source.html60
1 files changed, 60 insertions, 0 deletions
diff --git a/doc/api-documentation/html/utf8nfkd_8cpp-source.html b/doc/api-documentation/html/utf8nfkd_8cpp-source.html
new file mode 100644
index 0000000..b01fd27
--- /dev/null
+++ b/doc/api-documentation/html/utf8nfkd_8cpp-source.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>utf8nfkd.cpp Source File</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head><body>
+<!-- Generated by Doxygen 1.2.15 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center>
+<hr><h1>utf8nfkd.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/******************************************************************************</font>
+00002 <font class="comment">*</font>
+00003 <font class="comment">* utf8nfkd - SWFilter decendant to perform NFKD (compatability decomposition</font>
+00004 <font class="comment">* normalization) on UTF-8 text</font>
+00005 <font class="comment">*/</font>
+00006
+00007 <font class="preprocessor">#ifdef _ICU_</font>
+00008 <font class="preprocessor"></font>
+00009 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>
+00010 <font class="preprocessor">#include &lt;string.h&gt;</font>
+00011
+00012 <font class="preprocessor">#ifdef __GNUC__</font>
+00013 <font class="preprocessor"></font><font class="preprocessor">#include &lt;unixstr.h&gt;</font>
+00014 <font class="preprocessor">#endif</font>
+00015 <font class="preprocessor"></font>
+00016 <font class="preprocessor">#include &lt;utf8nfkd.h&gt;</font>
+00017
+00018 UTF8NFKD::UTF8NFKD() {
+00019 conv = ucnv_open(<font class="stringliteral">"UTF-8"</font>, &amp;err);
+00020 }
+00021
+00022 UTF8NFKD::~UTF8NFKD() {
+00023 ucnv_close(conv);
+00024 }
+00025
+00026 <font class="keywordtype">char</font> UTF8NFKD::ProcessText(<font class="keywordtype">char</font> *text, <font class="keywordtype">int</font> maxlen, <font class="keyword">const</font> <a class="code" href="class_s_w_key.html">SWKey</a> *key, <font class="keyword">const</font> <a class="code" href="class_s_w_module.html">SWModule</a> *module)
+00027 {
+00028 int32_t len = strlen(text) * 2;
+00029 source = <font class="keyword">new</font> UChar[len + 1]; <font class="comment">//each char could become a surrogate pair</font>
+00030
+00031 <font class="comment">// Convert UTF-8 string to UTF-16 (UChars)</font>
+00032 len = ucnv_toUChars(conv, source, len, text, -1, &amp;err);
+00033 target = <font class="keyword">new</font> UChar[len + 1];
+00034
+00035 <font class="comment">//compatability decomposition</font>
+00036 unorm_normalize(source, len, UNORM_NFKD, 0, target, len, &amp;err);
+00037
+00038 ucnv_fromUChars(conv, text, maxlen, target, -1, &amp;err);
+00039
+00040 <font class="keyword">delete</font> [] source;
+00041 <font class="keyword">delete</font> [] target;
+00042
+00043 <font class="keywordflow">return</font> 0;
+00044 }
+00045
+00046 <font class="preprocessor">#endif</font>
+</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:01 2002 for The Sword Project by
+<a href="http://www.doxygen.org/index.html">
+<img src="doxygen.png" alt="doxygen" align="middle" border=0
+width=110 height=53></a>1.2.15 </small></address>
+</body>
+</html>