| 4019 | |
| 4020 | template<typename ConfigT> |
| 4021 | class BoundArgFunction { |
| 4022 | public: |
| 4023 | BoundArgFunction() : functionObj( CLARA_NULL ) {} |
| 4024 | BoundArgFunction( IArgFunction<ConfigT>* _functionObj ) : functionObj( _functionObj ) {} |
| 4025 | BoundArgFunction( BoundArgFunction const& other ) : functionObj( other.functionObj ? other.functionObj->clone() : CLARA_NULL ) {} |
| 4026 | BoundArgFunction& operator = ( BoundArgFunction const& other ) { |
| 4027 | IArgFunction<ConfigT>* newFunctionObj = other.functionObj ? other.functionObj->clone() : CLARA_NULL; |
| 4028 | delete functionObj; |
| 4029 | functionObj = newFunctionObj; |
| 4030 | return *this; |
| 4031 | } |
| 4032 | ~BoundArgFunction() { delete functionObj; } |
| 4033 | |
| 4034 | void set( ConfigT& config, std::string const& value ) const { |
| 4035 | functionObj->set( config, value ); |
| 4036 | } |
| 4037 | void setFlag( ConfigT& config ) const { |
| 4038 | functionObj->setFlag( config ); |
| 4039 | } |
| 4040 | bool takesArg() const { return functionObj->takesArg(); } |
| 4041 | |
| 4042 | bool isSet() const { |
| 4043 | return functionObj != CLARA_NULL; |
| 4044 | } |
| 4045 | private: |
| 4046 | IArgFunction<ConfigT>* functionObj; |
| 4047 | }; |
| 4048 | |
| 4049 | template<typename C> |
| 4050 | struct NullBinder : IArgFunction<C>{ |