diff options
author | Mike Buland <eichlan@xagasoft.com> | 2010-10-12 06:09:48 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2010-10-12 06:09:48 +0000 |
commit | 1ee5f374ed986333d5cdbbf41390f1c4c755a8e3 (patch) | |
tree | 67b02598d3dca87a82263629a1290bd7b7a79006 /src/variant.h | |
parent | 313e28df2a8776c82f5493aef6fe44ad40f1935a (diff) | |
download | libbu++-1ee5f374ed986333d5cdbbf41390f1c4c755a8e3.tar.gz libbu++-1ee5f374ed986333d5cdbbf41390f1c4c755a8e3.tar.bz2 libbu++-1ee5f374ed986333d5cdbbf41390f1c4c755a8e3.tar.xz libbu++-1ee5f374ed986333d5cdbbf41390f1c4c755a8e3.zip |
This commit has a minor tweak to the variant class to make it easier to use,
and introduces the parser and lexer classes. I also made a test for parser and
put it in the tools directory. That is silly, it shouldn't be. However, it's
necesarry right now, because I don't want to do a full build to compile all
the parser tests.
However, this commit doesn't actually build yet. It will soon, I just wanted
to get it all committed.
Diffstat (limited to '')
-rw-r--r-- | src/variant.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/variant.h b/src/variant.h index 809aab9..5482ee3 100644 --- a/src/variant.h +++ b/src/variant.h | |||
@@ -98,9 +98,15 @@ namespace Bu | |||
98 | public: | 98 | public: |
99 | Variant(); | 99 | Variant(); |
100 | Variant( const Variant &v ); | 100 | Variant( const Variant &v ); |
101 | template<class t> | ||
102 | Variant( const t &v ) : | ||
103 | pCore( new VariantType<t>() ) | ||
104 | { | ||
105 | (*dynamic_cast<VariantType<t> *>(pCore)) = v; | ||
106 | } | ||
101 | virtual ~Variant(); | 107 | virtual ~Variant(); |
102 | 108 | ||
103 | bool isSet(); | 109 | bool isSet() const; |
104 | Bu::FString toString() const; | 110 | Bu::FString toString() const; |
105 | const std::type_info &getType() const; | 111 | const std::type_info &getType() const; |
106 | 112 | ||