liblcf
Loading...
Searching...
No Matches
writer_xml.h
Go to the documentation of this file.
1/*
2 * This file is part of liblcf. Copyright (c) 2020 liblcf authors.
3 * https://github.com/EasyRPG/liblcf - https://easyrpg.org
4 *
5 * liblcf is Free/Libre Open Source Software, released under the MIT License.
6 * For the full copyright and license information, please view the COPYING
7 * file that was distributed with this source code.
8 */
9
10#ifndef LCF_WRITER_XML_H
11#define LCF_WRITER_XML_H
12
13#include <string>
14#include <vector>
15#include <memory>
16#include <cstdio>
17#include <stdint.h>
18
22class XmlWriter {
23
24public:
30 XmlWriter(std::ostream& filestream);
31
35 ~XmlWriter();
36
40 void Close();
41
47 void WriteInt(int val);
48
54 template <class T>
55 void Write(const T& val);
56
64 template <class T>
65 void WriteNode(const std::string& name, const T& val);
66
72 void BeginElement(const std::string& name);
73
80 void BeginElement(const std::string& name, int ID);
81
87 void EndElement(const std::string& name);
88
92 void NewLine();
93
100 bool IsOk() const;
101
102protected:
104 std::ostream& stream;
108 bool at_bol;
109
113 void Indent();
114
120 template <class T>
121 void WriteVector(const std::vector<T>& val);
122
123};
124
125#endif
void BeginElement(const std::string &name)
Definition: writer_xml.cpp:161
std::ostream & stream
Definition: writer_xml.h:104
bool IsOk() const
Definition: writer_xml.cpp:199
void Indent()
Definition: writer_xml.cpp:191
int indent
Definition: writer_xml.h:106
void EndElement(const std::string &name)
Definition: writer_xml.cpp:177
void NewLine()
Definition: writer_xml.cpp:184
void Close()
void WriteInt(int val)
Definition: writer_xml.cpp:137
void Write(const T &val)
void WriteVector(const std::vector< T > &val)
Definition: writer_xml.cpp:142
bool at_bol
Definition: writer_xml.h:108
void WriteNode(const std::string &name, const T &val)
Definition: writer_xml.cpp:155