From 4ff279b998ce55bc1132e699976c51e7246ff3cc Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Wed, 21 Jan 2015 00:31:06 +0100 Subject: introduced ad-hoc validation method of Types against Variants. --- src/core/model/Typesystem.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/model/Typesystem.hpp b/src/core/model/Typesystem.hpp index 44cf126..f4182fc 100644 --- a/src/core/model/Typesystem.hpp +++ b/src/core/model/Typesystem.hpp @@ -111,11 +111,25 @@ public: * @param data is a variant containing the data that should be checked and * -- if possible and necessary -- converted to a variant adhering to the * internal representation used by the Type class. - * @param logger is the Logger instance into which errors should be written. + * @param logger is the Logger instance into which errors should be + * written. * @return true if the conversion was successful, false otherwise. */ bool build(Variant &data, Logger &logger) const; + /** + * Returns true if and only if the given Variant adheres to this Type. In + * essence this just calls the build method on a copy of the input Variant. + * + * @param data is a Variant containing data that shall be validated. + * @param logger is a logger instance to which errors will be written. + * + * @return true if and only if the given Variant adheres to this Type. + */ + bool isValid(Variant data, Logger &logger) const{ + return build(data, logger); + } + /** * Returns the underlying Typesystem instance. * -- cgit v1.2.3