Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
44
Src/replicant/nswasabi/XMLString.cpp
Normal file
44
Src/replicant/nswasabi/XMLString.cpp
Normal file
|
@ -0,0 +1,44 @@
|
|||
#include "XMLString.h"
|
||||
|
||||
/* TODO: make and use some sort of nx_mutable_string_t object */
|
||||
XMLString::XMLString()
|
||||
{
|
||||
data=0;
|
||||
}
|
||||
|
||||
XMLString::~XMLString()
|
||||
{
|
||||
NXMutableStringDestroy(data);
|
||||
}
|
||||
|
||||
|
||||
void XMLString::Reset()
|
||||
{
|
||||
if (data)
|
||||
data->nx_string_data->len = 0; // TODO: make mutable string function for this
|
||||
}
|
||||
|
||||
nx_string_t XMLString::GetString()
|
||||
{
|
||||
// TODO: make mutable string function for this
|
||||
nx_string_t str = data->nx_string_data;
|
||||
data->nx_string_data = 0;
|
||||
NXMutableStringDestroy(data);
|
||||
data=0;
|
||||
return str;
|
||||
}
|
||||
|
||||
void XMLString::XMLCallback_OnStartElement(const nsxml_char_t *xmlpath, const nsxml_char_t *xmltag, ifc_xmlattributes *attributes)
|
||||
{
|
||||
if (data)
|
||||
data->nx_string_data->len = 0; // TODO: make mutable string function for this
|
||||
}
|
||||
|
||||
void XMLString::XMLCallback_OnCharacterData(const nsxml_char_t *xmlpath, const nsxml_char_t *xmltag, const nsxml_char_t *characters, size_t num_characters)
|
||||
{
|
||||
if (!data)
|
||||
data = NXMutableStringCreateFromXML(characters, num_characters);
|
||||
else
|
||||
NXMutableStringGrowFromXML(data, characters, num_characters);
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue