Namespacified
This commit is contained in:
parent
697eb98621
commit
124b6e5b98
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
/** The different data types a paramater can be
|
/** The different data types a paramater can be
|
||||||
*/
|
*/
|
||||||
enum class DATA_TYPE
|
enum class DATA_TYPE
|
||||||
@ -10,3 +12,4 @@ enum class DATA_TYPE
|
|||||||
STRING,
|
STRING,
|
||||||
LIST
|
LIST
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "HazelnuppException.h"
|
#include "HazelnuppException.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
FloatValue::FloatValue(const long double& value)
|
FloatValue::FloatValue(const long double& value)
|
||||||
:
|
:
|
||||||
Value(DATA_TYPE::FLOAT),
|
Value(DATA_TYPE::FLOAT),
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "Value.h"
|
#include "Value.h"
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
/** Specializations for floating point values (uses long double)
|
/** Specializations for floating point values (uses long double)
|
||||||
*/
|
*/
|
||||||
class FloatValue : public Value
|
class FloatValue : public Value
|
||||||
@ -41,3 +43,4 @@ public:
|
|||||||
private:
|
private:
|
||||||
long double value;
|
long double value;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
Hazelnupp::Hazelnupp()
|
Hazelnupp::Hazelnupp()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
/** The main class to interface with
|
/** The main class to interface with
|
||||||
*/
|
*/
|
||||||
class Hazelnupp
|
class Hazelnupp
|
||||||
@ -85,3 +87,4 @@ private:
|
|||||||
//! If set to true, Hazelnupp will crash the application with output to stderr when an exception is thrown whilst parsing.
|
//! If set to true, Hazelnupp will crash the application with output to stderr when an exception is thrown whilst parsing.
|
||||||
bool crashOnFail = true;
|
bool crashOnFail = true;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
/** Generic hazelnupp exception
|
/** Generic hazelnupp exception
|
||||||
*/
|
*/
|
||||||
class HazelnuppException : public std::exception
|
class HazelnuppException : public std::exception
|
||||||
@ -63,3 +65,4 @@ public:
|
|||||||
HazelnuppConstraintMissingValue() : HazelnuppConstraintException() {};
|
HazelnuppConstraintMissingValue() : HazelnuppConstraintException() {};
|
||||||
HazelnuppConstraintMissingValue(const std::string& msg) : HazelnuppConstraintException(msg) {};
|
HazelnuppConstraintMissingValue(const std::string& msg) : HazelnuppConstraintException(msg) {};
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "HazelnuppException.h"
|
#include "HazelnuppException.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
IntValue::IntValue(const long long int& value)
|
IntValue::IntValue(const long long int& value)
|
||||||
:
|
:
|
||||||
Value(DATA_TYPE::INT),
|
Value(DATA_TYPE::INT),
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Value.h"
|
#include "Value.h"
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
/** Specializations for integer values (uses long long int)
|
/** Specializations for integer values (uses long long int)
|
||||||
*/
|
*/
|
||||||
class IntValue : public Value
|
class IntValue : public Value
|
||||||
@ -41,3 +43,4 @@ public:
|
|||||||
private:
|
private:
|
||||||
long long int value;
|
long long int value;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "HazelnuppException.h"
|
#include "HazelnuppException.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
ListValue::ListValue() :
|
ListValue::ListValue() :
|
||||||
Value(DATA_TYPE::LIST)
|
Value(DATA_TYPE::LIST)
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "Value.h"
|
#include "Value.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
/** Specializations for list values (uses std::vector<Value*>)
|
/** Specializations for list values (uses std::vector<Value*>)
|
||||||
*/
|
*/
|
||||||
class ListValue : public Value
|
class ListValue : public Value
|
||||||
@ -43,3 +45,4 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::vector<Value*> value;
|
std::vector<Value*> value;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
struct ParamConstraint
|
struct ParamConstraint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -63,3 +65,4 @@ public:
|
|||||||
//! an error will be produced if this parameter is not supplied by the user.
|
//! an error will be produced if this parameter is not supplied by the user.
|
||||||
bool required = false;
|
bool required = false;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "Parameter.h"
|
#include "Parameter.h"
|
||||||
|
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
Parameter::Parameter(const std::string& key, const ::Value* value)
|
Parameter::Parameter(const std::string& key, const ::Value* value)
|
||||||
:
|
:
|
||||||
key{ key }
|
key{ key }
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
class Parameter
|
class Parameter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -22,5 +24,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string key;
|
std::string key;
|
||||||
::Value* value;
|
Hazelnp::Value* value;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "StringTools.h"
|
#include "StringTools.h"
|
||||||
|
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
bool StringTools::Contains(const std::string& str, const char c)
|
bool StringTools::Contains(const std::string& str, const char c)
|
||||||
{
|
{
|
||||||
for (const char& i : str)
|
for (const char& i : str)
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
/** Internal helper class. Feel free to use it tho.
|
/** Internal helper class. Feel free to use it tho.
|
||||||
*/
|
*/
|
||||||
class StringTools
|
class StringTools
|
||||||
@ -35,3 +37,4 @@ public:
|
|||||||
//! Will make a string all lower-case
|
//! Will make a string all lower-case
|
||||||
static std::string ToLower(const std::string& str);
|
static std::string ToLower(const std::string& str);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "HazelnuppException.h"
|
#include "HazelnuppException.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
StringValue::StringValue(const std::string& value)
|
StringValue::StringValue(const std::string& value)
|
||||||
:
|
:
|
||||||
Value(DATA_TYPE::STRING),
|
Value(DATA_TYPE::STRING),
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "Value.h"
|
#include "Value.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
/** Specializations for string values (uses std::string)
|
/** Specializations for string values (uses std::string)
|
||||||
*/
|
*/
|
||||||
class StringValue : public Value
|
class StringValue : public Value
|
||||||
@ -40,3 +42,4 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::string value;
|
std::string value;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "Value.h"
|
#include "Value.h"
|
||||||
|
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
Value::Value(DATA_TYPE type)
|
Value::Value(DATA_TYPE type)
|
||||||
:
|
:
|
||||||
type{ type }
|
type{ type }
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
/** Abstract class for values
|
/** Abstract class for values
|
||||||
*/
|
*/
|
||||||
class Value
|
class Value
|
||||||
@ -45,3 +47,4 @@ protected:
|
|||||||
|
|
||||||
DATA_TYPE type;
|
DATA_TYPE type;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "VoidValue.h"
|
#include "VoidValue.h"
|
||||||
#include "HazelnuppException.h"
|
#include "HazelnuppException.h"
|
||||||
|
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
VoidValue::VoidValue()
|
VoidValue::VoidValue()
|
||||||
:
|
:
|
||||||
Value(DATA_TYPE::VOID)
|
Value(DATA_TYPE::VOID)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Value.h"
|
#include "Value.h"
|
||||||
|
|
||||||
|
namespace Hazelnp
|
||||||
|
{
|
||||||
/** Specializations for void values. These house no value whatsoever, but only communicate information by merely existing.
|
/** Specializations for void values. These house no value whatsoever, but only communicate information by merely existing.
|
||||||
*/
|
*/
|
||||||
class VoidValue : public Value
|
class VoidValue : public Value
|
||||||
@ -31,3 +33,4 @@ public:
|
|||||||
//! Throws HazelnuppValueNotConvertibleException
|
//! Throws HazelnuppValueNotConvertibleException
|
||||||
const std::vector<Value*>& GetList() const;
|
const std::vector<Value*>& GetList() const;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "Hazelnupp.h"
|
#include "Hazelnupp.h"
|
||||||
#include "IntValue.h"
|
#include "IntValue.h"
|
||||||
|
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "../Hazelnupp/Hazelnupp.h"
|
#include "../Hazelnupp/Hazelnupp.h"
|
||||||
|
|
||||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
namespace TestHazelnupp
|
namespace TestHazelnupp
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "../Hazelnupp/HazelnuppException.h"
|
#include "../Hazelnupp/HazelnuppException.h"
|
||||||
|
|
||||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
namespace TestHazelnupp
|
namespace TestHazelnupp
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "../Hazelnupp/HazelnuppException.h"
|
#include "../Hazelnupp/HazelnuppException.h"
|
||||||
|
|
||||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
namespace TestHazelnupp
|
namespace TestHazelnupp
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "../Hazelnupp/HazelnuppException.h"
|
#include "../Hazelnupp/HazelnuppException.h"
|
||||||
|
|
||||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
|
using namespace Hazelnp;
|
||||||
|
|
||||||
namespace TestHazelnupp
|
namespace TestHazelnupp
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user