]> git.mxchange.org Git - simgear.git/blobdiff - simgear/props/condition.cxx
Fix a warning from GCC - 'ALIAS' was unhandled in the switch stmt.
[simgear.git] / simgear / props / condition.cxx
index a633cacd33e318f80b71df3081ffec0d0de4afe6..7a382cd30ee44a66985ec9ab01742109bd39f81c 100644 (file)
 #  include <simgear/compiler.h>
 #endif
 
-// #include STL_IOSTREAM
+// #include <iostream>
 
 #include <simgear/structure/exception.hxx>
 
 #include "props.hxx"
 #include "condition.hxx"
 
-SG_USING_STD(istream);
-SG_USING_STD(ostream);
+using std::istream;
+using std::ostream;
 
 
 
@@ -65,7 +65,6 @@ SGNotCondition::SGNotCondition (SGCondition * condition)
 
 SGNotCondition::~SGNotCondition ()
 {
-  delete _condition;
 }
 
 bool
@@ -86,8 +85,6 @@ SGAndCondition::SGAndCondition ()
 
 SGAndCondition::~SGAndCondition ()
 {
-  for (unsigned int i = 0; i < _conditions.size(); i++)
-    delete _conditions[i];
 }
 
 bool
@@ -119,8 +116,6 @@ SGOrCondition::SGOrCondition ()
 
 SGOrCondition::~SGOrCondition ()
 {
-  for (unsigned int i = 0; i < _conditions.size(); i++)
-    delete _conditions[i];
 }
 
 bool
@@ -218,8 +213,10 @@ doComparison (const SGPropertyNode * left, const SGPropertyNode *right)
       return SGComparisonCondition::EQUALS;
     break;
   }
+  default:
+    throw sg_exception("condition: unrecognized node type in comparison");
   }
-  throw sg_exception("Unrecognized node type");
+  
   return 0;
 }
 
@@ -304,7 +301,7 @@ readNotCondition( SGPropertyNode *prop_root, const SGPropertyNode *node )
     if (condition != 0)
       return new SGNotCondition(condition);
   }
-  SG_LOG(SG_COCKPIT, SG_ALERT, "Panel: empty 'not' condition");
+  SG_LOG(SG_COCKPIT, SG_ALERT, "empty 'not' condition");
   return 0;
 }
 
@@ -346,8 +343,10 @@ readComparison( SGPropertyNode *prop_root,
   condition->setLeftProperty(prop_root, node->getStringValue("property[0]"));
   if (node->hasValue("property[1]"))
     condition->setRightProperty(prop_root, node->getStringValue("property[1]"));
-  else
+  else if (node->hasValue("value"))
     condition->setRightValue(node->getChild("value", 0));
+  else
+    throw sg_exception("condition: comparison without property[1] or value");
 
   return condition;
 }
@@ -398,13 +397,11 @@ SGConditional::SGConditional ()
 
 SGConditional::~SGConditional ()
 {
-  delete _condition;
 }
 
 void
 SGConditional::setCondition (SGCondition * condition)
 {
-  delete _condition;
   _condition = condition;
 }