Name

PropertyNode — The node of property tree.

Synopsis

class PropertyNode
  :  : public RefCountedWrappedObjectSernaApi::RefCountedWrappedObject
 {
public:
  // construct/copy/destruct
  PropertyNode(SernaApiBase * = 0);
  PropertyNode(const SString &, const SString & = SString());
  PropertyNode(const SString &, bool);
  PropertyNode(const SString &, int);
  PropertyNode(const SString &, double);
  ~PropertyNode();

  // public member functions

  SString name() const;
  void setName(const SString &) ;
  SString getString() const;
  bool getBool(bool * = 0) const;
  int getInt(bool * = 0) const;
  void * getPtr(bool * = 0) const;
  double getDouble(bool * = 0) const;
  void setString(const SString &) ;
  void setBool(bool) ;
  void setInt(int) ;
  void setPtr(void *) ;
  void setDouble(double) ;
  void merge(const PropertyNode &, bool = false) ;
  PropertyNode copy(bool = false) const;
  PropertyNode getProperty(const SString &) const;
  PropertyNode getSafeProperty(const SString &) const;
  PropertyNode makeDescendant(const SString &) ;
  PropertyNode makeDescendant(const SString &, const SString &, bool = true) ;
  void addWatcher(PropertyNodeWatcher *) ;
  void removeWatcher(PropertyNodeWatcher *) ;
  void removeAllWatchers() ;
  void dump() const;
  bool save(const SString &) const;
  bool read(const SString &, bool = false) ;
  PropertyNode firstChild() const;
  PropertyNode lastChild() const;
  PropertyNode getChild(int) const;
  int countChildren() const;
  void appendChild(const PropertyNode &) ;
  void removeAllChildren() ;
  PropertyNode nextSibling() const;
  PropertyNode prevSibling() const;
  PropertyNode parent() const;
  PropertyNode root() const;
  void remove() ;
  void insertBefore(const PropertyNode &) ;
  void insertAfter(const PropertyNode &) ;
  void removeGroup(const PropertyNode &) ;
  int siblingIndex() const;
  SString getTreelocString(const PropertyNode & = PropertyNode()) const;
  PropertyNode getByTreelocString(const SString &) const;
};

Description

PropertyNode construct/copy/destruct

  1. PropertyNode(SernaApiBase * = 0);


  2. PropertyNode(const SString & name, const SString & value = SString());


  3. PropertyNode(const SString & name, bool value);


  4. PropertyNode(const SString & name, int value);


  5. PropertyNode(const SString & name, double value);


  6. ~PropertyNode();


PropertyNode public member functions

  1. SString name() const;

    Get property name.


  2. void setName(const SString & ) ;

    Set (new) property name.


  3. SString getString() const;

    Get string value of property.


  4. bool getBool(bool * ok = 0) const;

    Get boolean property value.


  5. int getInt(bool * ok = 0) const;

    Get integer property value.


  6. void * getPtr(bool * ok = 0) const;

    Get pointer property value.


  7. double getDouble(bool * ok = 0) const;

    Get double property value.


  8. void setString(const SString & value) ;

    Set (new) string value of property.


  9. void setBool(bool ) ;

    Set boolean value of property.


  10. void setInt(int ) ;

    Set integer value of property.


  11. void setPtr(void * ) ;

    Set pointer value of property.


  12. void setDouble(double ) ;

    Set double value of property.


  13. void merge(const PropertyNode & other, bool override = false) ;

    Merge values from other property tree into current property tree. Change notifications are currently not sent during merge.


  14. PropertyNode copy(bool recursive = false) const;

    Make (possible recursive) copy of this property node.


  15. PropertyNode getProperty(const SString & name) const;

    Get child property by slash-delimited path.


  16. PropertyNode getSafeProperty(const SString & name) const;

    Safely get child property (never returns NULL, returns empty property).


  17. PropertyNode makeDescendant(const SString & name) ;

    Makes child property subtree (with path). Returns the leaf.


  18. PropertyNode makeDescendant(const SString & name, const SString & value,                bool override = true) ;

    Makes child property subtree (with path). Returns the leaf.


  19. void addWatcher(PropertyNodeWatcher * watcher) ;

    Register watcher for this PropertyNode.


  20. void removeWatcher(PropertyNodeWatcher * watcher) ;

    Removes watcher.


  21. void removeAllWatchers() ;

    Removes all watchers.


  22. void dump() const;

    Dump PropertyNode.


  23. bool save(const SString & url) const;

    Save property tree to the given URL. Returns True on success.


  24. bool read(const SString & url, bool merge = false) ;

    Read property tree from the URL. If the merge attribute is false, then contents of the current property node are discarded; otherwise, existing property tree is merged with one which were read from file.


  25. PropertyNode firstChild() const;


  26. PropertyNode lastChild() const;


  27. PropertyNode getChild(int n) const;


  28. int countChildren() const;


  29. void appendChild(const PropertyNode & ) ;


  30. void removeAllChildren() ;


  31. PropertyNode nextSibling() const;


  32. PropertyNode prevSibling() const;


  33. PropertyNode parent() const;


  34. PropertyNode root() const;


  35. void remove() ;


  36. void insertBefore(const PropertyNode & ) ;


  37. void insertAfter(const PropertyNode & ) ;


  38. void removeGroup(const PropertyNode & ) ;


  39. int siblingIndex() const;


  40. SString getTreelocString(const PropertyNode & = PropertyNode()) const;


  41. PropertyNode getByTreelocString(const SString & ) const;