Compiled hazelnupp

This commit is contained in:
Leonetienne 2021-09-05 12:56:48 +02:00
parent b45e305122
commit 069d544e02

View File

@ -1,18 +1,5 @@
#pragma once
/*** ../Hazelnupp/Placeholders.h ***/
#include <string>
namespace Hazelnp
{
namespace Placeholders
{
//! The only purpose of this is to provide the ability to return an empty string as an error for std::string& methods.
static const std::string g_emptyString;
}
}
/*** ../Hazelnupp/StringTools.h ***/
#include <string>
@ -59,9 +46,22 @@ namespace Hazelnp
}
/*** ../Hazelnupp/Placeholders.h ***/
#include <string>
namespace Hazelnp
{
namespace Placeholders
{
//! The only purpose of this is to provide the ability to return an empty string as an error for std::string& methods.
static const std::string g_emptyString;
}
}
/*** ../Hazelnupp/Version.h ***/
#define HAZELNUPP_VERSION (1.11)
#define HAZELNUPP_VERSION (1.12)
/*** ../Hazelnupp/DataType.h ***/
@ -244,6 +244,17 @@ namespace Hazelnp
return pc;
}
//! Daisychain-method. Will add a the "required-argument" aspect.
//! Think of the default value like of a list ofparameters. Like {"--width", "800"}
ParamConstraint AddRequire(const std::initializer_list<std::string>& defaultValue = {}, bool required = true)
{
ParamConstraint pc = *this;
pc.defaultValue = defaultValue;
pc.required = required;
return pc;
}
//! Constructs a type-safety constraint
static ParamConstraint TypeSafety(DATA_TYPE requiredType, bool constrainType = true)
{
@ -254,6 +265,17 @@ namespace Hazelnp
return pc;
}
//! Daisychain-method. Will add a the "type-safety" aspect.
//! Constructs a type-safety constraint
ParamConstraint AddTypeSafety(DATA_TYPE requiredType, bool constrainType = true)
{
ParamConstraint pc = *this;
pc.constrainType = constrainType;
pc.requiredType = requiredType;
return pc;
}
//! Constructs an incompatibility constraint.
//! This means, that the following parameters are NOT compatible with this one and will throw an error if passed together
static ParamConstraint Incompatibility(const std::initializer_list<std::string>& incompatibleParameters)
@ -275,6 +297,17 @@ 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.
//! Syntactical-sugar proxy method that will convert the lonely string to an initializer list for you :3
ParamConstraint AddIncompatibility(const std::string& incompatibleParameters)
{
ParamConstraint pc = *this;
pc.incompatibleParameters = { incompatibleParameters };
return pc;
}
//! Whole constructor
ParamConstraint(bool constrainType, DATA_TYPE requiredType, const std::initializer_list<std::string>& defaultValue, bool required, const std::initializer_list<std::string>& incompatibleParameters)
:
@ -366,19 +399,19 @@ namespace Hazelnp
};
}
/*** ../Hazelnupp/ListValue.h ***/
/*** ../Hazelnupp/StringValue.h ***/
#include <vector>
#include <string>
namespace Hazelnp
{
/** Specializations for list values (uses std::vector<Value*>)
/** Specializations for string values (uses std::string)
*/
class ListValue : public Value
class StringValue : public Value
{
public:
ListValue();
~ListValue() override;
StringValue(const std::string& value);
~StringValue() override {};
//! Will return a deeopopy of this object
Value* Deepcopy() const override;
@ -386,13 +419,10 @@ namespace Hazelnp
//! 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<Value*>& GetValue() const;
const std::string& GetValue() const;
operator std::vector<Value*>() const;
operator std::string() const;
//! Throws HazelnuppValueNotConvertibleException
long long int GetInt64() const override;
@ -404,14 +434,14 @@ namespace Hazelnp
//! Throws HazelnuppValueNotConvertibleException
double GetFloat32() const override;
//! Throws HazelnuppValueNotConvertibleException
//! Will return this value as a string
std::string GetString() const override;
//! Will return this values list
//! Throws HazelnuppValueNotConvertibleException
const std::vector<Value*>& GetList() const override;
private:
std::vector<Value*> value;
std::string value;
};
}
@ -462,6 +492,92 @@ namespace Hazelnp
};
}
/*** ../Hazelnupp/ListValue.h ***/
#include <vector>
namespace Hazelnp
{
/** Specializations for list values (uses std::vector<Value*>)
*/
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<Value*>& GetValue() const;
operator std::vector<Value*>() 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<Value*>& GetList() const override;
private:
std::vector<Value*> 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<Value*>& GetList() const;
};
}
/*** ../Hazelnupp/IntValue.h ***/
@ -509,89 +625,6 @@ namespace Hazelnp
};
}
/*** ../Hazelnupp/StringValue.h ***/
#include <string>
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<Value*>& GetList() const override;
private:
std::string 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<Value*>& GetList() const;
};
}
/*** ../Hazelnupp/Parameter.h ***/
#include <string>