-
Notifications
You must be signed in to change notification settings - Fork 543
Expand file tree
/
Copy pathMarshal.cs
More file actions
48 lines (39 loc) · 1.5 KB
/
Marshal.cs
File metadata and controls
48 lines (39 loc) · 1.5 KB
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 CppSharp.AST;
using CppSharp.Generators.C;
namespace CppSharp.Generators
{
public class MarshalContext : TypePrinter
{
public MarshalContext(BindingContext context, uint indentation)
{
Context = context;
Before = new TextGenerator { CurrentIndentation = indentation };
Return = new TextGenerator { CurrentIndentation = indentation };
Cleanup = new TextGenerator { CurrentIndentation = indentation };
VarPrefix = new TextGenerator();
ArgumentPrefix = new TextGenerator();
Indentation = indentation;
}
public MarshalPrinter<MarshalContext, CppTypePrinter> MarshalToNative;
public TextGenerator Before { get; }
public TextGenerator Return { get; }
public TextGenerator Cleanup { get; }
public TextGenerator VarPrefix { get; }
public TextGenerator ArgumentPrefix { get; }
public string ReturnVarName { get; set; }
public QualifiedType ReturnType { get; set; }
public string ArgName { get; set; }
public int ParameterIndex { get; set; }
public uint Indentation { get; }
}
public abstract class MarshalPrinter<C, P> : AstVisitor where C : MarshalContext where P : TypePrinter, new()
{
public C Context { get; }
protected MarshalPrinter(C ctx)
{
Context = ctx;
typePrinter.Context = ctx.Context;
}
protected P typePrinter = new P();
}
}