-
Notifications
You must be signed in to change notification settings - Fork 0
/
Xml.h
64 lines (39 loc) · 1.47 KB
/
Xml.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef XML_H
#define XML_H
#include <string>
#include <memory>
#include <fstream>
#include "XmlType.h"
/*
class TagRegular;
class TagClosing;
class TagSelfClosing;
class TagComment;
class TagScript;
class TagDoc;
class XmlText;*/
class Xml {
public:
Xml() = default;
virtual ~Xml() = default;
virtual const XmlType& getType() const = 0;
///Setters
virtual void setName(const std::string& value) = 0;
virtual void removeAttribute(const std::string& attr) = 0;
virtual void setAttribute(const std::string& attr, const std::string& value) = 0;
virtual void setText(const std::string& value) = 0;
virtual void addXml(std::unique_ptr<Xml> xml) = 0;
virtual void removeXml(size_t index) = 0;
virtual void replaceXml(size_t index, std::unique_ptr<Xml> xml) = 0;
///Getters
virtual const std::string& getName() const = 0;
virtual bool isAttribute(const std::string& name) const = 0;
virtual const std::string& getAttributeValueOrElse(const std::string& attr, const std::string& other) const = 0;
virtual const std::string& getText() const = 0;
virtual size_t getXmlCount() const = 0;
virtual const Xml* getXml(size_t index) const = 0;
virtual Xml* getXml(size_t index) = 0;
virtual std::string toString(const std::string& indent) const = 0;
virtual bool save(std::ofstream& stream, const std::string& indent) const = 0;
};
#endif //XML_H