liblcf
|
#include <reader_xml.h>
Public Member Functions | |
XmlReader (std::istream &filestream) | |
~XmlReader () | |
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) |
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) |
template<> | |
void | Read (bool &val, const std::string &data) |
template<> | |
void | Read (int32_t &val, const std::string &data) |
template<> | |
void | Read (int8_t &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) |
Protected Attributes | |
std::istream & | stream |
void * | parser |
int | nesting |
std::vector< XmlHandler * > | handlers |
std::string | buffer |
XmlReader class template.
Definition at line 31 of file reader_xml.h.
XmlReader::XmlReader | ( | std::istream & | filestream | ) |
Constructs a new File Reader.
filestream | already opened filestream. |
Definition at line 32 of file reader_xml.cpp.
XmlReader::~XmlReader | ( | ) |
Destructor. Closes the opened file.
Definition at line 47 of file reader_xml.cpp.
References parser.
void XmlReader::CharacterData | ( | const char * | s, |
int | len | ||
) |
void XmlReader::EndElement | ( | const char * | name | ) |
End element callback.
Definition at line 95 of file reader_xml.cpp.
References buffer, XmlHandler::CharacterData(), and handlers.
void XmlReader::Error | ( | const char * | fmt, |
... | |||
) |
Reports a parsing error.
Definition at line 59 of file reader_xml.cpp.
Referenced by Parse(), EquipmentXmlHandler::StartElement(), EventCommandXmlHandler::StartElement(), EventCommandVectorXmlHandler::StartElement(), ParametersXmlHandler::StartElement(), RectXmlHandler::StartElement(), TreeMapXmlHandler::StartElement(), MoveCommandXmlHandler::StartElement(), MoveCommandVectorXmlHandler::StartElement(), FlagsXmlHandler< S >::StartElement(), WrapperXmlHandler::StartElement(), RootXmlHandler< S >::StartElement(), StructFieldXmlHandler< S >::StartElement(), and StructVectorXmlHandler< S >::StartElement().
bool XmlReader::IsOk | ( | ) | const |
Checks if the file is readable and if no error occured.
Definition at line 55 of file reader_xml.cpp.
References parser, and stream.
Referenced by LDB_Reader::LoadXml(), LMT_Reader::LoadXml(), LMU_Reader::LoadXml(), LSD_Reader::LoadXml(), and Parse().
void XmlReader::Parse | ( | ) |
Parses the XML file.
Definition at line 67 of file reader_xml.cpp.
References buffer, Error(), IsOk(), parser, and stream.
Referenced by LDB_Reader::LoadXml(), LMT_Reader::LoadXml(), LMU_Reader::LoadXml(), and LSD_Reader::LoadXml().
|
static |
Definition at line 107 of file reader_xml.cpp.
References Data::data.
|
static |
Definition at line 149 of file reader_xml.cpp.
References Data::data.
|
static |
Definition at line 137 of file reader_xml.cpp.
References Data::data.
|
static |
Definition at line 115 of file reader_xml.cpp.
References Data::data.
|
static |
Definition at line 121 of file reader_xml.cpp.
References Data::data.
|
static |
Parses a primitive type.
Referenced by EquipmentXmlHandler::CharacterData(), RectXmlHandler::CharacterData(), Primitive< int32_t >::ParseXml(), Primitive< std::string >::ParseXml(), Primitive< std::vector< T > >::ParseXml(), and Primitive< T >::ParseXml().
|
static |
Definition at line 143 of file reader_xml.cpp.
References Data::data.
|
static |
Definition at line 129 of file reader_xml.cpp.
References Data::data.
|
static |
Parses a vector of primitive type.
Definition at line 182 of file reader_xml.cpp.
References Data::data.
void XmlReader::SetHandler | ( | XmlHandler * | handler | ) |
Changes the handler.
Definition at line 80 of file reader_xml.cpp.
References handlers.
Referenced by RawStruct< RPG::Equipment >::BeginXml(), RawStruct< RPG::EventCommand >::BeginXml(), RawStruct< RPG::MoveCommand >::BeginXml(), RawStruct< RPG::Parameters >::BeginXml(), RawStruct< RPG::Rect >::BeginXml(), RawStruct< RPG::TreeMap >::BeginXml(), Struct< S >::BeginXml(), Flags< S >::BeginXml(), RawStruct< std::vector< RPG::EventCommand > >::BeginXml(), RawStruct< std::vector< RPG::MoveCommand > >::BeginXml(), LDB_Reader::LoadXml(), LMT_Reader::LoadXml(), LMU_Reader::LoadXml(), LSD_Reader::LoadXml(), EventCommandVectorXmlHandler::StartElement(), MoveCommandVectorXmlHandler::StartElement(), WrapperXmlHandler::StartElement(), StructFieldXmlHandler< S >::StartElement(), and StructVectorXmlHandler< S >::StartElement().
void XmlReader::StartElement | ( | const char * | name, |
const char ** | atts | ||
) |
Start element callback.
Definition at line 84 of file reader_xml.cpp.
|
protected |
Text buffer.
Definition at line 109 of file reader_xml.h.
Referenced by CharacterData(), EndElement(), Parse(), and StartElement().
|
protected |
Handler stack.
Definition at line 107 of file reader_xml.h.
Referenced by XmlReader(), EndElement(), SetHandler(), and StartElement().
|
protected |
Nesting depth.
Definition at line 105 of file reader_xml.h.
|
protected |
Expat XML parser object.
Definition at line 102 of file reader_xml.h.
Referenced by XmlReader(), ~XmlReader(), IsOk(), and Parse().
|
protected |
File-stream managed by this Reader.
Definition at line 97 of file reader_xml.h.