sptk2 logo
SPTK Home Page
ExportXML.h
1#pragma once
2
3#include <sptk5/Buffer.h>
4#include <sptk5/String.h>
5#include <sptk5/xdoc/Document.h>
6#include <sptk5/xdoc/Node.h>
7#include <sptk5/xdoc/XMLDocType.h>
8
9namespace sptk::xdoc {
10
11class SP_EXPORT ExportXML
12{
13public:
14 explicit ExportXML(int indentSpaces = 2)
15 : m_indentSpaces(indentSpaces)
16 {
17 }
18
19 void saveElement(const Node* node, const String& nodeName, Buffer& buffer, bool formatted, int indent);
20
21 void appendSubNodes(const Node* node, Buffer& buffer, bool formatted, int indent);
22
23 static void appendClosingTag(const Node* node, Buffer& buffer, bool formatted, int indent);
24
25 void saveAttributes(const Node* node, Buffer& buffer);
26
27 int indentSpaces() const
28 {
29 return m_indentSpaces;
30 }
31
32private:
33 int m_indentSpaces {2};
34 XMLDocType m_docType;
35
36 Buffer& appendNodeContent(const Node* node, Buffer& buffer);
37
38 void appendNodeNameAndAttributes(const Node* node, const String& nodeName, Buffer& buffer);
39
40 void appendNodeEnd(const Node* node, const String& nodeName, Buffer& buffer, bool isNode);
41};
42
43} // namespace sptk::xdoc
Definition: Buffer.h:51
Definition: String.h:49
Definition: ExportXML.h:12
Definition: Node.h:48
Definition: XMLDocType.h:50

Fri Oct 14 2022 09:58:32: SPTK 5.4.1