liblcf
|
#include <writer_xml.h>
Public Member Functions | |
XmlWriter (std::ostream &filestream) | |
~XmlWriter () | |
void | Close () |
void | WriteInt (int val) |
template<class T > | |
void | Write (const T &val) |
template<class T > | |
void | WriteNode (const std::string &name, const T &val) |
void | BeginElement (const std::string &name) |
void | BeginElement (const std::string &name, int ID) |
void | EndElement (const std::string &name) |
void | NewLine () |
bool | IsOk () const |
template<> | |
void | Write (const bool &val) |
template<> | |
void | Write (const int32_t &val) |
template<> | |
void | Write (const int8_t &val) |
template<> | |
void | Write (const uint8_t &val) |
template<> | |
void | Write (const int16_t &val) |
template<> | |
void | Write (const uint32_t &val) |
template<> | |
void | Write (const double &val) |
Protected Member Functions | |
void | Indent () |
template<class T > | |
void | WriteVector (const std::vector< T > &val) |
Protected Attributes | |
std::ostream & | stream |
int | indent |
bool | at_bol |
XmlWriter class.
Definition at line 22 of file writer_xml.h.
XmlWriter::XmlWriter | ( | std::ostream & | filestream | ) |
Constructs a new XML File Writer.
filestream | already opened filestream. |
Definition at line 18 of file writer_xml.cpp.
References stream.
XmlWriter::~XmlWriter | ( | ) |
Destructor. Closes the opened file.
Definition at line 27 of file writer_xml.cpp.
void XmlWriter::BeginElement | ( | const std::string & | name | ) |
Writes element starting tag to the stream.
name | the element name string. |
Definition at line 161 of file writer_xml.cpp.
References indent, Indent(), NewLine(), and stream.
Referenced by LMT_Reader::SaveXml(), LMU_Reader::SaveXml(), LDB_Reader::SaveXml(), LSD_Reader::SaveXml(), WriteNode(), RawStruct< RPG::TreeMap >::WriteXml(), RawStruct< RPG::MoveCommand >::WriteXml(), RawStruct< RPG::Equipment >::WriteXml(), RawStruct< RPG::Rect >::WriteXml(), RawStruct< RPG::Parameters >::WriteXml(), RawStruct< RPG::EventCommand >::WriteXml(), TypedField< S, T >::WriteXml(), Flags< S >::WriteXml(), IDReaderT< S, true >::WriteXmlTag(), and IDReaderT< S, false >::WriteXmlTag().
void XmlWriter::BeginElement | ( | const std::string & | name, |
int | ID | ||
) |
void XmlWriter::Close | ( | ) |
Closes the opened file.
void XmlWriter::EndElement | ( | const std::string & | name | ) |
Writes element ending tag to the stream.
name | the element name string. |
Definition at line 177 of file writer_xml.cpp.
References indent, Indent(), NewLine(), and stream.
Referenced by LMT_Reader::SaveXml(), LMU_Reader::SaveXml(), LDB_Reader::SaveXml(), LSD_Reader::SaveXml(), WriteNode(), RawStruct< RPG::TreeMap >::WriteXml(), RawStruct< RPG::MoveCommand >::WriteXml(), RawStruct< RPG::Equipment >::WriteXml(), RawStruct< RPG::Parameters >::WriteXml(), RawStruct< RPG::Rect >::WriteXml(), RawStruct< RPG::EventCommand >::WriteXml(), TypedField< S, T >::WriteXml(), Struct< S >::WriteXml(), and Flags< S >::WriteXml().
|
protected |
Writes an indentation to the stream.
Definition at line 191 of file writer_xml.cpp.
References at_bol, indent, and stream.
Referenced by BeginElement(), EndElement(), Write(), and WriteVector().
bool XmlWriter::IsOk | ( | ) | const |
Checks if the file is writable and if no error occured.
Definition at line 199 of file writer_xml.cpp.
References stream.
Referenced by LMT_Reader::SaveXml(), LMU_Reader::SaveXml(), LSD_Reader::SaveXml(), and LDB_Reader::SaveXml().
void XmlWriter::NewLine | ( | ) |
Writes a line break to the stream.
Definition at line 184 of file writer_xml.cpp.
References at_bol, and stream.
Referenced by BeginElement(), and EndElement().
void XmlWriter::Write | ( | const bool & | val | ) |
Definition at line 31 of file writer_xml.cpp.
References Indent(), and stream.
void XmlWriter::Write | ( | const int32_t & | val | ) |
Definition at line 37 of file writer_xml.cpp.
References Indent(), and stream.
void XmlWriter::Write | ( | const int8_t & | val | ) |
Definition at line 43 of file writer_xml.cpp.
References WriteInt().
void XmlWriter::Write | ( | const uint8_t & | val | ) |
Definition at line 48 of file writer_xml.cpp.
References WriteInt().
void XmlWriter::Write | ( | const int16_t & | val | ) |
Definition at line 53 of file writer_xml.cpp.
References WriteInt().
void XmlWriter::Write | ( | const T & | val | ) |
Writes a primitive value to the stream.
val | the value. |
Referenced by RawStruct< RPG::TreeMap >::WriteXml(), Primitive< T >::WriteXml(), Primitive< std::vector< T > >::WriteXml(), and Primitive< std::string >::WriteXml().
void XmlWriter::Write | ( | const uint32_t & | val | ) |
Definition at line 58 of file writer_xml.cpp.
References Indent(), and stream.
void XmlWriter::Write | ( | const double & | val | ) |
Definition at line 64 of file writer_xml.cpp.
References Indent(), and stream.
void XmlWriter::WriteInt | ( | int | val | ) |
Writes an integer to the stream.
val | the integer. |
Definition at line 137 of file writer_xml.cpp.
Referenced by Write(), and Primitive< int32_t >::WriteXml().
template void XmlWriter::WriteNode< double > | ( | const std::string & | name, |
const T & | val | ||
) |
Writes a primitive value in a node to the stream. Calls BeginElement, Write and EndElement.
name | the node name string. |
val | the value. |
Definition at line 155 of file writer_xml.cpp.
References BeginElement(), and EndElement().
Referenced by RawStruct< RPG::Equipment >::WriteXml(), RawStruct< RPG::Rect >::WriteXml(), RawStruct< RPG::MoveCommand >::WriteXml(), RawStruct< RPG::TreeMap >::WriteXml(), RawStruct< RPG::Parameters >::WriteXml(), RawStruct< RPG::EventCommand >::WriteXml(), and Flags< S >::WriteXml().
|
protected |
Writes a vector of primitive values to the stream.
val | vector to write. |
Definition at line 142 of file writer_xml.cpp.
References Indent(), and stream.
|
protected |
Indicates if writer cursor is at the beginning of the line.
Definition at line 108 of file writer_xml.h.
|
protected |
Stores indentation level.
Definition at line 106 of file writer_xml.h.
Referenced by BeginElement(), EndElement(), and Indent().
|
protected |
File-stream managed by this Writer.
Definition at line 104 of file writer_xml.h.
Referenced by BeginElement(), EndElement(), Indent(), IsOk(), NewLine(), Write(), WriteVector(), and XmlWriter().