eolian_mono: add 1 tab inside the namespace
authorYeongjong Lee <yj34.lee@samsung.com>
Mon, 13 Jan 2020 00:45:16 +0000 (09:45 +0900)
committerJongmin Lee <jm105.lee@samsung.com>
Mon, 13 Jan 2020 21:11:02 +0000 (06:11 +0900)
Summary:
Also, this patch will fix indentation of enum, struct.

### Before
```
namespace Efl.Ui {
/// <summary>Define the move or resize mode of a window.
///
/// The user can request the display server to start moving or resizing the window by combining these modes. However only limited combinations are allowed.
...
[Efl.Eo.BindingEntity]
public enum WinMoveResizeMode
{
/// <summary>Start moving window<br/>Since EFL 1.22.</summary>
Move = 1,
/// <summary>Start resizing window to the top<br/>Since EFL 1.22.</summary>
Top = 2,
...
}
}
```

### After
```
namespace Efl.Ui {
    /// <summary>Define the move or resize mode of a window.
    ///
    /// The user can request the display server to start moving or resizing the window by combining these modes. However only limited combinations are allowed.
...
    [Efl.Eo.BindingEntity]
    public enum WinMoveResizeMode
    {
        /// <summary>Start moving window<br/>Since EFL 1.22.</summary>
        Move = 1,
        /// <summary>Start resizing window to the top<br/>Since EFL 1.22.</summary>
        Top = 2,
...
    }
}
```

Reviewers: Jaehyun_Cho, felipealmeida

Reviewed By: felipealmeida

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11032

src/bin/eolian_mono/eolian/mono/async_function_definition.hh
src/bin/eolian_mono/eolian/mono/enum_definition.hh
src/bin/eolian_mono/eolian/mono/events.hh
src/bin/eolian_mono/eolian/mono/function_declaration.hh
src/bin/eolian_mono/eolian/mono/function_definition.hh
src/bin/eolian_mono/eolian/mono/function_helpers.hh
src/bin/eolian_mono/eolian/mono/klass.hh
src/bin/eolian_mono/eolian/mono/parameter.hh
src/bin/eolian_mono/eolian/mono/part_definition.hh
src/bin/eolian_mono/eolian/mono/struct_definition.hh

index bf00dda..bc0bb68 100644 (file)
@@ -72,30 +72,30 @@ struct async_function_declaration_generator
       return true;
 
     if (!as_generator(
-            scope_tab << "/// <summary>Async wrapper for <see cref=\"" << name_helpers::managed_method_name(f) << "\" />.\n"
+            scope_tab(2) << "/// <summary>Async wrapper for <see cref=\"" << name_helpers::managed_method_name(f) << "\" />.\n"
         ).generate(sink, attributes::unused, context))
       return false;
 
     if (!f.documentation.since.empty())
       if (!as_generator
-          (scope_tab << "/// <para>Since EFL " + f.documentation.since + ".</para>\n")
+          (scope_tab(2) << "/// <para>Since EFL " + f.documentation.since + ".</para>\n")
           .generate (sink, attributes::unused, context))
       return false;
 
     if (!as_generator(
-            scope_tab << "/// </summary>\n"
+            scope_tab(2) << "/// </summary>\n"
         ).generate(sink, attributes::unused, context))
       return false;
 
     // generate_parameter is not a proper as_generator-compatible generator, so we had to do an old fashioned loop
     for (auto&& param : f.parameters)
-      if (!documentation(1).generate_parameter(sink, param, context))
+      if (!documentation(2).generate_parameter(sink, param, context))
         return false;
 
     if (!as_generator(
-            scope_tab << "/// <param name=\"token\">Token to notify the async operation of external request to cancel.</param>\n"
-            << scope_tab << "/// <returns>An async task wrapping the result of the operation.</returns>\n"
-            << scope_tab << "System.Threading.Tasks.Task<Eina.Value> " << name_helpers::managed_async_method_name(f) << "(" << *(parameter << ", ") <<
+            scope_tab(2) << "/// <param name=\"token\">Token to notify the async operation of external request to cancel.</param>\n"
+            << scope_tab(2) << "/// <returns>An async task wrapping the result of the operation.</returns>\n"
+            << scope_tab(2) << "System.Threading.Tasks.Task<Eina.Value> " << name_helpers::managed_async_method_name(f) << "(" << *(parameter << ", ") <<
                                     " System.Threading.CancellationToken token = default(System.Threading.CancellationToken));\n\n"
         ).generate(sink, f.parameters, context))
       return false;
@@ -130,18 +130,18 @@ struct async_function_definition_generator
     std::transform(f.parameters.begin(), f.parameters.end(), std::back_inserter(param_forwarding), parameter_forwarding);
 
     if (!as_generator(
-            scope_tab << "/// <summary>Async wrapper for <see cref=\"" << name_helpers::managed_method_name(f) << "\" />.\n"
+            scope_tab(2) << "/// <summary>Async wrapper for <see cref=\"" << name_helpers::managed_method_name(f) << "\" />.\n"
         ).generate(sink, attributes::unused, context))
       return false;
 
     if (!f.documentation.since.empty())
       if (!as_generator
-          (scope_tab << "/// <para>Since EFL " + f.documentation.since + ".</para>\n")
+          (scope_tab(2) << "/// <para>Since EFL " + f.documentation.since + ".</para>\n")
           .generate (sink, attributes::unused, context))
       return false;
 
     if (!as_generator(
-            scope_tab << "/// </summary>\n"
+            scope_tab(2) << "/// </summary>\n"
         ).generate(sink, attributes::unused, context))
       return false;
 
@@ -151,13 +151,13 @@ struct async_function_definition_generator
         return false;
 
     if(!as_generator(
-            scope_tab << "/// <param name=\"token\">Token to notify the async operation of external request to cancel.</param>\n"
-            << scope_tab << "/// <returns>An async task wrapping the result of the operation.</returns>\n"
-            << scope_tab << "public System.Threading.Tasks.Task<Eina.Value> " << name_helpers::managed_async_method_name(f) << "(" << *(parameter << ", ") << " System.Threading.CancellationToken token = default(System.Threading.CancellationToken))\n"
-            << scope_tab << "{\n"
-            << scope_tab << scope_tab << "Eina.Future future = " << name_helpers::managed_method_name(f) << "(" << (string % ", ") << ");\n"
-            << scope_tab << scope_tab << "return Efl.Eo.Globals.WrapAsync(future, token);\n"
-            << scope_tab << "}\n\n"
+            scope_tab(2) << "/// <param name=\"token\">Token to notify the async operation of external request to cancel.</param>\n"
+            << scope_tab(2) << "/// <returns>An async task wrapping the result of the operation.</returns>\n"
+            << scope_tab(2) << "public System.Threading.Tasks.Task<Eina.Value> " << name_helpers::managed_async_method_name(f) << "(" << *(parameter << ", ") << " System.Threading.CancellationToken token = default(System.Threading.CancellationToken))\n"
+            << scope_tab(2) << "{\n"
+            << scope_tab(2) << scope_tab << "Eina.Future future = " << name_helpers::managed_method_name(f) << "(" << (string % ", ") << ");\n"
+            << scope_tab(2) << scope_tab << "return Efl.Eo.Globals.WrapAsync(future, token);\n"
+            << scope_tab(2) << "}\n\n"
         ).generate(sink, std::make_tuple(f.parameters, param_forwarding), context))
       return false;
     return true;
index 2c304fc..4b07652 100644 (file)
@@ -49,10 +49,11 @@ struct enum_definition_generator
 
      if(!as_generator
         (
-         documentation
-         << flags_attribute
-         << "[Efl.Eo.BindingEntity]\n"
-         "public enum " << enum_name << "\n{\n"
+         documentation(1)
+         << scope_tab << flags_attribute << "\n"
+         << scope_tab << "[Efl.Eo.BindingEntity]\n"
+         << scope_tab << "public enum " << enum_name << "\n"
+         << scope_tab << "{\n"
          )
         .generate(sink, enum_, context))
        return false;
@@ -65,13 +66,14 @@ struct enum_definition_generator
           auto literal = (*first).value.literal;
           if (!as_generator
               (
-               documentation << string << " = " << string << ",\n"
+               documentation(2)
+               << scope_tab(2) << string << " = " << string << ",\n"
               )
               .generate(sink, std::make_tuple(*first, name, literal), context))
             return false;
        }
 
-     if(!as_generator("}\n").generate(sink, attributes::unused, context)) return false;
+     if(!as_generator(scope_tab << "}\n").generate(sink, attributes::unused, context)) return false;
 
      if(!name_helpers::close_namespaces(sink, enum_.namespaces, context))
        return false;
index 8bb1799..2b85c7e 100644 (file)
@@ -165,9 +165,9 @@ struct pack_event_info_and_call_visitor
       if (regular.is_struct())
         {
            return as_generator(
-                indent << "Contract.Requires(e != null, nameof(e));\n"
-                << indent << "IntPtr info = Marshal.AllocHGlobal(Marshal.SizeOf(e.arg));\n"
-                << indent << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Marshal.FreeHGlobal(p));\n"
+                indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
+                << indent.inc() << "IntPtr info = Marshal.AllocHGlobal(Marshal.SizeOf(e.arg));\n"
+                << indent.inc() << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Marshal.FreeHGlobal(p));\n"
               ).generate(sink, attributes::unused, *context);
         }
 
@@ -193,9 +193,9 @@ struct pack_event_info_and_call_visitor
       auto str_accept_func = [&](std::string const& conversion)
         {
            return as_generator(
-             indent << "Contract.Requires(e != null, nameof(e));\n"
-             << indent << "IntPtr info = Eina.StringConversion.ManagedStringToNativeUtf8Alloc(" << conversion << ");\n"
-             << indent << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Eina.MemoryNative.Free(p));\n"
+             indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
+             << indent.inc() << "IntPtr info = Eina.StringConversion.ManagedStringToNativeUtf8Alloc(" << conversion << ");\n"
+             << indent.inc() << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Eina.MemoryNative.Free(p));\n"
              ).generate(sink, attributes::unused, *context);
         };
 
@@ -212,9 +212,9 @@ struct pack_event_info_and_call_visitor
       auto value_accept_func = [&](std::string const& conversion)
         {
            return as_generator(
-             indent << "Contract.Requires(e != null, nameof(e));\n"
-             << indent << "IntPtr info = Eina.PrimitiveConversion.ManagedToPointerAlloc(" << conversion << ");\n"
-             << indent << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Marshal.FreeHGlobal(p));\n"
+             indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
+             << indent.inc() << "IntPtr info = Eina.PrimitiveConversion.ManagedToPointerAlloc(" << conversion << ");\n"
+             << indent.inc() << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Marshal.FreeHGlobal(p));\n"
              ).generate(sink, attributes::unused, *context);
         };
 
@@ -227,8 +227,8 @@ struct pack_event_info_and_call_visitor
    {
       auto const& indent = current_indentation(*context);
       return as_generator(
-                          indent << "Contract.Requires(e != null, nameof(e));\n"
-                          << indent << "IntPtr info = e.arg.NativeHandle;\n"
+                          indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
+                          << indent.inc() << "IntPtr info = e.arg.NativeHandle;\n"
                           << "CallNativeEventCallback(" << library_name << ", \"_" << evt_c_name << "\", IntPtr.Zero, null);\n"
                           ).generate(sink, attributes::unused, *context);
    }
@@ -239,8 +239,8 @@ struct pack_event_info_and_call_visitor
         return true;
 
       return as_generator(
-                          indent << "Contract.Requires(e != null, nameof(e));\n"
-                          << indent << "IntPtr info = e.arg.Handle;\n"
+                          indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
+                          << indent.inc() << "IntPtr info = e.arg.Handle;\n"
                           << "CallNativeEventCallback(" << library_name << ", \"_" << evt_c_name << "\", IntPtr.Zero, null);\n"
                           ).generate(sink, attributes::unused, *context);
    }
@@ -263,7 +263,7 @@ struct event_argument_wrapper_generator
 
       std::string evt_name = name_helpers::managed_event_name(evt.name);
 
-      if (!as_generator("/// <summary>Event argument wrapper for event <see cref=\""
+      if (!as_generator(scope_tab << "/// <summary>Event argument wrapper for event <see cref=\""
                         << join_namespaces(evt.klass.namespaces, '.', managed_namespace)
                         << klass_interface_name(evt.klass) << "." << evt_name << "\"/>.\n"
              ).generate(sink, nullptr, context))
@@ -286,7 +286,7 @@ struct event_argument_wrapper_generator
              {
 
                 if (!as_generator(
-                      lit("/// <para>Since EFL ") << evt.documentation.since << ".</para>\n"
+                      scope_tab << lit("/// <para>Since EFL ") << evt.documentation.since << ".</para>\n"
                     ).generate(sink, nullptr, context))
                   return false;
              }
@@ -298,23 +298,23 @@ struct event_argument_wrapper_generator
              }
         }
 
-      if (!as_generator(lit("/// </summary>\n")
-                         << "[Efl.Eo.BindingEntity]\n"
-                         << "public class " << name_helpers::managed_event_args_short_name(evt) << " : EventArgs {\n"
-                         << scope_tab << "/// <summary>Actual event payload.\n"
+      if (!as_generator(scope_tab << lit("/// </summary>\n")
+                        << scope_tab << "[Efl.Eo.BindingEntity]\n"
+                        << scope_tab << "public class " << name_helpers::managed_event_args_short_name(evt) << " : EventArgs {\n"
+                         << scope_tab(2) << "/// <summary>Actual event payload.\n"
              ).generate(sink, nullptr, context))
         return false;
 
       if (since != "")
         {
-           if (!as_generator(scope_tab << "/// <para>Since EFL " << since << ".</para>\n").generate(sink, nullptr, context))
+           if (!as_generator(scope_tab(2) << "/// <para>Since EFL " << since << ".</para>\n").generate(sink, nullptr, context))
              return false;
         }
 
-      if (!as_generator(scope_tab << "/// </summary>\n"
-                        << scope_tab << "/// <value>" << documentation_string << "</value>\n"
-                        << scope_tab << "public " << type << " arg { get; set; }\n"
-                        << "}\n\n"
+      if (!as_generator(scope_tab(2) << "/// </summary>\n"
+                        << scope_tab(2) << "/// <value>" << documentation_string << "</value>\n"
+                        << scope_tab(2) << "public " << type << " arg { get; set; }\n"
+                        << scope_tab << "}\n\n"
                  ).generate(sink, std::make_tuple(evt.documentation.summary, *etype), context))
         return false;
 
@@ -341,14 +341,14 @@ struct event_declaration_generator
       if (evt.type.is_engaged())
         wrapper_args_type = "<" + name_helpers::managed_event_args_name(evt) + ">";
 
-      if (!as_generator(documentation(1))
+      if (!as_generator(documentation(2))
                         .generate(sink, evt, context)) return false;
       if (evt.type.is_engaged())
         if (!as_generator(
-                scope_tab << "/// <value><see cref=\"" << name_helpers::managed_event_args_name(evt) << "\"/></value>\n"
+                scope_tab(2) << "/// <value><see cref=\"" << name_helpers::managed_event_args_name(evt) << "\"/></value>\n"
              ).generate(sink, evt, context)) return false;
       if (!as_generator(
-              scope_tab << "event EventHandler" << wrapper_args_type << " " << evt_name << ";\n"
+              scope_tab(2) << "event EventHandler" << wrapper_args_type << " " << evt_name << ";\n"
            ).generate(sink, evt, context))
         return false;
 
@@ -398,7 +398,7 @@ struct event_definition_generator
       if (!etype.is_engaged())
         {
            auto event_call_site_sink = std::back_inserter(event_native_call);
-           if (!as_generator(indent.inc().inc() << "CallNativeEventCallback(" << library_name << ", \"_" << utils::to_uppercase(evt.c_name) << "\", IntPtr.Zero, null);\n")
+           if (!as_generator(indent.inc().inc().inc() << "CallNativeEventCallback(" << library_name << ", \"_" << utils::to_uppercase(evt.c_name) << "\", IntPtr.Zero, null);\n")
                  .generate(event_call_site_sink, attributes::unused, context))
              return false;
         }
@@ -427,11 +427,11 @@ struct event_definition_generator
            event_args = arg_initializer;
         }
 
-      if(!as_generator(documentation(1)).generate(sink, evt, context))
+      if(!as_generator(documentation(2)).generate(sink, evt, context))
         return false;
       if (etype.is_engaged())
         if (!as_generator(
-                scope_tab << "/// <value><see cref=\"" << wrapper_args_type << "\"/></value>\n"
+                scope_tab(2) << "/// <value><see cref=\"" << wrapper_args_type << "\"/></value>\n"
              ).generate(sink, evt, context)) return false;
 
       // Visible event declaration. Either a regular class member or an explicit interface implementation.
@@ -439,7 +439,7 @@ struct event_definition_generator
       {
          // Public event implementation.
          if (!as_generator(
-                     scope_tab << (!use_explicit_impl ? "public " : " ") << "event EventHandler" << wrapper_args_template << " " << (use_explicit_impl ? (klass_name + ".") : "") << managed_evt_name << "\n"
+                     scope_tab(2) << (!use_explicit_impl ? "public " : " ") << "event EventHandler" << wrapper_args_template << " " << (use_explicit_impl ? (klass_name + ".") : "") << managed_evt_name << "\n"
                   ).generate(sink, attributes::unused, context))
            return false;
       }
@@ -452,7 +452,7 @@ struct event_definition_generator
            visibility += "new ";
 
          if (!as_generator(
-               scope_tab << visibility << "event EventHandler" << wrapper_args_template << " " << wrapper_evt_name << "\n"
+               scope_tab(2) << visibility << "event EventHandler" << wrapper_args_template << " " << wrapper_evt_name << "\n"
                ).generate(sink, attributes::unused, context))
            return false;
       }
@@ -479,7 +479,7 @@ struct event_definition_generator
       bool is_concrete = context_find_tag<class_context>(context).current_wrapper_kind == class_context::concrete;
 
       if (!as_generator(
-            scope_tab << "/// <summary>Method to raise event "<< event_name << ".\n"
+            scope_tab(2) << "/// <summary>Method to raise event "<< event_name << ".\n"
          ).generate(sink, nullptr, context))
         return false;
 
@@ -498,7 +498,7 @@ struct event_definition_generator
              {
 
                 if (!as_generator(
-                      scope_tab << "/// <para>Since EFL " << evt.documentation.since << ".</para>\n"
+                      scope_tab(2) << "/// <para>Since EFL " << evt.documentation.since << ".</para>\n"
                     ).generate(sink, nullptr, context))
                   return false;
              }
@@ -511,21 +511,21 @@ struct event_definition_generator
         }
 
       // Close summary
-      if (!as_generator(scope_tab << "/// </summary>\n").generate(sink, nullptr, context))
+      if (!as_generator(scope_tab(2) << "/// </summary>\n").generate(sink, nullptr, context))
         return false;
 
       if (evt.type.is_engaged())
         {
-            if (!as_generator(scope_tab << "/// <param name=\"e\">Event to raise.</param>\n"
+            if (!as_generator(scope_tab(2) << "/// <param name=\"e\">Event to raise.</param>\n"
                  ).generate(sink, nullptr, context))
               return false;
         }
 
       if (!as_generator(
-            scope_tab << (is_concrete ? "public" : "protected virtual") << " void On" << event_name << "(" << (!evt.type.is_engaged() ? "" : event_args_type + " e") << ")\n"
-            << scope_tab << "{\n"
+            scope_tab(2) << (is_concrete ? "public" : "protected virtual") << " void On" << event_name << "(" << (!evt.type.is_engaged() ? "" : event_args_type + " e") << ")\n"
+            << scope_tab(2) << "{\n"
             << event_native_call
-            << scope_tab << "}\n\n"
+            << scope_tab(2) << "}\n\n"
           ).generate(sink, nullptr, context))
        return false;
 
@@ -543,20 +543,20 @@ struct event_definition_generator
       attributes::klass_def klass(get_klass(evt.klass, unit), unit);
       auto library_name = context_find_tag<library_context>(context).actual_library_name(klass.filename);
       return as_generator(
-           scope_tab << "{\n"
-           << scope_tab << scope_tab << "add\n"
-           << scope_tab << scope_tab << "{\n"//evt.type.is_engaged()
-           << scope_tab << scope_tab << scope_tab << "Efl.EventCb callerCb = GetInternalEventCallback(value"
+           scope_tab(2) << "{\n"
+           << scope_tab(2) << scope_tab << "add\n"
+           << scope_tab(2) << scope_tab << "{\n"//evt.type.is_engaged()
+           << scope_tab(2) << scope_tab << scope_tab << "Efl.EventCb callerCb = GetInternalEventCallback(value"
            << (evt.type.is_engaged() ? event_args : "") << ");\n"
-           << scope_tab << scope_tab << scope_tab << "string key = \"_" << upper_c_name << "\";\n"
-           << scope_tab << scope_tab << scope_tab << "AddNativeEventHandler(" << library_name << ", key, callerCb, value);\n"
-           << scope_tab << scope_tab << "}\n\n"
-           << scope_tab << scope_tab << "remove\n"
-           << scope_tab << scope_tab << "{\n"
-           << scope_tab << scope_tab << scope_tab << "string key = \"_" << upper_c_name << "\";\n"
-           << scope_tab << scope_tab << scope_tab << "RemoveNativeEventHandler(" << library_name << ", key, value);\n"
-           << scope_tab << scope_tab << "}\n"
-           << scope_tab << "}\n\n"
+           << scope_tab(2) << scope_tab << scope_tab << "string key = \"_" << upper_c_name << "\";\n"
+           << scope_tab(2) << scope_tab << scope_tab << "AddNativeEventHandler(" << library_name << ", key, callerCb, value);\n"
+           << scope_tab(2) << scope_tab << "}\n\n"
+           << scope_tab(2) << scope_tab << "remove\n"
+           << scope_tab(2) << scope_tab << "{\n"
+           << scope_tab(2) << scope_tab << scope_tab << "string key = \"_" << upper_c_name << "\";\n"
+           << scope_tab(2) << scope_tab << scope_tab << "RemoveNativeEventHandler(" << library_name << ", key, value);\n"
+           << scope_tab(2) << scope_tab << "}\n"
+           << scope_tab(2) << "}\n\n"
            ).generate(sink, attributes::unused, context);
    }
 };
index b71ffb1..d209f06 100644 (file)
@@ -42,11 +42,11 @@ struct function_declaration_generator
     if(f.scope != attributes::member_scope::scope_public)
       return true;
 
-    if(!as_generator(documentation(1)).generate(sink, f, context))
+    if(!as_generator(documentation(2)).generate(sink, f, context))
       return false;
 
     return as_generator
-      (scope_tab << eolian_mono::type(true) << " " << string << "(" << (parameter % ", ") << ");\n\n")
+      (scope_tab(2) << eolian_mono::type(true) << " " << string << "(" << (parameter % ", ") << ");\n\n")
       .generate(sink, std::make_tuple(f.return_type, name_helpers::managed_method_name(f), f.parameters), context);
   }
 };
index fa49412..df6f62a 100644 (file)
@@ -207,7 +207,7 @@ struct function_definition_generator
       return false;
 
     if(!as_generator
-       (documentation(1)).generate(sink, f, context))
+       (documentation(2)).generate(sink, f, context))
       return false;
 
     std::string self = "this.NativeHandle";
@@ -220,15 +220,15 @@ struct function_definition_generator
       self = "";
 
     if(!as_generator
-       (scope_tab << eolian_mono::function_scope_get(f) << ((do_super && !f.is_static) ? "virtual " : "") << (f.is_static ? "static " : "") << return_type << " " << string << "(" << (parameter % ", ")
+       (scope_tab(2) << eolian_mono::function_scope_get(f) << ((do_super && !f.is_static) ? "virtual " : "") << (f.is_static ? "static " : "") << return_type << " " << string << "(" << (parameter % ", ")
         << ") {\n"
-        << scope_tab(2) << eolian_mono::function_definition_preamble()
+        << scope_tab(3) << eolian_mono::function_definition_preamble()
         << klass_full_native_inherit_name(f.klass) << "." << string << "_ptr.Value.Delegate("
         << self
         << ((!f.is_static && (f.parameters.size() > 0)) ? ", " : "")
         << (argument_invocation % ", ") << ");\n"
-        << scope_tab(2) << eolian_mono::function_definition_epilogue()
-        << scope_tab(1) << "}\n\n")
+        << scope_tab(3) << eolian_mono::function_definition_epilogue()
+        << scope_tab(2) << "}\n\n")
        .generate(sink, std::make_tuple(name_helpers::managed_method_name(f), f.parameters, f, f.c_name, f.parameters, f), context))
       return false;
 
@@ -285,11 +285,11 @@ struct property_extension_method_definition_generator
       if (property.setter.is_engaged())
         {
           attributes::type_def prop_type = property.setter->parameters[0].type;
-          if (!as_generator(scope_tab << "public static Efl.BindableProperty<" << type(true) << "> " << managed_name << "<T>(this Efl.Ui.ItemFactory<T> fac, Efl.Csharp.ExtensionTag<"
+          if (!as_generator(scope_tab(2) << "public static Efl.BindableProperty<" << type(true) << "> " << managed_name << "<T>(this Efl.Ui.ItemFactory<T> fac, Efl.Csharp.ExtensionTag<"
                             << name_helpers::klass_full_concrete_or_interface_name(cls)
                             << ", T>magic = null) where T : " << name_helpers::klass_full_concrete_or_interface_name(cls) <<  " {\n"
-                            << scope_tab << scope_tab << "return new Efl.BindableProperty<" << type(true) << ">(\"" << property.name << "\", fac);\n"
-                            << scope_tab << "}\n\n"
+                            << scope_tab(2) << scope_tab << "return new Efl.BindableProperty<" << type(true) << ">(\"" << property.name << "\", fac);\n"
+                            << scope_tab(2) << "}\n\n"
                             ).generate(sink, std::make_tuple(prop_type, prop_type), context))
             return false;
         }
@@ -302,12 +302,12 @@ struct property_extension_method_definition_generator
       if (property.setter.is_engaged())
         {
           attributes::type_def prop_type = property.setter->parameters[0].type;
-          if (!as_generator(scope_tab << "public static Efl.BindableProperty<" << type(true) << "> " << managed_name << "<T>(this Efl.BindablePart<T> part, Efl.Csharp.ExtensionTag<"
+          if (!as_generator(scope_tab(2) << "public static Efl.BindableProperty<" << type(true) << "> " << managed_name << "<T>(this Efl.BindablePart<T> part, Efl.Csharp.ExtensionTag<"
                             << name_helpers::klass_full_concrete_or_interface_name(cls)
                             << ", T>magic = null) where T : " << name_helpers::klass_full_concrete_or_interface_name(cls) <<  " {\n"
-                            << scope_tab << scope_tab << "Contract.Requires(part != null, nameof(part));\n"
-                            << scope_tab << scope_tab << "return new Efl.BindableProperty<" << type(true) << ">(part.PartName, \"" << property.name << "\", part.Binder);\n"
-                            << scope_tab << "}\n\n"
+                            << scope_tab(2) << scope_tab << "Contract.Requires(part != null, nameof(part));\n"
+                            << scope_tab(2) << scope_tab << "return new Efl.BindableProperty<" << type(true) << ">(part.PartName, \"" << property.name << "\", part.Binder);\n"
+                            << scope_tab(2) << "}\n\n"
                             ).generate(sink, std::make_tuple(prop_type, prop_type), context))
             return false;
         }
@@ -332,19 +332,19 @@ struct property_wrapper_definition_generator
    {
      if (is_interface)
      {
-        if (!as_generator(scope_tab << scope_tab << get_scope <<  "get;\n"
+        if (!as_generator(scope_tab(3) << get_scope <<  "get;\n"
                           ).generate(sink, attributes::unused, context))
           return false;
      }
      else
      {
-        if (!as_generator(scope_tab << scope_tab << get_scope << "get\n"
-                          << scope_tab << scope_tab << "{\n"
-                          << scope_tab << scope_tab(2) << "var i = new "
+        if (!as_generator(scope_tab(2) << scope_tab << get_scope << "get\n"
+                          << scope_tab(2) << scope_tab << "{\n"
+                          << scope_tab(2) << scope_tab(2) << "var i = new "
                           << name_helpers::property_concrete_indexer_name(property) << "();\n"
-                          << scope_tab << scope_tab(2) << "i.Self = this;\n"
-                          << scope_tab << scope_tab(2) << "return i;\n"
-                          << scope_tab << scope_tab << "}\n"
+                          << scope_tab(2) << scope_tab(2) << "i.Self = this;\n"
+                          << scope_tab(2) << scope_tab(2) << "return i;\n"
+                          << scope_tab(2) << scope_tab << "}\n"
                           ).generate(sink, attributes::unused, context))
           return false;
      }
@@ -388,12 +388,12 @@ struct property_wrapper_definition_generator
 
      if (!as_generator
          (
-          scope_tab << scope << "class " << name_helpers::property_concrete_indexer_name(property) << parentship
-          << scope_tab << "{\n"
-          << scope_tab(2) << "public " << class_name << " Self {get; set;}\n"
-          << scope_tab(2) << "public "
-          << type_or_tuple << " this[" << type_or_tuple <<" i]\n"
+          scope_tab(2) << scope << "class " << name_helpers::property_concrete_indexer_name(property) << parentship
           << scope_tab(2) << "{\n"
+          << scope_tab(3) << "public " << class_name << " Self {get; set;}\n"
+          << scope_tab(3) << "public "
+          << type_or_tuple << " this[" << type_or_tuple <<" i]\n"
+          << scope_tab(3) << "{\n"
          ).generate(sink, make_tuple(values, values, keys, keys), context))
        return false;
 
@@ -421,8 +421,8 @@ struct property_wrapper_definition_generator
 
      if (!as_generator
          (
-          scope_tab(2) << "}\n"
-          << scope_tab << "};\n"
+          scope_tab(3) << "}\n"
+          << scope_tab(2) << "};\n"
           ).generate(sink, attributes::unused, context))
        return false;
      return true;
@@ -437,20 +437,20 @@ struct property_wrapper_definition_generator
      using efl::eolian::grammar::counter;
      if (is_interface)
      {
-       if (!as_generator(scope_tab << scope_tab << set_scope <<  "set;\n"
+       if (!as_generator(scope_tab(2) << scope_tab << set_scope <<  "set;\n"
                          ).generate(sink, attributes::unused, context))
          return false;
      }
      else if (values.size() == 1)
      {
-       if (!as_generator(scope_tab << scope_tab << set_scope <<  "set " << "{ " << name_prefix << name_helpers::managed_method_name(*property.setter) + "(" << *(string << ",") << "value); }\n"
+       if (!as_generator(scope_tab(2) << scope_tab << set_scope <<  "set " << "{ " << name_prefix << name_helpers::managed_method_name(*property.setter) + "(" << *(string << ",") << "value); }\n"
             ).generate(sink, keys, context))
          return false;
      }
      else if (values.size() > 1)
      {
        if (!as_generator(
-            scope_tab << scope_tab << set_scope <<  "set "
+            scope_tab(2) << scope_tab << set_scope <<  "set "
             << ("{ " << name_prefix << name_helpers::managed_method_name(*property.setter) + "(")
             << *(string << ",") << ((" value.Item" << counter(1)) % ", ")
             << "); }\n"
@@ -472,7 +472,7 @@ struct property_wrapper_definition_generator
 
       if (is_interface) // only declaration
       {
-        if (!as_generator(scope_tab << scope_tab << get_scope <<  "get;\n"
+        if (!as_generator(scope_tab(2) << scope_tab << get_scope <<  "get;\n"
                           ).generate(sink, attributes::unused, context))
           return false;
       }
@@ -480,7 +480,7 @@ struct property_wrapper_definition_generator
       if (/*has_getter && */values.size() == 1)
       {
         if (!as_generator
-            (scope_tab << scope_tab << get_scope
+            (scope_tab(2) << scope_tab << get_scope
              << "get " << "{ return " << name_prefix << name_helpers::managed_method_name(*property.getter)
              << "(" << (string % ",") << "); }\n"
             ).generate(sink, keys, context))
@@ -489,16 +489,16 @@ struct property_wrapper_definition_generator
       else if (/*has_getter && */values.size() > 1)
       {
         if (!as_generator
-                 (scope_tab << scope_tab << get_scope << "get "
+                 (scope_tab(2) << scope_tab << get_scope << "get "
                   << "{\n"
                   << *attribute_reorder<1, -1, 1>
-                    (scope_tab(3) << type(true) << " _out_"
+                    (scope_tab(4) << type(true) << " _out_"
                      << argument(false) << " = default(" << type(true) << ");\n"
                     )
-                  << scope_tab(3) << name_prefix << name_helpers::managed_method_name(*property.getter)
+                  << scope_tab(4) << name_prefix << name_helpers::managed_method_name(*property.getter)
                   << "(" << *(string << ",") << (("out _out_" << argument(false)) % ", ") << ");\n"
-                  << scope_tab(3) << "return (" << (("_out_"<< argument(false)) % ", ") << ");\n"
-                  << scope_tab(2) << "}" << "\n"
+                  << scope_tab(4) << "return (" << (("_out_"<< argument(false)) % ", ") << ");\n"
+                  << scope_tab(3) << "}" << "\n"
                  ).generate(sink, std::make_tuple(values, keys, values, values), context))
           return false;
       }
@@ -716,8 +716,8 @@ struct property_wrapper_definition_generator
       if (generated_values.size() == 1)
       {
         if (!as_generator(
-                    documentation(1)
-                    << scope_tab << scope << (is_static ? "static " : virtual_mod) << type(true) << " " << managed_name << " {\n"
+                    documentation(2)
+                    << scope_tab(2) << scope << (is_static ? "static " : virtual_mod) << type(true) << " " << managed_name << " {\n"
               ).generate(sink, std::make_tuple(property, generated_values[0].type), context))
           return false;
       }
@@ -725,8 +725,8 @@ struct property_wrapper_definition_generator
       {
         if (!as_generator
             (
-             documentation(1)
-             << scope_tab << scope << (is_static ? "static (" : "(")
+             documentation(2)
+             << scope_tab(2) << scope << (is_static ? "static (" : "(")
              << (attribute_reorder<1, -1>(type(true) /*<< " " << argument*/) % ", ") << ") "
              << managed_name << " {\n"
             ).generate(sink, std::make_tuple(property, generated_values), context))
@@ -746,7 +746,7 @@ struct property_wrapper_definition_generator
           generate_set (sink, property, context, set_scope, empty_keys, values, is_interface);
       }
 
-      if (!as_generator(scope_tab << "}\n\n").generate(sink, attributes::unused, context))
+      if (!as_generator(scope_tab(2) << "}\n\n").generate(sink, attributes::unused, context))
         return false;
 
       return true;
@@ -783,9 +783,9 @@ struct interface_property_indexer_definition_generator
       std::string managed_name = name_helpers::property_managed_name(property);
 
       if (!as_generator
-           ("public interface " << name_helpers::property_interface_indexer_short_name(property, *implementing_klass) << "\n"
-           << "{\n"
-           << "}\n"
+           (scope_tab << "public interface " << name_helpers::property_interface_indexer_short_name(property, *implementing_klass) << "\n"
+           << scope_tab << "{\n"
+           << scope_tab << "}\n"
            ).generate (sink, attributes::unused, context))
         return false;
 
index 4b9447f..a70df96 100644 (file)
@@ -117,7 +117,7 @@ struct function_definition_epilogue_generator
                   "Eina.Error.RaiseIfUnhandledException();\n"
                   << *(convert_out_assign)
                   << *(convert_in_ptr_assign)
-                  << scope_tab(2) << convert_return << "\n"
+                  << scope_tab(3) << convert_return << "\n"
                   ).generate(sink, std::make_tuple(f.parameters, f.parameters, f.return_type), context))
           return false;
 
index a9cd53b..09f8480 100644 (file)
@@ -110,21 +110,21 @@ struct klass
        if (!as_generator(*(interface_property_indexer_definition(cls))).generate(sink, cls.properties, iface_cxt))
          return false;
        
-       if(!as_generator(documentation).generate(sink, cls, iface_cxt))
+       if(!as_generator(documentation(1)).generate(sink, cls, iface_cxt))
          return false;
 
        // Mark the interface with the proper native Efl_Class* getter
-       if(!as_generator(lit("[") << name_helpers::klass_full_native_inherit_name(cls) << "]\n")
+       if(!as_generator(scope_tab << lit("[") << name_helpers::klass_full_native_inherit_name(cls) << "]\n")
           .generate(sink, attributes::unused, iface_cxt))
          return false;
 
-       if(!as_generator("[Efl.Eo.BindingEntity]\n").generate(sink, attributes::unused, iface_cxt))
+       if(!as_generator(scope_tab << "[Efl.Eo.BindingEntity]\n").generate(sink, attributes::unused, iface_cxt))
          return false;
 
        using efl::eolian::grammar::lit;
        if(!as_generator
         (
-         lit("public ") << (is_partial ? "partial ":"")
+         scope_tab << lit("public ") << (is_partial ? "partial ":"")
          /*<< class_type*/ << "interface" /*<<*/ " " << string << " : "
          )
         .generate(sink, name_helpers::klass_interface_name(cls), iface_cxt))
@@ -144,10 +144,10 @@ struct klass
                 return false;
          }
 
-       if(!as_generator("\n" << scope_tab << "Efl.Eo.IWrapper, IDisposable").generate(sink, attributes::unused, iface_cxt))
+       if(!as_generator("\n" << scope_tab(2) << "Efl.Eo.IWrapper, IDisposable").generate(sink, attributes::unused, iface_cxt))
          return false;
 
-       if(!as_generator("\n{\n").generate(sink, attributes::unused, iface_cxt))
+       if(!as_generator("\n" << scope_tab << "{\n").generate(sink, attributes::unused, iface_cxt))
          return false;
 
        if(!as_generator(*(function_declaration)).generate(sink, cls.functions, iface_cxt))
@@ -161,7 +161,7 @@ struct klass
 
        for (auto &&p : cls.parts)
          if (!as_generator(
-              documentation(1)
+              documentation(2)
               << name_helpers::klass_full_concrete_or_interface_name(p.klass) << " " << utils::capitalize(p.name) << "{ get;}\n"
             ).generate(sink, p, iface_cxt))
            return false;
@@ -170,7 +170,7 @@ struct klass
          return false;
 
        // End of interface declaration
-       if(!as_generator("}\n\n").generate(sink, attributes::unused, iface_cxt)) return false;
+       if(!as_generator(scope_tab << "}\n\n").generate(sink, attributes::unused, iface_cxt)) return false;
      }
 
      // Events arguments go in the top namespace to avoid the Concrete suffix clutter in interface events.
@@ -208,12 +208,12 @@ struct klass
          // other classes that implement the interface.
          if(!as_generator
             (
-             documentation
-             << "public sealed " << (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"
-             << "{\n"
+             documentation(1)
+             << scope_tab << "public sealed " << (is_partial ? "partial ":"") << "class " << concrete_name << " :\n"
+             << scope_tab(2) << (root ? "Efl.Eo.EoWrapper" : "") << (klass_full_concrete_or_interface_name % "")
+             << ",\n" << scope_tab(2) << interface_name
+             << *(",\n" << scope_tab(2) << name_helpers::klass_full_concrete_or_interface_name) << "\n"
+             << scope_tab << "{\n"
             ).generate(sink, std::make_tuple(cls, inherit_classes, inherit_interfaces), concrete_cxt))
               return false;
 
@@ -222,27 +222,27 @@ struct klass
 
          if (!as_generator
             (
-             scope_tab << "/// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.\n"
-             << scope_tab << "/// Do not call this constructor directly.</summary>\n"
-             << scope_tab << "/// <param name=\"ch\">Tag struct storing the native handle of the object being constructed.</param>\n"
-             << scope_tab << "private " << concrete_name << "(ConstructingHandle ch) : base(ch)\n"
-             << scope_tab << "{\n"
-             << scope_tab << "}\n\n"
+             scope_tab(2) << "/// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.\n"
+             << scope_tab(2) << "/// Do not call this constructor directly.</summary>\n"
+             << scope_tab(2) << "/// <param name=\"ch\">Tag struct storing the native handle of the object being constructed.</param>\n"
+             << scope_tab(2) << "private " << concrete_name << "(ConstructingHandle ch) : base(ch)\n"
+             << scope_tab(2) << "{\n"
+             << scope_tab(2) << "}\n\n"
             )
             .generate(sink, attributes::unused, concrete_cxt))
            return false;
 
          if (!as_generator
             (
-             scope_tab << "[System.Runtime.InteropServices.DllImport(" << context_find_tag<library_context>(concrete_cxt).actual_library_name(cls.filename)
+             scope_tab(2) << "[System.Runtime.InteropServices.DllImport(" << context_find_tag<library_context>(concrete_cxt).actual_library_name(cls.filename)
              << ")] internal static extern System.IntPtr\n"
-             << scope_tab << scope_tab << name_helpers::klass_get_name(cls) << "();\n\n"
-             << scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << interface_name << "\"/> class.\n"
-             << scope_tab << "/// Internal usage: This is used when interacting with C code and should not be used directly.</summary>\n"
-             << scope_tab << "/// <param name=\"wh\">The native pointer to be wrapped.</param>\n"
-             << scope_tab << "private " << concrete_name << "(Efl.Eo.WrappingHandle wh) : base(wh)\n"
-             << scope_tab << "{\n"
-             << scope_tab << "}\n\n"
+             << scope_tab(2) << scope_tab << name_helpers::klass_get_name(cls) << "();\n\n"
+             << scope_tab(2) << "/// <summary>Initializes a new instance of the <see cref=\"" << interface_name << "\"/> class.\n"
+             << scope_tab(2) << "/// Internal usage: This is used when interacting with C code and should not be used directly.</summary>\n"
+             << scope_tab(2) << "/// <param name=\"wh\">The native pointer to be wrapped.</param>\n"
+             << scope_tab(2) << "private " << concrete_name << "(Efl.Eo.WrappingHandle wh) : base(wh)\n"
+             << scope_tab(2) << "{\n"
+             << scope_tab(2) << "}\n\n"
             )
             .generate(sink, attributes::unused, concrete_cxt))
            return false;
@@ -282,17 +282,17 @@ struct klass
 
          // Copied from nativeinherit class, used when setting up providers.
          if(!as_generator(
-              scope_tab << "private static IntPtr GetEflClassStatic()\n"
-              << scope_tab << "{\n"
-              << scope_tab << scope_tab << "return " << name_helpers::klass_get_full_name(cls) << "();\n"
-              << scope_tab << "}\n\n"
+              scope_tab(2) << "private static IntPtr GetEflClassStatic()\n"
+              << scope_tab(2) << "{\n"
+              << scope_tab(2) << scope_tab << "return " << name_helpers::klass_get_full_name(cls) << "();\n"
+              << scope_tab(2) << "}\n\n"
            ).generate(sink, attributes::unused, concrete_cxt))
            return false;
 
          if(!generate_native_inherit_class(sink, cls, change_indentation(indent.inc(), concrete_cxt)))
            return true;
 
-         if(!as_generator("}\n").generate(sink, attributes::unused, concrete_cxt)) return false;
+         if(!as_generator(scope_tab << "}\n").generate(sink, attributes::unused, concrete_cxt)) return false;
        }
 
      // Inheritable class
@@ -305,11 +305,11 @@ struct klass
         // Class header
         if(!as_generator
             (
-             documentation
-             << "[" << name_helpers::klass_full_native_inherit_name(cls) << "]\n"
-             << "[Efl.Eo.BindingEntity]\n"
-             << "[SuppressMessage(\"Microsoft.Naming\", \"CA1724:TypeNamesShouldNotMatchNamespaces\")]\n"
-             << "public "
+             documentation(1)
+             << scope_tab << "[" << name_helpers::klass_full_native_inherit_name(cls) << "]\n"
+             << scope_tab << "[Efl.Eo.BindingEntity]\n"
+             << scope_tab << "[SuppressMessage(\"Microsoft.Naming\", \"CA1724:TypeNamesShouldNotMatchNamespaces\")]\n"
+             << scope_tab<< "public "
              << (is_partial
                  ? class_type == "class"
                  ? "partial class"
@@ -321,7 +321,7 @@ struct klass
              << (root ? "Efl.Eo.EoWrapper" : "") // ... or root
              << (inherit_interfaces.empty() ? "" : ", ")
              << (klass_full_concrete_or_interface_name % ", ") // interfaces
-             << "\n{\n"
+             << "\n" << scope_tab << "{\n"
              )
            .generate(sink, std::make_tuple(cls, inherit_classes, inherit_interfaces), inherit_cxt))
            return false;
@@ -363,17 +363,17 @@ struct klass
 
          // Copied from nativeinherit class, used when setting up providers.
          if(!as_generator(
-              scope_tab << "private static IntPtr GetEflClassStatic()\n"
-              << scope_tab << "{\n"
-              << scope_tab << scope_tab << "return " << name_helpers::klass_get_full_name(cls) << "();\n"
-              << scope_tab << "}\n\n"
+              scope_tab(2) << "private static IntPtr GetEflClassStatic()\n"
+              << scope_tab(2) << "{\n"
+              << scope_tab(2) << scope_tab << "return " << name_helpers::klass_get_full_name(cls) << "();\n"
+              << scope_tab(2) << "}\n\n"
            ).generate(sink, attributes::unused, inherit_cxt))
            return false;
 
          if(!generate_native_inherit_class(sink, cls, change_indentation(indent.inc(), inherit_cxt)))
            return true;
 
-         if(!as_generator("}\n").generate(sink, attributes::unused, inherit_cxt)) return false;
+         if(!as_generator(scope_tab << "}\n").generate(sink, attributes::unused, inherit_cxt)) return false;
        }
 
 
@@ -407,10 +407,10 @@ struct klass
      if(!as_generator
         (lit("#if EFL_BETA\n")
          << "#pragma warning disable CS1591\n" // Disabling warnings as DocFx will hide these classes
-         << "public static class " << name_helpers::klass_concrete_name(cls)
+         << scope_tab << "public static class " << name_helpers::klass_concrete_name(cls)
          << "Extensions {\n"
          << extension_method_stream.str()
-         << "}\n"
+         << scope_tab << "}\n"
          << "#pragma warning restore CS1591\n"
          << "#endif\n")
         .generate(sink, cls.namespaces, context))
@@ -435,7 +435,7 @@ struct klass
          auto inherit_name = name_helpers::klass_inherit_name(cls);
          auto implementable_methods = helpers::get_all_registerable_methods(cls, context);
          bool root = !helpers::has_regular_ancestor(cls);
-         auto const& indent = current_indentation(inative_cxt);
+         auto const& indent = current_indentation(inative_cxt).inc();
          std::string klass_since;
 
          if (!documentation_helpers::generate_since_tag_line(std::back_inserter(klass_since), cls.documentation, indent, context))
@@ -521,7 +521,7 @@ struct klass
            return false;
 
          if (!klass_since.empty())
-             klass_since = static_cast<std::string>(scope_tab) + klass_since;
+             klass_since = static_cast<std::string>(scope_tab(2)) + klass_since;
 
          // Attribute getter of the native 'Efl_Class *' handle (for proper inheritance from additional explicit interfaces)
          if(!as_generator(
@@ -543,7 +543,7 @@ struct klass
                 << indent << scope_tab << "#pragma warning restore CA1707, CS1591, SA1300, SA1600\n\n")
             .generate(sink, implementable_methods, change_indentation(indent.inc(), inative_cxt))) return false;
 
-         if(!as_generator("}\n").generate(sink, attributes::unused, inative_cxt)) return false;
+         if(!as_generator(indent << "}\n").generate(sink, attributes::unused, inative_cxt)) return false;
        }
      return true;
    }
@@ -558,21 +558,21 @@ struct klass
      auto inherit_name = name_helpers::klass_concrete_name(cls);
 
      if(!as_generator(
-                scope_tab << "/// <summary>Pointer to the native class description.</summary>\n"
-                << scope_tab << "public override System.IntPtr NativeClass\n"
-                << scope_tab << "{\n"
-                << scope_tab << scope_tab << "get\n"
-                << scope_tab << scope_tab << "{\n"
-                << scope_tab << scope_tab << scope_tab << "if (((object)this).GetType() == typeof(" << inherit_name << "))\n"
-                << scope_tab << scope_tab << scope_tab << "{\n"
-                << scope_tab << scope_tab << scope_tab << scope_tab << "return GetEflClassStatic();\n"
-                << scope_tab << scope_tab << scope_tab << "}\n"
-                << scope_tab << scope_tab << scope_tab << "else\n"
-                << scope_tab << scope_tab << scope_tab << "{\n"
-                << scope_tab << scope_tab << scope_tab << scope_tab << "return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];\n"
-                << scope_tab << scope_tab << scope_tab << "}\n"
-                << scope_tab << scope_tab << "}\n"
-                << scope_tab << "}\n\n"
+                scope_tab(2) << "/// <summary>Pointer to the native class description.</summary>\n"
+                << scope_tab(2) << "public override System.IntPtr NativeClass\n"
+                << scope_tab(2) << "{\n"
+                << scope_tab(2) << scope_tab << "get\n"
+                << scope_tab(2) << scope_tab << "{\n"
+                << scope_tab(2) << scope_tab << scope_tab << "if (((object)this).GetType() == typeof(" << inherit_name << "))\n"
+                << scope_tab(2) << scope_tab << scope_tab << "{\n"
+                << scope_tab(2) << scope_tab << scope_tab << scope_tab << "return GetEflClassStatic();\n"
+                << scope_tab(2) << scope_tab << scope_tab << "}\n"
+                << scope_tab(2) << scope_tab << scope_tab << "else\n"
+                << scope_tab(2) << scope_tab << scope_tab << "{\n"
+                << scope_tab(2) << scope_tab << scope_tab << scope_tab << "return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];\n"
+                << scope_tab(2) << scope_tab << scope_tab << "}\n"
+                << scope_tab(2) << scope_tab << "}\n"
+                << scope_tab(2) << "}\n\n"
             ).generate(sink, attributes::unused, context))
          return false;
 
@@ -585,9 +585,9 @@ struct klass
      auto inherit_name = name_helpers::klass_concrete_name(cls);
 
      if(!as_generator(
-             scope_tab << "[System.Runtime.InteropServices.DllImport(" << context_find_tag<library_context>(context).actual_library_name(cls.filename)
+             scope_tab(2) << "[System.Runtime.InteropServices.DllImport(" << context_find_tag<library_context>(context).actual_library_name(cls.filename)
              << ")] internal static extern System.IntPtr\n"
-             << scope_tab << scope_tab << name_helpers::klass_get_name(cls) << "();\n\n"
+             << scope_tab(2) << scope_tab << name_helpers::klass_get_name(cls) << "();\n\n"
             ).generate(sink, attributes::unused, context))
        return false;
 
@@ -599,40 +599,40 @@ struct klass
      });
 
      std::string klass_since;
-     if (!documentation_helpers::generate_since_tag_line(std::back_inserter(klass_since), cls.documentation, scope_tab, context))
+     if (!documentation_helpers::generate_since_tag_line(std::back_inserter(klass_since), cls.documentation, scope_tab(2), context))
        return false;
 
      // Public (API) constructors
      if (!as_generator(
-                     scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.\n"
+                     scope_tab(2) << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.\n"
                      << klass_since
-                     << scope_tab << "/// </summary>\n"
-                     << scope_tab << "/// <param name=\"parent\">Parent instance.</param>\n"
-                     << *(documentation)
+                     << scope_tab(2) << "/// </summary>\n"
+                     << scope_tab(2) << "/// <param name=\"parent\">Parent instance.</param>\n"
+                     << *(documentation(1))
                      // For constructors with arguments, the parent is also required, as optional parameters can't come before non-optional paramenters.
-                     << scope_tab << "public " << inherit_name << "(Efl.Object parent" << ((constructors.size() > 0) ? "" : "= null")
+                     << scope_tab(2) << "public " << inherit_name << "(Efl.Object parent" << ((constructors.size() > 0) ? "" : "= null")
                      << *(", " << constructor_param ) << ") : "
                      << "base(" << name_helpers::klass_get_name(cls) <<  "(), parent)\n"
-                     << scope_tab << "{\n"
+                     << scope_tab(2) << "{\n"
                      << (*(scope_tab << scope_tab << constructor_invocation << "\n"))
-                     << scope_tab << scope_tab << "FinishInstantiation();\n"
-                     << scope_tab << "}\n\n"
-                     << scope_tab << "/// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.\n"
-                     << scope_tab << "/// Do not call this constructor directly.\n"
+                     << scope_tab(2) << scope_tab << "FinishInstantiation();\n"
+                     << scope_tab(2) << "}\n\n"
+                     << scope_tab(2) << "/// <summary>Subclasses should override this constructor if they are expected to be instantiated from native code.\n"
+                     << scope_tab(2) << "/// Do not call this constructor directly.\n"
                      << klass_since
-                     << scope_tab << "/// </summary>\n"
-                     << scope_tab << "/// <param name=\"ch\">Tag struct storing the native handle of the object being constructed.</param>\n"
-                     << scope_tab << "protected " << inherit_name << "(ConstructingHandle ch) : base(ch)\n"
-                     << scope_tab << "{\n"
-                     << scope_tab << "}\n\n"
-                     << scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.\n"
-                     << scope_tab << "/// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.\n"
+                     << scope_tab(2) << "/// </summary>\n"
+                     << scope_tab(2) << "/// <param name=\"ch\">Tag struct storing the native handle of the object being constructed.</param>\n"
+                     << scope_tab(2) << "protected " << inherit_name << "(ConstructingHandle ch) : base(ch)\n"
+                     << scope_tab(2) << "{\n"
+                     << scope_tab(2) << "}\n\n"
+                     << scope_tab(2) << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.\n"
+                     << scope_tab(2) << "/// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.\n"
                      << klass_since
-                     << scope_tab << "/// </summary>\n"
-                     << scope_tab << "/// <param name=\"wh\">The native pointer to be wrapped.</param>\n"
-                     << scope_tab << "internal " << inherit_name << "(Efl.Eo.WrappingHandle wh) : base(wh)\n"
-                     << scope_tab << "{\n"
-                     << scope_tab << "}\n\n"
+                     << scope_tab(2) << "/// </summary>\n"
+                     << scope_tab(2) << "/// <param name=\"wh\">The native pointer to be wrapped.</param>\n"
+                     << scope_tab(2) << "internal " << inherit_name << "(Efl.Eo.WrappingHandle wh) : base(wh)\n"
+                     << scope_tab(2) << "{\n"
+                     << scope_tab(2) << "}\n\n"
                  ).generate(sink, std::make_tuple(constructors, constructors, constructors), context))
          return false;
 
@@ -642,27 +642,27 @@ struct klass
      if (cls.type == attributes::class_type::abstract_)
      {
          if (!as_generator(
-                scope_tab << "[Efl.Eo.PrivateNativeClass]\n"
-                << scope_tab << "private class " << inherit_name << "Realized : " << inherit_name << "\n"
-                << scope_tab << "{\n"
-                << scope_tab << scope_tab << "private " << inherit_name << "Realized(Efl.Eo.WrappingHandle wh) : base(wh)\n"
-                << scope_tab << scope_tab << "{\n"
-                << scope_tab << scope_tab << "}\n"
-                << scope_tab << "}\n"
+                scope_tab(2) << "[Efl.Eo.PrivateNativeClass]\n"
+                << scope_tab(2) << "private class " << inherit_name << "Realized : " << inherit_name << "\n"
+                << scope_tab(2) << "{\n"
+                << scope_tab(2) << scope_tab << "private " << inherit_name << "Realized(Efl.Eo.WrappingHandle wh) : base(wh)\n"
+                << scope_tab(2) << scope_tab << "{\n"
+                << scope_tab(2) << scope_tab << "}\n"
+                << scope_tab(2) << "}\n"
             ).generate(sink, attributes::unused, context))
            return false;
      }
 
      return as_generator(
-                 scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.\n"
-                 << scope_tab << "/// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.\n"
+                 scope_tab(2) << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.\n"
+                 << scope_tab(2) << "/// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.\n"
                  << klass_since
-                 << scope_tab << "/// </summary>\n"
-                 << scope_tab << "/// <param name=\"baseKlass\">The pointer to the base native Eo class.</param>\n"
-                 << scope_tab << "/// <param name=\"parent\">The Efl.Object parent of this instance.</param>\n"
-                 << scope_tab << "protected " << inherit_name << "(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)\n"
-                 << scope_tab << "{\n"
-                 << scope_tab << "}\n\n"
+                 << scope_tab(2) << "/// </summary>\n"
+                 << scope_tab(2) << "/// <param name=\"baseKlass\">The pointer to the base native Eo class.</param>\n"
+                 << scope_tab(2) << "/// <param name=\"parent\">The Efl.Object parent of this instance.</param>\n"
+                 << scope_tab(2) << "protected " << inherit_name << "(IntPtr baseKlass, Efl.Object parent) : base(baseKlass, parent)\n"
+                 << scope_tab(2) << "{\n"
+                 << scope_tab(2) << "}\n\n"
               ).generate(sink, attributes::unused, context);
    }
 
index 5e6246d..91b29af 100644 (file)
@@ -1612,11 +1612,11 @@ struct constructor_invocation_generator
   {
      auto params = ctor.function.parameters;
      if (!as_generator(
-                       "if (" <<
+                       scope_tab << "if (" <<
                        (efl::eolian::grammar::attribute_reorder<-1>
                         ("Efl.Eo.Globals.ParamHelperCheck(" << constructor_parameter_name(ctor) << ")") % " || ") << ")\n"
-                       << scope_tab << scope_tab << "{\n"
-                       << scope_tab << scope_tab << scope_tab << name_helpers::managed_method_name(ctor.function) << "("
+                       << scope_tab(2) << scope_tab << "{\n"
+                       << scope_tab(2) << scope_tab << scope_tab << name_helpers::managed_method_name(ctor.function) << "("
              ).generate(sink, params, context))
        return false;
 
@@ -1633,7 +1633,7 @@ struct constructor_invocation_generator
 
      if (!as_generator(
                  ");\n"
-                 << scope_tab << scope_tab << "}\n").generate(sink, attributes::unused, context))
+                 << scope_tab(2) << scope_tab << "}\n").generate(sink, attributes::unused, context))
        return false;
      return true;
   }
index 0b8dece..4facf27 100644 (file)
@@ -37,14 +37,14 @@ struct part_definition_generator
        return true;
 
      auto part_klass_name = name_helpers::klass_full_concrete_or_interface_name(part.klass);
-     return as_generator(documentation(1)
-                       << scope_tab << "public " << part_klass_name << " " << name_helpers::managed_part_name(part) << "\n"
-                       << scope_tab << "{\n"
-                       << scope_tab << scope_tab << "get\n"
-                       << scope_tab << scope_tab << "{\n"
-                       << scope_tab << scope_tab << scope_tab << "return GetPart(\"" << part.name << "\") as " << part_klass_name << ";\n"
-                       << scope_tab << scope_tab << "}\n"
-                       << scope_tab << "}\n"
+     return as_generator(documentation(2)
+                       << scope_tab(2) << "public " << part_klass_name << " " << name_helpers::managed_part_name(part) << "\n"
+                       << scope_tab(2) << "{\n"
+                       << scope_tab(2) << scope_tab << "get\n"
+                       << scope_tab(2) << scope_tab << "{\n"
+                       << scope_tab(2) << scope_tab << scope_tab << "return GetPart(\"" << part.name << "\") as " << part_klass_name << ";\n"
+                       << scope_tab(2) << scope_tab << "}\n"
+                       << scope_tab(2) << "}\n"
             ).generate(sink, part.documentation, context);
   }
 
@@ -70,12 +70,12 @@ struct part_extension_method_definition_generator
         bindableClass = "Efl.BindableFactoryPart";
 
       if (!as_generator(
-                scope_tab << "public static " << bindableClass << "<" << part_klass_name << "> " << name_helpers::managed_part_name(part) << "<T>(this Efl.Ui.ItemFactory<T> fac, Efl.Csharp.ExtensionTag<"
+                scope_tab(2) << "public static " << bindableClass << "<" << part_klass_name << "> " << name_helpers::managed_part_name(part) << "<T>(this Efl.Ui.ItemFactory<T> fac, Efl.Csharp.ExtensionTag<"
                             << name_helpers::klass_full_concrete_or_interface_name(cls)
                             << ", T> x=null) where T : " << name_helpers::klass_full_concrete_or_interface_name(cls) << "\n"
-                << scope_tab << "{\n"
-                << scope_tab << scope_tab << "return new " << bindableClass << "<" << part_klass_name << ">(\"" << part.name << "\", fac);\n"
-                << scope_tab << "}\n\n"
+                << scope_tab(2) << "{\n"
+                << scope_tab(2) << scope_tab << "return new " << bindableClass << "<" << part_klass_name << ">(\"" << part.name << "\", fac);\n"
+                << scope_tab(2) << "}\n\n"
             ).generate(sink, attributes::unused, context))
         return false;
 
index 7a3019e..24d0ff3 100644 (file)
@@ -296,7 +296,7 @@ struct struct_internal_definition_generator
      auto const& indent = current_indentation(context);
      if (!as_generator
          (
-          indent << "#pragma warning disable CS1591\n\n"
+          "#pragma warning disable CS1591\n\n"
           << indent << "/// <summary>Internal wrapper for struct " << string << ".</summary>\n"
           << indent << "[StructLayout(LayoutKind.Sequential)]\n"
           << indent << "internal struct " << string << "\n"
@@ -398,7 +398,7 @@ struct struct_internal_definition_generator
 
      // close internal class
      if(!as_generator(indent << "}\n"
-                      << indent << "#pragma warning restore CS1591\n"
+                      << "#pragma warning restore CS1591\n"
                  ).generate(sink, attributes::unused, context)) return false;
 
      return true;
@@ -426,7 +426,7 @@ struct struct_definition_generator
        return true;
 
      auto struct_name = binding_struct_name(struct_);
-     auto const& indent = current_indentation(context);
+     auto const& indent = current_indentation(context).inc();
 
      if (!as_generator(
            indent << scope_tab << "/// <summary>Packs tuple into " << struct_name << " object.\n"
@@ -472,7 +472,7 @@ struct struct_definition_generator
   template <typename OutputIterator, typename Context>
   bool generate_deconstruct_method(OutputIterator sink, attributes::struct_def const& struct_, Context const& context) const
   {
-     auto const& indent = current_indentation(context);
+     auto const& indent = current_indentation(context).inc();
      auto struct_name = binding_struct_name(struct_);
 
      if (!as_generator(
@@ -528,15 +528,15 @@ struct struct_definition_generator
   bool generate(OutputIterator sink, attributes::struct_def const& struct_, Context const& context) const
   {
      EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "struct_definition_generator: " << struct_.cxx_name << std::endl;
-     auto const& indent = current_indentation(context);
-     if(!as_generator(documentation).generate(sink, struct_, context))
+     auto const& indent = current_indentation(context).inc();
+     if(!as_generator(documentation(1)).generate(sink, struct_, context))
        return false;
      auto struct_managed_name = binding_struct_name(struct_);
      if(!as_generator
         (
             indent << "[StructLayout(LayoutKind.Sequential)]\n"
          << indent << "[Efl.Eo.BindingEntity]\n"
-         << "[SuppressMessage(\"Microsoft.Naming\", \"CA1724:TypeNamesShouldNotMatchNamespaces\")]\n"
+         << indent << "[SuppressMessage(\"Microsoft.Naming\", \"CA1724:TypeNamesShouldNotMatchNamespaces\")]\n"
          << indent << "public struct " << struct_managed_name << " : IEquatable<" << struct_managed_name << ">\n"
          << indent << "{\n"
          )