Removed glibmm dependency.
authorspixx <spixx>
Sun, 26 Nov 2006 14:28:59 +0000 (14:28 +0000)
committerspixx <spixx>
Sun, 26 Nov 2006 14:28:59 +0000 (14:28 +0000)
src/rule.cpp

index 564aa2c6e3d7757a18d4e873c6aca236123c7e51..24cc04722a7a50c4ef10d97140058534c670cb8f 100644 (file)
 
 
 
-#include <string>
+#include <cstdlib>
 
-#include <glibmm/stringutils.h>
+#include <sstream>
+#include <string>
 
 #include "rule.h"
 
@@ -112,7 +113,8 @@ void Rule::fromString(string ruleString)
         {
             i++;
         }
-        setProbability(Glib::Ascii::strtod(string(ruleString, 2, i - 2)));
+        
+        setProbability(strtod(string(ruleString, 2, i - 2).c_str(), NULL));
         
         // ignore the '='
         i += 2;
@@ -136,13 +138,14 @@ string Rule::toString()
     
     // probability factor
     
-    if (_probability != 0.0)
+    if (_probability > 0.0 && _probability < 1.0)
     {
-        // TODO: precision
-        string probabilityString(Glib::Ascii::dtostr(getProbability()), 0, 4);
+        ostringstream probabilityString;
+        probabilityString << getProbability();
         
+        // TODO: precision
         rulesString += '(';
-        rulesString += probabilityString;
+        rulesString += string(probabilityString.str(), 0, 4);
         rulesString += ')';
     }