Add new information in modules
This commit is contained in:
4 files changed
+23
-10
No files matched your search
+12
-5
@@ -62,7 +62,7 @@ class boolOption : public OptionBase
|
||||
{
|
||||
public:
|
||||
boolOption( const ClpString& name, const ClpString& desc )
|
||||
: OptionBase( name, desc ) { is_binary = true; }
|
||||
: OptionBase( name, desc, "(1-0)" ) { is_binary = true; }
|
||||
void parse( const ClpString& arg ) { arg_count++; }
|
||||
};
|
||||
|
||||
@@ -71,8 +71,8 @@ template <typename T>
|
||||
class StandardOption : public OptionBase
|
||||
{
|
||||
public:
|
||||
StandardOption( const ClpString& name, T& storage, const ClpString& desc )
|
||||
: OptionBase( name, desc ), opt_storage( storage )
|
||||
StandardOption( const ClpString& name, T& storage, const ClpString& desc, const ClpString& def )
|
||||
: OptionBase( name, desc, def ), opt_storage( storage )
|
||||
{
|
||||
is_binary = false;
|
||||
}
|
||||
@@ -160,8 +160,8 @@ struct FunctionOption : public OptionBase
|
||||
public:
|
||||
typedef void( Func )( CalypOptions&, const ClpString& );
|
||||
|
||||
FunctionOption( const ClpString& name, CalypOptions& parent_, Func* func_, const ClpString& desc )
|
||||
: OptionBase( name, desc ), parent( parent_ ), func( func_ )
|
||||
FunctionOption( const ClpString& name, CalypOptions& parent_, Func* func_, const ClpString& desc, const ClpString& def )
|
||||
: OptionBase( name, desc, def ), parent( parent_ ), func( func_ )
|
||||
{
|
||||
is_binary = false;
|
||||
}
|
||||
@@ -198,6 +198,13 @@ CalypOptions& CalypOptions::operator()( const ClpString& name, const ClpString&
|
||||
*/
|
||||
template <typename T>
|
||||
CalypOptions& CalypOptions::operator()( const ClpString& name, T& storage, const ClpString& desc )
|
||||
{
|
||||
addOption( new StandardOption<T>( name, storage, desc, ClpString( "" ) ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
CalypOptions& CalypOptions::operator()( const ClpString& name, T& storage, const ClpString& desc, const ClpString& defaults )
|
||||
{
|
||||
addOption( new StandardOption<T>( name, storage, desc ) );
|
||||
return *this;
|
||||
|
||||
+7
-3
@@ -55,8 +55,8 @@
|
||||
class OptionBase
|
||||
{
|
||||
public:
|
||||
OptionBase( const ClpString& name, const ClpString& desc )
|
||||
: arg_count( 0 ), opt_string( name ), opt_desc( desc ) {}
|
||||
OptionBase( const ClpString& name, const ClpString& desc, const ClpString& def )
|
||||
: arg_count( 0 ), opt_string( name ), opt_desc( desc ), opt_defaults( def ) {}
|
||||
virtual ~OptionBase() {}
|
||||
/* parse argument arg, to obtain a value for the option */
|
||||
virtual void parse( const ClpString& arg ) = 0;
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
int arg_count;
|
||||
ClpString opt_string;
|
||||
ClpString opt_desc;
|
||||
ClpString opt_defaults;
|
||||
bool is_binary;
|
||||
};
|
||||
|
||||
@@ -117,11 +118,14 @@ public:
|
||||
* Add option described by name to the parent Options list,
|
||||
* with storage for the option's value
|
||||
* with default_val as the default value
|
||||
* with desc as an optional help description
|
||||
* description and range along with default value
|
||||
*/
|
||||
template <typename T>
|
||||
CalypOptions& operator()( const ClpString& name, T& storage, const ClpString& desc );
|
||||
|
||||
template <typename T>
|
||||
CalypOptions& operator()( const ClpString& name, T& storage, const ClpString& desc, const ClpString& defaults );
|
||||
|
||||
bool checkListingOpts();
|
||||
|
||||
private:
|
||||
|
||||
Reference in new issue
Block a user