Basic datatypes
This commit is contained in:
parent
cd906be4c9
commit
29c85b58c7
10
src/datatype.h
Normal file
10
src/datatype.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <variant>
|
||||||
|
#include "datatypes/primitives.h"
|
||||||
|
|
||||||
|
typedef std::variant<StringData, IntData, FloatData> DataValue;
|
||||||
|
|
||||||
|
const uint DAT_STRING = 0;
|
||||||
|
const uint DAT_INT = 1;
|
||||||
|
const uint DAT_FLOAT = 2;
|
11
src/datatypes/primitives.cpp
Normal file
11
src/datatypes/primitives.cpp
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#include "primitives.h"
|
||||||
|
|
||||||
|
StringData::StringData(std::string str) : wrapped(str) {}
|
||||||
|
StringData::operator std::string() { return wrapped; }
|
||||||
|
|
||||||
|
IntData::IntData(int in) : wrapped(in) {}
|
||||||
|
IntData::operator int() { return wrapped; }
|
||||||
|
|
||||||
|
FloatData::FloatData(float in) : wrapped(in) {}
|
||||||
|
FloatData::operator float() { return wrapped; }
|
||||||
|
|
24
src/datatypes/primitives.h
Normal file
24
src/datatypes/primitives.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class StringData {
|
||||||
|
std::string wrapped;
|
||||||
|
public:
|
||||||
|
StringData(std::string);
|
||||||
|
operator std::string();
|
||||||
|
};
|
||||||
|
|
||||||
|
class IntData {
|
||||||
|
int wrapped;
|
||||||
|
public:
|
||||||
|
IntData(int);
|
||||||
|
operator int();
|
||||||
|
};
|
||||||
|
|
||||||
|
class FloatData {
|
||||||
|
float wrapped;
|
||||||
|
public:
|
||||||
|
FloatData(float);
|
||||||
|
operator float();
|
||||||
|
};
|
Loading…
Reference in a new issue