52    name_(name), value_(
""), parent_(parent) {
 
 
   66    name_(old.name_), value_(old.value_), parent_(NULL),
 
   67    attributes_(old.attributes_) {
 
 
  101    const std::string& name,
 
  102    const std::string& value) {
 
  104    AttributeTable::iterator iter = 
attributes_.begin();
 
  106        if ((*iter).name == 
name) {
 
  107            (*iter).value = value;
 
  114    newAttribute.
value = value;
 
 
  206    AttributeTable::const_iterator iter = 
attributes_.begin();
 
  208        if ((*iter).name == 
name) {
 
 
  230        const string procName = 
"ObjectState::attribute";
 
  232        errorMsg += 
"Requested attribute by index '";
 
  234        errorMsg += 
"' which is out of range.";
 
  235        throw OutOfRange(__FILE__, __LINE__, procName, errorMsg);
 
 
  250    AttributeTable::const_iterator iter = 
attributes_.begin();
 
  252        if ((*iter).name == 
name) {
 
  253            return (*iter).
value;
 
  258    string procName = 
"ObjectState::stringAttribute";
 
  260    errorMsg += 
"Requested attribute by name '";
 
  262    errorMsg += 
"' which doesn't exist.";
 
  263    throw KeyNotFound(__FILE__, __LINE__, procName, errorMsg);
 
 
  345        const string procName = 
"ObjectState::boolAttribute";
 
 
  359    ChildTable::const_iterator iter = 
children_.begin();
 
  361        if ((*iter)->name() == 
name) {
 
 
  394        const string procName = 
"ObjectState::removeChild";
 
 
  409    if (newChild->
parent() != NULL) {
 
  410        const string procName = 
"ObjectState::replaceChild";
 
  414    ChildTable::iterator it = 
children_.begin();
 
  418            ChildTable::iterator pt = it;
 
 
  444    ChildTable::const_iterator iter = 
children_.begin();
 
  446        if ((*iter)->name() == 
name) {
 
  452    string procName = 
"ObjectState::childByName";
 
  454    errorMsg += 
"Requested child by name '";
 
  456    errorMsg += 
"' which doesn't exist.";
 
 
  473        const string procName = 
"ObjectState::child";
 
  475        errorMsg += 
"Requested child by index '";
 
  477        errorMsg += 
"' which is out of range.";
 
  478        throw OutOfRange(__FILE__, __LINE__, procName, errorMsg);
 
 
  495        children_.size() != 
static_cast<unsigned int>(
object.childCount()) ||
 
  496        static_cast<int>(
attributes_.size()) != 
object.attributeCount()) {
 
  506            if (attr.
value != 
object.stringAttribute(attr.
name)) {
 
  512    for (
size_t i = 0; i < 
children_.size(); i++) {
 
  515        if (
child != compare) {
 
 
  530    string errorMsg = 
"ObjectState ";
 
 
  542    std::ostream& output,
 
  543    const std::string& identation) {
 
  548    cout << identation << 
"Name: "<< state.
name() << 
" ";
 
  554        cout << identation << 
"Attr: " << state.
attribute(i)->
name << 
" = " 
  557    for (
int i = 0; i < state.
childCount(); i++) {
 
 
#define assert(condition)
static double toDouble(const T &source)
static std::string toString(const T &source)
static int toInt(const T &source)
static ULongWord toUnsignedLong(const T &source)
static unsigned int toUnsignedInt(const T &source)
ChildTable children_
The child elements.
bool hasAttribute(const std::string &name) const
bool operator!=(const ObjectState &object)
std::string name_
Name of the element.
Attribute * attribute(int index) const
ObjectState * childByName(const std::string &name) const
double doubleAttribute(const std::string &name) const
void setAttribute(const std::string &name, const std::string &value)
int attributeCount() const
void removeChild(ObjectState *child)
bool hasChild(const std::string &name) const
static void dumpObjectState(const ObjectState &state, std::ostream &output, const std::string &identation="")
ObjectState * child(int index) const
ObjectState(const std::string &name, ObjectState *parent=NULL)
void addChild(ObjectState *child)
std::string stringAttribute(const std::string &name) const
std::string value_
The value of a leaf element.
ObjectState * parent() const
AttributeTable attributes_
Contains all the attributes of the element.
void replaceChild(ObjectState *old, ObjectState *newChild)
bool boolAttribute(const std::string &name) const
int intAttribute(const std::string &name) const
std::string stringValue() const
unsigned int unsignedIntAttribute(const std::string &name) const
ULongWord uLongAttribute(const std::string &name) const
std::string commonErrorMessage() const
ObjectState * parent_
The parent element.
Struct for describing an attribute of the XML element.
std::string value
Value of the attribute.
std::string name
Name of the attribute.