diff options
Diffstat (limited to '')
-rw-r--r-- | src/astleaf.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/astleaf.h b/src/astleaf.h new file mode 100644 index 0000000..0c8911b --- /dev/null +++ b/src/astleaf.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef AST_LEAF_H | ||
2 | #define AST_LEAF_H | ||
3 | |||
4 | #include "astnode.h" | ||
5 | #include "bu/fstring.h" | ||
6 | #include "bu/formatter.h" | ||
7 | |||
8 | class AstLeaf : public AstNode | ||
9 | { | ||
10 | public: | ||
11 | AstLeaf( Type eType ); | ||
12 | AstLeaf( Type eType, int iNew ); | ||
13 | AstLeaf( Type eType, float fNew ); | ||
14 | AstLeaf( Type eType, bool bNew ); | ||
15 | AstLeaf( Type eType, const Bu::FString &sNew ); | ||
16 | AstLeaf( Type eType, const char *sNew ); | ||
17 | virtual ~AstLeaf(); | ||
18 | |||
19 | void setIntValue( int iNew ); | ||
20 | void setFloatValue( float fNew ); | ||
21 | void setBoolValue( bool bNew ); | ||
22 | void setStrValue( const Bu::FString &sNew ); | ||
23 | |||
24 | int getIntValue() const; | ||
25 | float getFloatValue() const; | ||
26 | bool getBoolValue() const; | ||
27 | Bu::FString &getStrValue() const; | ||
28 | |||
29 | private: | ||
30 | union | ||
31 | { | ||
32 | int iVal; | ||
33 | float fVal; | ||
34 | bool bVal; | ||
35 | Bu::FString *sVal; | ||
36 | }; | ||
37 | }; | ||
38 | |||
39 | Bu::Formatter &operator<<( Bu::Formatter &f, const AstLeaf &l ); | ||
40 | |||
41 | #endif | ||