diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-12 23:51:08 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-12 23:51:08 +0100 |
commit | c72fff236dd65c7142242b3faf93750e64dd6ba1 (patch) | |
tree | 0cdf82215062426a9efffd3cff88113c6d716d73 /src/core | |
parent | 1f8c4a5fcfb7b60c0fea62c7de81c69cef325a0a (diff) |
Implemented and tested "Any" Argument type
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/common/Argument.cpp | 11 | ||||
-rw-r--r-- | src/core/common/Argument.hpp | 20 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/core/common/Argument.cpp b/src/core/common/Argument.cpp index 3461868..4e80f23 100644 --- a/src/core/common/Argument.cpp +++ b/src/core/common/Argument.cpp @@ -48,6 +48,17 @@ Argument::Argument(std::string name, const RttiType &type) { } + +Argument Argument::Any(std::string name) +{ + return Argument{name, RttiTypes::None, RttiTypes::None, nullptr, false}; +} + +Argument Argument::Any(std::string name, Variant defaultValue) +{ + return Argument{name, RttiTypes::None, RttiTypes::None, defaultValue, true}; +} + Argument Argument::Bool(std::string name) { return Argument{name, RttiTypes::Bool}; diff --git a/src/core/common/Argument.hpp b/src/core/common/Argument.hpp index cb08fc3..7227ddb 100644 --- a/src/core/common/Argument.hpp +++ b/src/core/common/Argument.hpp @@ -119,6 +119,26 @@ public: const bool hasDefault; /** + * Named constructor for an argument with any type. + * + * @param name is the name of the argument as used for error messages and in + * case the arguments are given as a map. + * @return a new Argument instance. + */ + static Argument Any(std::string name); + + /** + * Named constructor for an argument with any type. + * + * @param name is the name of the argument as used for error messages and in + * case the arguments are given as a map. + * @param defaultValue is the default value to be used in case this argument + * is not supplied. + * @return a new Argument instance. + */ + static Argument Any(std::string name, Variant defaultValue); + + /** * Named constructor for a boolean argument with no default value. * * @param name is the name of the argument as used for error messages and in |