forked from PuqiAR/Fig-TreeWalker
[Feat] 面对对象(struct)支持,完成对其初始化解析。 [Impl] Value更换为Object,且简单类型按值存储,复杂类型为shared_ptr。 [Impl] 全局使用 Object shared_ptr
32 lines
961 B
C++
32 lines
961 B
C++
#pragma once
|
|
|
|
#include <context_forward.hpp>
|
|
|
|
namespace Fig
|
|
{
|
|
struct StructInstance
|
|
{
|
|
size_t parentId;
|
|
ContextPtr localContext;
|
|
|
|
// ===== Constructors =====
|
|
StructInstance(size_t _parentId, ContextPtr _localContext) :
|
|
parentId(_parentId), localContext(std::move(_localContext)) {}
|
|
|
|
StructInstance(const StructInstance &other) = default;
|
|
StructInstance(StructInstance &&) noexcept = default;
|
|
StructInstance &operator=(const StructInstance &) = default;
|
|
StructInstance &operator=(StructInstance &&) noexcept = default;
|
|
|
|
// ===== Comparison =====
|
|
bool operator==(const StructInstance &other) const noexcept
|
|
{
|
|
return parentId == other.parentId && localContext == other.localContext;
|
|
}
|
|
bool operator!=(const StructInstance &other) const noexcept
|
|
{
|
|
return !(*this == other);
|
|
}
|
|
};
|
|
} // namespace Fig
|