1
1
using CppSharp . AST ;
2
2
using CppSharp . Generators ;
3
3
using CppSharp . Generators . C ;
4
- using CppSharp . Passes ;
5
4
using CppSharp . Types ;
6
5
using CppSharp . Utils ;
7
6
@@ -21,32 +20,49 @@ public override void MarshalToManaged(MarshalContext ctx, GeneratorKind kind)
21
20
}
22
21
}
23
22
24
- [ TypeMap ( "TestMappedTypeNonConstRefParam" , GeneratorKindID = GeneratorKind . CLI_ID ) ]
25
- public class TestMappedTypeNonConstRefParamTypeMap : TypeMap
23
+ namespace CLI
26
24
{
27
- public override Type SignatureType ( TypePrinterContext ctx , GeneratorKind kind )
28
- {
29
- return new CILType ( typeof ( string ) ) ;
30
- }
31
-
32
- public override void MarshalToManaged ( MarshalContext ctx , GeneratorKind kind )
25
+ [ TypeMap ( "TestMappedTypeNonConstRefParam" , GeneratorKindID = GeneratorKind . CLI_ID ) ]
26
+ public class TestMappedTypeNonConstRefParamTypeMap : TypeMap
33
27
{
34
- ctx . Return . Write ( "clix::marshalString<clix::E_UTF8>({0}.m_str)" , ctx . ReturnVarName ) ;
35
- }
28
+ public override Type SignatureType ( TypePrinterContext ctx , GeneratorKind kind )
29
+ {
30
+ return new CILType ( typeof ( string ) ) ;
31
+ }
36
32
37
- public override void MarshalToNative ( MarshalContext ctx , GeneratorKind kind )
38
- {
39
- if ( ctx . Parameter . Usage == ParameterUsage . InOut )
33
+ public override void MarshalToManaged ( MarshalContext ctx , GeneratorKind kind )
40
34
{
41
- ctx . Before . WriteLine ( $ "System::String^ _ { ctx . Parameter . Name } = { ctx . Parameter . Name } ;" ) ;
35
+ ctx . Return . Write ( "clix::marshalString<clix::E_UTF8>({0}.m_str)" , ctx . ReturnVarName ) ;
42
36
}
43
37
44
- string paramName = ctx . Parameter . Usage == ParameterUsage . InOut ? $ "_{ ctx . Parameter . Name } " : ctx . Parameter . Name ;
38
+ public override void MarshalToNative ( MarshalContext ctx , GeneratorKind kind )
39
+ {
40
+ if ( ctx . Parameter . Usage == ParameterUsage . InOut )
41
+ {
42
+ ctx . Before . WriteLine ( $ "System::String^ _{ ctx . Parameter . Name } = { ctx . Parameter . Name } ;") ;
43
+ }
45
44
46
- ctx . Before . WriteLine (
47
- $ "::TestMappedTypeNonConstRefParam _{ ctx . ArgName } = clix::marshalString<clix::E_UTF8>({ paramName } );") ;
45
+ string paramName = ctx . Parameter . Usage == ParameterUsage . InOut ? $ "_{ ctx . Parameter . Name } " : ctx . Parameter . Name ;
48
46
49
- ctx . Return . Write ( "_{0}" , ctx . ArgName ) ;
47
+ ctx . Before . WriteLine (
48
+ $ "::TestMappedTypeNonConstRefParam _{ ctx . ArgName } = clix::marshalString<clix::E_UTF8>({ paramName } );") ;
49
+
50
+ ctx . Return . Write ( "_{0}" , ctx . ArgName ) ;
51
+ }
52
+ }
53
+ }
54
+
55
+ namespace Cpp
56
+ {
57
+ [ TypeMap ( "TestMappedTypeNonConstRefParam" , GeneratorKindID = GeneratorKind . CPlusPlus_ID ) ]
58
+ public class TestMappedTypeNonConstRefParamTypeMap : TypeMap
59
+ {
60
+ public override Type SignatureType ( TypePrinterContext ctx , GeneratorKind kind )
61
+ {
62
+ var tagType = ctx . Type as TagType ;
63
+ var typePrinter = new CppTypePrinter ( Context ) ;
64
+ return new CustomType ( tagType . Declaration . Visit ( typePrinter ) ) ;
65
+ }
50
66
}
51
67
}
52
68
0 commit comments