@@ -106,16 +106,23 @@ private void WrapConstructor(Method method)
106
106
{
107
107
Write ( GetDerivedType ( @namespace , wrapper ) ) ;
108
108
Write ( $ "{ wrapper } { @namespace } ") ;
109
- Write ( $@ "({ ( string . Join ( ", " , method . Parameters . Select (
110
- p => cppTypePrinter . VisitParameter ( p ) ) ) ) } )" ) ;
109
+ Write ( $@ "({ string . Join ( ", " , method . Parameters . Select (
110
+ p => cppTypePrinter . VisitParameter ( p ) ) ) } )" ) ;
111
111
WriteLine ( $ ": { @namespace } ({ @params } ) {{}} }};") ;
112
112
Write ( $ "extern \" C\" {{ void { wrapper } ({ signature } ) ") ;
113
113
WriteLine ( $ "{{ new (instance) { wrapper } { @namespace } ({ @params } ); }} }}") ;
114
114
}
115
115
else
116
116
{
117
- Write ( $ "extern \" C\" {{ void { wrapper } ({ signature } ) ") ;
118
- WriteLine ( $ "{{ new (instance) { @namespace } ({ @params } ); }} }}") ;
117
+ Write ( $ "extern \" C\" ") ;
118
+ if ( method . Namespace . Access == AccessSpecifier . Protected )
119
+ Write ( $@ "{{ class { wrapper } { method . Namespace . Namespace . Name } : public {
120
+ method . Namespace . Namespace . Visit ( cppTypePrinter ) } " ) ;
121
+ Write ( $ "{{ void { wrapper } ({ signature } ) ") ;
122
+ Write ( $ "{{ new (instance) { @namespace } ({ @params } ); }} }}") ;
123
+ if ( method . Namespace . Access == AccessSpecifier . Protected )
124
+ Write ( "; }" ) ;
125
+ NewLine ( ) ;
119
126
}
120
127
121
128
foreach ( var param in method . Parameters . Where ( p =>
@@ -149,14 +156,23 @@ private void WrapDestructor(Method method)
149
156
Write ( GetDerivedType ( @namespace , wrapper ) ) ;
150
157
else
151
158
Write ( "extern \" C\" { " ) ;
159
+ if ( method . Namespace . Access == AccessSpecifier . Protected )
160
+ Write ( $@ "class { wrapper } { method . Namespace . Namespace . Name } : public {
161
+ method . Namespace . Namespace . Visit ( cppTypePrinter ) } {{ " ) ;
152
162
Write ( $ "void { wrapper } ") ;
153
163
if ( isProtected )
154
164
Write ( "protected" ) ;
155
- WriteLine ( $@ "({ @namespace } * instance) {{ instance->~{
165
+ Write ( $@ "({ @namespace } * instance) {{ instance->~{
156
166
method . Namespace . OriginalName } (); }} }}" ) ;
157
167
if ( isProtected )
158
- WriteLine ( $@ "void { wrapper } ({ @namespace } instance) {{ {
159
- wrapper } { @namespace } ::{ wrapper } protected(instance); }}" ) ;
168
+ {
169
+ NewLine ( ) ;
170
+ Write ( $@ "void { wrapper } ({ @namespace } instance) {{ {
171
+ wrapper } { @namespace } ::{ wrapper } protected(instance); }}" ) ;
172
+ }
173
+ if ( method . Namespace . Access == AccessSpecifier . Protected )
174
+ Write ( "; }" ) ;
175
+ NewLine ( ) ;
160
176
}
161
177
162
178
private void TakeFunctionAddress ( Function function )
@@ -177,6 +193,9 @@ private void TakeFunctionAddress(Function function)
177
193
WriteRedeclaration ( function , returnType , signature , functionName ) ;
178
194
179
195
var method = function as Method ;
196
+ if ( function . Namespace . Access == AccessSpecifier . Protected )
197
+ Write ( $@ "class { wrapper } { function . Namespace . Namespace . Name } : public {
198
+ function . Namespace . Namespace . Visit ( cppTypePrinter ) } {{ " ) ;
180
199
Write ( $@ "{ returnType } ({ ( method != null && ! method . IsStatic ?
181
200
( @namespace + "::" ) : string . Empty ) } *{ wrapper } ){ signature } " ) ;
182
201
if ( function . Access == AccessSpecifier . Protected )
@@ -189,6 +208,8 @@ private void TakeFunctionAddress(Function function)
189
208
{
190
209
Write ( $ " = &{ functionName } ;") ;
191
210
}
211
+ if ( function . Namespace . Access == AccessSpecifier . Protected )
212
+ Write ( " };" ) ;
192
213
NewLine ( ) ;
193
214
}
194
215
0 commit comments