return context_find_tag<class_context>(context).current_wrapper_kind == class_context::inherit;
}
+enum partial_class
+{
+ class_partial = 1
+};
+
struct klass
{
template <typename OutputIterator, typename Context>
if(!as_generator("[Efl.Eo.BindingEntity]\n").generate(sink, attributes::unused, iface_cxt))
return false;
+ using efl::eolian::grammar::lit;
if(!as_generator
(
- "public " /*<< class_type*/ "interface" /*<<*/ " " << string << " : "
+ lit("public ") << (is_partial ? "partial ":"")
+ /*<< class_type*/ << "interface" /*<<*/ " " << string << " : "
)
.generate(sink, name_helpers::klass_interface_name(cls), iface_cxt))
return false;
if(!as_generator
(
documentation
- << "sealed public class " << concrete_name << " :\n"
+ << "sealed public " << (is_partial ? "partial ":"") << " class " << concrete_name << " :\n"
<< scope_tab << (root ? "Efl.Eo.EoWrapper" : "") << (klass_full_concrete_or_interface_name % "") << "\n"
<< scope_tab << ", " << interface_name << "\n"
<< scope_tab << *(", " << name_helpers::klass_full_concrete_or_interface_name) << "\n"
documentation
<< "[" << name_helpers::klass_full_native_inherit_name(cls) << "]\n"
<< "[Efl.Eo.BindingEntity]\n"
- << "public " << class_type << " " << name_helpers::klass_concrete_name(cls) << " : "
+ << "public "
+ << (is_partial
+ ? class_type == "class"
+ ? "partial class"
+ : "abstract partial class"
+ : class_type
+ )
+ << " " << name_helpers::klass_concrete_name(cls) << " : "
<< (klass_full_concrete_or_interface_name % ",") // classes
<< (root ? "Efl.Eo.EoWrapper" : "") // ... or root
<< (inherit_interfaces.empty() ? "" : ", ")
}
return true;
}
+
+ bool is_partial;
+
+ klass const operator()(partial_class) const
+ {
+ return klass{true};
+ }
};
-struct klass const klass = {};
+struct klass const klass = {false};
}
int v_major;
int v_minor;
bool want_beta;
+ bool want_partial;
std::map<const std::string, std::string> references_map;
};
efl::eolian::grammar::attributes::klass_def klass_def(klass, opts.unit);
std::vector<efl::eolian::grammar::attributes::klass_def> klasses{klass_def};
- if (!eolian_mono::klass
- .generate(iterator, klass_def, context))
+ auto klass_gen = !opts.want_partial ? eolian_mono::klass
+ : eolian_mono::klass(eolian_mono::class_partial);
+ if (!klass_gen.generate(iterator, klass_def, context))
{
throw std::runtime_error("Failed to generate class");
}
<< " -v, --version Print the version." << std::endl
<< " -b, --beta Enable @beta methods." << std::endl
<< " -e, --example-dir <dir> Folder to search for example files." << std::endl
+ << " -p, --partial Create class as a partial class" << std::endl
<< " -h, --help Print this help." << std::endl;
exit(EXIT_FAILURE);
}
{ "references", required_argument, 0, 'r'},
{ "beta", no_argument, 0, 'b'},
{ "example-dir", required_argument, 0, 'e' },
+ { "partial", no_argument, 0, 'p' },
{ 0, 0, 0, 0 }
};
- const char* options = "I:D:o:c:M:m:ar:vhbe:";
+ const char* options = "I:D:o:c:M:m:ar:vhbpe:";
int c, idx;
while ( (c = getopt_long(argc, argv, options, long_options, &idx)) != -1)
opts.examples_dir = optarg;
if (!opts.examples_dir.empty() && opts.examples_dir.back() != '/') opts.examples_dir += "/";
}
+ else if (c == 'p')
+ {
+ opts.want_partial = true;
+ }
}
if (optind == argc-1)
{
'elm_atspi_app_object.eo',
]
+manual_inheritance_files = [
+ 'efl_object.eo'
+]
+
beta_option = []
if (get_option('mono-beta'))
beta_option = '-b'
subdir_file_location = join_paths(file_location, eo_file_subdir)
foreach mono_gen_file : mono_pub_eo_files
if not blacklisted_files.contains(mono_gen_file)
+ partial = []
+ if manual_inheritance_files.contains(mono_gen_file)
+ partial = '-p'
+ endif
mono_generator_target += custom_target('eolian_mono_gen_'+mono_gen_file.underscorify()+'',
input : join_paths(subdir_file_location, mono_gen_file),
output : [mono_gen_file + '.cs'],
command : [eolian_mono_gen, beta_option, '-I', meson.current_source_dir(), eolian_include_directories,
'--dllimport', package_name,
'-o', join_paths(meson.current_build_dir(), mono_gen_file + '.cs'),
- '-e', get_option('mono-examples-dir'),
+ '-e', get_option('mono-examples-dir'), partial,
'@INPUT@'])
endif
endforeach