diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-01-05 00:41:22 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-01-05 00:41:22 -0700 |
commit | de83196633b28f06bb8c08ddf5780cc8049703f4 (patch) | |
tree | 25e1434132496a68112f4e0fe52d82fcb2cbc91c /src/smlnode.h | |
parent | ef56ac3105dbd72cc5989edef9bbbb3fedfe6449 (diff) | |
download | stage-de83196633b28f06bb8c08ddf5780cc8049703f4.tar.gz stage-de83196633b28f06bb8c08ddf5780cc8049703f4.tar.bz2 stage-de83196633b28f06bb8c08ddf5780cc8049703f4.tar.xz stage-de83196633b28f06bb8c08ddf5780cc8049703f4.zip |
Interface plugin basics. SML system parser.
Diffstat (limited to 'src/smlnode.h')
-rw-r--r-- | src/smlnode.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/smlnode.h b/src/smlnode.h new file mode 100644 index 0000000..92dd65e --- /dev/null +++ b/src/smlnode.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef SML_NODE_H | ||
2 | #define SML_NODE_H | ||
3 | |||
4 | #include <bu/string.h> | ||
5 | #include <bu/list.h> | ||
6 | |||
7 | class SmlNode | ||
8 | { | ||
9 | friend Bu::Formatter &operator<<( Bu::Formatter &f, const SmlNode &n ); | ||
10 | public: | ||
11 | enum Type | ||
12 | { | ||
13 | typeRoot, | ||
14 | typeText, | ||
15 | typeTag, | ||
16 | }; | ||
17 | |||
18 | SmlNode( Type eType, const Bu::String &sText=Bu::String(), SmlNode *pParent=NULL ); | ||
19 | virtual ~SmlNode(); | ||
20 | |||
21 | static SmlNode *parse( const Bu::String &sSrc ); | ||
22 | |||
23 | typedef Bu::List<SmlNode *> SmlNodeList; | ||
24 | |||
25 | SmlNode *append( Type type, const Bu::String &sText ); | ||
26 | SmlNode *getParent() { return pParent; } | ||
27 | |||
28 | Type getType() const { return eType; } | ||
29 | Bu::String getText() const { return sText; } | ||
30 | const SmlNodeList &getChildren() const { return lChildren; } | ||
31 | |||
32 | private: | ||
33 | Type eType; | ||
34 | Bu::String sText; | ||
35 | SmlNodeList lChildren; | ||
36 | SmlNode *pParent; | ||
37 | }; | ||
38 | |||
39 | Bu::Formatter &operator<<( Bu::Formatter &f, const SmlNode &n ); | ||
40 | |||
41 | #endif | ||