+/**
+ * Initialize a node to represent this node's parent.
+ *
+ * A return value of true means success; otherwise, the node supplied
+ * is unmodified.
+ */
+bool
+FGPropertyNode::getParent (FGPropertyNode &parent) const
+{
+ string::size_type pos = _path.rfind('/');
+ if (pos != string::npos) {
+ parent.setPath(_path.substr(0, pos-1));
+ parent.setPropertyList(_props);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+
+/**
+ * Initialize a node to represent this node's nth child.
+ *
+ * A return value of true means success; otherwise, the node supplied
+ * is unmodified.
+ */
+bool
+FGPropertyNode::getChild (FGPropertyNode &child, int n) const
+{
+ if (_props == 0)
+ return false;
+
+ int s = 0;
+ string base;
+ string lastBase;
+ string pattern = _path;
+ pattern += '/';
+
+ FGPropertyList::const_iterator it = _props->begin();
+ FGPropertyList::const_iterator end = _props->end();
+ while (it != end) {
+ if (get_base(pattern, it->first, base) && base != lastBase) {
+ if (s == n) {
+ string path = _path;
+ path += '/';
+ path += base;
+ child.setPath(path);
+ child.setPropertyList(_props);
+ return true;
+ } else {
+ s++;
+ lastBase = base;
+ }
+ }
+ it++;
+ }
+
+ return false;
+}