Changeset View
Changeset View
Standalone View
Standalone View
src/bin/eolian_mono/eolian/mono/name_helpers.hh
Show First 20 Lines • Show All 287 Lines • ▼ Show 20 Line(s) | |||||
288 | 288 | | |||
289 | // Class name translation (interface/concrete/inherit/etc) | 289 | // Class name translation (interface/concrete/inherit/etc) | ||
290 | struct klass_interface_name_generator | 290 | struct klass_interface_name_generator | ||
291 | { | 291 | { | ||
292 | 292 | | |||
293 | template <typename T> | 293 | template <typename T> | ||
294 | std::string operator()(T const& klass) const | 294 | std::string operator()(T const& klass) const | ||
295 | { | 295 | { | ||
296 | std::string name = utils::remove_all(klass.eolian_name, '_'); | 296 | return ((klass.type == attributes::class_type::mixin | ||
297 | if (klass.type == attributes::class_type::mixin || klass.type == attributes::class_type::interface_) | 297 | || klass.type == attributes::class_type::interface_) ? "I" : "") | ||
298 | return "I" + name; | 298 | + utils::remove_all(klass.eolian_name, '_'); | ||
299 | else | | |||
300 | return name; | | |||
301 | } | 299 | } | ||
302 | 300 | | |||
303 | template <typename OutputIterator, typename Attr, typename Context> | 301 | template <typename OutputIterator, typename Attr, typename Context> | ||
304 | bool generate(OutputIterator sink, Attr const& attribute, Context const& context) const | 302 | bool generate(OutputIterator sink, Attr const& attribute, Context const& context) const | ||
305 | { | 303 | { | ||
306 | return as_generator((*this).operator()<Attr>(attribute)).generate(sink, attributes::unused, context); | 304 | return as_generator((*this).operator()<Attr>(attribute)).generate(sink, attributes::unused, context); | ||
307 | } | 305 | } | ||
308 | } const klass_interface_name; | 306 | } const klass_interface_name; | ||
Show All 11 Lines | 309 | { | |||
320 | { | 318 | { | ||
321 | return as_generator((*this).operator()<Attr>(attribute)).generate(sink, attributes::unused, context); | 319 | return as_generator((*this).operator()<Attr>(attribute)).generate(sink, attributes::unused, context); | ||
322 | } | 320 | } | ||
323 | } const klass_full_interface_name; | 321 | } const klass_full_interface_name; | ||
324 | 322 | | |||
325 | template<typename T> | 323 | template<typename T> | ||
326 | inline std::string klass_concrete_name(T const& klass) | 324 | inline std::string klass_concrete_name(T const& klass) | ||
327 | { | 325 | { | ||
328 | if (klass.type == attributes::class_type::mixin || klass.type == attributes::class_type::interface_) | 326 | return utils::remove_all(klass.eolian_name, '_') + ((klass.type == attributes::class_type::mixin | ||
329 | return klass_interface_name(klass) + "Concrete"; | 327 | || klass.type == attributes::class_type::interface_) | ||
330 | 328 | ? "Concrete" : ""); | |||
331 | return utils::remove_all(klass.eolian_name, '_'); | | |||
332 | } | 329 | } | ||
333 | 330 | | |||
334 | template<typename T> | 331 | template<typename T> | ||
335 | inline std::string klass_concrete_or_interface_name(T const& klass) | 332 | inline std::string klass_concrete_or_interface_name(T const& klass) | ||
336 | { | 333 | { | ||
337 | switch(klass.type) | 334 | switch(klass.type) | ||
338 | { | 335 | { | ||
339 | case attributes::class_type::abstract_: | 336 | case attributes::class_type::abstract_: | ||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | |||||
420 | // Events | 417 | // Events | ||
421 | inline std::string managed_event_name(std::string const& name) | 418 | inline std::string managed_event_name(std::string const& name) | ||
422 | { | 419 | { | ||
423 | return utils::to_pascal_case(utils::split(name, "_,"), "") + "Event"; | 420 | return utils::to_pascal_case(utils::split(name, "_,"), "") + "Event"; | ||
424 | } | 421 | } | ||
425 | 422 | | |||
426 | inline std::string managed_event_args_short_name(attributes::event_def const& evt) | 423 | inline std::string managed_event_args_short_name(attributes::event_def const& evt) | ||
427 | { | 424 | { | ||
428 | return klass_concrete_or_interface_name(evt.klass) + name_helpers::managed_event_name(evt.name) + "Args"; | 425 | return utils::remove_all(evt.klass.eolian_name, '_') + name_helpers::managed_event_name(evt.name) + "Args"; | ||
429 | } | 426 | } | ||
430 | 427 | | |||
431 | inline std::string managed_event_args_name(attributes::event_def evt) | 428 | inline std::string managed_event_args_name(attributes::event_def evt) | ||
432 | { | 429 | { | ||
433 | return join_namespaces(evt.klass.namespaces, '.', managed_namespace) + | 430 | return join_namespaces(evt.klass.namespaces, '.', managed_namespace) + | ||
434 | managed_event_args_short_name(evt); | 431 | managed_event_args_short_name(evt); | ||
435 | } | 432 | } | ||
436 | 433 | | |||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |