Namespacified

This commit is contained in:
Leonetienne 2021-06-03 13:42:40 +02:00
parent 697eb98621
commit 124b6e5b98
26 changed files with 443 additions and 383 deletions

View File

@ -1,5 +1,7 @@
#pragma once
namespace Hazelnp
{
/** The different data types a paramater can be
*/
enum class DATA_TYPE
@ -10,3 +12,4 @@ enum class DATA_TYPE
STRING,
LIST
};
}

View File

@ -2,6 +2,8 @@
#include "HazelnuppException.h"
#include <sstream>
using namespace Hazelnp;
FloatValue::FloatValue(const long double& value)
:
Value(DATA_TYPE::FLOAT),

View File

@ -2,6 +2,8 @@
#include "Value.h"
#include <ostream>
namespace Hazelnp
{
/** Specializations for floating point values (uses long double)
*/
class FloatValue : public Value
@ -41,3 +43,4 @@ public:
private:
long double value;
};
}

View File

@ -9,6 +9,8 @@
#include <iostream>
#include <cstdlib>
using namespace Hazelnp;
Hazelnupp::Hazelnupp()
{
return;

View File

@ -4,6 +4,8 @@
#include <unordered_map>
#include <vector>
namespace Hazelnp
{
/** The main class to interface with
*/
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.
bool crashOnFail = true;
};
}

View File

@ -1,6 +1,8 @@
#pragma once
#include <stdexcept>
namespace Hazelnp
{
/** Generic hazelnupp exception
*/
class HazelnuppException : public std::exception
@ -63,3 +65,4 @@ public:
HazelnuppConstraintMissingValue() : HazelnuppConstraintException() {};
HazelnuppConstraintMissingValue(const std::string& msg) : HazelnuppConstraintException(msg) {};
};
}

View File

@ -2,6 +2,8 @@
#include "HazelnuppException.h"
#include <sstream>
using namespace Hazelnp;
IntValue::IntValue(const long long int& value)
:
Value(DATA_TYPE::INT),

View File

@ -1,6 +1,8 @@
#pragma once
#include "Value.h"
namespace Hazelnp
{
/** Specializations for integer values (uses long long int)
*/
class IntValue : public Value
@ -41,3 +43,4 @@ public:
private:
long long int value;
};
}

View File

@ -2,6 +2,8 @@
#include "HazelnuppException.h"
#include <sstream>
using namespace Hazelnp;
ListValue::ListValue() :
Value(DATA_TYPE::LIST)
{

View File

@ -2,6 +2,8 @@
#include "Value.h"
#include <vector>
namespace Hazelnp
{
/** Specializations for list values (uses std::vector<Value*>)
*/
class ListValue : public Value
@ -43,3 +45,4 @@ public:
private:
std::vector<Value*> value;
};
}

View File

@ -3,6 +3,8 @@
#include <string>
#include <vector>
namespace Hazelnp
{
struct ParamConstraint
{
public:
@ -63,3 +65,4 @@ public:
//! an error will be produced if this parameter is not supplied by the user.
bool required = false;
};
}

View File

@ -1,5 +1,7 @@
#include "Parameter.h"
using namespace Hazelnp;
Parameter::Parameter(const std::string& key, const ::Value* value)
:
key{ key }

View File

@ -3,6 +3,8 @@
#include <string>
#include <ostream>
namespace Hazelnp
{
class Parameter
{
public:
@ -22,5 +24,6 @@ public:
private:
std::string key;
::Value* value;
Hazelnp::Value* value;
};
}

View File

@ -1,5 +1,7 @@
#include "StringTools.h"
using namespace Hazelnp;
bool StringTools::Contains(const std::string& str, const char c)
{
for (const char& i : str)

View File

@ -4,6 +4,8 @@
#include <vector>
#include <cmath>
namespace Hazelnp
{
/** Internal helper class. Feel free to use it tho.
*/
class StringTools
@ -35,3 +37,4 @@ public:
//! Will make a string all lower-case
static std::string ToLower(const std::string& str);
};
}

View File

@ -2,6 +2,8 @@
#include "HazelnuppException.h"
#include <sstream>
using namespace Hazelnp;
StringValue::StringValue(const std::string& value)
:
Value(DATA_TYPE::STRING),

View File

@ -2,6 +2,8 @@
#include "Value.h"
#include <string>
namespace Hazelnp
{
/** Specializations for string values (uses std::string)
*/
class StringValue : public Value
@ -40,3 +42,4 @@ public:
private:
std::string value;
};
}

View File

@ -1,5 +1,7 @@
#include "Value.h"
using namespace Hazelnp;
Value::Value(DATA_TYPE type)
:
type{ type }

View File

@ -3,6 +3,8 @@
#include <ostream>
#include <vector>
namespace Hazelnp
{
/** Abstract class for values
*/
class Value
@ -45,3 +47,4 @@ protected:
DATA_TYPE type;
};
}

View File

@ -1,6 +1,8 @@
#include "VoidValue.h"
#include "HazelnuppException.h"
using namespace Hazelnp;
VoidValue::VoidValue()
:
Value(DATA_TYPE::VOID)

View File

@ -1,6 +1,8 @@
#pragma once
#include "Value.h"
namespace Hazelnp
{
/** Specializations for void values. These house no value whatsoever, but only communicate information by merely existing.
*/
class VoidValue : public Value
@ -31,3 +33,4 @@ public:
//! Throws HazelnuppValueNotConvertibleException
const std::vector<Value*>& GetList() const;
};
}

View File

@ -2,6 +2,8 @@
#include "Hazelnupp.h"
#include "IntValue.h"
using namespace Hazelnp;
int main(int argc, char** argv)
{
while (1)

View File

@ -3,6 +3,7 @@
#include "../Hazelnupp/Hazelnupp.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace Hazelnp;
namespace TestHazelnupp
{

View File

@ -4,6 +4,7 @@
#include "../Hazelnupp/HazelnuppException.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace Hazelnp;
namespace TestHazelnupp
{

View File

@ -4,6 +4,7 @@
#include "../Hazelnupp/HazelnuppException.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace Hazelnp;
namespace TestHazelnupp
{

View File

@ -4,6 +4,7 @@
#include "../Hazelnupp/HazelnuppException.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace Hazelnp;
namespace TestHazelnupp
{