+/*static*/ XMLNode *
+GUIObjectState::get_node (const XMLNode* parent, const string& id)
+{
+ XMLNodeList const & children = parent->children ();
+ for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
+ if ((*i)->name() != X_("Object")) {
+ continue;
+ }
+ if ((*i)->has_property_with_value(X_("id"), id)) {
+ return *i;
+ }
+ }
+ return 0;
+}
+
+/*static*/ XMLNode *
+GUIObjectState::get_or_add_node (XMLNode* parent, const string& id)
+{
+ XMLNode* child = get_node (parent, id);
+ if (!child) {
+ child = new XMLNode (X_("Object"));
+ child->set_property (X_("id"), id);
+ parent->add_child_nocopy (*child);
+ }
+ return child;
+}
+
+