Dawn/src/dawntools/util/XmlNew.hpp
2023-02-07 21:22:57 -08:00

43 lines
1.1 KiB
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "dawnsharedlibs.hpp"
namespace Dawn {
enum XmlParseState {
XML_PARSE_STATE_DOING_NOTHING,
XML_PARSE_STATE_PARSING_TAG_NAME,
XML_PARSE_STATE_LOOKING_FOR_ATTRIBUTE,
XML_PARSE_STATE_PARSING_ATTRIBUTE_NAME,
XML_PARSE_STATE_LOOKING_FOR_ATTRIBUTE_VALUE,
XML_PARSE_STATE_PARSING_ATTRIBUTE_VALUE,
XML_PARSE_STATE_PARSING_VALUE,
XML_PARSE_STATE_PARSING_CHILD,
XML_PARSE_STATE_PARSING_CLOSE,
XML_PARSE_STATE_PARSING_COMMENT
};
class Xml {
protected:
static bool_t isWhitespace(char_t c);
public:
static Xml load(std::string data);
static void load(Xml *xml, std::string data, size_t *j);
std::string node;
std::string value;
std::map<std::string, std::string> attributes;
std::vector<Xml*> children;
std::vector<Xml*> getChildrenOfType(std::string type);
Xml * getFirstChildOfType(std::string type);
~Xml();
};
}