// #include STL_IOSTREAM
-#include <simgear/misc/exception.hxx>
+#include <simgear/structure/exception.hxx>
#include "props.hxx"
-
#include "condition.hxx"
SG_USING_STD(istream);
SGNotCondition::~SGNotCondition ()
{
- delete _condition;
}
bool
SGAndCondition::~SGAndCondition ()
{
- for (unsigned int i = 0; i < _conditions.size(); i++)
- delete _conditions[i];
}
bool
SGOrCondition::~SGOrCondition ()
{
- for (unsigned int i = 0; i < _conditions.size(); i++)
- delete _conditions[i];
}
bool
break;
}
}
- throw sg_exception("Unrecognized node type");
+ throw sg_exception("condition: unrecognized node type in comparison");
return 0;
}
SGComparisonCondition::~SGComparisonCondition ()
{
- delete _right_value;
}
bool
SGComparisonCondition::setRightProperty( SGPropertyNode *prop_root,
const char * propname )
{
- delete _right_value;
_right_value = 0;
_right_property = prop_root->getNode(propname, true);
}
SGComparisonCondition::setRightValue (const SGPropertyNode *node)
{
_right_property = 0;
- delete _right_value;
_right_value = new 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;
}
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;
}
SGConditional::~SGConditional ()
{
- delete _condition;
}
void
SGConditional::setCondition (SGCondition * condition)
{
- delete _condition;
_condition = condition;
}