summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeongjong Lee <yj34.lee@samsung.com>2019-10-17 14:32:29 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-17 14:35:37 -0300
commitcfa8baa152625a75eee6b288f111b0d9bc790e5a (patch)
treeefc1be055501ee1e138f53c3c063368c19ef3f07
parent711823cb1d7c91d8ec2e97b713e8493162edc03d (diff)
mono: merge namespaces
Summary: This patch merge namespaces to improve readablity. Before ``` namespace Efl { namespace Canvas { ``` After ``` namespace Efl.Canvas { ``` Test Plan: meson setup -Dbindings=mono,cxx -Dmono-beta=true Reviewers: lauromoura, Jaehyun_Cho Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10436
-rw-r--r--src/bin/eolian_mono/eolian/mono/name_helpers.hh11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/name_helpers.hh b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
index 08b2bc9..df1405d 100644
--- a/src/bin/eolian_mono/eolian/mono/name_helpers.hh
+++ b/src/bin/eolian_mono/eolian/mono/name_helpers.hh
@@ -501,15 +501,18 @@ bool open_namespaces(OutputIterator sink, std::vector<std::string> namespaces, C
501{ 501{
502 std::transform(namespaces.begin(), namespaces.end(), namespaces.begin(), managed_namespace); 502 std::transform(namespaces.begin(), namespaces.end(), namespaces.begin(), managed_namespace);
503 503
504 auto open_namespace = *("namespace " << string << " {\n\n"); 504 std::string joined_namespace = join_namespaces(namespaces, '.');
505 return as_generator(open_namespace).generate(sink, namespaces, context); 505 if (joined_namespace.empty()) return true;
506 joined_namespace.pop_back();
507
508 return as_generator("namespace " << string << " {\n").generate(sink, joined_namespace, context);
506} 509}
507 510
508template<typename OutputIterator, typename Context> 511template<typename OutputIterator, typename Context>
509bool close_namespaces(OutputIterator sink, std::vector<std::string> const& namespaces, Context const& context) 512bool close_namespaces(OutputIterator sink, std::vector<std::string> const& namespaces, Context const& context)
510{ 513{
511 auto close_namespace = (lit("}") % "\n" ) << "\n\n"; 514 if (namespaces.empty()) return true;
512 return as_generator(close_namespace).generate(sink, namespaces, context); 515 return as_generator("}\n\n").generate(sink, attributes::unused, context);
513} 516}
514 517
515std::string constructor_managed_name(std::string full_name) 518std::string constructor_managed_name(std::string full_name)