diff --git a/INCLUDE/Hazelnupp.h b/INCLUDE/Hazelnupp.h index 63abb42..4c6113d 100644 --- a/INCLUDE/Hazelnupp.h +++ b/INCLUDE/Hazelnupp.h @@ -59,10 +59,6 @@ namespace Hazelnp } } -/*** ../Hazelnupp/Version.h ***/ - -#define HAZELNUPP_VERSION (1.12) - /*** ../Hazelnupp/DataType.h ***/ #include @@ -300,7 +296,7 @@ namespace Hazelnp //! Daisychain-method. Will add a the "incompatiblity" aspect. //! This means, that the following parameters are NOT compatible with this one and will throw an error if passed together. //! Syntactical-sugar proxy method that will convert the lonely string to an initializer list for you :3 - ParamConstraint AddIncompatibility(const std::string& incompatibleParameters) + ParamConstraint AddIncompatibilities(const std::string& incompatibleParameters) { ParamConstraint pc = *this; pc.incompatibleParameters = { incompatibleParameters }; @@ -308,6 +304,16 @@ namespace Hazelnp return pc; } + //! Daisychain-method. Will add a the "incompatiblity" aspect. + //! This means, that the following parameters are NOT compatible with this one and will throw an error if passed together. + ParamConstraint AddIncompatibilities(const std::initializer_list& incompatibleParameters) + { + ParamConstraint pc = *this; + pc.incompatibleParameters = incompatibleParameters; + + return pc; + } + //! Whole constructor ParamConstraint(bool constrainType, DATA_TYPE requiredType, const std::initializer_list& defaultValue, bool required, const std::initializer_list& incompatibleParameters) : @@ -348,6 +354,10 @@ namespace Hazelnp }; } +/*** ../Hazelnupp/Version.h ***/ + +#define HAZELNUPP_VERSION (1.121) + /*** ../Hazelnupp/Value.h ***/ #include @@ -399,19 +409,19 @@ namespace Hazelnp }; } -/*** ../Hazelnupp/StringValue.h ***/ +/*** ../Hazelnupp/ListValue.h ***/ -#include +#include namespace Hazelnp { - /** Specializations for string values (uses std::string) + /** Specializations for list values (uses std::vector) */ - class StringValue : public Value + class ListValue : public Value { public: - StringValue(const std::string& value); - ~StringValue() override {}; + ListValue(); + ~ListValue() override; //! Will return a deeopopy of this object Value* Deepcopy() const override; @@ -419,10 +429,13 @@ namespace Hazelnp //! Will return a string suitable for an std::ostream; std::string GetAsOsString() const override; - //! Will return the raw value - const std::string& GetValue() const; + //! Will add this value to the list + void AddValue(const Value* value); - operator std::string() const; + //! Will return the raw value + const std::vector& GetValue() const; + + operator std::vector() const; //! Throws HazelnuppValueNotConvertibleException long long int GetInt64() const override; @@ -434,14 +447,14 @@ namespace Hazelnp //! Throws HazelnuppValueNotConvertibleException double GetFloat32() const override; - //! Will return this value as a string + //! Throws HazelnuppValueNotConvertibleException std::string GetString() const override; - //! Throws HazelnuppValueNotConvertibleException + //! Will return this values list const std::vector& GetList() const override; private: - std::string value; + std::vector value; }; } @@ -492,92 +505,6 @@ namespace Hazelnp }; } -/*** ../Hazelnupp/ListValue.h ***/ - -#include - -namespace Hazelnp -{ - /** Specializations for list values (uses std::vector) - */ - class ListValue : public Value - { - public: - ListValue(); - ~ListValue() override; - - //! Will return a deeopopy of this object - Value* Deepcopy() const override; - - //! Will return a string suitable for an std::ostream; - std::string GetAsOsString() const override; - - //! Will add this value to the list - void AddValue(const Value* value); - - //! Will return the raw value - const std::vector& GetValue() const; - - operator std::vector() const; - - //! Throws HazelnuppValueNotConvertibleException - long long int GetInt64() const override; - //! Throws HazelnuppValueNotConvertibleException - int GetInt32() const override; - - //! Throws HazelnuppValueNotConvertibleException - long double GetFloat64() const override; - //! Throws HazelnuppValueNotConvertibleException - double GetFloat32() const override; - - //! Throws HazelnuppValueNotConvertibleException - std::string GetString() const override; - - //! Will return this values list - const std::vector& GetList() const override; - - private: - std::vector value; - }; -} - -/*** ../Hazelnupp/VoidValue.h ***/ - - -namespace Hazelnp -{ - /** Specializations for void values. These house no value whatsoever, but only communicate information by merely existing. - */ - class VoidValue : public Value - { - public: - VoidValue(); - ~VoidValue() override {}; - - //! Will return a deeopopy of this object - Value* Deepcopy() const override; - - //! Will return a string suitable for an std::ostream; - std::string GetAsOsString() const override; - - //! Throws HazelnuppValueNotConvertibleException - long long int GetInt64() const override; - //! Throws HazelnuppValueNotConvertibleException - int GetInt32() const override; - - //! Throws HazelnuppValueNotConvertibleException - long double GetFloat64() const override; - //! Throws HazelnuppValueNotConvertibleException - double GetFloat32() const override; - - //! Returns an empty string - std::string GetString() const override; - - //! Returns an empty list - const std::vector& GetList() const; - }; -} - /*** ../Hazelnupp/IntValue.h ***/ @@ -625,6 +552,89 @@ namespace Hazelnp }; } +/*** ../Hazelnupp/VoidValue.h ***/ + + +namespace Hazelnp +{ + /** Specializations for void values. These house no value whatsoever, but only communicate information by merely existing. + */ + class VoidValue : public Value + { + public: + VoidValue(); + ~VoidValue() override {}; + + //! Will return a deeopopy of this object + Value* Deepcopy() const override; + + //! Will return a string suitable for an std::ostream; + std::string GetAsOsString() const override; + + //! Throws HazelnuppValueNotConvertibleException + long long int GetInt64() const override; + //! Throws HazelnuppValueNotConvertibleException + int GetInt32() const override; + + //! Throws HazelnuppValueNotConvertibleException + long double GetFloat64() const override; + //! Throws HazelnuppValueNotConvertibleException + double GetFloat32() const override; + + //! Returns an empty string + std::string GetString() const override; + + //! Returns an empty list + const std::vector& GetList() const; + }; +} + +/*** ../Hazelnupp/StringValue.h ***/ + +#include + +namespace Hazelnp +{ + /** Specializations for string values (uses std::string) + */ + class StringValue : public Value + { + public: + StringValue(const std::string& value); + ~StringValue() override {}; + + //! Will return a deeopopy of this object + Value* Deepcopy() const override; + + //! Will return a string suitable for an std::ostream; + std::string GetAsOsString() const override; + + //! Will return the raw value + const std::string& GetValue() const; + + operator std::string() const; + + //! Throws HazelnuppValueNotConvertibleException + long long int GetInt64() const override; + //! Throws HazelnuppValueNotConvertibleException + int GetInt32() const override; + + //! Throws HazelnuppValueNotConvertibleException + long double GetFloat64() const override; + //! Throws HazelnuppValueNotConvertibleException + double GetFloat32() const override; + + //! Will return this value as a string + std::string GetString() const override; + + //! Throws HazelnuppValueNotConvertibleException + const std::vector& GetList() const override; + + private: + std::string value; + }; +} + /*** ../Hazelnupp/Parameter.h ***/ #include