14.05.2015, 02:42
Quote:
I'm sorry but isn't this just a ripoff of another XML plugin's code?
|
scripting.cpp (Zeex's plugin):
pawn Код:
// native xml_get_string(XML:handle, const xpath[], result[], size = sizeof result);
static cell AMX_NATIVE_CALL n_xml_get_string(AMX *amx, cell *params)
{
document_iterator i = documents.find(reinterpret_cast<pugi::xml_document*>(params[1]));
if (i != documents.end())
{
char *xpath;
amx_StrParam(amx, params[2], xpath);
cell* addr;
amx_GetAddr(amx, params[3], &addr);
try
{
amx_SetString(addr, pugi::xpath_query(xpath).evaluate_string(*(i->first)).c_str(), 0, 0, params[4]);
return 1;
}
catch (std::exception &e)
{
logprintf("XML exception: %s\n", e.what());
}
}
return 0;
}
pawn Код:
static cell AMX_NATIVE_CALL plugin_xml_get_value_string(AMX *amx, cell *params) // native xml_get_value_string(XML:handle, const node[], destination[], size = sizeof destination);
{
document_iterator doc = documents.find(reinterpret_cast<pugi::xml_document*>(params[1]));
if (doc != documents.end())
{
char *node;
amx_StrParam(amx, params[2], node);
cell* addr;
amx_GetAddr(amx, params[3], &addr);
try
{
amx_SetString(addr, pugi::xpath_query(node).evaluate_string(*(doc->first)).c_str(), 0, 0, params[4]);
return 1;
}
catch (std::exception &error)
{
logprintf("[jXML] Exception: %s\n", error.what());
}
}
return 0;
}