aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a03729.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/a03729.html')
-rw-r--r--docs/doxygen/nel/a03729.html569
1 files changed, 569 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03729.html b/docs/doxygen/nel/a03729.html
new file mode 100644
index 00000000..c28e6f28
--- /dev/null
+++ b/docs/doxygen/nel/a03729.html
@@ -0,0 +1,569 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>NeL: NLMISC::CWordsDictionary class Reference</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head><body>
+<!-- Generated by Doxygen 1.3.6 -->
+<div class="qindex"> <form class="search" action="search.php" method="get">
+<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a> | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
+<h1>NLMISC::CWordsDictionary Class Reference</h1><code>#include &lt;<a class="el" href="a06754.html">words_dictionary.h</a>&gt;</code>
+<p>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+Words dictionary: allows to search for keys and words in _words_&lt;language&gt;.txt Unicode files. All searches are case not-sensitive.<p>
+<dl compact><dt><b>Author:</b></dt><dd>Olivier Cado <p>
+Nevrax France </dd></dl>
+<dl compact><dt><b>Date:</b></dt><dd>2003 </dd></dl>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06754.html#l00044">44</a> of file <a class="el" href="a06754.html">words_dictionary.h</a>.<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03729.html#NLMISC_1_1CWordsDictionarya0">CWordsDictionary</a> ()</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor. <a href="#NLMISC_1_1CWordsDictionarya0"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03729.html#NLMISC_1_1CWordsDictionarya1">exactLookupByKey</a> (const <a class="el" href="a03435.html">CSString</a> &amp;key, <a class="el" href="a03670.html">CVectorSString</a> &amp;resultVec)</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the result vector with the word(s) corresponding to the key. <a href="#NLMISC_1_1CWordsDictionarya1"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a03670.html">CVectorSString</a> &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03729.html#NLMISC_1_1CWordsDictionarya2">getKeys</a> ()</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a03670.html">CVectorSString</a> &amp;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03729.html#NLMISC_1_1CWordsDictionarya3">getWords</a> ()</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03435.html">CSString</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03729.html#NLMISC_1_1CWordsDictionarya4">getWordsKey</a> (const <a class="el" href="a03435.html">CSString</a> &amp;resultStr)</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return the key contained in the provided string returned by <a class="el" href="a03729.html#NLMISC_1_1CWordsDictionarya6">lookup()</a> (without extension). <a href="#NLMISC_1_1CWordsDictionarya4"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03729.html#NLMISC_1_1CWordsDictionarya5">init</a> (const std::string &amp;configFileName="words_dic.cfg")</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03729.html#NLMISC_1_1CWordsDictionarya6">lookup</a> (const <a class="el" href="a03435.html">CSString</a> &amp;inputStr, <a class="el" href="a03670.html">CVectorSString</a> &amp;resultVec)</td></tr>
+
+<tr><td colspan=2><br><h2>Protected Member Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03435.html">CSString</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03729.html#NLMISC_1_1CWordsDictionaryb0">makeResult</a> (const <a class="el" href="a03435.html">CSString</a> key, const <a class="el" href="a03435.html">CSString</a> word)</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Make a result string. <a href="#NLMISC_1_1CWordsDictionaryb0"></a><br><br></td></tr>
+<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03670.html">CVectorSString</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03729.html#NLMISC_1_1CWordsDictionaryr0">_Keys</a></td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Keys (same indices as in _Words). <a href="#NLMISC_1_1CWordsDictionaryr0"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03670.html">CVectorSString</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03729.html#NLMISC_1_1CWordsDictionaryr1">_Words</a></td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Words (same indices as in _Keys). <a href="#NLMISC_1_1CWordsDictionaryr1"></a><br><br></td></tr>
+</table>
+<hr><h2>Constructor &amp; Destructor Documentation</h2>
+<a class="anchor" name="NLMISC_1_1CWordsDictionarya0" doxytag="NLMISC::CWordsDictionary::CWordsDictionary" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> NLMISC::CWordsDictionary::CWordsDictionary </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Constructor.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06753.html#l00041">41</a> of file <a class="el" href="a06753.html">words_dictionary.cpp</a>.
+<p>
+<div class="fragment"><pre>00042 {
+00043 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr><h2>Member Function Documentation</h2>
+<a class="anchor" name="NLMISC_1_1CWordsDictionarya1" doxytag="NLMISC::CWordsDictionary::exactLookupByKey" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void NLMISC::CWordsDictionary::exactLookupByKey </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a03435.html">CSString</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>key</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a03670.html">CVectorSString</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>resultVec</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set the result vector with the word(s) corresponding to the key.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06753.html#l00190">190</a> of file <a class="el" href="a06753.html">words_dictionary.cpp</a>.
+<p>
+References <a class="el" href="a06754.html#l00091">_Words</a>.
+<p>
+<div class="fragment"><pre>00191 {
+00192 <span class="comment">// Search</span>
+00193 <span class="keywordflow">for</span> ( CVectorSString::const_iterator ivs=<a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr0">_Keys</a>.begin(); ivs!=<a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr0">_Keys</a>.end(); ++ivs )
+00194 {
+00195 <span class="keywordflow">if</span> ( key == *ivs )
+00196 resultVec.push_back( _Words[ivs-<a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr0">_Keys</a>.begin()] );
+00197 }
+00198 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CWordsDictionarya2" doxytag="NLMISC::CWordsDictionary::getKeys" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const <a class="el" href="a03670.html">CVectorSString</a>&amp; NLMISC::CWordsDictionary::getKeys </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [inline]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06754.html#l00077">77</a> of file <a class="el" href="a06754.html">words_dictionary.h</a>.
+<p>
+<div class="fragment"><pre>00077 { <span class="keywordflow">return</span> <a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr0">_Keys</a>; }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CWordsDictionarya3" doxytag="NLMISC::CWordsDictionary::getWords" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const <a class="el" href="a03670.html">CVectorSString</a>&amp; NLMISC::CWordsDictionary::getWords </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap><code> [inline]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a06754.html#l00078">78</a> of file <a class="el" href="a06754.html">words_dictionary.h</a>.
+<p>
+References <a class="el" href="a06754.html#l00091">_Words</a>.
+<p>
+<div class="fragment"><pre>00078 { <span class="keywordflow">return</span> <a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr1">_Words</a>; }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CWordsDictionarya4" doxytag="NLMISC::CWordsDictionary::getWordsKey" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="a03435.html">CSString</a> NLMISC::CWordsDictionary::getWordsKey </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a03435.html">CSString</a> &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>resultStr</em> </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Return the key contained in the provided string returned by <a class="el" href="a03729.html#NLMISC_1_1CWordsDictionarya6">lookup()</a> (without extension).
+<p>
+
+<p>
+Definition at line <a class="el" href="a06753.html#l00214">214</a> of file <a class="el" href="a06753.html">words_dictionary.cpp</a>.
+<p>
+References <a class="el" href="a06431.html#l00133">NLMISC::CSString::splitTo()</a>.
+<p>
+<div class="fragment"><pre>00215 {
+00216 <span class="keywordflow">return</span> resultStr.splitTo( <span class="charliteral">':'</span> );
+00217 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CWordsDictionarya5" doxytag="NLMISC::CWordsDictionary::init" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> bool NLMISC::CWordsDictionary::init </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>configFileName</em> = "words_dic.cfg" </td>
+ <td class="md" valign="top">&nbsp;)&nbsp;</td>
+ <td class="md" nowrap></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Load the config file and the related words files. Return false in case of failure. Config file variables:<ul>
+<li>WordsPath: where to find *_words_.txt</li><li>LanguageCode: language code (ex: en for English)</li><li>Utf8: results are in UTF8, otherwise in ANSI string</li></ul>
+
+<p>
+Definition at line <a class="el" href="a06753.html#l00052">52</a> of file <a class="el" href="a06753.html">words_dictionary.cpp</a>.
+<p>
+References <a class="el" href="a06754.html#l00091">_Words</a>, <a class="el" href="a05635.html#l00104">STRING_MANAGER::TWorksheet::begin()</a>, <a class="el" href="a05635.html#l00109">STRING_MANAGER::TWorksheet::end()</a>, <a class="el" href="a05635.html#l00209">STRING_MANAGER::TWorksheet::findCol()</a>, <a class="el" href="a05635.html#l00193">STRING_MANAGER::TWorksheet::findId()</a>, <a class="el" href="a05597.html#l00441">NLMISC::CConfigFile::getVarPtr()</a>, <a class="el" href="a05597.html#l00244">NLMISC::CConfigFile::load()</a>, <a class="el" href="a05634.html#l00558">STRING_MANAGER::loadExcelSheet()</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, <a class="el" href="a05635.html#l00094">STRING_MANAGER::TWorksheet::TRow</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05646.html#l00237">v</a>.
+<p>
+<div class="fragment"><pre>00053 {
+00054 <span class="comment">// Read config file</span>
+00055 <span class="keywordtype">bool</span> cfFound = <span class="keyword">false</span>;
+00056 CConfigFile cf;
+00057 <span class="keywordflow">try</span>
+00058 {
+00059 cf.load( configFileName );
+00060 cfFound = <span class="keyword">true</span>;
+00061 }
+00062 <span class="keywordflow">catch</span> ( EConfigFile&amp; e )
+00063 {
+00064 <a class="code" href="a04199.html#a2">nlwarning</a>( <span class="stringliteral">"WD: %s"</span>, e.what() );
+00065 }
+00066 string wordsPath, languageCode;
+00067 <span class="keywordtype">bool</span> utf8 = <span class="keyword">false</span>;
+00068 <span class="keywordflow">if</span> ( cfFound )
+00069 {
+00070 <a class="code" href="a02402.html">CConfigFile::CVar</a> *<a class="code" href="a04223.html#a576">v</a> = cf.getVarPtr( <span class="stringliteral">"WordsPath"</span> );
+00071 <span class="keywordflow">if</span> ( <a class="code" href="a04223.html#a576">v</a> )
+00072 {
+00073 wordsPath = <a class="code" href="a04223.html#a576">v</a>-&gt;asString();
+00074 <span class="comment">/*if ( (!wordsPath.empty()) &amp;&amp; (wordsPath[wordsPath.size()-1]!='/') )</span>
+00075 <span class="comment"> wordsPath += '/';*/</span>
+00076 }
+00077 <a class="code" href="a04223.html#a576">v</a> = cf.getVarPtr( <span class="stringliteral">"LanguageCode"</span> );
+00078 <span class="keywordflow">if</span> ( <a class="code" href="a04223.html#a576">v</a> )
+00079 languageCode = <a class="code" href="a04223.html#a576">v</a>-&gt;asString();
+00080 <a class="code" href="a04223.html#a576">v</a> = cf.getVarPtr( <span class="stringliteral">"Utf8"</span> );
+00081 <span class="keywordflow">if</span> ( <a class="code" href="a04223.html#a576">v</a> )
+00082 utf8 = (<a class="code" href="a04223.html#a576">v</a>-&gt;asInt() == 1);
+00083 }
+00084 <span class="keywordflow">if</span> ( languageCode.empty() )
+00085 languageCode = <span class="stringliteral">"en"</span>;
+00086
+00087 <span class="comment">// Load all found words files</span>
+00088 <span class="keyword">const</span> string ext = <span class="stringliteral">".txt"</span>;
+00089 vector&lt;string&gt; fileList;
+00090 CPath::getPathContent( wordsPath, <span class="keyword">false</span>, <span class="keyword">false</span>, <span class="keyword">true</span>, fileList );
+00091 <span class="keywordflow">for</span> ( vector&lt;string&gt;::const_iterator ifl=fileList.begin(); ifl!=fileList.end(); ++ifl )
+00092 {
+00093 <span class="keyword">const</span> string&amp; <a class="code" href="a05377.html#a2">filename</a> = (*ifl);
+00094 string::size_type p;
+00095 <span class="keywordflow">if</span> ( (p = <a class="code" href="a05377.html#a2">filename</a>.find( string(<span class="stringliteral">"_words_"</span>) + languageCode + ext )) != string::npos )
+00096 {
+00097 <a class="code" href="a04199.html#a0">nldebug</a>( <span class="stringliteral">"WD: Loading %s"</span>, <a class="code" href="a05377.html#a2">filename</a>.c_str() );
+00098 string::size_type origSize = <a class="code" href="a05377.html#a2">filename</a>.size() - ext.size();
+00099 <span class="keyword">const</span> string truncFilename = CFile::getFilenameWithoutExtension( filename );
+00100 <span class="keyword">const</span> string wordType = truncFilename.substr( 0, p - (origSize - truncFilename.size()) );
+00101
+00102 <span class="comment">// Load Unicode Excel words file</span>
+00103 <a class="code" href="a03919.html">STRING_MANAGER::TWorksheet</a> worksheet;
+00104 <a class="code" href="a05383.html#a11">STRING_MANAGER::loadExcelSheet</a>( filename, worksheet );
+00105 <a class="code" href="a04558.html#a15">uint</a> ck, cw;
+00106 <span class="keywordflow">if</span> ( worksheet.<a class="code" href="a03919.html#STRING__MANAGER_1_1TWorksheeta8">findId</a>( ck ) &amp;&amp; worksheet.<a class="code" href="a03919.html#STRING__MANAGER_1_1TWorksheeta7">findCol</a>( <a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"name"</span>), cw ) ) <span class="comment">// =&gt; </span>
+00107 {
+00108 <span class="keywordflow">for</span> ( std::vector&lt;STRING_MANAGER::TWorksheet::TRow&gt;::iterator ip = worksheet.<a class="code" href="a03919.html#STRING__MANAGER_1_1TWorksheeta2">begin</a>(); ip!=worksheet.<a class="code" href="a03919.html#STRING__MANAGER_1_1TWorksheeta4">end</a>(); ++ip )
+00109 {
+00110 <span class="keywordflow">if</span> ( ip == worksheet.<a class="code" href="a03919.html#STRING__MANAGER_1_1TWorksheeta2">begin</a>() ) <span class="comment">// skip first row</span>
+00111 <span class="keywordflow">continue</span>;
+00112 <a class="code" href="a03919.html#STRING__MANAGER_1_1TWorksheetw1">STRING_MANAGER::TWorksheet::TRow</a>&amp; row = *ip;
+00113 <a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr0">_Keys</a>.push_back( row[ck].<a class="code" href="a05378.html#a244">toString</a>() );
+00114 string word = utf8 ? row[cw].toUtf8() : row[cw].<a class="code" href="a05378.html#a244">toString</a>();
+00115 <a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr1">_Words</a>.push_back( word );
+00116 }
+00117 }
+00118 <span class="keywordflow">else</span>
+00119 <a class="code" href="a04199.html#a2">nlwarning</a>( <span class="stringliteral">"WD: %s ID or name not found in %s"</span>, wordType.c_str(), <a class="code" href="a05377.html#a2">filename</a>.c_str() );
+00120 }
+00121 }
+00122
+00123 <span class="keywordflow">if</span> ( <a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr0">_Keys</a>.empty() )
+00124 {
+00125 <span class="keywordflow">if</span> ( wordsPath.empty() )
+00126 <a class="code" href="a04199.html#a2">nlwarning</a>( <span class="stringliteral">"WD: WordsPath missing in config file %s"</span>, configFileName.c_str() );
+00127 <a class="code" href="a04199.html#a2">nlwarning</a>( <span class="stringliteral">"WD: *_words_%s.txt not found"</span>, languageCode.c_str() );
+00128 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00129 }
+00130 <span class="keywordflow">else</span>
+00131 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00132 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CWordsDictionarya6" doxytag="NLMISC::CWordsDictionary::lookup" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> void NLMISC::CWordsDictionary::lookup </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a03435.html">CSString</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>inputStr</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a03670.html">CVectorSString</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>resultVec</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Set the result vector with strings corresponding to the input string:<ul>
+<li>If inputStr is partially or completely found in the keys, all the matching &lt;key,words&gt; are returned;</li><li>If inputStr is partially or completely in the words, all the matching &lt;key, words&gt; are returned. The following tags can modify the behaviour of the search algorithm:</li><li>^mystring returns mystring only if it is at the beginning of a key or word</li><li>mystring$ returns mystring only if it is at the end of a key or word All returned words are in UTF8 string or ANSI string, depending of the config file.</li></ul>
+
+<p>
+Definition at line <a class="el" href="a06753.html#l00144">144</a> of file <a class="el" href="a06753.html">words_dictionary.cpp</a>.
+<p>
+References <a class="el" href="a06754.html#l00091">_Words</a>, <a class="el" href="a06431.html#l00506">NLMISC::CSString::find()</a>, <a class="el" href="a06753.html#l00204">makeResult()</a>, and <a class="el" href="a06431.html#l00111">NLMISC::CSString::rightCrop()</a>.
+<p>
+<div class="fragment"><pre>00145 {
+00146 <span class="comment">// Prepare search string</span>
+00147 <span class="keywordflow">if</span> ( inputStr.empty() )
+00148 <span class="keywordflow">return</span>;
+00149
+00150 CSString searchStr = inputStr;
+00151 <span class="keywordtype">bool</span> findAtBeginning = <span class="keyword">false</span>, findAtEnd = <span class="keyword">false</span>;
+00152 <span class="keywordflow">if</span> ( searchStr[0] == <span class="charliteral">'^'</span> )
+00153 {
+00154 searchStr = searchStr.substr( 1 );
+00155 findAtBeginning = <span class="keyword">true</span>;
+00156 }
+00157 <span class="keywordflow">if</span> ( searchStr[searchStr.size()-1] == <span class="charliteral">'$'</span> )
+00158 {
+00159 searchStr = searchStr.rightCrop( 1 );
+00160 findAtEnd = <span class="keyword">true</span>;
+00161 }
+00162
+00163 <span class="comment">// Search</span>
+00164 <span class="keywordflow">for</span> ( CVectorSString::const_iterator ivs=<a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr0">_Keys</a>.begin(); ivs!=<a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr0">_Keys</a>.end(); ++ivs )
+00165 {
+00166 <span class="keyword">const</span> CSString&amp; key = *ivs;
+00167 string::size_type p;
+00168 <span class="keywordflow">if</span> ( (p = key.find( searchStr.c_str() )) != string::npos )
+00169 {
+00170 <span class="keywordflow">if</span> ( ((!findAtBeginning) || (p==0)) &amp;&amp; ((!findAtEnd) || (p==key.size()-searchStr.size())) )
+00171 resultVec.push_back( <a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryb0">makeResult</a>( key, _Words[ivs-<a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr0">_Keys</a>.begin()] ) );
+00172 }
+00173 }
+00174 <span class="keywordflow">for</span> ( CVectorSString::const_iterator ivs=<a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr1">_Words</a>.begin(); ivs!=<a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr1">_Words</a>.end(); ++ivs )
+00175 {
+00176 <span class="keyword">const</span> CSString&amp; word = *ivs;
+00177 string::size_type p;
+00178 <span class="keywordflow">if</span> ( (p = word.find( searchStr.c_str() )) != string::npos )
+00179 {
+00180 <span class="keywordflow">if</span> ( ((!findAtBeginning) || (p==0)) &amp;&amp; ((!findAtEnd) || (p==word.size()-searchStr.size())) )
+00181 resultVec.push_back( <a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryb0">makeResult</a>( _Keys[ivs-<a class="code" href="a03729.html#NLMISC_1_1CWordsDictionaryr1">_Words</a>.begin()], word ) );
+00182 }
+00183 }
+00184 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CWordsDictionaryb0" doxytag="NLMISC::CWordsDictionary::makeResult" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="a03435.html">CSString</a> NLMISC::CWordsDictionary::makeResult </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a03435.html">CSString</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>key</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const <a class="el" href="a03435.html">CSString</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>word</em></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"><code> [inline, protected]</code></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Make a result string.
+<p>
+
+<p>
+Definition at line <a class="el" href="a06753.html#l00204">204</a> of file <a class="el" href="a06753.html">words_dictionary.cpp</a>.
+<p>
+References <a class="el" href="a05646.html#l01119">res</a>.
+<p>
+Referenced by <a class="el" href="a06753.html#l00144">lookup()</a>.
+<p>
+<div class="fragment"><pre>00205 {
+00206 CSString <a class="code" href="a04223.html#a643">res</a> = key + CSString(<span class="stringliteral">": "</span>) + word;
+00207 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a643">res</a>;
+00208 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr><h2>Field Documentation</h2>
+<a class="anchor" name="NLMISC_1_1CWordsDictionaryr0" doxytag="NLMISC::CWordsDictionary::_Keys" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="a03670.html">CVectorSString</a> <a class="el" href="a03729.html#NLMISC_1_1CWordsDictionaryr0">NLMISC::CWordsDictionary::_Keys</a><code> [private]</code>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Keys (same indices as in _Words).
+<p>
+
+<p>
+Definition at line <a class="el" href="a06754.html#l00088">88</a> of file <a class="el" href="a06754.html">words_dictionary.h</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="NLMISC_1_1CWordsDictionaryr1" doxytag="NLMISC::CWordsDictionary::_Words" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> <a class="el" href="a03670.html">CVectorSString</a> <a class="el" href="a03729.html#NLMISC_1_1CWordsDictionaryr1">NLMISC::CWordsDictionary::_Words</a><code> [private]</code>
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Words (same indices as in _Keys).
+<p>
+
+<p>
+Definition at line <a class="el" href="a06754.html#l00091">91</a> of file <a class="el" href="a06754.html">words_dictionary.h</a>.
+<p>
+Referenced by <a class="el" href="a06753.html#l00190">exactLookupByKey()</a>, <a class="el" href="a06754.html#l00078">getWords()</a>, <a class="el" href="a06753.html#l00052">init()</a>, and <a class="el" href="a06753.html#l00144">lookup()</a>. </td>
+ </tr>
+</table>
+<hr>The documentation for this class was generated from the following files:<ul>
+<li><a class="el" href="a06754.html">words_dictionary.h</a><li><a class="el" href="a06753.html">words_dictionary.cpp</a></ul>
+<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:43:30 2004 for NeL by
+<a href="http://www.doxygen.org/index.html">
+<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
+</a>1.3.6 </small></address>
+</body>
+</html>