]> git.mxchange.org Git - simgear.git/blobdiff - simgear/structure/SGExpression.hxx
Merge branch 'master' of git://gitorious.org/fg/simgear into fredb/winbuild
[simgear.git] / simgear / structure / SGExpression.hxx
index 2dac8efb1863c105bfd78b045af4289180df6c06..05fc8336f9fd1f7b8c5e6b02b9dbf0c75757d331 100644 (file)
@@ -31,6 +31,7 @@
 #include <simgear/math/SGMath.hxx>
 #include <simgear/scene/model/persparam.hxx>
 #include <simgear/structure/exception.hxx>
+#include <simgear/structure/Singleton.hxx>
 
 /// Expression tree implementation.
 
@@ -1009,10 +1010,16 @@ namespace simgear
   class ExpressionParser : public Parser
   {
   public:
-      ParserMap& getParserMap() { return _parserTable; }
+      ParserMap& getParserMap()
+      {
+          return ParserMapSingleton::instance()->_parserTable;
+      }
       static void addExpParser(const std::string&, exp_parser);
   protected:
-      static ParserMap _parserTable;
+      struct ParserMapSingleton : public simgear::Singleton<ParserMapSingleton>
+      {
+          ParserMap _parserTable;
+      };
   };
 
   /**
@@ -1195,7 +1202,7 @@ namespace simgear
     void eval(bool& value, const expression::Binding* b) const
     {
       value = false;
-      for (int i = 0; i < getNumOperands(); ++i) {
+      for (int i = 0; i < (int)getNumOperands(); ++i) {
         value = value || getOperand(i)->getValue(b);
         if (value)
           return;
@@ -1209,7 +1216,7 @@ namespace simgear
     void eval(bool& value, const expression::Binding* b) const
     {
       value = true;
-      for (int i = 0; i < getNumOperands(); ++i) {
+      for (int i = 0; i < (int)getNumOperands(); ++i) {
         value = value && getOperand(i)->getValue(b);
         if (!value)
           return;