14 const char*
node =
nullptr;
20 this->attributes = attr;
39 assert(
p_out !=
nullptr);
40 return p_out->println(
"<?xml version=\"1.0\"?>");
48 const char* attributes =
nullptr) {
51 return printNode(node, children, attributes);
55 const char* attributes =
nullptr) {
56 assert(
p_out !=
nullptr);
63 size_t printNode(
const char* node,
const char* txt =
nullptr,
64 const char* attributes =
nullptr) {
65 assert(
p_out !=
nullptr);
68 result +=
p_out->print(
"<");
69 result +=
p_out->print(node);
70 result +=
p_out->println(
"/>");
73 result +=
p_out->print(txt);
80 const char* attributes =
nullptr) {
81 assert(
p_out !=
nullptr);
83 result +=
p_out->print(txt);
88 size_t printNode(
const char* node, std::function<
size_t(
void)> callback,
89 const char* attributes =
nullptr) {
90 assert(
p_out !=
nullptr);
98 const char* ns =
nullptr) {
99 assert(
p_out !=
nullptr);
101 result +=
p_out->print(
"<");
103 result +=
p_out->print(ns);
104 result +=
p_out->print(
":");
106 result +=
p_out->print(node);
107 if (attributes !=
nullptr) {
108 result +=
p_out->print(
" ");
109 result +=
p_out->print(attributes);
111 result +=
p_out->print(
">");
116 const char* ns =
nullptr) {
118 result = +
p_out->println();
123 size_t result =
p_out->print(
"</");
125 result +=
p_out->print(ns);
126 result +=
p_out->print(
":");
128 result +=
p_out->print(node);
129 result +=
p_out->println(
">");
137 assert(
p_out !=
nullptr);
138 return p_out->println(txt);
144 for (
auto& node : children) {
A simple wrapper to provide string functions on char*. If the underlying char* is a const we do not a...
Definition: StrView.h:25
Vector implementation which provides the most important methods as defined by std::vector....
Definition: Vector.h:21
void push_back(T &&value)
Definition: Vector.h:167
Definition: Allocator.h:6
Represents a single XML element.
Definition: XMLPrinter.h:13
const char * node
Definition: XMLPrinter.h:14
const char * content
Definition: XMLPrinter.h:16
XMLNode(const char *node, const char *content, const char *attr=nullptr)
Definition: XMLPrinter.h:18
const char * attributes
Definition: XMLPrinter.h:15
Functions to efficiently output XML. XML data contains a lot of redundancy so it is more memory effic...
Definition: XMLPrinter.h:31
size_t printNodeBegin(const char *node, const char *attributes=nullptr, const char *ns=nullptr)
Definition: XMLPrinter.h:97
size_t printNodeBeginNl(const char *node, const char *attributes=nullptr, const char *ns=nullptr)
Definition: XMLPrinter.h:115
size_t printNode(const char *node, XMLNode child, const char *attributes=nullptr)
Definition: XMLPrinter.h:47
Print * p_out
Definition: XMLPrinter.h:134
size_t printNode(const char *node, Vector< XMLNode > children, const char *attributes=nullptr)
Definition: XMLPrinter.h:54
size_t printNode(XMLNode node)
Definition: XMLPrinter.h:43
size_t printNode(const char *node, int txt, const char *attributes=nullptr)
Definition: XMLPrinter.h:79
size_t printNode(const char *node, std::function< size_t(void)> callback, const char *attributes=nullptr)
Definition: XMLPrinter.h:88
XMLPrinter(Print &output)
Definition: XMLPrinter.h:33
size_t printNodeEnd(const char *node, const char *ns=nullptr)
Definition: XMLPrinter.h:122
size_t println(const char *txt)
Definition: XMLPrinter.h:136
size_t printChildren(Vector< XMLNode > &children)
Definition: XMLPrinter.h:142
void setOutput(Print &output)
Defines the output.
Definition: XMLPrinter.h:36
size_t printNode(const char *node, const char *txt=nullptr, const char *attributes=nullptr)
Definition: XMLPrinter.h:63
size_t printXMLHeader()
Definition: XMLPrinter.h:38