From ec05778d5718a7912e506764d443a78d6a6179e3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 5 Nov 2012 22:41:51 +0000 Subject: Converted tabs to spaces with tabconv. --- src/stable/optparser.h | 398 ++++++++++++++++++++++++------------------------- 1 file changed, 199 insertions(+), 199 deletions(-) (limited to 'src/stable/optparser.h') diff --git a/src/stable/optparser.h b/src/stable/optparser.h index 2da93c9..412f262 100644 --- a/src/stable/optparser.h +++ b/src/stable/optparser.h @@ -19,205 +19,205 @@ namespace Bu { - typedef Bu::Array StrArray; - - /** - * POSIX/Gnu style command line parser. Handles long and short options in - * a variety of fun and useful ways, along with singal based callbacks and - * automatic variable setting. It's pretty easy to use, and very flexible. - * - * OptParser supports it's own builtin help mechanism which automatically - * enumerates the available options and their help in a well formatted and - * easy to read way, automatically formatting your help text per option and - * allows for addition "help banners" which can be placed wherever you - * would like. - */ - class OptParser - { - private: - class _ValueProxy - { - public: - _ValueProxy(); - virtual ~_ValueProxy(); - - virtual void setValueFromStr( const Bu::String & )=0; - virtual void setValue( const Bu::Variant &vVar )=0; - virtual _ValueProxy *clone()=0; - }; - - template - class ValueProxy : public _ValueProxy - { - public: - ValueProxy( ptype &v ) : - v( v ) - { - } - - virtual ~ValueProxy() - { - } - - virtual void setValueFromStr( const Bu::String &sVal ) - { - Bu::MemBuf mb( sVal ); - Bu::Formatter f( mb ); - f << Bu::Fmt().tokenize( false ); - f >> v; - } - - virtual void setValue( const Bu::Variant &vVar ) - { - if( vVar.getType() == typeid(ptype) ) - { - v = vVar.get(); - } - else if( vVar.getType() == typeid(Bu::String) ) - { - setValueFromStr( vVar.get() ); - } - else - { - Bu::MemBuf mb; - Bu::Formatter f( mb ); -// f << vVar; - setValueFromStr( mb.getString() ); - } - } - - virtual _ValueProxy *clone() - { - return new ValueProxy( v ); - } - - private: - ptype &v; - }; - - public: - typedef Signal1 OptionSignal; - class Option - { - public: - Option(); - Option( const Option &rSrc ); - virtual ~Option(); - - char cOpt; - Bu::String sOpt; - Bu::String sHelp; - OptionSignal sUsed; - _ValueProxy *pProxy; - Bu::Variant sOverride; - Bu::String sHelpDefault; - }; - - private: - typedef Bu::List