/
ElementNode.h
executable file
·42 lines (33 loc) · 1.15 KB
/
ElementNode.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
#ifndef __ELEMENTNODE_H__
#define __ELEMENTNODE_H__
#include "Node.h"
#include "CommentNode.h"
#include "TextNode.h"
namespace tinyXMLpp{
class ElementNode : public Node {
std::vector<Attribute*> attributes;
int numberOfAttributes;
bool isRoot;
std::string name;
ElementNode(){}
ElementNode(std::string name):numberOfAttributes(0), name(name) { }
public:
~ElementNode();
/*Used to Construct the Element Node*/
static ElementNode* createElementNode();
static ElementNode* createElementNode(const std::string& name);
/*Returns the name of the Element Tag*/
std::string getName() const;
/*Methods to add and remove attributes*/
void addAttribute (Attribute* attrib);
void addAttribute(const std::string& key, const std::string& value);
void removeAttribute(const std::string& name);
/*Methods to retrieve the attributes*/
int getNumberOfAttributes() const;
Attribute* getAttribute(const std::string& name);
const std::vector<Attribute*>& getAttributes() const;
/*Method to write the Node to an output stream*/
void write(std::ostream& os) const;
};
}
#endif