Reflection stub

This commit is contained in:
Vulpovile
2023-11-03 22:56:09 -07:00
parent 061fc1e564
commit 25d34d28ee
9 changed files with 2287 additions and 134 deletions

View File

@@ -0,0 +1,15 @@
#pragma once
namespace B3D{
namespace Reflection{
enum ReflectionType {
TYPE_INT = 0,
TYPE_FLOAT = 1,
TYPE_STRING = 2,
TYPE_VECTOR3 = 3,
TYPE_COLOR3 = 4,
TYPE_CFRAME = 5,
TYPE_BOOLEAN = 6,
TYPE_ENUM = 7
};
}
}

View File

@@ -0,0 +1,26 @@
#pragma once
#include <iostream>
#include <string>
#include <map>
#include "ReflectionProperty.h"
namespace B3D{
namespace Instance{
class Instance;
}
namespace Reflection{
class ReflectionDataTable
{
public:
ReflectionDataTable(Instance::Instance * parentInstance, std::string className);
ReflectionDataTable::ReflectionDataTable(void);
~ReflectionDataTable(void);
std::string ReflectionDataTable::getClassName(void);
private:
//Perhaps not stored here?
std::string className;
std::map<std::string, B3D::Reflection::ReflectionProperty<void*>*> propertyTable;
Instance::Instance * parentInstance;
};
}
}

View File

@@ -0,0 +1,28 @@
#pragma once
#include "Reflection.h"
#include <iostream>
#include <string>
#include <typeinfo>
namespace B3D{
namespace Reflection{
class ReflectionDataTable;
template<typename T>
class ReflectionProperty
{
public:
T * value;
ReflectionType type;
ReflectionProperty(T * value, ReflectionType type, ReflectionDataTable * containerTable, bool archivable = true, bool locked = false, bool propertyHidden = false);
ReflectionProperty(void);
~ReflectionProperty(void);
private:
std::string propertyName;
bool archivable;
bool locked;
bool propertyHidden;
ReflectionDataTable * containerTable;
};
}
}

View File

@@ -0,0 +1,22 @@
#include "Reflection\ReflectionDataTable.h"
using namespace B3D::Reflection;
ReflectionDataTable::ReflectionDataTable(B3D::Instance::Instance * parentInstance, std::string className)
{
this->parentInstance = parentInstance;
this->className = className;
}
ReflectionDataTable::ReflectionDataTable(void)
{
}
ReflectionDataTable::~ReflectionDataTable(void)
{
}
std::string ReflectionDataTable::getClassName(void)
{
return className;
}

View File

@@ -0,0 +1,23 @@
#include "Reflection\ReflectionProperty.h"
using namespace B3D::Reflection;
template<typename T>
ReflectionProperty<T>::ReflectionProperty(T * value, ReflectionType type, ReflectionDataTable * containerTable, bool archivable = true, bool locked = false, bool propertyHidden = false)
{
this->value = value;
this->type = type;
this->containerTable = containerTable;
this->locked = locked;
this->archivable = archivable;
this->propertyHidden = propertyHidden;
}
template<typename T>
ReflectionProperty<T>::ReflectionProperty(void)
{
}
template<typename T>
ReflectionProperty<T>::~ReflectionProperty(void)
{
}