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;
59 int getIntProp(
const std::string& name )
const noexcept;
61 int getPIntProp(
const std::string& name,
int def )
const noexcept;
62 void setProp(
const std::string& name,
const std::string& text )
noexcept;
64 bool findName(
const std::string& node,
const std::string& searchname,
bool deepfind =
true )
noexcept;
65 bool find(
const std::string& searchnode,
bool deepfind =
true)
noexcept;
66 xmlNode* findX( xmlNode* root,
const std::string& searchnode,
bool deepfind =
true )
const noexcept;
77 bool canPrev()
const noexcept;
78 bool canNext()
const noexcept;
103 xmlNode* getCurrent()
noexcept;
106 const std::string getName()
const noexcept;
107 const std::string getContent()
const noexcept;
109 operator xmlNode* ()
const noexcept;
111 void goBegin()
noexcept;
112 void goEnd()
noexcept;
114 UniXMLPropList getPropList()
const;
126 typedef UniXMLPropList PropList;
128 UniXML(
const std::string& filename );
132 xmlNode* getFirstNode()
noexcept;
133 xmlNode* getFirstNode()
const noexcept;
140 void open(
const std::string& filename );
141 bool isOpen()
const noexcept;
145 std::string getFileName()
const noexcept;
147 void createFromText(
const std::string& text );
151 void newDoc(
const std::string& root_node,
const std::string& xml_ver =
"1.0");
154 static std::string getProp(
const xmlNode* node,
const std::string& name)
noexcept;
155 static std::string getProp2(
const xmlNode* node,
const std::string& name,
const std::string& defval =
"" )
noexcept;
157 static int getIntProp(
const xmlNode* node,
const std::string& name)
noexcept;
160 static int getPIntProp(
const xmlNode* node,
const std::string& name,
int def)
noexcept;
163 static void setProp(xmlNode* node,
const std::string& name,
const std::string& text);
165 static UniXMLPropList getPropList( xmlNode* node );
168 static xmlNode* createChild(xmlNode* node,
const std::string& title,
const std::string& text);
171 static xmlNode* createNext(xmlNode* node,
const std::string& title,
const std::string& text);
174 static xmlNode* insertNext(xmlNode* node,
const std::string& title,
const std::string& text);
180 static xmlNode*
copyNode(xmlNode* node,
int recursive = 1);
184 bool save(
const std::string& filename =
"",
int level = 2);
187 static xmlNode* nextNode(xmlNode* node);
191 xmlNode* findNode( xmlNode* node,
const std::string& searchnode,
const std::string& name =
"")
const;
196 xmlNode* extFindNode( xmlNode* node,
int depth,
int width,
const std::string& searchnode,
const std::string& name =
"",
bool top =
true )
const;
201 xmlNode* findNodeLevel1( xmlNode* root,
const std::string& nodename,
const std::string& nm =
"" )
const;
205 std::string filename;
209 void operator()(xmlDoc* doc)
const noexcept
216 std::unique_ptr<xmlDoc, UniXMLDocDeleter> doc;
bool goParent() noexcept
Definition UniXML.cc:519
bool goThrowNext() noexcept
Definition UniXML.cc:463
bool goPrev() noexcept
Definition UniXML.cc:484
bool goChildren() noexcept
Definition UniXML.cc:531
bool goNext() noexcept
Definition UniXML.cc:444
int getPIntProp(const std::string &name, int def) const noexcept
if value if not positive ( <= 0 ), returns def
Definition UniXML.cc:627
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:282
static void removeNode(xmlNode *node)
Удаление указанного узла со всеми вложенными
Definition UniXML.cc:276
Definition Calibration.h:27