Sunset old XML child system

This commit is contained in:
2023-07-12 10:54:02 -07:00
parent 19c6575aaf
commit c2831f54e8
7 changed files with 67 additions and 27 deletions

View File

@ -33,6 +33,9 @@ namespace Dawn {
protected:
static bool_t isWhitespace(char_t c);
// @deprecated
std::vector<Xml*> children;
public:
static Xml load(std::string data);
static void load(Xml *xml, std::string data, size_t *j);
@ -43,9 +46,6 @@ namespace Dawn {
std::string textContent;
std::map<std::string, std::string> attributes;
std::vector<struct XmlNode> childNodes;
// @deprecated
std::vector<Xml*> children;
std::vector<Xml*> getChildrenOfType(std::string type);
Xml * getFirstChildOfType(std::string type);

View File

@ -56,10 +56,15 @@ int32_t SceneItemParser::onParse(
struct SceneItemDependency dep;
auto itChildren = node->children.begin();
while(itChildren != node->children.end()) {
auto itChildren = node->childNodes.begin();
while(itChildren != node->childNodes.end()) {
if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) {
++itChildren;
continue;
}
// Parse child nodes, they may be components or not
auto c = *itChildren;
auto c = itChildren->child;
if(c->node == "child" || c->node == "item") {
struct SceneItem child;

View File

@ -32,9 +32,14 @@ int32_t SceneParser::onParse(
struct SceneItemDependency dep;
//Parse the children
auto itChildren = node->children.begin();
while(itChildren != node->children.end()) {
Xml *child = *itChildren;
auto itChildren = node->childNodes.begin();
while(itChildren != node->childNodes.end()) {
if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) {
++itChildren;
continue;
}
Xml *child = itChildren->child;
if(child->node == "asset") {
struct SceneAsset asset;

View File

@ -29,9 +29,14 @@ int32_t VNSceneParser::onParse(
if(ret != 0) return ret;
// Now pass the VN Events
auto itChildren = node->children.begin();
while(itChildren != node->children.end()) {
Xml *child = *itChildren;
auto itChildren = node->childNodes.begin();
while(itChildren != node->childNodes.end()) {
if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) {
++itChildren;
continue;
}
Xml *child = itChildren->child;
if(child->node != "events") {
++itChildren;
continue;

View File

@ -22,9 +22,14 @@ int32_t VNChoiceParser::onParse(
std::string *error
) {
int32_t ret;
auto itChildren = node->children.begin();
while(itChildren != node->children.end()) {
Xml *child = *itChildren;
auto itChildren = node->childNodes.begin();
while(itChildren != node->childNodes.end()) {
if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) {
++itChildren;
continue;
}
Xml *child = itChildren->child;
// Parse strings
if(child->node == "string") {
@ -61,16 +66,26 @@ int32_t VNChoicesEventParser::onParse(
std::string *error
) {
int32_t ret;
auto itChildren = node->children.begin();
while(itChildren != node->children.end()) {
Xml *child = *itChildren;
auto itChildren = node->childNodes.begin();
while(itChildren != node->childNodes.end()) {
if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) {
++itChildren;
continue;
}
Xml *child = itChildren->child;
// Parse strings
if(child->node == "title") {
auto itChildren2 = child->children.begin();
while(itChildren2 != child->children.end()) {
auto itChildren2 = child->childNodes.begin();
while(itChildren2 != child->childNodes.end()) {
if(itChildren2->nodeType != XML_NODE_TYPE_ELEMENT) {
++itChildren2;
continue;
}
VNText text;
ret = (VNTextParser()).parse(*itChildren2, &text, error);
ret = (VNTextParser()).parse(itChildren2->child, &text, error);
if(ret != 0) return ret;
out->titles.push_back(text);
++itChildren2;

View File

@ -24,9 +24,14 @@ int32_t VNSceneEventsParser::onParse(
) {
int32_t ret;
auto itChildren = node->children.begin();
while(itChildren != node->children.end()) {
Xml *child = *itChildren;
auto itChildren = node->childNodes.begin();
while(itChildren != node->childNodes.end()) {
if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) {
++itChildren;
continue;
}
Xml *child = itChildren->child;
struct VNSceneEvent event;
// Parse event(s)

View File

@ -47,9 +47,14 @@ int32_t VNTextEventParser::onParse(
std::string *error
) {
int32_t ret;
auto itChildren = node->children.begin();
while(itChildren != node->children.end()) {
Xml *child = *itChildren;
auto itChildren = node->childNodes.begin();
while(itChildren != node->childNodes.end()) {
if(itChildren->nodeType != XML_NODE_TYPE_ELEMENT) {
++itChildren;
continue;
}
Xml *child = itChildren->child;
// Parse strings
if(child->node == "string") {