summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-15 00:21:36 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-15 00:21:36 +0100
commitf7326c640690cf5cfee89340db5569ef9b44a652 (patch)
tree62a30cf6415bf814364d58c7aacd186b8daf088f /src/core
parent5b68f46580824d47ce948ac349d43f8aa8647ec9 (diff)
Using Arguments::None instead of storing a flag if no explicit arguments were given for validation
Diffstat (limited to 'src/core')
-rw-r--r--src/core/common/Function.cpp9
-rw-r--r--src/core/common/Function.hpp10
2 files changed, 5 insertions, 14 deletions
diff --git a/src/core/common/Function.cpp b/src/core/common/Function.cpp
index 6aedb7b..5a4359d 100644
--- a/src/core/common/Function.cpp
+++ b/src/core/common/Function.cpp
@@ -23,12 +23,9 @@ namespace ousia {
Variant::arrayType &ValidatingFunction::validate(Variant::arrayType &args) const
{
- // If an argument descriptor was given, use it to validate the arguments.
- // Throw any violation as exception.
- if (checkArguments) {
- ExceptionLogger logger;
- arguments.validateArray(args, logger);
- }
+ // Validate the given arguments. Throw any violation as exception.
+ ExceptionLogger logger;
+ arguments.validateArray(args, logger);
return args;
}
}
diff --git a/src/core/common/Function.hpp b/src/core/common/Function.hpp
index adfc9bb..dd6e5ec 100644
--- a/src/core/common/Function.hpp
+++ b/src/core/common/Function.hpp
@@ -128,23 +128,17 @@ private:
*/
Arguments arguments;
- /**
- * Set to true if any arguments for checking were given in the constructor.
- * If set to false, no argument checks are performed.
- */
- bool checkArguments;
-
protected:
/**
* Default constructor. Disables validation, all arguments are allowed.
*/
- ValidatingFunction() : checkArguments(false){};
+ ValidatingFunction() : arguments(Arguments::None){};
/**
* Default constructor. Disables validation, all arguments are allowed.
*/
ValidatingFunction(Arguments arguments)
- : arguments(std::move(arguments)), checkArguments(true){};
+ : arguments(std::move(arguments)) {};
/**
* Function which cares about validating a set of arguments.