eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] eliot/dic compdic.cpp


From: Olivier Teulière
Subject: [Eliot-dev] eliot/dic compdic.cpp
Date: Fri, 03 Jul 2009 21:51:08 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Changes by:     Olivier Teulière <ipkiss>       09/07/03 21:51:08

Modified files:
        dic            : compdic.cpp 

Log message:
        Tiny optimization of the compressed dictionary

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/compdic.cpp?cvsroot=eliot&r1=1.13&r2=1.14

Patches:
Index: compdic.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/compdic.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- compdic.cpp 28 Jun 2009 12:11:10 -0000      1.13
+++ compdic.cpp 3 Jul 2009 21:51:08 -0000       1.14
@@ -26,6 +26,7 @@
 #include <iostream>
 #include <vector>
 #include <map>
+#include <boost/foreach.hpp>
 #include <boost/tokenizer.hpp>
 #include <boost/unordered_map.hpp>
 #include <boost/functional/hash.hpp>
@@ -181,8 +182,20 @@
 
         if (tokens.size() > 5)
         {
-            ioHeaderInfo.displayInputData[upChar] =
-                vector<wstring>(tokens.begin() + 5, tokens.end());
+            vector<wstring> inputs(tokens.begin() + 5, tokens.end());
+            // Ensure the input strings are in upper case
+            BOOST_FOREACH(wstring &str, inputs)
+            {
+                std::transform(str.begin(), str.end(), str.begin(), towupper);
+            }
+
+            // If the display stirng is identical to the internal char and if
+            // there is no other input, no need to save this information, as
+            // it is already the default.
+            if (inputs.size() != 1 || inputs[0] != wstring(1, upChar))
+            {
+                ioHeaderInfo.displayInputData[upChar] = inputs;
+            }
         }
 
         ++lineNb;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]