summaryrefslogtreecommitdiff
path: root/src/core/common/Argument.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/common/Argument.hpp')
-rw-r--r--src/core/common/Argument.hpp65
1 files changed, 45 insertions, 20 deletions
diff --git a/src/core/common/Argument.hpp b/src/core/common/Argument.hpp
index 42b1722..ea68e3c 100644
--- a/src/core/common/Argument.hpp
+++ b/src/core/common/Argument.hpp
@@ -53,15 +53,33 @@ class Rtti;
class Argument {
private:
/**
+ * Contains the name of the argument. Used for logging and in case the
+ * arguments are presented as map.
+ */
+ std::string name;
+
+ /**
* Type that should be returned by the Variant rttiType function.
*/
- const Rtti &type;
+ Rtti const* type;
/**
* Describes the inner type of the variant -- e.g. the type of the elements
* inside an array. Normally set to RttiTypes::None.
*/
- const Rtti &innerType;
+ Rtti const* innerType;
+
+ /**
+ * Default value. Note that a value of nullptr does not indicate that no
+ * default value has been set. Use the "hasDefault" flag for this purpose.
+ * Nullptr is a valid value for objects.
+ */
+ Variant defaultValue;
+
+ /**
+ * True if a default value is set, false otherwise.
+ */
+ bool hasDefaultValue;
/**
* Private constructor used for manually setting all internal data fields.
@@ -101,24 +119,6 @@ private:
public:
/**
- * Contains the name of the argument. Used for logging and in case the
- * arguments are presented as map.
- */
- const std::string name;
-
- /**
- * Default value. Note that a value of nullptr does not indicate that no
- * default value has been set. Use the "hasDefault" flag for this purpose.
- * Nullptr is a valid value for objects.
- */
- const Variant defaultValue;
-
- /**
- * True if a default value is set, false otherwise.
- */
- 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
@@ -404,6 +404,31 @@ public:
* @return true if the given variant was valid, false otherwise.
*/
bool validate(Variant &var, Logger &logger) const;
+
+ /**
+ * Returns the name of the argument. The name is used for logging and in
+ * case a map is presented as arguments.
+ *
+ * @return the name of the argument given in the constructor.
+ */
+ const std::string &getName() const;
+
+ /**
+ * Returns the default value. Note that a value of nullptr does not indicate
+ * that no default value has been set. Use the "hasDefault" flag for this
+ * purpose. Nullptr is a valid value for objects.
+ *
+ * @return the default value that was given in the constructor (may be
+ * nullptr) and nullptr if no default value was given.
+ */
+ const Variant& getDefaultValue() const;
+
+ /**
+ * Returns true if a default value was set in the constructor.
+ *
+ * @return true if a default value is set, false otherwise.
+ */
+ bool hasDefault() const;
};
/**