17 #ifndef ESTOOLS_OHMMS_LIBXML_DEF_H 18 #define ESTOOLS_OHMMS_LIBXML_DEF_H 62 inline char*
castXMLCharToChar(xmlChar* c) {
return static_cast<char*
>(
static_cast<void*
>(c)); }
66 inline const char*
castXMLCharToChar(
const xmlChar* c) {
return static_cast<const char*
>(
static_cast<const void*
>(c)); }
70 inline xmlChar*
castCharToXMLChar(
char* c) {
return static_cast<xmlChar*
>(
static_cast<void*
>(c)); }
76 return static_cast<const xmlChar*
>(
static_cast<const void*
>(c));
92 return !stream.fail();
100 while (success && first != last)
103 success = !stream.fail();
121 if (cur->children == NULL)
124 s.setf(std::ios::scientific, std::ios::floatfield);
141 inline bool putContent(std::vector<T>& a,
const xmlNodePtr cur)
143 if (cur->children == NULL)
159 inline bool getContent(
const std::vector<T>& a, xmlNodePtr cur)
163 for (
int i = 0; i < a.size(); i++)
177 xmlNodePtr element = cur->children;
178 while (element != NULL)
180 std::string cname((
const char*)(element->name));
181 functor(cname, element);
182 element = element->next;
std::string getNodeName(xmlNodePtr cur)
XMLNodeString convert xmlNode contents into a std::string XMLAttrString convert one xmlNode attribute...
void setXMLNodeContent(xmlNodePtr cur) const
write a string to an xmlNode
char * castXMLCharToChar(xmlChar *c)
assign a value from a node. Use specialization for classes.
bool putContent(T &a, xmlNodePtr cur)
replaces a's value with the first "element" in the "string" returned by XMLNodeString{cur}.
convert xmlNode contents into a std::string
bool getContent(const T &a, xmlNodePtr cur)
write a value to a node.
void processChildren(const xmlNodePtr cur, const F &functor)
process through all the children of an XML element F is a lambda or functor void F/[](const std::stri...
xmlChar * castCharToXMLChar(char *c)
unsafe char* to xmlChar* cast