liblcf
|
#include <reader_xml.h>
Public Member Functions | |
XmlReader (const std::string &filename) | |
~XmlReader () | |
void | Open () |
void | Close () |
bool | IsOk () const |
void | Error (const char *fmt,...) |
void | Parse () |
void | SetHandler (XmlHandler *handler) |
void | StartElement (const char *name, const char **atts) |
void | CharacterData (const char *s, int len) |
void | EndElement (const char *name) |
template<> | |
void | Read (bool &val, const std::string &data) |
template<> | |
void | Read (int &val, const std::string &data) |
template<> | |
void | Read (uint8_t &val, const std::string &data) |
template<> | |
void | Read (int16_t &val, const std::string &data) |
template<> | |
void | Read (uint32_t &val, const std::string &data) |
template<> | |
void | Read (double &val, const std::string &data) |
Static Public Member Functions | |
template<class T > | |
static void | Read (T &ref, const std::string &data) |
template<class T > | |
static void | ReadVector (std::vector< T > &ref, const std::string &data) |
Protected Attributes | |
std::string | filename |
FILE * | stream |
void * | parser |
int | nesting |
std::vector< XmlHandler * > | handlers |
std::string | buffer |
XmlReader class template.
Definition at line 28 of file reader_xml.h.
XmlReader::XmlReader | ( | const std::string & | filename | ) |
Constructs a new File Reader.
filename | file to open. |
Definition at line 30 of file reader_xml.cpp.
References Open().
XmlReader::~XmlReader | ( | ) |
Destructor. Closes the opened file.
Definition at line 38 of file reader_xml.cpp.
References Close().
void XmlReader::CharacterData | ( | const char * | s, |
int | len | ||
) |
void XmlReader::Close | ( | ) |
Closes the opened file.
Definition at line 55 of file reader_xml.cpp.
References parser, and stream.
Referenced by ~XmlReader().
void XmlReader::EndElement | ( | const char * | name | ) |
End element callback.
Definition at line 107 of file reader_xml.cpp.
References buffer, XmlHandler::CharacterData(), and handlers.
void XmlReader::Error | ( | const char * | fmt, |
... | |||
) |
Reports a parsing error.
Definition at line 71 of file reader_xml.cpp.
Referenced by Parse(), RectXmlHandler::StartElement(), EquipmentXmlHandler::StartElement(), ParametersXmlHandler::StartElement(), TreeMapXmlHandler::StartElement(), FlagsXmlHandler< S >::StartElement(), EventCommandXmlHandler::StartElement(), MoveCommandXmlHandler::StartElement(), StructFieldXmlHandler< S >::StartElement(), EventCommandVectorXmlHandler::StartElement(), MoveCommandVectorXmlHandler::StartElement(), StructVectorXmlHandler< S >::StartElement(), WrapperXmlHandler::StartElement(), and RootXmlHandler< S >::StartElement().
bool XmlReader::IsOk | ( | ) | const |
Checks if the file is readable and if no error occured.
Definition at line 67 of file reader_xml.cpp.
References parser, and stream.
Referenced by LMU_Reader::LoadXml(), LMT_Reader::LoadXml(), LSD_Reader::LoadXml(), LDB_Reader::LoadXml(), and Parse().
void XmlReader::Open | ( | ) |
Definition at line 42 of file reader_xml.cpp.
References filename, handlers, parser, and stream.
Referenced by XmlReader().
void XmlReader::Parse | ( | ) |
Parses the XML file.
Definition at line 79 of file reader_xml.cpp.
References buffer, Error(), IsOk(), parser, and stream.
Referenced by LMU_Reader::LoadXml(), LMT_Reader::LoadXml(), LSD_Reader::LoadXml(), and LDB_Reader::LoadXml().
|
static |
Parses a primitive type.
Referenced by RectXmlHandler::CharacterData(), EquipmentXmlHandler::CharacterData(), Primitive< T >::ParseXml(), Primitive< std::vector< T > >::ParseXml(), Primitive< int >::ParseXml(), and Primitive< std::string >::ParseXml().
void XmlReader::Read | ( | bool & | val, |
const std::string & | data | ||
) |
Definition at line 119 of file reader_xml.cpp.
References Data::data.
void XmlReader::Read | ( | int & | val, |
const std::string & | data | ||
) |
Definition at line 127 of file reader_xml.cpp.
References Data::data.
void XmlReader::Read | ( | uint8_t & | val, |
const std::string & | data | ||
) |
Definition at line 133 of file reader_xml.cpp.
References Data::data.
void XmlReader::Read | ( | int16_t & | val, |
const std::string & | data | ||
) |
Definition at line 141 of file reader_xml.cpp.
References Data::data.
void XmlReader::Read | ( | uint32_t & | val, |
const std::string & | data | ||
) |
Definition at line 147 of file reader_xml.cpp.
References Data::data.
void XmlReader::Read | ( | double & | val, |
const std::string & | data | ||
) |
Definition at line 153 of file reader_xml.cpp.
References Data::data.
|
static |
Parses a vector of primitive type.
Definition at line 186 of file reader_xml.cpp.
void XmlReader::SetHandler | ( | XmlHandler * | handler | ) |
Changes the handler.
Definition at line 92 of file reader_xml.cpp.
References handlers.
Referenced by RawStruct< RPG::MoveCommand >::BeginXml(), RawStruct< RPG::Equipment >::BeginXml(), RawStruct< RPG::Rect >::BeginXml(), RawStruct< RPG::TreeMap >::BeginXml(), RawStruct< RPG::Parameters >::BeginXml(), RawStruct< RPG::EventCommand >::BeginXml(), RawStruct< std::vector< RPG::MoveCommand > >::BeginXml(), RawStruct< std::vector< RPG::EventCommand > >::BeginXml(), Struct< S >::BeginXml(), Flags< S >::BeginXml(), LMU_Reader::LoadXml(), LMT_Reader::LoadXml(), LSD_Reader::LoadXml(), LDB_Reader::LoadXml(), StructFieldXmlHandler< S >::StartElement(), EventCommandVectorXmlHandler::StartElement(), MoveCommandVectorXmlHandler::StartElement(), StructVectorXmlHandler< S >::StartElement(), and WrapperXmlHandler::StartElement().
void XmlReader::StartElement | ( | const char * | name, |
const char ** | atts | ||
) |
Start element callback.
Definition at line 96 of file reader_xml.cpp.
|
protected |
Text buffer.
Definition at line 118 of file reader_xml.h.
Referenced by CharacterData(), EndElement(), Parse(), and StartElement().
|
protected |
Name of the file that is associated with the stream.
Definition at line 104 of file reader_xml.h.
Referenced by Open().
|
protected |
Handler stack.
Definition at line 116 of file reader_xml.h.
Referenced by EndElement(), Open(), SetHandler(), and StartElement().
|
protected |
Nesting depth.
Definition at line 114 of file reader_xml.h.
|
protected |
|
protected |