aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a05383.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/a05383.html')
-rw-r--r--docs/doxygen/nel/a05383.html1566
1 files changed, 1566 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a05383.html b/docs/doxygen/nel/a05383.html
new file mode 100644
index 00000000..06cfaf80
--- /dev/null
+++ b/docs/doxygen/nel/a05383.html
@@ -0,0 +1,1566 @@
+<!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: STRING_MANAGER Namespace 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>STRING_MANAGER Namespace Reference</h1>
+<p>
+
+<p>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>class &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02833.html">CMakeDiff</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a02834.html">CMakeDiff::IDiffCallback</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03901.html">TClause</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03904.html">TGetHashValue</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03905.html">TGetIdentifier</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03906.html">TGetWorksheetHashValue</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03907.html">TGetWorksheetIdentifier</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03910.html">TPhrase</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03911.html">TPhraseDiffContext</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03912.html">TStringDiffContext</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03913.html">TStringInfo</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03914.html">TTestItem</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03915.html">TTestWorksheetItem</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03918.html">TWordsDiffContext</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03919.html">TWorksheet</a></td></tr>
+
+<tr><td colspan=2><br><h2>Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="a02833.html">CMakeDiff</a>&lt; <a class="el" href="a03910.html">TPhrase</a>,<br>
+ <a class="el" href="a03911.html">TPhraseDiffContext</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a2">TPhraseDiff</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="a02833.html">CMakeDiff</a>&lt; <a class="el" href="a03913.html">TStringInfo</a>,<br>
+ <a class="el" href="a03912.html">TStringDiffContext</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a1">TStringDiff</a></td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="a02833.html">CMakeDiff</a>&lt; <a class="el" href="a03919.html#STRING__MANAGER_1_1TWorksheetw1">TWorksheet::TRow</a>,<br>
+ <a class="el" href="a03918.html">TWordsDiffContext</a>, <a class="el" href="a03907.html">TGetWorksheetIdentifier</a>,<br>
+ <a class="el" href="a03906.html">TGetWorksheetHashValue</a>, <a class="el" href="a03915.html">TTestWorksheetItem</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a3">TWorkSheetDiff</a></td></tr>
+
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a11">loadExcelSheet</a> (const string <a class="el" href="a04560.html#a1">filename</a>, <a class="el" href="a03919.html">TWorksheet</a> &amp;worksheet, bool checkUnique)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a6">loadStringFile</a> (const std::string <a class="el" href="a04560.html#a1">filename</a>, vector&lt; <a class="el" href="a03913.html">TStringInfo</a> &gt; &amp;stringInfos, bool forceRehash, <a class="el" href="a05167.html#a18">ucchar</a> openMark, <a class="el" href="a05167.html#a18">ucchar</a> closeMark, bool specialCase)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a13">makeHashCode</a> (<a class="el" href="a03919.html">TWorksheet</a> &amp;sheet, bool forceRehash)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a4">makePhraseHash</a> (const <a class="el" href="a03910.html">TPhrase</a> &amp;phrase)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a5">parseHashFromComment</a> (const <a class="el" href="a03924.html">ucstring</a> &amp;comments, <a class="el" href="a04558.html#a13">uint64</a> &amp;hashValue)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03924.html">ucstring</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a14">prepareExcelSheet</a> (const <a class="el" href="a03919.html">TWorksheet</a> &amp;worksheet)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03924.html">ucstring</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a16">preparePhraseFile</a> (const std::vector&lt; <a class="el" href="a03910.html">TPhrase</a> &gt; &amp;phrases, bool removeDiffComments)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03924.html">ucstring</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a10">preparePhraseFile</a> (const vector&lt; <a class="el" href="a03910.html">TPhrase</a> &gt; &amp;phrases, bool removeDiffComments)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03924.html">ucstring</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a15">prepareStringFile</a> (const std::vector&lt; <a class="el" href="a03913.html">TStringInfo</a> &gt; &amp;strings, bool removeDiffComments)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03924.html">ucstring</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a7">prepareStringFile</a> (const vector&lt; <a class="el" href="a03913.html">TStringInfo</a> &gt; &amp;strings, bool removeDiffComments)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a12">readExcelSheet</a> (const <a class="el" href="a03924.html">ucstring</a> &amp;str, <a class="el" href="a03919.html">TWorksheet</a> &amp;worksheet, bool checkUnique)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a8">readPhraseFile</a> (const std::string &amp;<a class="el" href="a04560.html#a1">filename</a>, vector&lt; <a class="el" href="a03910.html">TPhrase</a> &gt; &amp;phrases, bool forceRehash)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03924.html">ucstring</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a9">tabLines</a> (<a class="el" href="a04558.html#a15">uint</a> nbTab, const <a class="el" href="a03924.html">ucstring</a> &amp;str)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a03924.html">ucstring</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a05383.html#a0">nl</a> ("\r\n")</td></tr>
+
+</table>
+<hr><h2>Typedef Documentation</h2>
+<a class="anchor" name="a2" doxytag="STRING_MANAGER::TPhraseDiff" ></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"> typedef <a class="el" href="a02833.html">CMakeDiff</a>&lt;<a class="el" href="a03910.html">TPhrase</a>, <a class="el" href="a03911.html">TPhraseDiffContext</a>&gt; <a class="el" href="a02833.html">STRING_MANAGER::TPhraseDiff</a>
+ </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="a05635.html#l00493">493</a> of file <a class="el" href="a05635.html">diff_tool.h</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="STRING_MANAGER::TStringDiff" ></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"> typedef <a class="el" href="a02833.html">CMakeDiff</a>&lt;<a class="el" href="a03913.html">TStringInfo</a>, <a class="el" href="a03912.html">TStringDiffContext</a>&gt; <a class="el" href="a02833.html">STRING_MANAGER::TStringDiff</a>
+ </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="a05635.html#l00492">492</a> of file <a class="el" href="a05635.html">diff_tool.h</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="STRING_MANAGER::TWorkSheetDiff" ></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"> typedef <a class="el" href="a02833.html">CMakeDiff</a>&lt;<a class="el" href="a03919.html#STRING__MANAGER_1_1TWorksheetw1">TWorksheet::TRow</a>, <a class="el" href="a03918.html">TWordsDiffContext</a>, <a class="el" href="a03907.html">TGetWorksheetIdentifier</a>, <a class="el" href="a03906.html">TGetWorksheetHashValue</a>, <a class="el" href="a03915.html">TTestWorksheetItem</a>&gt; <a class="el" href="a02833.html">STRING_MANAGER::TWorkSheetDiff</a>
+ </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="a05635.html#l00494">494</a> of file <a class="el" href="a05635.html">diff_tool.h</a>. </td>
+ </tr>
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a11" doxytag="STRING_MANAGER::loadExcelSheet" ></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 STRING_MANAGER::loadExcelSheet </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const string&nbsp;</td>
+ <td class="mdname" nowrap> <em>filename</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>TWorksheet &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>worksheet</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkUnique</em> = true</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>
+
+<p>
+Definition at line <a class="el" href="a05634.html#l00558">558</a> of file <a class="el" href="a05634.html">diff_tool.cpp</a>.
+<p>
+References <a class="el" href="a05708.html#l00255">NLMISC::CIFile::close()</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05708.html#l00135">NLMISC::CIFile::open()</a>, and <a class="el" href="a05634.html#l00578">readExcelSheet()</a>.
+<p>
+Referenced by <a class="el" href="a06753.html#l00052">NLMISC::CWordsDictionary::init()</a>.
+<p>
+<div class="fragment"><pre>00559 {
+00560 <span class="comment">// Yoyo: must test with CIFile because can be packed into a .bnp on client...</span>
+00561 <a class="code" href="a02653.html">CIFile</a> fp;
+00562 <span class="keywordflow">if</span>(!fp.<a class="code" href="a02653.html#NLMISC_1_1CIFilea12">open</a>(filename))
+00563 {
+00564 <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"DT: Can't open file [%s]\n"</span>, <a class="code" href="a05377.html#a2">filename</a>.c_str());
+00565 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00566 }
+00567 fp.<a class="code" href="a02653.html#NLMISC_1_1CIFilea3">close</a>();
+00568
+00569 <a class="code" href="a03924.html">ucstring</a> str;
+00570 CI18N::readTextFile(filename, str, <span class="keyword">false</span>, <span class="keyword">false</span>);
+00571
+00572 <span class="keywordflow">if</span> (!<a class="code" href="a05383.html#a12">readExcelSheet</a>(str, worksheet, checkUnique))
+00573 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00574
+00575 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00576 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a6" doxytag="STRING_MANAGER::loadStringFile" ></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 STRING_MANAGER::loadStringFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string&nbsp;</td>
+ <td class="mdname" nowrap> <em>filename</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>std::vector&lt; TStringInfo &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>stringInfos</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>forceRehash</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a05167.html#a18">ucchar</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>openMark</em> = '[', </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a05167.html#a18">ucchar</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>closeMark</em> = ']', </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>specialCase</em> = false</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>
+
+<p>
+Definition at line <a class="el" href="a05634.html#l00071">71</a> of file <a class="el" href="a05634.html">diff_tool.cpp</a>.
+<p>
+References <a class="el" href="a05635.html#l00040">STRING_MANAGER::TStringInfo::Comments</a>, <a class="el" href="a05635.html#l00041">STRING_MANAGER::TStringInfo::HashValue</a>, <a class="el" href="a05635.html#l00037">STRING_MANAGER::TStringInfo::Identifier</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05634.html#l00054">parseHashFromComment()</a>, <a class="el" href="a05635.html#l00038">STRING_MANAGER::TStringInfo::Text</a>, <a class="el" href="a05635.html#l00039">STRING_MANAGER::TStringInfo::Text2</a>, <a class="el" href="a06590.html#l00236">ucchar</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+<div class="fragment"><pre>00072 {
+00073 <span class="comment">/* uint8 *buffer = 0;</span>
+00074 <span class="comment"> uint size;</span>
+00075 <span class="comment"></span>
+00076 <span class="comment"> try</span>
+00077 <span class="comment"> {</span>
+00078 <span class="comment"> CIFile fp(filename);</span>
+00079 <span class="comment"> size = fp.getFileSize();</span>
+00080 <span class="comment"> buffer = new uint8[size];</span>
+00081 <span class="comment"> fp.serialBuffer(buffer, size);</span>
+00082 <span class="comment"> }</span>
+00083 <span class="comment"> catch(Exception &amp;e)</span>
+00084 <span class="comment"> {</span>
+00085 <span class="comment"> nlinfo("Can't open file [%s] (%s)\n", filename.c_str(), e.what());</span>
+00086 <span class="comment"> return true;</span>
+00087 <span class="comment"> }</span>
+00088 <span class="comment">*/</span>
+00089 <span class="comment">/* FILE *fp = fopen(filename.c_str(), "rb");</span>
+00090 <span class="comment"></span>
+00091 <span class="comment"> if (fp == NULL)</span>
+00092 <span class="comment"> {</span>
+00093 <span class="comment"> nlinfo("Can't open file [%s]\n", filename.c_str());</span>
+00094 <span class="comment"> if (buffer != 0)</span>
+00095 <span class="comment"> delete [] buffer;</span>
+00096 <span class="comment"> return true;</span>
+00097 <span class="comment"> }</span>
+00098 <span class="comment"></span>
+00099 <span class="comment"> // move to end of file</span>
+00100 <span class="comment"> fseek(fp, 0, SEEK_END);</span>
+00101 <span class="comment"></span>
+00102 <span class="comment"> fpos_t pos;</span>
+00103 <span class="comment"> fgetpos(fp, &amp;pos);</span>
+00104 <span class="comment"></span>
+00105 <span class="comment"> uint8 *buffer = new uint8[uint(pos)];</span>
+00106 <span class="comment"></span>
+00107 <span class="comment"> rewind(fp);</span>
+00108 <span class="comment"> uint size = fread(buffer, 1, uint(pos), fp);</span>
+00109 <span class="comment"> fclose (fp);</span>
+00110 <span class="comment">*/</span>
+00111 <a class="code" href="a03924.html">ucstring</a> text;
+00112
+00113 CI18N::readTextFile(filename, text, <span class="keyword">false</span>, <span class="keyword">false</span>, <span class="keyword">true</span>);
+00114 <span class="comment">// CI18N::readTextBuffer(buffer, size, text);</span>
+00115 <span class="comment">// delete [] buffer;</span>
+00116
+00117 <span class="comment">// ok, parse the file now.</span>
+00118 ucstring::const_iterator first(text.begin()), last(text.end());
+00119 std::string lastLabel(<span class="stringliteral">"nothing"</span>);
+00120
+00121 <span class="keywordflow">while</span> (first != last)
+00122 {
+00123 TStringInfo si;
+00124 CI18N::skipWhiteSpace(first, last, &amp;si.Comments);
+00125
+00126 <span class="keywordflow">if</span> (first == last)
+00127 {
+00128 <span class="comment">// check if there is only swap command remaining in comment</span>
+00129 <span class="keywordflow">if</span> (si.Comments.find(<a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"// DIFF SWAP "</span>)) != ucstring::npos)
+00130 {
+00131 stringInfos.push_back(si);
+00132 }
+00133 <span class="keywordflow">break</span>;
+00134 }
+00135
+00136 <span class="keywordflow">if</span> (!CI18N::parseLabel(first, last, si.Identifier))
+00137 {
+00138 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: Fatal : Invalid label will reading %s after %s\n"</span>, <a class="code" href="a05377.html#a2">filename</a>.c_str(), lastLabel.c_str());
+00139 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00140 }
+00141 lastLabel = si.Identifier;
+00142
+00143 CI18N::skipWhiteSpace(first, last, &amp;si.Comments);
+00144
+00145 <span class="keywordflow">if</span> (!CI18N::parseMarkedString(openMark, closeMark, first, last, si.Text))
+00146 {
+00147 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: Fatal : Invalid text value reading %s for label %s\n"</span>, <a class="code" href="a05377.html#a2">filename</a>.c_str(), lastLabel.c_str());
+00148 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00149 }
+00150
+00151 <span class="keywordflow">if</span> (specialCase)
+00152 {
+00153 CI18N::skipWhiteSpace(first, last, &amp;si.Comments);
+00154
+00155 <span class="keywordflow">if</span> (!CI18N::parseMarkedString(openMark, closeMark, first, last, si.Text2))
+00156 {
+00157 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: Fatal : Invalid text2 value reading %s for label %s\n"</span>, <a class="code" href="a05377.html#a2">filename</a>.c_str(), lastLabel.c_str());
+00158 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00159 }
+00160
+00161 }
+00162
+00163 <span class="keywordflow">if</span> (forceRehash || !<a class="code" href="a05383.html#a5">parseHashFromComment</a>(si.Comments, si.HashValue))
+00164 {
+00165 <span class="comment">// compute the hash value from text.</span>
+00166 si.HashValue = CI18N::makeHash(si.Text);
+00167 <span class="comment">// nldebug("Generating hash for %s as %s", si.Identifier.c_str(), CI18N::hashToString(si.HashValue).c_str());</span>
+00168 }
+00169 <span class="keywordflow">else</span>
+00170 {
+00171 <span class="comment">// nldebug("Comment = [%s]", si.Comments.toString().c_str());</span>
+00172 <span class="comment">// nldebug("Retreiving hash for %s as %s", si.Identifier.c_str(), CI18N::hashToString(si.HashValue).c_str());</span>
+00173 }
+00174 stringInfos.push_back(si);
+00175 }
+00176
+00177
+00178 <span class="comment">// check identifier uniqueness</span>
+00179 {
+00180 <span class="keywordtype">bool</span> error = <span class="keyword">false</span>;
+00181 set&lt;string&gt; unik;
+00182 set&lt;string&gt;::iterator it;
+00183 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;stringInfos.size(); ++i)
+00184 {
+00185 it = unik.find(stringInfos[i].Identifier);
+00186 <span class="keywordflow">if</span> (it != unik.end())
+00187 {
+00188 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: loadStringFile : identifier '%s' exist twice"</span>, stringInfos[i].Identifier.c_str() );
+00189 error = <span class="keyword">true</span>;
+00190 }
+00191 <span class="keywordflow">else</span>
+00192 unik.insert(stringInfos[i].Identifier);
+00193
+00194 }
+00195 <span class="keywordflow">if</span> (error)
+00196 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00197 }
+00198
+00199 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00200 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a13" doxytag="STRING_MANAGER::makeHashCode" ></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 STRING_MANAGER::makeHashCode </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">TWorksheet &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>sheet</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>forceRehash</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>
+
+<p>
+Definition at line <a class="el" href="a05634.html#l00749">749</a> of file <a class="el" href="a05634.html">diff_tool.cpp</a>.
+<p>
+References <a class="el" href="a05635.html#l00097">STRING_MANAGER::TWorksheet::ColCount</a>, <a class="el" href="a05635.html#l00096">STRING_MANAGER::TWorksheet::Data</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a05635.html#l00159">STRING_MANAGER::TWorksheet::insertColumn()</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00102">uint64</a>.
+<p>
+<div class="fragment"><pre>00750 {
+00751 <span class="keywordflow">if</span> (!sheet.Data.empty())
+00752 {
+00753 TWorksheet::TRow::iterator it = find(sheet.Data[0].begin(), sheet.Data[0].end(), <a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"*HASH_VALUE"</span>));
+00754 <span class="keywordflow">if</span> (forceRehash || it == sheet.Data[0].end())
+00755 {
+00756 <span class="comment">// we need to generate HASH_VALUE column !</span>
+00757 <span class="keywordflow">if</span> (it == sheet.Data[0].end())
+00758 {
+00759 sheet.insertColumn(0);
+00760 sheet.Data[0][0] = <a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"*HASH_VALUE"</span>);
+00761 }
+00762
+00763 <span class="comment">// Check columns</span>
+00764 vector&lt;bool&gt; columnOk;
+00765 columnOk.resize(sheet.ColCount, <span class="keyword">false</span>);
+00766 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k=1; k&lt;sheet.ColCount; ++k)
+00767 {
+00768 <span class="keywordflow">if</span> (sheet.Data[0][k].find(<a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"*"</span>)) != 0 &amp;&amp; sheet.Data[0][k].find(<a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"DIFF "</span>)) != 0)
+00769 {
+00770 columnOk[k]= <span class="keyword">true</span>;
+00771 }
+00772 }
+00773
+00774 <span class="comment">// make hash for each line</span>
+00775 <a class="code" href="a03924.html">ucstring</a> str;
+00776 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j=1; j&lt;sheet.Data.size(); ++j)
+00777 {
+00778 str.erase();
+00779 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k=1; k&lt;sheet.ColCount; ++k)
+00780 {
+00781 <span class="keywordflow">if</span> (columnOk[k])
+00782 {
+00783 str += sheet.Data[j][k];
+00784 }
+00785 }
+00786 <a class="code" href="a04558.html#a13">uint64</a> hash = CI18N::makeHash(str);
+00787 CI18N::hashToUCString(hash, sheet.Data[j][0]);
+00788 }
+00789 }
+00790 <span class="keywordflow">else</span>
+00791 {
+00792 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a566">index</a> = it - sheet.Data[0].begin();
+00793 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j=1; j&lt;sheet.Data.size(); ++j)
+00794 {
+00795 <a class="code" href="a03924.html">ucstring</a> &amp;field = sheet.Data[j][<a class="code" href="a04223.html#a566">index</a>];
+00796
+00797 <span class="keywordflow">if</span> (!field.empty() &amp;&amp; field[0] == <span class="charliteral">'_'</span>)
+00798 field = field.substr(1);
+00799 }
+00800 }
+00801 }
+00802 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="STRING_MANAGER::makePhraseHash" ></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="a04558.html#a13">uint64</a> STRING_MANAGER::makePhraseHash </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const TPhrase &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>phrase</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>
+
+<p>
+Definition at line <a class="el" href="a05634.html#l00037">37</a> of file <a class="el" href="a05634.html">diff_tool.cpp</a>.
+<p>
+References <a class="el" href="a05635.html#l00073">STRING_MANAGER::TPhrase::Clauses</a>, <a class="el" href="a05635.html#l00071">STRING_MANAGER::TPhrase::Parameters</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00102">uint64</a>.
+<p>
+Referenced by <a class="el" href="a05634.html#l00279">readPhraseFile()</a>.
+<p>
+<div class="fragment"><pre>00038 {
+00039 <a class="code" href="a03924.html">ucstring</a> text;
+00040 text = phrase.Parameters;
+00041 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;phrase.Clauses.size(); ++i)
+00042 {
+00043 text += phrase.Clauses[i].Conditions;
+00044 text += phrase.Clauses[i].Identifier;
+00045 text += phrase.Clauses[i].Text;
+00046 }
+00047
+00048 <span class="keywordflow">return</span> CI18N::makeHash(text);
+00049 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="STRING_MANAGER::parseHashFromComment" ></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 STRING_MANAGER::parseHashFromComment </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>comments</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap><a class="el" href="a04558.html#a13">uint64</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>hashValue</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>
+
+<p>
+Definition at line <a class="el" href="a05634.html#l00054">54</a> of file <a class="el" href="a05634.html">diff_tool.cpp</a>.
+<p>
+References <a class="el" href="a06640.html#l00133">ucstring::toString()</a>, and <a class="el" href="a05981.html#l00102">uint64</a>.
+<p>
+Referenced by <a class="el" href="a05634.html#l00071">loadStringFile()</a>, and <a class="el" href="a05634.html#l00279">readPhraseFile()</a>.
+<p>
+<div class="fragment"><pre>00055 {
+00056 string str = comments.<a class="code" href="a03924.html#ucstringa11">toString</a>();
+00057
+00058 string::size_type pos = str.find(<span class="stringliteral">"HASH_VALUE "</span>);
+00059 <span class="keywordflow">if</span> (pos == string::npos)
+00060 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00061
+00062 string hashStr = str.substr(pos + 11, 16);
+00063
+00064 hashValue = CI18N::stringToHash(hashStr);
+00065 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00066 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a14" doxytag="STRING_MANAGER::prepareExcelSheet" ></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="a03924.html">ucstring</a> STRING_MANAGER::prepareExcelSheet </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const TWorksheet &amp;&nbsp;</td>
+ <td class="mdname1" valign="top" nowrap> <em>worksheet</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>
+
+<p>
+Definition at line <a class="el" href="a05634.html#l00804">804</a> of file <a class="el" href="a05634.html">diff_tool.cpp</a>.
+<p>
+References <a class="el" href="a05635.html#l00096">STRING_MANAGER::TWorksheet::Data</a>, <a class="el" href="a05383.html#a0">nl</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+<div class="fragment"><pre>00805 {
+00806 <span class="keywordflow">if</span>(worksheet.Data.empty())
+00807 <span class="keywordflow">return</span> <a class="code" href="a03924.html">ucstring</a>();
+00808
+00809 <span class="comment">// **** First pass: count approx the size</span>
+00810 <a class="code" href="a04558.html#a15">uint</a> approxSize= 0;
+00811 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;worksheet.Data.size(); ++i)
+00812 {
+00813 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j=0; j&lt;worksheet.Data[i].size(); ++j)
+00814 {
+00815 approxSize+= worksheet.Data[i][j].size() + 1;
+00816 }
+00817 approxSize++;
+00818 }
+00819
+00820 <span class="comment">// Hash value for each column?</span>
+00821 vector&lt;bool&gt; hashValue;
+00822 hashValue.resize(worksheet.Data[0].size());
+00823 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j=0; j&lt;worksheet.Data[0].size(); ++j)
+00824 {
+00825 hashValue[j]= worksheet.Data[0][j] == <a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"*HASH_VALUE"</span>);
+00826 }
+00827
+00828 <span class="comment">// **** Second pass: fill</span>
+00829 <a class="code" href="a03924.html">ucstring</a> text;
+00830 text.reserve(approxSize*2);
+00831 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;worksheet.Data.size(); ++i)
+00832 {
+00833 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j=0; j&lt;worksheet.Data[i].size(); ++j)
+00834 {
+00835 <span class="keywordflow">if</span> (i &gt; 0 &amp;&amp; hashValue[j])
+00836 text += <span class="stringliteral">"_"</span>;
+00837 text += worksheet.Data[i][j];
+00838 <span class="keywordflow">if</span> (j != worksheet.Data[i].size()-1)
+00839 text += <span class="charliteral">'\t'</span>;
+00840 }
+00841 text += <a class="code" href="a05383.html#a0">nl</a>;
+00842 }
+00843
+00844 <span class="keywordflow">return</span> text;
+00845 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a16" doxytag="STRING_MANAGER::preparePhraseFile" ></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="a03924.html">ucstring</a> preparePhraseFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::vector&lt; TPhrase &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>phrases</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>removeDiffComments</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>
+ </td>
+ </tr>
+</table>
+<a class="anchor" name="a10" doxytag="STRING_MANAGER::preparePhraseFile" ></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="a03924.html">ucstring</a> preparePhraseFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const vector&lt; TPhrase &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>phrases</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>removeDiffComments</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>
+
+<p>
+Definition at line <a class="el" href="a05634.html#l00472">472</a> of file <a class="el" href="a05634.html">diff_tool.cpp</a>.
+<p>
+References <a class="el" href="a05635.html#l00073">STRING_MANAGER::TPhrase::Clauses</a>, <a class="el" href="a04115.html#a118">comment()</a>, <a class="el" href="a05635.html#l00064">STRING_MANAGER::TClause::Comments</a>, <a class="el" href="a05635.html#l00072">STRING_MANAGER::TPhrase::Comments</a>, <a class="el" href="a05635.html#l00062">STRING_MANAGER::TClause::Conditions</a>, <a class="el" href="a05586.html#l00821">NLMISC::explode()</a>, <a class="el" href="a05635.html#l00074">STRING_MANAGER::TPhrase::HashValue</a>, <a class="el" href="a05635.html#l00061">STRING_MANAGER::TClause::Identifier</a>, <a class="el" href="a05635.html#l00070">STRING_MANAGER::TPhrase::Identifier</a>, <a class="el" href="a05383.html#a0">nl</a>, <a class="el" href="a05635.html#l00071">STRING_MANAGER::TPhrase::Parameters</a>, <a class="el" href="a05634.html#l00449">tabLines()</a>, <a class="el" href="a05635.html#l00063">STRING_MANAGER::TClause::Text</a>, <a class="el" href="a06640.html#l00133">ucstring::toString()</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+<div class="fragment"><pre>00473 {
+00474 <a class="code" href="a03924.html">ucstring</a> ret;
+00475 vector&lt;TPhrase&gt;::const_iterator first(phrases.begin()), last(phrases.end());
+00476 <span class="keywordflow">for</span> (; first != last; ++first)
+00477 {
+00478 <span class="keyword">const</span> TPhrase &amp;p = *first;
+00479
+00480 <span class="keywordflow">if</span> (removeDiffComments)
+00481 {
+00482 string <a class="code" href="a04115.html#a118">comment</a> = p.Comments.toString();
+00483 vector&lt;string&gt; lines;
+00484 <a class="code" href="a05378.html#a281">explode</a>(comment, <span class="stringliteral">"\n"</span>, lines, <span class="keyword">true</span>);
+00485
+00486 <a class="code" href="a04558.html#a15">uint</a> i;
+00487 <span class="keywordflow">for</span> (i=0; i&lt;lines.size(); ++i)
+00488 {
+00489 <span class="keywordflow">if</span> (lines[i].find(<span class="stringliteral">"// DIFF "</span>) != string::npos)
+00490 {
+00491 lines.erase(lines.begin()+i);
+00492 --i;
+00493 }
+00494 }
+00495
+00496 <a class="code" href="a04115.html#a118">comment</a>.erase();
+00497 <span class="keywordflow">for</span> (i=0; i&lt;lines.size(); ++i)
+00498 {
+00499 <a class="code" href="a04115.html#a118">comment</a> += lines[i] + <span class="stringliteral">"\n"</span>;
+00500 }
+00501 p.Comments = <a class="code" href="a03924.html">ucstring</a>(comment);
+00502 }
+00503 ret += p.Comments;
+00504
+00505 <span class="keywordflow">if</span> (!p.Identifier.empty() || !p.Clauses.empty())
+00506 {
+00507 <span class="keywordflow">if</span> (p.Comments.find(<a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"// HASH_VALUE "</span>)) == ucstring::npos)
+00508 {
+00509 <span class="comment">// add the hash value.</span>
+00510 ret += <a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"// HASH_VALUE "</span>)+CI18N::hashToString(p.HashValue) + <a class="code" href="a05383.html#a0">nl</a>;
+00511 }
+00512 ret += p.Identifier + <span class="stringliteral">" ("</span>+p.Parameters + <span class="stringliteral">")"</span> + <a class="code" href="a05383.html#a0">nl</a>;
+00513 ret += <span class="charliteral">'{'</span>;
+00514 ret += <a class="code" href="a05383.html#a0">nl</a>;
+00515 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;p.Clauses.size(); ++i)
+00516 {
+00517 <span class="keyword">const</span> TClause &amp;c = p.Clauses[i];
+00518 <span class="keywordflow">if</span> (!c.Comments.empty())
+00519 {
+00520 <a class="code" href="a03924.html">ucstring</a> <a class="code" href="a04115.html#a118">comment</a> = <a class="code" href="a05383.html#a9">tabLines</a>(1, c.Comments);
+00521 ret += <a class="code" href="a04115.html#a118">comment</a>; <span class="comment">// + '\r'+'\n';</span>
+00522 }
+00523 <span class="keywordflow">if</span> (!c.Conditions.empty())
+00524 {
+00525 <a class="code" href="a03924.html">ucstring</a> cond = <a class="code" href="a05383.html#a9">tabLines</a>(1, c.Conditions);
+00526 ret += cond + <a class="code" href="a05383.html#a0">nl</a>;
+00527 }
+00528 ret += <span class="charliteral">'\t'</span>;
+00529 <span class="comment">// ucstring text = CI18N::makeMarkedString('[', ']', c.Text);</span>
+00530
+00531 <a class="code" href="a03924.html">ucstring</a> text = CI18N::makeMarkedString(<span class="charliteral">'['</span>, <span class="charliteral">']'</span>, c.Text);;
+00532 <a class="code" href="a03924.html">ucstring</a> text2;
+00533 <span class="comment">// add new line and tab after each \n tag</span>
+00534 ucstring::size_type pos;
+00535 <span class="keyword">const</span> <a class="code" href="a03924.html">ucstring</a> nlTag(<span class="stringliteral">"\\n"</span>);
+00536 <span class="keywordflow">while</span> ((pos = text.find(nlTag)) != ucstring::npos)
+00537 {
+00538 text2 += text.substr(0, pos+2) + <a class="code" href="a05383.html#a0">nl</a>;
+00539 text = text.substr(pos+2);
+00540 }
+00541 text2 += text;<span class="comment">//.substr(0, pos+2);</span>
+00542
+00543 text.swap(text2);
+00544
+00545 text = <a class="code" href="a05383.html#a9">tabLines</a>(3, text);
+00546 <span class="comment">// remove begin tabs</span>
+00547 text = text.substr(3);
+00548 ret += <span class="charliteral">'\t'</span> + c.Identifier + <span class="charliteral">'\t'</span> + text + <a class="code" href="a05383.html#a0">nl</a> + <a class="code" href="a05383.html#a0">nl</a>;
+00549 }
+00550 ret += <span class="charliteral">'}'</span>;
+00551 }
+00552 ret += <a class="code" href="a05383.html#a0">nl</a> + <a class="code" href="a05383.html#a0">nl</a>;
+00553 }
+00554
+00555 <span class="keywordflow">return</span> ret;
+00556 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a15" doxytag="STRING_MANAGER::prepareStringFile" ></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="a03924.html">ucstring</a> prepareStringFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::vector&lt; TStringInfo &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>strings</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>removeDiffComments</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>
+ </td>
+ </tr>
+</table>
+<a class="anchor" name="a7" doxytag="STRING_MANAGER::prepareStringFile" ></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="a03924.html">ucstring</a> prepareStringFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const vector&lt; TStringInfo &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>strings</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>removeDiffComments</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>
+
+<p>
+Definition at line <a class="el" href="a05634.html#l00203">203</a> of file <a class="el" href="a05634.html">diff_tool.cpp</a>.
+<p>
+References <a class="el" href="a04115.html#a118">comment()</a>, <a class="el" href="a05635.html#l00040">STRING_MANAGER::TStringInfo::Comments</a>, <a class="el" href="a05586.html#l00821">NLMISC::explode()</a>, <a class="el" href="a05635.html#l00041">STRING_MANAGER::TStringInfo::HashValue</a>, <a class="el" href="a05635.html#l00037">STRING_MANAGER::TStringInfo::Identifier</a>, <a class="el" href="a05383.html#a0">nl</a>, <a class="el" href="a05635.html#l00038">STRING_MANAGER::TStringInfo::Text</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, <a class="el" href="a06640.html#l00133">ucstring::toString()</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+<div class="fragment"><pre>00204 {
+00205 <a class="code" href="a03924.html">ucstring</a> diff;
+00206
+00207 vector&lt;TStringInfo&gt;::const_iterator first(strings.begin()), last(strings.end());
+00208 <span class="keywordflow">for</span> (; first != last; ++first)
+00209 {
+00210 <a class="code" href="a03924.html">ucstring</a> str;
+00211 <span class="keyword">const</span> TStringInfo &amp;si = *first;
+00212 string <a class="code" href="a04115.html#a118">comment</a> = si.Comments.toString();
+00213 vector&lt;string&gt; lines;
+00214 <a class="code" href="a05378.html#a281">explode</a>(comment, <span class="stringliteral">"\n"</span>, lines, <span class="keyword">true</span>);
+00215
+00216 <a class="code" href="a04558.html#a15">uint</a> i;
+00217 <span class="keywordflow">for</span> (i=0; i&lt;lines.size(); ++i)
+00218 {
+00219 <span class="keywordflow">if</span> (removeDiffComments)
+00220 {
+00221 <span class="keywordflow">if</span> (lines[i].find(<span class="stringliteral">"// DIFF "</span>) != string::npos)
+00222 {
+00223 lines.erase(lines.begin()+i);
+00224 --i;
+00225 <span class="keywordflow">continue</span>;
+00226 }
+00227 }
+00228 <span class="keywordflow">if</span> (lines[i].find(<span class="stringliteral">"// INDEX "</span>) != string::npos)
+00229 {
+00230 lines.erase(lines.begin()+i);
+00231 --i;
+00232 }
+00233 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (lines[i].find(<span class="stringliteral">"// HASH_VALUE "</span>) != string::npos)
+00234 {
+00235 lines.erase(lines.begin()+i);
+00236 --i;
+00237 }
+00238 }
+00239
+00240 <a class="code" href="a04115.html#a118">comment</a>.erase();
+00241 <span class="keywordflow">for</span> (i=0; i&lt;lines.size(); ++i)
+00242 {
+00243 <a class="code" href="a04115.html#a118">comment</a> += lines[i] + <span class="stringliteral">"\n"</span>;
+00244 }
+00245 si.Comments = <a class="code" href="a03924.html">ucstring</a>(comment);
+00246
+00247 str = si.Comments;
+00248 <span class="keywordflow">if</span> (!si.Identifier.empty() || !si.Text.empty())
+00249 {
+00250 <span class="comment">// add hash value comment if needed</span>
+00251 <span class="comment">// if (si.Comments.find(ucstring("// HASH_VALUE ")) == ucstring::npos)</span>
+00252 str += <a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"// HASH_VALUE "</span>) + CI18N::hashToString(si.HashValue)+ <a class="code" href="a05383.html#a0">nl</a>;
+00253 str += <a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"// INDEX "</span>) + <a class="code" href="a05378.html#a244">NLMISC::toString</a>(<span class="stringliteral">"%u"</span>, first-strings.begin())+ <a class="code" href="a05383.html#a0">nl</a>;
+00254 str += si.Identifier + <span class="charliteral">'\t'</span>;
+00255
+00256 <a class="code" href="a03924.html">ucstring</a> text = CI18N::makeMarkedString(<span class="charliteral">'['</span>, <span class="charliteral">']'</span>, si.Text);;
+00257 <a class="code" href="a03924.html">ucstring</a> text2;
+00258 <span class="comment">// add new line and tab after each \n tag</span>
+00259 ucstring::size_type pos;
+00260 <span class="keyword">const</span> <a class="code" href="a03924.html">ucstring</a> nlTag(<span class="stringliteral">"\\n"</span>);
+00261 <span class="keywordflow">while</span> ((pos = text.find(nlTag)) != ucstring::npos)
+00262 {
+00263 text2 += text.substr(0, pos+2) + <a class="code" href="a05383.html#a0">nl</a> + <span class="stringliteral">"\t"</span>;
+00264 text = text.substr(pos+2);
+00265 }
+00266 text2 += text;<span class="comment">//.substr(0, pos+2);</span>
+00267 str += text2 + <a class="code" href="a05383.html#a0">nl</a> + <a class="code" href="a05383.html#a0">nl</a>;
+00268 <span class="comment">// str += CI18N::makeMarkedString('[', ']', si.Text) + nl + nl;</span>
+00269 }
+00270
+00271 <span class="comment">// nldebug("Adding string [%s]", str.toString().c_str());</span>
+00272 diff += str;
+00273 }
+00274
+00275 <span class="keywordflow">return</span> diff;
+00276 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a12" doxytag="STRING_MANAGER::readExcelSheet" ></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 STRING_MANAGER::readExcelSheet </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const <a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>text</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>TWorksheet &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>worksheet</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>checkUnique</em> = true</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>
+append last cell
+<p>
+Definition at line <a class="el" href="a05634.html#l00578">578</a> of file <a class="el" href="a05634.html">diff_tool.cpp</a>.
+<p>
+References <a class="el" href="a05635.html#l00097">STRING_MANAGER::TWorksheet::ColCount</a>, <a class="el" href="a05635.html#l00265">STRING_MANAGER::TWorksheet::getData()</a>, <a class="el" href="a05635.html#l00159">STRING_MANAGER::TWorksheet::insertColumn()</a>, <a class="el" href="a05383.html#a0">nl</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05635.html#l00230">STRING_MANAGER::TWorksheet::resize()</a>, <a class="el" href="a05635.html#l00257">STRING_MANAGER::TWorksheet::setData()</a>, <a class="el" href="a05635.html#l00154">STRING_MANAGER::TWorksheet::size()</a>, <a class="el" href="a06640.html#l00133">ucstring::toString()</a>, <a class="el" href="a06590.html#l00236">ucchar</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a06590.html#l00217">uint16</a>.
+<p>
+Referenced by <a class="el" href="a05634.html#l00558">loadExcelSheet()</a>.
+<p>
+<div class="fragment"><pre>00579 {
+00580 <span class="keywordflow">if</span>(str.empty())
+00581 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00582
+00583 <span class="comment">// copy the str to a big ucchar array =&gt; Avoid allocation / free</span>
+00584 vector&lt;ucchar&gt; strArray;
+00585 <span class="comment">// append a '\0'</span>
+00586 strArray.resize(str.size()+1);
+00587 strArray[strArray.size()-1]= 0;
+00588 memcpy(&amp;strArray[0], &amp;str[0], str.size()*<span class="keyword">sizeof</span>(<a class="code" href="a05167.html#a18">ucchar</a>));
+00589
+00590
+00591 <span class="comment">// **** Build array of lines. just point to strArray, and fill 0 where appropriated</span>
+00592 vector&lt;ucchar*&gt; lines;
+00593 lines.reserve(500);
+00594 ucstring::size_type pos = 0;
+00595 ucstring::size_type lastPos = 0;
+00596 <span class="keywordflow">while</span> ((pos = str.find(nl, lastPos)) != ucstring::npos)
+00597 {
+00598 <span class="keywordflow">if</span> (pos&gt;lastPos)
+00599 {
+00600 strArray[pos]= 0;
+00601 <span class="comment">// nldebug("Found line : [%s]", ucstring(&amp;strArray[lastPos]).toString().c_str());</span>
+00602 lines.push_back(&amp;strArray[lastPos]);
+00603 }
+00604 lastPos = pos + 2;
+00605 }
+00606
+00607 <span class="comment">// Must add last line if no \r\n ending</span>
+00608 <span class="keywordflow">if</span> (lastPos &lt; str.size())
+00609 {
+00610 pos= str.size();
+00611 strArray[pos]= 0;
+00612 <span class="comment">// nldebug("Found line : [%s]", ucstring(&amp;strArray[lastPos]).toString().c_str());</span>
+00613 lines.push_back(&amp;strArray[lastPos]);
+00614 }
+00615
+00616 <span class="comment">// nldebug("Found %u lines", lines.size());</span>
+00617
+00618 <span class="comment">// **** Do 2 pass.1st count the cell number, then fill. =&gt; avoid reallocation</span>
+00619 <a class="code" href="a04558.html#a15">uint</a> newColCount= 0;
+00620 <a class="code" href="a04558.html#a15">uint</a> i;
+00621 <span class="keywordflow">for</span> (i=0; i&lt;lines.size(); ++i)
+00622 {
+00623 <a class="code" href="a04558.html#a15">uint</a> numCells;
+00624 numCells= 0;
+00625
+00626 <a class="code" href="a05167.html#a18">ucchar</a> *first= lines[i];
+00627 <span class="keywordflow">for</span> (; *first != 0; ++first)
+00628 {
+00629 <span class="keywordflow">if</span> (*first == <span class="charliteral">'\t'</span>)
+00630 {
+00631 numCells++;
+00632 }
+00633 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (*first == <span class="charliteral">'"'</span> &amp;&amp; first==lines[i])
+00634 {
+00635 <span class="comment">// read a quoted field.</span>
+00636 first++;
+00637 <span class="keywordflow">while</span> (*first != 0 &amp;&amp; *first != <span class="charliteral">'"'</span> &amp;&amp; *(first+1) != 0 &amp;&amp; *(first+1) != <span class="charliteral">'"'</span>)
+00638 {
+00639 first++;
+00640 <span class="keywordflow">if</span> (*first != 0 &amp;&amp; *first == <span class="charliteral">'"'</span>)
+00641 {
+00642 <span class="comment">// skip this</span>
+00643 first++;
+00644 }
+00645 }
+00646 }
+00647 }
+00648 <span class="comment">// last cell</span>
+00649 numCells++;
+00650
+00651 <span class="comment">// take max cell of all lines</span>
+00652 newColCount= max(newColCount, numCells);
+00653 }
+00654
+00655
+00656 <span class="comment">// **** alloc / enlarge worksheet</span>
+00657 <span class="comment">// enlarge Worksheet column size, as needed</span>
+00658 <span class="keywordflow">while</span> (worksheet.ColCount &lt; newColCount)
+00659 worksheet.insertColumn(worksheet.ColCount);
+00660
+00661 <span class="comment">// enlarge Worksheet row size, as needed</span>
+00662 <a class="code" href="a04558.html#a15">uint</a> startLine= worksheet.size();
+00663 worksheet.resize(startLine + lines.size());
+00664
+00665
+00666 <span class="comment">// **** fill worksheet</span>
+00667 <a class="code" href="a03924.html">ucstring</a> cell;
+00668 <span class="keywordflow">for</span> (i=0; i&lt;lines.size(); ++i)
+00669 {
+00670 <a class="code" href="a04558.html#a15">uint</a> numCells;
+00671 numCells= 0;
+00672 cell.erase();
+00673
+00674 <a class="code" href="a05167.html#a18">ucchar</a> *first= lines[i];
+00675 <span class="keywordflow">for</span> (; *first != 0; ++first)
+00676 {
+00677 <span class="keywordflow">if</span> (*first == <span class="charliteral">'\t'</span>)
+00678 {
+00679 <span class="comment">// nldebug("Found cell [%s]", cell.toString().c_str());</span>
+00680 worksheet.setData(startLine + i, numCells, cell);
+00681 numCells++;
+00682 cell.erase();
+00683 }
+00684 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (*first == <span class="charliteral">'"'</span> &amp;&amp; first==lines[i])
+00685 {
+00686 <span class="comment">// read a quoted field.</span>
+00687 first++;
+00688 <span class="keywordflow">while</span> (*first != 0 &amp;&amp; *first != <span class="charliteral">'"'</span> &amp;&amp; *(first+1) != 0 &amp;&amp; *(first+1) != <span class="charliteral">'"'</span>)
+00689 {
+00690 cell += *first;
+00691 first++;
+00692 <span class="keywordflow">if</span> (*first != 0 &amp;&amp; *first == <span class="charliteral">'"'</span>)
+00693 {
+00694 <span class="comment">// skip this</span>
+00695 first++;
+00696 }
+00697 }
+00698 }
+00699 <span class="keywordflow">else</span>
+00700 {
+00701 cell += *first;
+00702 }
+00703 }
+00704 <span class="comment">// nldebug("Found cell [%s]", cell.toString().c_str());</span>
+00706 <span class="comment"></span> worksheet.setData(startLine + i, numCells, cell);
+00707 numCells++;
+00708 <a class="code" href="a04199.html#a6">nlassert</a>(numCells&lt;=newColCount);
+00709 <span class="comment">// nldebug("Found %u cells in line %u", numCells, i);</span>
+00710 }
+00711
+00712
+00713 <span class="comment">// **** identifier uniqueness checking.</span>
+00714 <span class="keywordflow">if</span> (checkUnique)
+00715 {
+00716 <span class="keywordflow">if</span> (worksheet.size() &gt; 0)
+00717 {
+00718 <span class="comment">// look for the first non '* tagged' or 'DIFF_CMD' column</span>
+00719 <a class="code" href="a04558.html#a15">uint</a> nameCol = 0;
+00720 <span class="keywordflow">while</span> (nameCol &lt; worksheet.ColCount &amp;&amp; (*worksheet.getData(0, nameCol).begin() == <a class="code" href="a05167.html#a11">uint16</a>(<span class="charliteral">'*'</span>) || worksheet.getData(0, nameCol) == <a class="code" href="a03924.html">ucstring</a>(<span class="stringliteral">"DIFF_CMD"</span>)))
+00721 ++nameCol;
+00722
+00723 <span class="keywordflow">if</span> (nameCol &lt; worksheet.ColCount )
+00724 {
+00725 <span class="comment">// ok we can check unikness</span>
+00726 <span class="keywordtype">bool</span> error = <span class="keyword">false</span>;
+00727 set&lt;ucstring&gt; unik;
+00728 set&lt;ucstring&gt;::iterator it;
+00729 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j=0; j&lt;worksheet.size(); ++j)
+00730 {
+00731 it = unik.find(worksheet.getData(j, nameCol));
+00732 <span class="keywordflow">if</span> (it != unik.end())
+00733 {
+00734 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: loadStringFile : identifier '%s' exist twice"</span>, worksheet.getData(j, nameCol).toString().c_str() );
+00735 error = <span class="keyword">true</span>;
+00736 }
+00737 <span class="keywordflow">else</span>
+00738 unik.insert(worksheet.getData(j, nameCol));
+00739 }
+00740 <span class="keywordflow">if</span> (error)
+00741 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00742 }
+00743 }
+00744 }
+00745
+00746 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00747 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a8" doxytag="STRING_MANAGER::readPhraseFile" ></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 STRING_MANAGER::readPhraseFile </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>filename</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>std::vector&lt; TPhrase &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>phrases</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>forceRehash</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>
+
+<p>
+Definition at line <a class="el" href="a05634.html#l00279">279</a> of file <a class="el" href="a05634.html">diff_tool.cpp</a>.
+<p>
+References <a class="el" href="a05635.html#l00073">STRING_MANAGER::TPhrase::Clauses</a>, <a class="el" href="a05635.html#l00064">STRING_MANAGER::TClause::Comments</a>, <a class="el" href="a05635.html#l00072">STRING_MANAGER::TPhrase::Comments</a>, <a class="el" href="a05635.html#l00062">STRING_MANAGER::TClause::Conditions</a>, <a class="el" href="a05635.html#l00074">STRING_MANAGER::TPhrase::HashValue</a>, <a class="el" href="a05635.html#l00061">STRING_MANAGER::TClause::Identifier</a>, <a class="el" href="a05635.html#l00070">STRING_MANAGER::TPhrase::Identifier</a>, <a class="el" href="a05634.html#l00037">makePhraseHash()</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05635.html#l00071">STRING_MANAGER::TPhrase::Parameters</a>, <a class="el" href="a05634.html#l00054">parseHashFromComment()</a>, <a class="el" href="a05635.html#l00063">STRING_MANAGER::TClause::Text</a>, and <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+<div class="fragment"><pre>00280 {
+00281 <a class="code" href="a03924.html">ucstring</a> doc;
+00282
+00283 CI18N::readTextFile(filename, doc, <span class="keyword">false</span>, <span class="keyword">false</span>, <span class="keyword">true</span>);
+00284
+00285 <span class="comment">// CI18N::writeTextFile("test.txt", doc, false);</span>
+00286
+00287 <span class="comment">/* uint8 *buffer = 0;</span>
+00288 <span class="comment"> uint size;</span>
+00289 <span class="comment">*/</span>
+00290
+00291 <span class="comment">/* try</span>
+00292 <span class="comment"> {</span>
+00293 <span class="comment"> CIFile fp(filename);</span>
+00294 <span class="comment"> size = fp.getFileSize();</span>
+00295 <span class="comment"> buffer = new uint8[size];</span>
+00296 <span class="comment"> fp.serialBuffer(buffer, size);</span>
+00297 <span class="comment"> }</span>
+00298 <span class="comment"> catch(Exception &amp;e)</span>
+00299 <span class="comment"> {</span>
+00300 <span class="comment"> nlinfo("Can't open file [%s] (%s)\n", filename.c_str(), e.what());</span>
+00301 <span class="comment"> return true;</span>
+00302 <span class="comment"> }</span>
+00303 <span class="comment">*/</span>
+00304 <span class="comment">/* FILE *fp = fopen(filename.c_str(), "rb");</span>
+00305 <span class="comment"> if (fp == 0)</span>
+00306 <span class="comment"> {</span>
+00307 <span class="comment"> nlinfo("Could't not open %s\n", filename.c_str());</span>
+00308 <span class="comment"> return true;</span>
+00309 <span class="comment"> }</span>
+00310 <span class="comment"> uint size = CFile::getFileSize(fp);</span>
+00311 <span class="comment"> uint8 *buffer = new uint8[size];</span>
+00312 <span class="comment"> fread(buffer, 1, size, fp);</span>
+00313 <span class="comment"> fclose(fp);</span>
+00314 <span class="comment">*/</span>
+00315 <span class="comment">/* CI18N::readTextBuffer(buffer, size, doc);</span>
+00316 <span class="comment"> delete [] buffer;</span>
+00317 <span class="comment">*/</span>
+00318 std::string lastRead(<span class="stringliteral">"nothing"</span>);
+00319
+00320 ucstring::const_iterator first(doc.begin()), last(doc.end());
+00321 <span class="keywordflow">while</span> (first != last)
+00322 {
+00323 TPhrase phrase;
+00324 <span class="comment">// parse the phrase</span>
+00325 CI18N::skipWhiteSpace(first, last, &amp;phrase.Comments);
+00326
+00327 <span class="keywordflow">if</span> (first == last)
+00328 <span class="keywordflow">break</span>;
+00329 <span class="keywordflow">if</span> (!CI18N::parseLabel(first, last, phrase.Identifier))
+00330 {
+00331 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: Error parsing phrase identifier after %s\n"</span>, lastRead.c_str());
+00332 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00333 }
+00334 <span class="comment">// nldebug("DT: parsing phrase '%s'", phrase.Identifier.c_str());</span>
+00335 lastRead = phrase.Identifier;
+00336 CI18N::skipWhiteSpace(first, last, &amp;phrase.Comments);
+00337 <span class="keywordflow">if</span> (!CI18N::parseMarkedString(<span class="charliteral">'('</span>, <span class="charliteral">')'</span>, first, last, phrase.Parameters))
+00338 {
+00339 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: Error parsing parameter list for phrase %s\n"</span>, phrase.Identifier.c_str());
+00340 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00341 }
+00342 CI18N::skipWhiteSpace(first, last, &amp;phrase.Comments);
+00343 <span class="keywordflow">if</span> (first == last || *first != <span class="charliteral">'{'</span>)
+00344 {
+00345 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: Error parsing block opening '{' in phase %s\n"</span>, phrase.Identifier.c_str());
+00346 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00347 }
+00348 ++first;
+00349
+00350 <a class="code" href="a03924.html">ucstring</a> temp;
+00351
+00352 <span class="keywordflow">while</span> (first != last &amp;&amp; *first != <span class="charliteral">'}'</span>)
+00353 {
+00354 TClause clause;
+00355 <span class="comment">// append the comment preread at previous pass</span>
+00356 clause.Comments = temp;
+00357 temp.erase();
+00358 <span class="comment">// parse the clauses</span>
+00359 CI18N::skipWhiteSpace(first, last, &amp;clause.Comments);
+00360 <span class="keywordflow">if</span> (first == last)
+00361 {
+00362 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: Found end of file in non closed block for phrase %s\n"</span>, phrase.Identifier.c_str());
+00363 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00364 }
+00365
+00366 <span class="keywordflow">if</span> (*first == <span class="charliteral">'}'</span>)
+00367 <span class="keywordflow">break</span>;
+00368
+00369 <span class="comment">// skip the conditionnal expression</span>
+00370 <a class="code" href="a03924.html">ucstring</a> cond;
+00371 <span class="keywordflow">while</span> (first != last &amp;&amp; *first == <span class="charliteral">'('</span>)
+00372 {
+00373 <span class="keywordflow">if</span> (!CI18N::parseMarkedString(<span class="charliteral">'('</span>, <span class="charliteral">')'</span>, first, last, cond))
+00374 {
+00375 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: Error parsing conditionnal expression in phrase %s, clause %u\n"</span>, phrase.Identifier.c_str(), phrase.Clauses.size()+1);
+00376 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00377 }
+00378 clause.Conditions += <span class="stringliteral">"("</span> + cond + <span class="stringliteral">") "</span>;
+00379 CI18N::skipWhiteSpace(first, last, &amp;clause.Comments);
+00380 }
+00381 <span class="keywordflow">if</span> (first == last)
+00382 {
+00383 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: Found end of file in non closed block for phrase %s\n"</span>, phrase.Identifier.c_str());
+00384 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00385 }
+00386 <span class="comment">// read the idnetifier (if any)</span>
+00387 CI18N::parseLabel(first, last, clause.Identifier);
+00388 CI18N::skipWhiteSpace(first, last, &amp;temp);
+00389 <span class="comment">// read the text</span>
+00390 <span class="keywordflow">if</span> (CI18N::parseMarkedString(<span class="charliteral">'['</span>, <span class="charliteral">']'</span>, first, last, clause.Text))
+00391 {
+00392 <span class="comment">// the last read comment is for this clause.</span>
+00393 clause.Comments += temp;
+00394 temp.erase();
+00395 }
+00396 <span class="keywordflow">else</span>
+00397 {
+00398 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: Error reading text for clause %u (%s) in phrase %s\n"</span>,
+00399 phrase.Clauses.size()+1,
+00400 clause.Identifier.c_str(),
+00401 phrase.Identifier.c_str());
+00402 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00403
+00404 }
+00405
+00406 phrase.Clauses.push_back(clause);
+00407 }
+00408 CI18N::skipWhiteSpace(first, last);
+00409 <span class="keywordflow">if</span> (first == last || *first != <span class="charliteral">'}'</span>)
+00410 {
+00411 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: Missing block clogin tag '}' in phrase %s\n"</span>, phrase.Identifier.c_str());
+00412 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00413 }
+00414 ++first;
+00415
+00416 <span class="comment">// handle hash value.</span>
+00417 <span class="keywordflow">if</span> (forceRehash || !<a class="code" href="a05383.html#a5">parseHashFromComment</a>(phrase.Comments, phrase.HashValue))
+00418 {
+00419 <span class="comment">// the hash is not in the comment, compute it.</span>
+00420 phrase.HashValue = <a class="code" href="a05383.html#a4">makePhraseHash</a>(phrase);
+00421 }
+00422
+00423 <span class="comment">// nldebug("DT : storing phrase '%s'", phrase.Identifier.c_str());</span>
+00424 phrases.push_back(phrase);
+00425 }
+00426
+00427 <span class="comment">// check identifier uniqueness</span>
+00428 {
+00429 <span class="keywordtype">bool</span> error = <span class="keyword">false</span>;
+00430 set&lt;string&gt; unik;
+00431 set&lt;string&gt;::iterator it;
+00432 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;phrases.size(); ++i)
+00433 {
+00434 it = unik.find(phrases[i].Identifier);
+00435 <span class="keywordflow">if</span> (it != unik.end())
+00436 {
+00437 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"DT: loadStringFile : identifier '%s' exist twice"</span>, phrases[i].Identifier.c_str() );
+00438 error = <span class="keyword">true</span>;
+00439 }
+00440 <span class="keywordflow">else</span>
+00441 unik.insert(phrases[i].Identifier);
+00442 }
+00443 <span class="keywordflow">if</span> (error)
+00444 <span class="keywordflow">return</span> <span class="keyword">false</span>;
+00445 }
+00446
+00447 <span class="keywordflow">return</span> <span class="keyword">true</span>;
+00448 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a9" doxytag="STRING_MANAGER::tabLines" ></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="a03924.html">ucstring</a> STRING_MANAGER::tabLines </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a>&nbsp;</td>
+ <td class="mdname" nowrap> <em>nbTab</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const <a class="el" href="a03924.html">ucstring</a> &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>str</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>
+
+<p>
+Definition at line <a class="el" href="a05634.html#l00449">449</a> of file <a class="el" href="a05634.html">diff_tool.cpp</a>.
+<p>
+References <a class="el" href="a05981.html#l00105">uint</a>.
+<p>
+Referenced by <a class="el" href="a05634.html#l00472">preparePhraseFile()</a>.
+<p>
+<div class="fragment"><pre>00450 {
+00451 <a class="code" href="a03924.html">ucstring</a> ret;
+00452 <a class="code" href="a03924.html">ucstring</a> tabs;
+00453
+00454 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i =0; i&lt;nbTab; ++i)
+00455 tabs.push_back(<span class="charliteral">'\t'</span>);
+00456
+00457 ret = tabs;
+00458 ucstring::const_iterator first(str.begin()), last(str.end());
+00459 <span class="keywordflow">for</span> (; first != last; ++first)
+00460 {
+00461 ret += *first;
+00462 <span class="keywordflow">if</span> (*first == <span class="charliteral">'\n'</span>)
+00463 ret += tabs;
+00464 }
+00465
+00466 <span class="keywordflow">while</span> (ret[ret.size()-1] == <span class="charliteral">'\t'</span>)
+00467 ret = ret.substr(0, ret.size()-1);
+00468
+00469 <span class="keywordflow">return</span> ret;
+00470 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a0" doxytag="STRING_MANAGER::nl" ></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="a03924.html">ucstring</a> <a class="el" href="a05383.html#a0">STRING_MANAGER::nl</a>("\r\n")
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Referenced by <a class="el" href="a05634.html#l00804">prepareExcelSheet()</a>, <a class="el" href="a05634.html#l00472">preparePhraseFile()</a>, <a class="el" href="a05634.html#l00203">prepareStringFile()</a>, and <a class="el" href="a05634.html#l00578">readExcelSheet()</a>. </td>
+ </tr>
+</table>
+<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 14:54:11 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>