阶段性保存,全面修改Value为Object

This commit is contained in:
2025-12-22 19:18:43 +08:00
parent 34a56beb90
commit 271846143a
15 changed files with 334 additions and 418 deletions

View File

@@ -1,50 +1,32 @@
#pragma once
#include <Value/BaseValue.hpp>
#include <context_forward.hpp>
namespace Fig
{
struct StructInstanceT final
struct StructInstance
{
size_t parentId;
ContextPtr localContext;
StructInstanceT(size_t _parentId, ContextPtr _localContext) :
parentId(std::move(_parentId)), localContext(std::move(_localContext)) {}
StructInstanceT(const StructInstanceT &other) :
parentId(other.parentId), localContext(other.localContext) {}
StructInstanceT &operator=(const StructInstanceT &) = default;
StructInstanceT(StructInstanceT &&) = default;
StructInstanceT &operator=(StructInstanceT &&) = default;
bool operator==(const StructInstanceT &) const = default;
};
class StructInstance final : public __ValueWrapper<StructInstanceT>
{
public:
StructInstance(const StructInstanceT &x) :
__ValueWrapper(ValueType::StructInstance)
{
data = std::make_unique<StructInstanceT>(x);
}
// ===== Constructors =====
StructInstance(size_t _parentId, ContextPtr _localContext) :
__ValueWrapper(ValueType::StructInstance)
{
data = std::make_unique<StructInstanceT>(std::move(_parentId), std::move(_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 data == other.data;
return parentId == other.parentId && localContext == other.localContext;
}
bool operator!=(const StructInstance &other) const noexcept
{
return !(*this == other);
}
StructInstance(const StructInstance &) = default;
StructInstance(StructInstance &&) = default;
StructInstance &operator=(const StructInstance &) = default;
StructInstance &operator=(StructInstance &&) = default;
};
}; // namespace Fig
} // namespace Fig