mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 03:51:50 +00:00
test environment (sky)
This commit is contained in:
parent
c4d5812b4f
commit
a7ad219261
14 changed files with 421 additions and 196 deletions
|
|
@ -9,6 +9,10 @@
|
|||
#include <stdexcept>
|
||||
#include <unordered_map>
|
||||
|
||||
#ifdef VC_ENABLE_REFLECTION
|
||||
#include "util/EnumMetadata.hpp"
|
||||
#endif
|
||||
|
||||
namespace util {
|
||||
template<class T> class Buffer;
|
||||
}
|
||||
|
|
@ -70,6 +74,14 @@ namespace dv {
|
|||
return ptr != nullptr;
|
||||
}
|
||||
|
||||
inline value* operator->() noexcept {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
inline const value* operator->() const noexcept {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
inline value& operator*() noexcept {
|
||||
return *ptr;
|
||||
}
|
||||
|
|
@ -78,6 +90,11 @@ namespace dv {
|
|||
return *ptr;
|
||||
}
|
||||
|
||||
#ifdef VC_ENABLE_REFLECTION
|
||||
template <typename T>
|
||||
bool get(T& dst, const util::EnumMetadata<T>& mt) const;
|
||||
#endif
|
||||
|
||||
bool get(std::string& dst) const;
|
||||
bool get(bool& dst) const;
|
||||
bool get(char& dst) const;
|
||||
|
|
@ -552,6 +569,17 @@ namespace dv {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef VC_ENABLE_REFLECTION
|
||||
template <typename T>
|
||||
inline bool optionalvalue::get(T& dst, const util::EnumMetadata<T>& mt) const {
|
||||
if (ptr) {
|
||||
return mt.getItem(ptr->asString(), dst);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline bool optionalvalue::get(std::string& dst) const {
|
||||
if (ptr) {
|
||||
dst = ptr->asString();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue