62 const size_t msgSize = strlen(
msg);
63 if (msgSize * 3 >
size)
66 char* buf =
new char[
size + 1];
95 if (Fuzzer::conditionTerminate(filename.c_str()))
101 char *
data =
nullptr;
112 file.open(filename.c_str(), std::ios::in);
117 file.seekg(0, std::ios::end);
126 file.seekg(0, std::ios::beg);
146 reportAlways(
"Error parsing XML file %s", filename.c_str())
151 reportAlways(
"Error loading XML file %s", filename.c_str())
171 return mDoc !=
nullptr ? xmlDocGetRootElement(
mDoc) :
nullptr;
175 const char *
const name,
180 xmlChar *
const prop = XmlGetProp(node, name);
183 ret = atoi(
reinterpret_cast<const char*
>(prop));
191 const char *
const name,
198 xmlChar *
const prop = XmlGetProp(node, name);
201 ret = atoi(
reinterpret_cast<char*
>(prop));
212 const char *
const name,
217 xmlChar *
const prop = XmlGetProp(node, name);
220 ret =
static_cast<float>(atof(
reinterpret_cast<char*
>(prop)));
228 const char *
const name,
233 xmlChar *
const prop = XmlGetProp(node, name);
236 ret = atof(
reinterpret_cast<char*
>(prop));
244 const char *
const name,
245 const std::string &def)
247 xmlChar *
const prop = XmlGetProp(node, name);
250 std::string val =
reinterpret_cast<char*
>(prop);
259 const char *
const name,
260 const std::string &def)
270 const char *
const name,
273 xmlChar *
const prop = XmlGetProp(node, name);
275 if (XmlStrEqual(prop,
"true"))
280 if (XmlStrEqual(prop,
"false"))
290 const char *
const name)
292 if (parent ==
nullptr)
296 if (xmlNameEqual(child, name))
322 const xmlDocPtr doc = xmlReadFile(
fileName.c_str(),
323 nullptr, XML_PARSE_PEDANTIC);
324 const bool valid1(doc !=
nullptr);
330 file.open(
fileName.c_str(), std::ios::in);
337 if (!file.getline(line, 100))
341 const std::string str = line;
#define reportAlways(...)
void log_r(const char *const log_text,...)
const std::string getStr(const std::string &str)
static bool validateXml(const std::string &fileName)
Document(const std::string &filename, const UseVirtFs useResman, const SkipError skipError)
static void xmlErrorLogger(void *ctx, const char *msg,...)
#define for_each_xml_child_node(var, parent)
bool msg(InputEvent &event)
union EAthena::ItemFlags __attribute__((packed))
const char * loadFile(std::string filename, int &fileSize)
std::string langProperty(const xmlNodePtr node, const char *const name, const std::string &def)
float getFloatProperty(const xmlNodePtr node, const char *const name, float def)
bool getBoolProperty(const xmlNodePtr node, const char *const name, const bool def)
int getProperty(const xmlNodePtr node, const char *const name, int def)
int getIntProperty(const xmlNodePtr node, const char *const name, int def, const int min, const int max)
xmlNodePtr findFirstChildByName(const xmlNode *const parent, const char *const name)
double getDoubleProperty(const xmlNodePtr node, const char *const name, double def)
#define BLOCK_START(name)
const bool SkipError_false
bool strStartWith(const std::string &str1, const std::string &str2)
const bool UseVirtFs_true