|
commonlib
|
SerializableNode is an abstract class that defines functions for writing/reading to/from a custom file or stream and inherits from a Node abstract class. More...
#include <serializable_node.h>
Public Member Functions | |
| virtual void | saveToFile (const std::string &fileName)=0 |
| virtual void | readFromFile (const std::string &fileName)=0 |
| virtual void | saveToStream (std::ostream &outStream)=0 |
| virtual void | readFromStream (std::istream &inStream)=0 |
Public Member Functions inherited from Node | |
| virtual void | destroy ()=0 |
| destroy function releases internal node and sets it value to nullptr. | |
| template<typename T > | |
| void | addAttribute (const std::string &name, const T &value) |
| addAttribute function adds an attribute with a given name and given value to a node. More... | |
| template<typename T > | |
| void | write (const std::string &name, const T &value) |
| write function creates a new child with a given name and adds a given value to it. More... | |
| template<typename T , typename U > | |
| void | write (const std::string &name, const T &value, const U &defaultValue) |
| write function creates a new child with a given name and adds a given value to it. More... | |
| template<typename T > | |
| void | read (const std::string &name, T &value) |
| read function reads a value from a nodes child with a given name. More... | |
| template<typename T , typename U > | |
| void | read (const std::string &name, T &value, const U &defaultValue) |
| read function reads a value from a nodes child with a given name. More... | |
| template<typename T > | |
| void | update (const std::string &name, T &value) |
| update function writes or reads a value to/from a node, depends on nodes isWriteUpdateType More... | |
| template<typename T , typename U > | |
| void | update (const std::string &name, T &value, const U &defaultValue) |
| update function writes or reads a value to/from a node, depends on nodes isWriteUpdateType More... | |
| virtual NodePtr | updateChild (const std::string &childName)=0 |
| updateChild function creates or finds a node child with a given name based on update type More... | |
| virtual NodePtr | readChild (const std::string &childName)=0 |
| readChild function finds a node child with a given name More... | |
| virtual NodePtr | createNode (std::string name, std::string value)=0 |
| createNode function creates a new Node and returns a pointer to it. More... | |
| virtual void | initializeNode (std::string name, std::string value)=0 |
| initializeNode function initializes an empty Node with a given name and given value. More... | |
| virtual void | initializeNode (NodePtr node)=0 |
| initializeNode function initializes an empty Node with a given node. More... | |
| virtual void | setValue (std::string value)=0 |
| setValue function sets a given value to a node. More... | |
| virtual NodePtr | addChild (std::string name)=0 |
| addChild function creates and adds a child with a given name to a node and returns a pointer to it. More... | |
| virtual NodePtr | addChild (const NodePtr &childNode)=0 |
| addChild function creates and adds a given child node to a node and returns a pointer to it. More... | |
| virtual NodePtr | clone ()=0 |
| clone function creates a clone of a node. More... | |
| NodePtr | clone (const NodePtr &nodeToClone) |
| clone function creates a clone of a given node and returns a pointer to it. More... | |
| virtual NodePtr | addAttributeNode (const NodePtr &attributeNode)=0 |
| addAttributeNode adds a given attribute node to a node and returns a pointer to it. More... | |
| virtual void | clearChildNodes ()=0 |
| clearChildNodes clears all child nodes. | |
| virtual void | clearAttributeNodes ()=0 |
| clearAttributeNodes clears all attribute nodes. | |
| virtual NodePtr | findChildNode (const std::string &name)=0 |
| findChildNode finds a child node with a given name and returns a pointer to it or nullptr if not found. More... | |
| virtual NodePtr | findAttributeNode (const std::string &name)=0 |
| findAttributeNode finds an attribute node with a given name and returns a pointer to it or nullptr if not found. More... | |
| virtual NodePtr | getAttribute (const size_t attributeIndex)=0 |
| getAttribute returns an attribute with a given index or nullptr if index is invalid. More... | |
| virtual NodePtr | getChild (const size_t childIndex)=0 |
| getChild returns a child with a given index or nullptr if index is invalid. More... | |
| virtual size_t | getAttributeCount ()=0 |
| getAttributeCount returns a number of attributes of a node. More... | |
| virtual size_t | getChildCount ()=0 |
| getChildCount returns a number of children of a node. More... | |
| virtual void | removeAttribute (const std::string &attributeName)=0 |
| removeAttribute removes all attributes with a given name from a node. More... | |
| virtual void | removeAttribute (const size_t attributeIndex)=0 |
| removeAttribute removes an attribute with a given index from a node. More... | |
| virtual void | removeAttribute (NodePtr &attributeNode)=0 |
| removeAttribute removes an attribute that has the same name as given attribute node. More... | |
| virtual void | removeChild (const std::string &childName)=0 |
| removeChild removes all children with a given name from a node. More... | |
| virtual void | removeChild (const size_t childIndex)=0 |
| removeChild removes a child with a given index from a node. More... | |
| virtual void | removeChild (NodePtr &childNode)=0 |
| removeChild removes a child that has the same name as given node. More... | |
| virtual std::string | getName ()=0 |
| getName returns a name of a node. More... | |
| virtual std::string | getValue ()=0 |
| getValue returns a value of a node. More... | |
| virtual NodePtr | getNextSibling ()=0 |
| getNextSibling returns a sibling of a node or nullptr if it doesnt exist. More... | |
| virtual void | updateOperation (bool write)=0 |
| updateOperation sets a node update operation (node can be used either for writting or reading). More... | |
| virtual bool | isWrite ()=0 |
| isWrite returns true if node should be used for writting or false otherwise. More... | |
| virtual bool | isInitialized ()=0 |
| isInitialized returns true if node is initialized or false otherwise. More... | |
| virtual bool | isEmpty ()=0 |
| isEmpty returns true if node does not have any children, attributes and if it does not have any value More... | |
| bool | isDummy () const |
| isDummy returns true if node was created as a dummy node in updateChild function More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Node | |
| virtual void | internalWrite (const std::string &name, const std::string &value, const std::string &defaultValue)=0 |
| virtual void | internalRead (const std::string &name, std::string &value, const std::string &defaultValue)=0 |
| virtual void | internalAddAttribute (const std::string &name, const std::string &value)=0 |
Protected Attributes inherited from Node | |
| bool | isDummyNode = false |
SerializableNode is an abstract class that defines functions for writing/reading to/from a custom file or stream and inherits from a Node abstract class.
You can create its descendants if you want to implement these functions.