summaryrefslogtreecommitdiff
path: root/src/bin/eolian_mono/eolian/mono/struct_definition.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/eolian_mono/eolian/mono/struct_definition.hh')
-rw-r--r--src/bin/eolian_mono/eolian/mono/struct_definition.hh44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
index 7802b4518c..17485d12e4 100644
--- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
@@ -131,6 +131,22 @@ struct struct_internal_definition_generator
131 .generate(sink, nullptr, context)) 131 .generate(sink, nullptr, context))
132 return false; 132 return false;
133 } 133 }
134 else if (regular && !(regular->base_qualifier & efl::eolian::grammar::attributes::qualifier_info::is_ref)
135 && regular->base_type == "bool")
136 {
137 if (!as_generator("///<summary>Internal wrapper for field " << field_name << "</summary>\n"
138 "public System.Byte " << field_name << ";\n")
139 .generate(sink, nullptr, context))
140 return false;
141 }
142 else if (regular && !(regular->base_qualifier & efl::eolian::grammar::attributes::qualifier_info::is_ref)
143 && regular->base_type == "char")
144 {
145 if (!as_generator("///<summary>Internal wrapper for field " << field_name << "</summary>\n"
146 "public System.Byte " << field_name << ";\n")
147 .generate(sink, nullptr, context))
148 return false;
149 }
134 else if (!as_generator(scope_tab << eolian_mono::marshall_annotation(false) << "\n" 150 else if (!as_generator(scope_tab << eolian_mono::marshall_annotation(false) << "\n"
135 << scope_tab << "public " << eolian_mono::marshall_type(false) << " " << string << ";\n") 151 << scope_tab << "public " << eolian_mono::marshall_type(false) << " " << string << ";\n")
136 .generate(sink, std::make_tuple(field.type, field.type, field_name), context)) 152 .generate(sink, std::make_tuple(field.type, field.type, field_name), context))
@@ -255,6 +271,20 @@ struct to_internal_field_convert_generator
255 ).generate(sink, std::make_tuple(field_name, field_name), context)) 271 ).generate(sink, std::make_tuple(field_name, field_name), context))
256 return false; 272 return false;
257 } 273 }
274 else if (!field.type.is_ptr && regular && regular->base_type == "bool")
275 {
276 if (!as_generator(
277 scope_tab << scope_tab << "_internal_struct." << string << " = _external_struct." << string << " ? (byte)1 : (byte)0;\n")
278 .generate(sink, std::make_tuple(field_name, field_name), context))
279 return false;
280 }
281 else if (!field.type.is_ptr && regular && regular->base_type == "char")
282 {
283 if (!as_generator(
284 scope_tab << scope_tab << "_internal_struct." << string << " = (byte)_external_struct." << string << ";\n")
285 .generate(sink, std::make_tuple(field_name, field_name), context))
286 return false;
287 }
258 else // primitives and enums 288 else // primitives and enums
259 { 289 {
260 if (!as_generator( 290 if (!as_generator(
@@ -358,6 +388,20 @@ struct to_external_field_convert_generator
358 ).generate(sink, std::make_tuple(field_name, field_name), context)) 388 ).generate(sink, std::make_tuple(field_name, field_name), context))
359 return false; 389 return false;
360 } 390 }
391 else if (!field.type.is_ptr && regular && regular->base_type == "bool")
392 {
393 if (!as_generator(
394 scope_tab << scope_tab << "_external_struct." << string << " = _internal_struct." << string << " != 0;\n"
395 ).generate(sink, std::make_tuple(field_name, field_name), context))
396 return false;
397 }
398 else if (!field.type.is_ptr && regular && regular->base_type == "char")
399 {
400 if (!as_generator(
401 scope_tab << scope_tab << "_external_struct." << string << " = (char)_internal_struct." << string << ";\n"
402 ).generate(sink, std::make_tuple(field_name, field_name), context))
403 return false;
404 }
361 else // primitives and enums 405 else // primitives and enums
362 { 406 {
363 if (!as_generator( 407 if (!as_generator(