]> git.mxchange.org Git - simgear.git/blobdiff - simgear/props/props.cxx
hla: Use raw pointers for HLAFederate::_insert methods.
[simgear.git] / simgear / props / props.cxx
index 09b71fb44c6b91a158fdefd0a86707d65f665cd7..702ad77dfc02b5b823186fd9f1801bf7b0d7db89 100644 (file)
@@ -57,7 +57,6 @@ using std::stringstream;
 
 using namespace simgear;
 
-\f
 ////////////////////////////////////////////////////////////////////////
 // Local classes.
 ////////////////////////////////////////////////////////////////////////
@@ -74,14 +73,12 @@ public:
 };
 
 
-\f
 ////////////////////////////////////////////////////////////////////////
 // Convenience macros for value access.
 ////////////////////////////////////////////////////////////////////////
 
 #define TEST_READ(dflt) if (!getAttribute(READ)) return dflt
 #define TEST_WRITE if (!getAttribute(WRITE)) return false
-\f
 
 ////////////////////////////////////////////////////////////////////////
 // Local path normalization code.
@@ -153,7 +150,6 @@ inline bool validateName(const string& name)
              is_alnum() || is_any_of("_-."));
 }
 
-\f
 ////////////////////////////////////////////////////////////////////////
 // Other static utility functions.
 ////////////////////////////////////////////////////////////////////////
@@ -190,7 +186,7 @@ find_child (Itr begin, Itr end, int index, const PropertyList& nodes)
   for (int i = 0; i < nNodes; i++) {
     SGPropertyNode * node = nodes[i];
 
-    // searching for a mathing index is a lot less time consuming than
+    // searching for a matching index is a lot less time consuming than
     // comparing two strings so do that first.
     if (node->getIndex() == index && boost::equals(node->getName(), name))
       return i;
@@ -205,7 +201,7 @@ static int
 find_last_child (const char * name, const PropertyList& nodes)
 {
   int nNodes = nodes.size();
-  int index = 0;
+  int index = -1;
 
   for (int i = 0; i < nNodes; i++) {
     SGPropertyNode * node = nodes[i];
@@ -234,7 +230,7 @@ first_unused_index( const char * name,
       return index;
   }
 
-  SG_LOG(SG_GENERAL, SG_ALERT, "Too much nodes: " << name);
+  SG_LOG(SG_GENERAL, SG_ALERT, "Too many nodes: " << name);
   return -1;
 }
 
@@ -370,7 +366,6 @@ find_node (SGPropertyNode * current,
      return find_node_aux(current, itr, create, last_index);
 }
 
-\f
 ////////////////////////////////////////////////////////////////////////
 // Private methods from SGPropertyNode (may be inlined for speed).
 ////////////////////////////////////////////////////////////////////////
@@ -654,7 +649,6 @@ SGPropertyNode::trace_read () const
 #endif
 }
 
-\f
 ////////////////////////////////////////////////////////////////////////
 // Public methods from SGPropertyNode.
 ////////////////////////////////////////////////////////////////////////
@@ -1839,7 +1833,6 @@ SGPropertyNode::getNode (const char * relative_path, int index) const
   return ((SGPropertyNode *)this)->getNode(relative_path, index, false);
 }
 
-\f
 ////////////////////////////////////////////////////////////////////////
 // Convenience methods using relative paths.
 ////////////////////////////////////////////////////////////////////////
@@ -2145,12 +2138,35 @@ SGPropertyNode::fireChildAdded (SGPropertyNode * child)
   fireChildAdded(this, child);
 }
 
+void
+SGPropertyNode::fireCreatedRecursive()
+{
+  _parent->fireChildAdded(this);
+
+  if( _children.empty() && getType() != simgear::props::NONE )
+    return fireValueChanged();
+
+  for(size_t i = 0; i < _children.size(); ++i)
+    _children[i]->fireCreatedRecursive();
+}
+
 void
 SGPropertyNode::fireChildRemoved (SGPropertyNode * child)
 {
   fireChildRemoved(this, child);
 }
 
+void
+SGPropertyNode::fireChildrenRemovedRecursive()
+{
+  for(size_t i = 0; i < _children.size(); ++i)
+  {
+    SGPropertyNode* child = _children[i];
+    fireChildRemoved(this, child);
+    child->fireChildrenRemovedRecursive();
+  }
+}
+
 void
 SGPropertyNode::fireValueChanged (SGPropertyNode * node)
 {
@@ -2189,7 +2205,6 @@ SGPropertyNode::fireChildRemoved (SGPropertyNode * parent,
     _parent->fireChildRemoved(parent, child);
 }
 
-\f
 ////////////////////////////////////////////////////////////////////////
 // Implementation of SGPropertyChangeListener.
 ////////////////////////////////////////////////////////////////////////