From bd07ae3f4e1bcdedc3e373460671ca9713a03de5 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Thu, 2 Jun 2022 21:34:16 -0700 Subject: Changeset: 60 Add struct/class scanning to codegen --- source/20-codegen-runtime/MetadataBase.hpp | 43 ++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'source/20-codegen-runtime/MetadataBase.hpp') diff --git a/source/20-codegen-runtime/MetadataBase.hpp b/source/20-codegen-runtime/MetadataBase.hpp index 8be668d..c1ad894 100644 --- a/source/20-codegen-runtime/MetadataBase.hpp +++ b/source/20-codegen-runtime/MetadataBase.hpp @@ -1,14 +1,53 @@ #pragma once +#include #include +#include #include namespace Metadata { -template +struct TypeId { + size_t id; +}; + +struct TypeInfo; + +struct TypePropertyInfo { + std::string_view name; + const TypeInfo* type; + std::string_view getterName; + std::string_view setterName; + + bool IsDirectAccess() const; +}; + +struct TypeMethodInfo { + std::string_view name; + // TODO +}; + +struct TypeInfo { + TypeId typeId; + std::string_view name; + std::span parents; + std::span properties; + std::span methods; + + /// Whether this object is registered at runtime or statically compiled + bool dynamic = false; +}; + +// NOTE: implemented by generating specializations; not-generated ones should generated an error in the linking phase +template +const TypeInfo* GetTypeInfo(); + +// NOTE: implemented by generating specializations; not-generated ones should generated an error in the linking phase +template std::string_view EnumToString(TEnum value); -template +// NOTE: implemented by generating specializations; not-generated ones should generated an error in the linking phase +template std::optional EnumFromString(std::string_view str); } // namespace Metadata -- cgit v1.2.3-70-g09d2