36#include <libxml/parser.h>
37#include <libxml/tree.h>
41 typedef std::vector< std::pair<const std::string, const std::string> > UniXMLPropList;
46 using iterator_category = std::bidirectional_iterator_tag;
47 using value_type = xmlNode;
48 using difference_type = ptrdiff_t;
49 using pointer =
const value_type*;
50 using reference =
const value_type&;
57 std::string getProp2(
const std::string& name,
const std::string& defval =
"" )
const noexcept;
58 std::string getProp(
const std::string& name )
const noexcept;
60 std::string
getPropOrProp(
const std::string& name1,
const std::string& name2 )
const noexcept;
61 int getIntProp(
const std::string& name )
const noexcept;
63 int getPIntProp(
const std::string& name,
int def )
const noexcept;
64 void setProp(
const std::string& name,
const std::string& text )
noexcept;
66 bool findName(
const std::string& node,
const std::string& searchname,
bool deepfind =
true )
noexcept;
67 bool find(
const std::string& searchnode,
bool deepfind =
true)
noexcept;
68 xmlNode* findX( xmlNode* root,
const std::string& searchnode,
bool deepfind =
true )
const noexcept;
79 bool canPrev()
const noexcept;
80 bool canNext()
const noexcept;
105 xmlNode* getCurrent()
noexcept;
108 const std::string getName()
const noexcept;
109 const std::string getContent()
const noexcept;
111 operator xmlNode* ()
const noexcept;
113 void goBegin()
noexcept;
114 void goEnd()
noexcept;
116 UniXMLPropList getPropList()
const;
128 typedef UniXMLPropList PropList;
130 UniXML(
const std::string& filename );
134 xmlNode* getFirstNode()
noexcept;
135 xmlNode* getFirstNode()
const noexcept;
142 void open(
const std::string& filename );
143 bool isOpen()
const noexcept;
147 std::string getFileName()
const noexcept;
149 void createFromText(
const std::string& text );
153 void newDoc(
const std::string& root_node,
const std::string& xml_ver =
"1.0");
156 static std::string getProp(
const xmlNode* node,
const std::string& name)
noexcept;
157 static std::string getProp2(
const xmlNode* node,
const std::string& name,
const std::string& defval =
"" )
noexcept;
159 static std::string
getPropOrProp(
const xmlNode* node,
const std::string& name1,
const std::string& name2)
noexcept;
161 static int getIntProp(
const xmlNode* node,
const std::string& name)
noexcept;
164 static int getPIntProp(
const xmlNode* node,
const std::string& name,
int def)
noexcept;
167 static void setProp(xmlNode* node,
const std::string& name,
const std::string& text);
169 static UniXMLPropList getPropList( xmlNode* node );
172 static xmlNode* createChild(xmlNode* node,
const std::string& title,
const std::string& text);
175 static xmlNode* createNext(xmlNode* node,
const std::string& title,
const std::string& text);
178 static xmlNode* insertNext(xmlNode* node,
const std::string& title,
const std::string& text);
184 static xmlNode*
copyNode(xmlNode* node,
int recursive = 1);
188 bool save(
const std::string& filename =
"",
int level = 2);
191 static xmlNode* nextNode(xmlNode* node);
195 xmlNode* findNode( xmlNode* node,
const std::string& searchnode,
const std::string& name =
"")
const;
200 xmlNode* extFindNode( xmlNode* node,
int depth,
int width,
const std::string& searchnode,
const std::string& name =
"",
bool top =
true )
const;
205 xmlNode* findNodeLevel1( xmlNode* root,
const std::string& nodename,
const std::string& nm =
"" )
const;
209 std::string filename;
213 void operator()(xmlDoc* doc)
const noexcept
220 std::unique_ptr<xmlDoc, UniXMLDocDeleter> doc;
bool goParent() noexcept
Definition UniXML.cc:529
std::string getPropOrProp(const std::string &name1, const std::string &name2) const noexcept
Get property by name1, if empty - try name2.
Definition UniXML.cc:596
bool goThrowNext() noexcept
Definition UniXML.cc:473
bool goPrev() noexcept
Definition UniXML.cc:494
bool goChildren() noexcept
Definition UniXML.cc:541
bool goNext() noexcept
Definition UniXML.cc:454
int getPIntProp(const std::string &name, int def) const noexcept
if value if not positive ( <= 0 ), returns def
Definition UniXML.cc:642
static std::string getPropOrProp(const xmlNode *node, const std::string &name1, const std::string &name2) noexcept
Get property by name1, if empty - try name2.
Definition UniXML.cc:226
static int getPIntProp(const xmlNode *node, const std::string &name, int def) noexcept
if value if not positive ( <= 0 ), returns def
Definition UniXML.cc:216
iterator begin() noexcept
Definition UniXML.cc:100
static xmlNode * copyNode(xmlNode *node, int recursive=1)
Definition UniXML.cc:292
static void removeNode(xmlNode *node)
Удаление указанного узла со всеми вложенными
Definition UniXML.cc:286
Definition AccessConfig.h:30