ARC SDK
|
Configuration element - represents (sub)tree of ARC XML configuration. More...
#include <arc/ArcConfig.h>
Public Member Functions | |
Config () | |
Creates empty XML tree. | |
Config (const NS &ns) | |
Creates an empty configuration object with the given namespace. | |
Config (const char *filename) | |
Loads configuration document from file at filename. | |
Config (const std::string &xml_str) | |
Parse configuration document from string. | |
Config (XMLNode xml) | |
Acquire existing XML (sub)tree. More... | |
Config (XMLNode xml, const std::string &filename) | |
Acquire existing XML (sub)tree and set config file. More... | |
Config (long cfg_ptr_addr) | |
Copy constructor used by language bindings. | |
Config (const Config &cfg) | |
Copy constructor used by language bindings. | |
void | print (void) |
Print structure of document for debugging purposes. More... | |
bool | parse (const char *filename) |
Parse configuration document from file at filename. | |
const std::string & | getFileName (void) const |
Returns file name of config file or empty string if it was generated from the XMLNode subtree. | |
void | setFileName (const std::string &filename) |
Set the file name of config file. | |
void | save (const char *filename) |
Save config to file. | |
![]() | |
XMLNode (void) | |
Constructor of invalid node. More... | |
XMLNode (const XMLNode &node) | |
Copies existing instance. More... | |
XMLNode (const std::string &xml) | |
Creates XML document structure from textual representation of XML document. More... | |
XMLNode (const char *xml, int len=-1) | |
Creates XML document structure from textual representation of XML document. More... | |
XMLNode (long ptr_addr) | |
Copy constructor. Used by language bindings. | |
XMLNode (const NS &ns, const char *name) | |
Creates empty XML document structure with specified namespaces. More... | |
~XMLNode (void) | |
Destructor. More... | |
void | New (XMLNode &node) const |
Creates a copy of XML (sub)tree. More... | |
void | Exchange (XMLNode &node) |
Exchanges XML (sub)trees. More... | |
void | Move (XMLNode &node) |
Moves content of this XML (sub)tree to node. More... | |
void | Swap (XMLNode &node) |
Swaps XML (sub)trees to which this and node refer. More... | |
operator bool (void) const | |
Returns true if instance points to XML element - valid instance. | |
bool | operator! (void) const |
Returns true if instance does not point to XML element - invalid instance. | |
bool | operator== (const XMLNode &node) |
Returns true if 'node' represents same XML element. | |
bool | operator!= (const XMLNode &node) |
Returns false if 'node' represents same XML element. | |
bool | Same (const XMLNode &node) |
Returns true if 'node' represents same XML element - for bindings. | |
bool | operator== (bool val) |
This operator is needed to avoid ambiguity. | |
bool | operator!= (bool val) |
This operator is needed to avoid ambiguity. | |
bool | operator== (const std::string &str) |
This operator is needed to avoid ambiguity. | |
bool | operator!= (const std::string &str) |
This operator is needed to avoid ambiguity. | |
bool | operator== (const char *str) |
This operator is needed to avoid ambiguity. | |
bool | operator!= (const char *str) |
This operator is needed to avoid ambiguity. | |
XMLNode | Child (int n=0) |
Returns XMLNode instance representing n-th child of XML element. More... | |
XMLNode | operator[] (const char *name) const |
Returns XMLNode instance representing first child element with specified name. More... | |
XMLNode | operator[] (const std::string &name) const |
Returns XMLNode instance representing first child element with specified name. More... | |
XMLNode | operator[] (int n) const |
Returns XMLNode instance representing n-th node in sequence of siblings of same name. More... | |
void | operator++ (void) |
Convenience operator to switch to next element of same name. More... | |
void | operator-- (void) |
Convenience operator to switch to previous element of same name. More... | |
int | Size (void) const |
Returns number of children nodes. | |
XMLNode | Get (const std::string &name) const |
Same as operator[](). | |
std::string | Name (void) const |
Returns name of XML node. | |
std::string | Prefix (void) const |
Returns namespace prefix of XML node. | |
std::string | FullName (void) const |
Returns prefix:name of XML node. | |
std::string | Namespace (void) const |
Returns namespace URI of XML node. | |
void | Prefix (const std::string &prefix, int recursion=0) |
Assigns namespace prefix to XML node(s). More... | |
void | StripNamespace (int recursion=0) |
Removes namespace prefix from XML node(s). | |
void | Name (const char *name) |
Assigns new name to XML node. | |
void | Name (const std::string &name) |
Assigns new name to XML node. | |
void | GetXML (std::string &out_xml_str, bool user_friendly=false) const |
Fills argument with this instance XML subtree textual representation. | |
void | GetXML (std::string &out_xml_str, const std::string &encoding, bool user_friendly=false) const |
Get string representation of XML subtree. More... | |
void | GetDoc (std::string &out_xml_str, bool user_friendly=false) const |
Fills out_xml_str with whole XML document textual representation. | |
operator std::string (void) const | |
Returns textual content of node excluding content of children nodes. | |
XMLNode & | operator= (const char *content) |
Sets textual content of node. All existing children nodes are discarded. | |
XMLNode & | operator= (const std::string &content) |
Sets textual content of node. All existing children nodes are discarded. | |
void | Set (const std::string &content) |
Same as operator=. Used for bindings. | |
XMLNode & | operator= (const XMLNode &node) |
Make instance refer to another XML node. Ownership is not inherited. More... | |
XMLNode | Attribute (int n=0) |
Returns XMLNode instance reresenting n-th attribute of node. | |
XMLNode | Attribute (const char *name) |
Returns XMLNode instance representing first attribute of node with specified by name. | |
XMLNode | Attribute (const std::string &name) |
Returns XMLNode instance representing first attribute of node with specified by name. | |
XMLNode | NewAttribute (const char *name) |
Creates new attribute with specified name. | |
XMLNode | NewAttribute (const std::string &name) |
Creates new attribute with specified name. | |
int | AttributesSize (void) const |
Returns number of attributes of node. | |
void | Namespaces (const NS &namespaces, bool keep=false, int recursion=-1) |
Assigns namespaces of XML document at point specified by this instance. More... | |
NS | Namespaces (void) |
Returns namespaces known at this node. | |
std::string | NamespacePrefix (const char *urn) |
Returns prefix of specified namespace or empty string if no such namespace. | |
XMLNode | NewChild (const char *name, int n=-1, bool global_order=false) |
Creates new child XML element at specified position with specified name. More... | |
XMLNode | NewChild (const std::string &name, int n=-1, bool global_order=false) |
Same as NewChild(const char*,int,bool). | |
XMLNode | NewChild (const char *name, const NS &namespaces, int n=-1, bool global_order=false) |
Creates new child XML element at specified position with specified name and namespaces. More... | |
XMLNode | NewChild (const std::string &name, const NS &namespaces, int n=-1, bool global_order=false) |
Same as NewChild(const char*,const NS&,int,bool). | |
XMLNode | NewChild (const XMLNode &node, int n=-1, bool global_order=false) |
Link a copy of supplied XML node as child. More... | |
void | Replace (const XMLNode &node) |
Makes a copy of supplied XML node and makes this instance refer to it. | |
void | Destroy (void) |
Destroys underlying XML element. More... | |
XMLNodeList | Path (const std::string &path) |
Collects nodes corresponding to specified path. More... | |
XMLNodeList | XPathLookup (const std::string &xpathExpr, const NS &nsList) |
Uses xPath to look up the whole xml structure,. More... | |
XMLNode | GetRoot (void) |
Get the root node from any child node of the tree. | |
XMLNode | Parent (void) |
Get the parent node from any child node of the tree. | |
bool | SaveToFile (const std::string &file_name) const |
Save string representation of node to file. | |
bool | SaveToStream (std::ostream &out) const |
Save string representation of node to stream. | |
bool | ReadFromFile (const std::string &file_name) |
Read XML document from file and associate it with this node. | |
bool | ReadFromStream (std::istream &in) |
Read XML document from stream and associate it with this node. | |
bool | Validate (const std::string &schema_file, std::string &err_msg) |
XML schema validation against the schema file defined as argument. | |
bool | Validate (XMLNode schema_doc, std::string &err_msg) |
Additional Inherited Members | |
![]() | |
XMLNode (xmlNodePtr node) | |
Protected constructor for inherited classes. More... | |
bool | Validate (xmlSchemaPtr schema, std::string &err_msg) |
![]() | |
static void | LogError (void *ctx, const char *msg,...) |
![]() | |
bool | is_owner_ |
If true node is owned by this instance - hence released in destructor. More... | |
bool | is_temporary_ |
This variable is reserved for future use. | |
Configuration element - represents (sub)tree of ARC XML configuration.
This class is intended to be used to pass configuration details to various parts of HED and external modules. Currently it's just a wrapper over XML tree. But that may change in the future, although the interface should be preserved. Currently it is capable of loading an XML configuration document from a file. In future it will be capable of loading a more user-readable format and processing it into a tree-like structure convenient for machine processing (XML-like). So far there are no schema and/or namespaces assigned.
|
inline |
Acquire existing XML (sub)tree.
Content is not copied. Make sure XML tree is not destroyed while in use by this object.
|
inline |
Acquire existing XML (sub)tree and set config file.
Content is not copied. Make sure XML tree is not destroyed while in use by this object.
void Arc::Config::print | ( | void | ) |
Print structure of document for debugging purposes.
Printed content is not an XML document.