-
Notifications
You must be signed in to change notification settings - Fork 44
/
04_CompileTimeClasses.cpp
35 lines (29 loc) · 1.56 KB
/
04_CompileTimeClasses.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <BNM/UserSettings/GlobalSettings.hpp>
#include <BNM/Class.hpp>
void OnLoaded_Example_04() {
using namespace BNM;
// CompileTimeClass is used for ClassesManagement to find classes
// It cannot be created directly, so there is a CompileTimeClassBuilder
// Suppose there is such a structure:
/*
namespace ExampleNamespace {
class ExampleClass {
class ExampleInnerClass {
class ExampleInnerGenericClass<T1, T2, T3> {
}
}
}
}
*/
// And you need an array class ExampleInnerGenericClass<int, float, ExampleClass>[]
auto targetClass = CompileTimeClassBuilder(BNM_OBFUSCATE("ExampleNamespace"), BNM_OBFUSCATE("ExampleClass")) // ExampleNamespace.ExampleClass
.Class(BNM_OBFUSCATE("ExampleInnerClass")) // ExampleNamespace.ExampleClass.ExampleInnerClass
.Class(BNM_OBFUSCATE("ExampleInnerGenericClass`3")) // ExampleNamespace.ExampleClass.ExampleInnerClass.ExampleInnerGenericClass<T1, T2, T3>
.Generic({
BNM::Defaults::Get<int>(),
BNM::Defaults::Get<float>(),
CompileTimeClassBuilder(BNM_OBFUSCATE("ExampleNamespace"), BNM_OBFUSCATE("ExampleClass")).Build()
}) // ExampleNamespace.ExampleClass.ExampleInnerClass.ExampleInnerGenericClass<int, float, ExampleNamespace.ExampleClass>
.Modifier(CompileTimeClass::ModifierType::Array) // ExampleNamespace.ExampleClass.ExampleInnerClass.ExampleInnerGenericClass<int, float, ExampleNamespace.ExampleClass>[]
.Build();
}