blob: 92dd65e28ad3cba39e923119c06d781eda57bfb2 (
plain)
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
|
#ifndef SML_NODE_H
#define SML_NODE_H
#include <bu/string.h>
#include <bu/list.h>
class SmlNode
{
friend Bu::Formatter &operator<<( Bu::Formatter &f, const SmlNode &n );
public:
enum Type
{
typeRoot,
typeText,
typeTag,
};
SmlNode( Type eType, const Bu::String &sText=Bu::String(), SmlNode *pParent=NULL );
virtual ~SmlNode();
static SmlNode *parse( const Bu::String &sSrc );
typedef Bu::List<SmlNode *> SmlNodeList;
SmlNode *append( Type type, const Bu::String &sText );
SmlNode *getParent() { return pParent; }
Type getType() const { return eType; }
Bu::String getText() const { return sText; }
const SmlNodeList &getChildren() const { return lChildren; }
private:
Type eType;
Bu::String sText;
SmlNodeList lChildren;
SmlNode *pParent;
};
Bu::Formatter &operator<<( Bu::Formatter &f, const SmlNode &n );
#endif
|