diff options
author | rtk0c <[email protected]> | 2022-06-02 21:34:16 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-02 21:34:16 -0700 |
commit | bd07ae3f4e1bcdedc3e373460671ca9713a03de5 (patch) | |
tree | 15c897891474a97983f247196923f8e4f2184083 /source/20-codegen-runtime/MetadataBase.hpp | |
parent | 8a0f2cd0b398ee0b7740e44a0e5fb2f75d090ccb (diff) |
Changeset: 60 Add struct/class scanning to codegen
Diffstat (limited to 'source/20-codegen-runtime/MetadataBase.hpp')
-rw-r--r-- | source/20-codegen-runtime/MetadataBase.hpp | 43 |
1 files changed, 41 insertions, 2 deletions
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 <cstddef> #include <optional> +#include <span> #include <string_view> namespace Metadata { -template <class TEnum> +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<const TypeInfo*> parents; + std::span<const TypePropertyInfo> properties; + std::span<const TypeMethodInfo> 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 <typename T> +const TypeInfo* GetTypeInfo(); + +// NOTE: implemented by generating specializations; not-generated ones should generated an error in the linking phase +template <typename TEnum> std::string_view EnumToString(TEnum value); -template <class TEnum> +// NOTE: implemented by generating specializations; not-generated ones should generated an error in the linking phase +template <typename TEnum> std::optional<TEnum> EnumFromString(std::string_view str); } // namespace Metadata |