-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathCodeGenerator.cs
48 lines (44 loc) · 1.22 KB
/
CodeGenerator.cs
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
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using ReClassNET.CodeGenerator;
using ReClassNET.Logger;
using ReClassNET.Nodes;
using UnrealEngineClassesPlugin.Nodes;
namespace UnrealEngineClassesPlugin
{
public class CodeGenerator : CustomCppCodeGenerator
{
public override bool CanHandle(BaseNode node)
{
switch (node)
{
case FDateTimeNode _:
case FGuidNode _:
case FQWordNode _:
case FStringNode _:
case TArrayNode _:
case TSharedPtrNode _:
return true;
}
return false;
}
public override string GetTypeDefinition(BaseNode node, GetTypeDefinitionFunc defaultGetTypeDefinitionFunc, ResolveWrappedTypeFunc defaultResolveWrappedTypeFunc, ILogger logger)
{
switch (node)
{
case FDateTimeNode _:
return "FDateTime";
case FGuidNode _:
return "FGuid";
case FQWordNode _:
return "FQWord";
case FStringNode _:
return "FString";
case TArrayNode arrayNode:
return $"TArray<{defaultResolveWrappedTypeFunc(arrayNode.InnerNode, true, logger)}>";
case TSharedPtrNode sharedPtrNode:
return $"TSharedPtr<{defaultResolveWrappedTypeFunc(sharedPtrNode.InnerNode, true, logger)}>";
}
throw new InvalidOperationException("Can not handle node: " + node.GetType());
}
}
}