Kage Studio 0.7.230612
A Simple Free and Open Source 2D Animation Software
Loading...
Searching...
No Matches
xml.h
Go to the documentation of this file.
1/*
2 * xml.h
3 *
4 * Copyright 2019 Mj Mendoza IV <mj.mendoza.iv@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 *
21 *
22 */
23
24#ifndef KAGE_UTIL_XML_H
25 #define KAGE_UTIL_XML_H
26
27 #include <vector>
28 #include <string>
29 #include <sstream>
30 #include <iostream>
31 #include <string.h>
32 #include <fstream>
33 #include "xmltagproperty.h"
34 #include "xmltoken.h"
35 #include "xmltag.h"
36 using namespace std;
37
38 class BasicXml {
39 public:
40 BasicXml(string p_xmlContent);
41 BasicXml();
42 virtual ~BasicXml();
43
44 void setContent(string p_xmlContent);
45 string getContent();
46 bool parse(string p_content);
47 bool parse();
48
49 void setProperties(vector<XmlTagProperty> p_xmlTagProperties);
50 string getProperties();
52 std::string toString();
53 void copy(BasicXml p_xmlTag);
54 bool equalTo(BasicXml p_xmlTag);
55
56 vector<XmlToken> _tokens;
57 bool tokenize();
59
60 void debugToken(unsigned int p_index);
61 void printXML();
62 string getXML();
63 bool setXML(string p_xmldata);
64
65 static string openXMLFile(string p_path);
66 static bool isNumeric(string p_value);
67 protected:
68 unsigned int createTag(unsigned int p_index, XmlTag &p_xmlTagParent);
69 unsigned int skipWhitespace(unsigned int p_index);
70 unsigned int expectFor(unsigned int p_index, string p_token);
71 unsigned int lookFor(unsigned int p_index, string p_token);
72 unsigned int getPreviousIndex(unsigned int p_index);
73 void listChildren(vector<XmlTag> p_tags, string p_tab);
74 string getXMLChildren(vector<XmlTag> p_children, string p_tab);
75
77 vector<XmlTagProperty> _xmlTagProperties;
79// vector<XmlTag> _children;
80 };
81#endif //KAGE_UTIL_XML_H
Definition: xml.h:38
void debugToken(unsigned int p_index)
Definition: xml.cpp:341
string getXMLChildren(vector< XmlTag > p_children, string p_tab)
Definition: xml.cpp:286
virtual ~BasicXml()
Definition: xml.cpp:34
XmlTag _root
Definition: xml.h:78
unsigned int getPreviousIndex(unsigned int p_index)
Definition: xml.cpp:97
string _xmlContent
Definition: xml.h:76
BasicXml clone()
void printXML()
Definition: xml.cpp:268
unsigned int lookFor(unsigned int p_index, string p_token)
Definition: xml.cpp:86
void listChildren(vector< XmlTag > p_tags, string p_tab)
Definition: xml.cpp:256
unsigned int skipWhitespace(unsigned int p_index)
Definition: xml.cpp:63
bool tokenize()
Definition: xml.cpp:239
unsigned int expectFor(unsigned int p_index, string p_token)
Definition: xml.cpp:73
bool parse()
Definition: xml.cpp:139
string getProperties()
bool equalTo(BasicXml p_xmlTag)
BasicXml()
Definition: xml.cpp:26
static string openXMLFile(string p_path)
Definition: xml.cpp:538
string getXML()
Definition: xml.cpp:317
static bool isNumeric(string p_value)
Definition: xml.cpp:109
XmlTag getRoot()
Definition: xml.cpp:50
void copy(BasicXml p_xmlTag)
string getContent()
Definition: xml.cpp:41
void setContent(string p_xmlContent)
Definition: xml.cpp:38
vector< XmlTagProperty > _xmlTagProperties
Definition: xml.h:77
bool setXML(string p_xmldata)
Definition: xml.cpp:273
void setProperties(vector< XmlTagProperty > p_xmlTagProperties)
vector< XmlToken > _tokens
Definition: xml.h:56
std::string toString()
Definition: xml.cpp:53
unsigned int createTag(unsigned int p_index, XmlTag &p_xmlTagParent)
Definition: xml.cpp:349
Definition: xmltag.h:33