imple of comments for 'review comments impl'
This commit is contained in:
parent
ac77c4444e
commit
36ecbca03f
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
namespace effil {
|
namespace effil {
|
||||||
|
|
||||||
|
|||||||
@ -188,25 +188,24 @@ StoredObject createStoredObject(GCObjectHandle handle) {
|
|||||||
return std::make_unique<TableHolder>(handle);
|
return std::make_unique<TableHolder>(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
sol::optional<bool> storedObjectToBool(const StoredObject& sobj) {
|
template<typename DataType>
|
||||||
auto ptr = dynamic_cast<PrimitiveHolder<bool>*>(sobj.get());
|
sol::optional<DataType> getPrimitiveHolderData(const StoredObject& sobj) {
|
||||||
|
auto ptr = dynamic_cast<PrimitiveHolder<DataType>*>(sobj.get());
|
||||||
if (ptr)
|
if (ptr)
|
||||||
return ptr->getData();
|
return ptr->getData();
|
||||||
return sol::optional<bool>();
|
return sol::optional<DataType>();
|
||||||
|
}
|
||||||
|
|
||||||
|
sol::optional<bool> storedObjectToBool(const StoredObject& sobj) {
|
||||||
|
return getPrimitiveHolderData<bool>(sobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
sol::optional<double> storedObjectToDouble(const StoredObject& sobj) {
|
sol::optional<double> storedObjectToDouble(const StoredObject& sobj) {
|
||||||
auto ptr = dynamic_cast<PrimitiveHolder<double>*>(sobj.get());
|
return getPrimitiveHolderData<double>(sobj);
|
||||||
if (ptr)
|
|
||||||
return ptr->getData();
|
|
||||||
return sol::optional<double>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sol::optional<std::string> storedObjectToString(const StoredObject& sobj) {
|
sol::optional<std::string> storedObjectToString(const StoredObject& sobj) {
|
||||||
auto ptr = dynamic_cast<PrimitiveHolder<std::string>*>(sobj.get());
|
return getPrimitiveHolderData<std::string>(sobj);
|
||||||
if (ptr)
|
|
||||||
return ptr->getData();
|
|
||||||
return sol::optional<std::string>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // effil
|
} // effil
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "utils.h"
|
|
||||||
|
|
||||||
#include "garbage-collector.h"
|
#include "garbage-collector.h"
|
||||||
|
|
||||||
#include <sol.hpp>
|
#include <sol.hpp>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user