-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
144 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
53 changes: 0 additions & 53 deletions
53
tests/zetsubou_build_step/config/agnes/reflection_class.mustache
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
tests/zetsubou_build_step/config/agnes/reflection_enum.mustache
This file was deleted.
Oops, something went wrong.
69 changes: 11 additions & 58 deletions
69
tests/zetsubou_build_step/config/agnes/reflection_header.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,19 @@ | ||
#include <Reflection/ReflectionInfo.h> | ||
#include "{{header_path}}" | ||
|
||
namespace Meta::ReflectionData | ||
// Classes | ||
namespace Meta | ||
{ | ||
{{#classes}} | ||
class meta_{{class_name}} : public ClassInfo | ||
{ | ||
static meta_{{class_name}} Data; | ||
|
||
// private constructor | ||
meta_{{class_name}}() { | ||
Fields = { | ||
{{#fields}} | ||
{ {{name}}, &{{{canonical_name}}}::{{name}}, {{access}}, Meta::GetType<{{{type}}}> }, | ||
{{/fields}} | ||
}; | ||
Methods = { | ||
{{#methods}} | ||
{ {{name}}, detail::MethodWrapper<decltype(&{{{canonical_name}}}::{{name}}), &{{{canonical_name}}}::{{name}}> }, | ||
{{/methods}} | ||
}; | ||
} | ||
|
||
const std::string Name = "{{class_name}}"; | ||
const std::string CanonicalName = "{{{canonical_name}}}"; | ||
|
||
public: | ||
ClassInfo& Get() { return Data; } | ||
}; | ||
|
||
TReflectionVector<Attribute> {{class_name}}Meta::Attributes = { | ||
{{#attributes}} | ||
{{{value}}}, | ||
{{/attributes}} | ||
}; | ||
|
||
TReflectionVector<FieldInfo> {{class_name}}Meta::Fields = { | ||
{{#fields}} | ||
{ {{name}}, &{{{canonical_name}}}::{{name}}, {{access}}, Meta::GetType<{{{type}}}> }, | ||
{{/fields}} | ||
}; | ||
|
||
TReflectionVector<MethodInfo> {{class_name}}Meta::Methods = { | ||
{{#methods}} | ||
{ {{name}}, detail::MethodWrapper<decltype(&{{{canonical_name}}}::{{name}}), &{{{canonical_name}}}::{{name}}> }, | ||
{{/methods}} | ||
}; | ||
template<> | ||
void RegisterClassRtti<typename {{{canonical_name}}}>(); | ||
{{/classes}} | ||
} | ||
|
||
// Enums | ||
namespace Meta | ||
{ | ||
{{#enums}} | ||
class {{enum_name}}_Enum | ||
{ | ||
std::vector<EnumValue> Values = { | ||
{{#values}} | ||
{ {{name}}, {{value}} }, | ||
{{/values}} | ||
}; | ||
|
||
std::vector<Attribute> Attributes = { | ||
{{#attributes}} | ||
{{value}}, | ||
{{/attributes}} | ||
}; | ||
}; | ||
template<> | ||
void RegisterEnumRtti<typename {{{canonical_name}}}>(); | ||
{{/enums}} | ||
} |
10 changes: 8 additions & 2 deletions
10
tests/zetsubou_build_step/config/agnes/reflection_main.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
{{#includes}} | ||
#include "{{path}}.h" | ||
#include "{{path}}" | ||
{{/includes}} | ||
|
||
namespace Meta | ||
{ | ||
void RegisterReflection() | ||
{ | ||
// Classes | ||
{{#classes}} | ||
Meta::GetType<typename {{{canonical_name}}}>(); | ||
RegisterClassRtti<typename {{{canonical_name}}}>(); | ||
{{/classes}} | ||
|
||
// Enums | ||
{{#enums}} | ||
RegisterEnumRtti<typename {{{canonical_name}}}>(); | ||
{{/enums}} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 49 additions & 1 deletion
50
tests/zetsubou_build_step/config/agnes/reflection_unit.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,49 @@ | ||
#include "{{output_file_name}}.h" | ||
#include "{{header_path}}" | ||
#include <iostream> | ||
|
||
// Classes | ||
namespace Meta | ||
{ | ||
{{#classes}} | ||
template<> | ||
void RegisterClassRtti<typename {{{canonical_name}}}>() | ||
{ | ||
std::cout << "Class: " << "{{{canonical_name}}}" << std::endl; | ||
std::cout << " attributes:" << std::endl; | ||
{{#attributes}} | ||
std::cout << " val: " << "{{value}}" << std::endl; | ||
{{/attributes}} | ||
|
||
std::cout << " fields:" << std::endl; | ||
{{#fields}} | ||
std::cout << " name: " << "{{name}}" << " type: " << "{{{type}}}" << std::endl; | ||
{{/fields}} | ||
|
||
std::cout << std::endl; | ||
} | ||
{{/classes}} | ||
} | ||
|
||
// Enums | ||
namespace Meta | ||
{ | ||
{{#enums}} | ||
template<> | ||
void RegisterEnumRtti<typename {{{canonical_name}}}>() | ||
{ | ||
std::cout << "Enum: " << "{{{canonical_name}}}" << std::endl; | ||
std::cout << " attributes:" << std::endl; | ||
{{#attributes}} | ||
std::cout << " val: " << "{{value}}" << std::endl; | ||
{{/attributes}} | ||
|
||
std::cout << " values:" << std::endl; | ||
{{#values}} | ||
std::cout << " name: " << "{{name}}" << " val: " << "{{value}}" << std::endl; | ||
{{/values}} | ||
std::cout << std::endl; | ||
} | ||
{{/enums}} | ||
} |
Oops, something went wrong.