aboutsummaryrefslogtreecommitdiff
path: root/src/variant.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-10-27 03:27:05 +0000
committerMike Buland <eichlan@xagasoft.com>2010-10-27 03:27:05 +0000
commit10b68e6b5e7d12c7af51b960191e1be9eb788d2e (patch)
treeccc6375726b9acaf53b1bb67bec81747b0bde223 /src/variant.cpp
parent68b8b5136677435a84da7d277e78470ac4a41a64 (diff)
downloadlibbu++-10b68e6b5e7d12c7af51b960191e1be9eb788d2e.tar.gz
libbu++-10b68e6b5e7d12c7af51b960191e1be9eb788d2e.tar.bz2
libbu++-10b68e6b5e7d12c7af51b960191e1be9eb788d2e.tar.xz
libbu++-10b68e6b5e7d12c7af51b960191e1be9eb788d2e.zip
Interesting tweak to the variant and optparser classes. In the Variant, it
would always fail if a const char * was passed in, it now converts these silently to Bu::FStrings, good to know... Also, the OptParser now uses a Variant for overrides, meaning it doesn't have to do extra parsing, and the amount of code you have to write may be significantly reduced. Pretty sweet, overall. There is one downside. For the moment if you use a non-standard type or object as the target of a parameter it always needs to have a formatter >> operator defined, even if you override and the formatter >> operator is never called. Hopefully we can get around this in the future. Also, it looks like it should be relatively trivial to create conversion functions for the variant, they'll just be global template functions that take two parameters, source type and target type. Should be good times.
Diffstat (limited to 'src/variant.cpp')
-rw-r--r--src/variant.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/variant.cpp b/src/variant.cpp
index a66ec39..a239e0f 100644
--- a/src/variant.cpp
+++ b/src/variant.cpp
@@ -34,6 +34,12 @@ Bu::Variant::Variant( const Variant &v ) :
34 } 34 }
35} 35}
36 36
37Bu::Variant::Variant( const char *t ) :
38 pCore( NULL )
39{
40 set( Bu::FString( t ) );
41}
42
37Bu::Variant::~Variant() 43Bu::Variant::~Variant()
38{ 44{
39 if( pCore ) 45 if( pCore )