36 #include <libxml/parser.h> 37 #include <libxml/tree.h> 41 typedef std::vector< std::pair<const std::string, const std::string> > UniXMLPropList;
44 public std::iterator<std::bidirectional_iterator_tag, xmlNode, ptrdiff_t, xmlNode*, xmlNode&>
52 std::string getProp2(
const std::string& name,
const std::string& defval =
"" )
const noexcept;
53 std::string getProp(
const std::string& name )
const noexcept;
54 int getIntProp(
const std::string& name )
const noexcept;
56 int getPIntProp(
const std::string& name,
int def )
const noexcept;
57 void setProp(
const std::string& name,
const std::string& text ) noexcept;
59 bool findName(
const std::string& node,
const std::string& searchname,
bool deepfind =
true ) noexcept;
60 bool find(
const std::string& searchnode,
bool deepfind =
true) noexcept;
61 xmlNode* findX( xmlNode* root,
const std::string& searchnode,
bool deepfind =
true ) noexcept;
72 bool canPrev()
const noexcept;
73 bool canNext()
const noexcept;
98 xmlNode* getCurrent() noexcept;
101 const std::string getName()
const noexcept;
102 const std::string getContent()
const noexcept;
104 operator xmlNode* ()
const noexcept;
106 void goBegin() noexcept;
107 void goEnd() noexcept;
109 UniXMLPropList getPropList()
const;
121 typedef UniXMLPropList PropList;
123 UniXML(
const std::string& filename );
127 xmlNode* getFirstNode() noexcept;
128 xmlNode* getFirstNode()
const noexcept;
131 iterator begin() noexcept;
132 iterator end() noexcept;
135 void open(
const std::string& filename );
136 bool isOpen()
const noexcept;
140 std::string getFileName()
const noexcept;
143 void newDoc(
const std::string& root_node,
const std::string& xml_ver =
"1.0");
146 static std::string getProp(
const xmlNode* node,
const std::string& name) noexcept;
147 static std::string getProp2(
const xmlNode* node,
const std::string& name,
const std::string& defval =
"" ) noexcept;
149 static int getIntProp(
const xmlNode* node,
const std::string& name) noexcept;
152 static int getPIntProp(
const xmlNode* node,
const std::string& name,
int def) noexcept;
155 static void setProp(xmlNode* node,
const std::string& name,
const std::string& text);
157 static UniXMLPropList getPropList( xmlNode* node );
160 static xmlNode* createChild(xmlNode* node,
const std::string& title,
const std::string& text);
163 static xmlNode* createNext(xmlNode* node,
const std::string& title,
const std::string& text);
166 static void removeNode(xmlNode* node);
169 static xmlNode* copyNode(xmlNode* node,
int recursive = 1);
173 bool save(
const std::string& filename =
"",
int level = 2);
176 static xmlNode* nextNode(xmlNode* node);
180 xmlNode* findNode( xmlNode* node,
const std::string& searchnode,
const std::string& name =
"")
const;
185 xmlNode* extFindNode( xmlNode* node,
int depth,
int width,
const std::string& searchnode,
const std::string& name =
"",
bool top =
true )
const;
190 xmlNode* findNodeLevel1( xmlNode* root,
const std::string& nodename,
const std::string& nm =
"" );
194 std::string filename;
198 void operator()(xmlDoc* doc)
const noexcept
205 std::unique_ptr<xmlDoc, UniXMLDocDeleter> doc;
Definition: CallbackTimer.h:29
bool goThrowNext() noexcept
Definition: UniXML.cc:420
bool goChildren() noexcept
Definition: UniXML.cc:482
int getPIntProp(const std::string &name, int def) const noexcept
if value if not positive ( <= 0 ), returns def
Definition: UniXML.cc:576
bool goNext() noexcept
Definition: UniXML.cc:404
bool goParent() noexcept
Definition: UniXML.cc:470
bool goPrev() noexcept
Definition: UniXML.cc:438