23 static void ReadLcf(std::vector<RPG::EventCommand>& ref,
LcfReader& stream, uint32_t length);
24 static void WriteLcf(
const std::vector<RPG::EventCommand>& ref,
LcfWriter& stream);
25 static int LcfSize(
const std::vector<RPG::EventCommand>& ref,
LcfWriter& stream);
26 static void WriteXml(
const std::vector<RPG::EventCommand>& ref,
XmlWriter& stream);
35 if (event_command.
code != 0) {
38 for (
int i = stream.
ReadInt(); i > 0; i--) {
51 for (
int i = 0; i < count; i++)
63 for (
int i = 0; i < count; i++)
90 if (strcmp(name,
"code") == 0)
92 else if (strcmp(name,
"indent") == 0)
94 else if (strcmp(name,
"string") == 0)
96 else if (strcmp(name,
"parameters") == 0)
99 stream.
Error(
"Unrecognized field '%s'", name);
111 XmlReader::Read<int>(ref.
code,
data);
117 XmlReader::Read<std::string>(ref.
string,
data);
134 std::vector<RPG::EventCommand>& event_commands,
LcfReader& stream, uint32_t length) {
137 unsigned long startpos = stream.
Tell();
138 unsigned long endpos = startpos + length;
149 event_commands.push_back(command);
151 assert(stream.
Tell() == endpos);
155 int count = event_commands.size();
156 for (
int i = 0; i < count; i++)
158 for (
int i = 0; i < 4; i++)
164 int count = event_commands.size();
165 for (
int i = 0; i < count; i++)
172 std::vector<RPG::EventCommand>::const_iterator it;
173 for (it = event_commands.begin(); it != event_commands.end(); it++)
182 if (strcmp(name,
"EventCommand") != 0)
183 stream.
Error(
"Expecting %s but got %s",
"EventCommand", name);
184 ref.resize(
ref.size() + 1);
189 std::vector<RPG::EventCommand>&
ref;
EventCommandXmlHandler(RPG::EventCommand &ref)
void Seek(size_t pos, SeekMode mode=FromStart)
void SetHandler(XmlHandler *handler)
void BeginElement(const std::string &name)
std::string Decode(const std::string &str_to_encode)
void Read(void *ptr, size_t size, size_t nmemb)
void EndElement(const std::string &name)
static void ReadLcf(T &ref, LcfReader &stream, uint32_t length)
void Error(const char *fmt,...)
void Write(const void *ptr, size_t size, size_t nmemb)
void StartElement(XmlReader &stream, const char *name, const char **)
void ReadString(std::string &ref, size_t size)
std::vector< RPG::EventCommand > & ref
static void WriteLcf(const T &ref, LcfWriter &stream)
static int LcfSize(const T &ref, LcfWriter &stream)
void EndElement(XmlReader &, const char *)
std::vector< int > parameters
EventCommandVectorXmlHandler(std::vector< RPG::EventCommand > &ref)
static int IntSize(unsigned int x)
static void BeginXml(T &ref, XmlReader &stream)
void CharacterData(XmlReader &, const std::string &data)
enum EventCommandXmlHandler::@0 field
static void WriteXml(const T &ref, XmlWriter &stream)
void WriteNode(const std::string &name, const T &val)
void StartElement(XmlReader &stream, const char *name, const char **)