forked from enlightenment/efl
csharp: Add more since tags to members
Summary: - Class constructors and other members - Aliases fields ref T8359 Reviewers: felipealmeida, segfaultxavi, brunobelo, woohyun Reviewed By: felipealmeida Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8359 Differential Revision: https://phab.enlightenment.org/D10419
This commit is contained in:
parent
09fd7ca8d6
commit
11094aeaaf
|
@ -56,6 +56,10 @@ struct alias_definition_generator
|
|||
alias_type_doc = utils::replace_all(alias_type, "<", "<");
|
||||
alias_type_doc = utils::replace_all(alias_type_doc, ">", ">");
|
||||
|
||||
std::string alias_since;
|
||||
if (!documentation_helpers::generate_since_tag_line(std::back_inserter(alias_since), alias.documentation, scope_tab, context))
|
||||
return false;
|
||||
|
||||
std::string const alias_name = utils::remove_all(alias.eolian_name, '_');
|
||||
if (!as_generator(
|
||||
documentation
|
||||
|
@ -63,7 +67,9 @@ struct alias_definition_generator
|
|||
<< "{\n"
|
||||
<< scope_tab << "private " << alias_type << " payload;\n\n"
|
||||
|
||||
<< scope_tab << "/// <summary>Converts an instance of " << alias_type_doc << " to this struct.</summary>\n"
|
||||
<< scope_tab << "/// <summary>Converts an instance of " << alias_type_doc << " to this struct.\n"
|
||||
<< alias_since
|
||||
<< scope_tab << "/// </summary>\n"
|
||||
<< scope_tab << "/// <param name=\"value\">The value to be converted.</param>\n"
|
||||
<< scope_tab << "/// <returns>A struct with the given value.</returns>\n"
|
||||
<< scope_tab << "public static implicit operator " << alias_name << "(" << alias_type << " value)\n"
|
||||
|
@ -71,7 +77,9 @@ struct alias_definition_generator
|
|||
<< scope_tab << scope_tab << "return new " << alias_name << "{payload=value};\n"
|
||||
<< scope_tab << "}\n\n"
|
||||
|
||||
<< scope_tab << "/// <summary>Converts an instance of this struct to " << alias_type_doc << ".</summary>\n"
|
||||
<< scope_tab << "/// <summary>Converts an instance of this struct to " << alias_type_doc << ".\n"
|
||||
<< alias_since
|
||||
<< scope_tab << "/// </summary>\n"
|
||||
<< scope_tab << "/// <param name=\"value\">The value to be converted packed in this struct.</param>\n"
|
||||
<< scope_tab << "/// <returns>The actual value the alias is wrapping.</returns>\n"
|
||||
<< scope_tab << "public static implicit operator " << alias_type << "(" << alias_name << " value)\n"
|
||||
|
|
|
@ -649,8 +649,24 @@ struct documentation_string_generator
|
|||
|
||||
} const documentation_string {};
|
||||
|
||||
} // namespace eolian_mono
|
||||
namespace documentation_helpers
|
||||
{
|
||||
|
||||
template<typename OutputIterator, typename Indent, typename Context>
|
||||
bool generate_since_tag_line(OutputIterator sink, attributes::documentation_def const& doc, Indent indentation, Context context)
|
||||
{
|
||||
if (doc.since.empty())
|
||||
return true;
|
||||
|
||||
return as_generator
|
||||
(
|
||||
indentation << ("/// <para>Since EFL " + doc.since + ".</para>\n")
|
||||
).generate(sink, attributes::unused, context);
|
||||
}
|
||||
|
||||
} // documentation_helpers
|
||||
|
||||
} // namespace eolian_mono
|
||||
|
||||
namespace efl { namespace eolian { namespace grammar {
|
||||
|
||||
|
|
|
@ -410,6 +410,10 @@ struct klass
|
|||
auto implementable_methods = helpers::get_all_registerable_methods(cls, context);
|
||||
bool root = !helpers::has_regular_ancestor(cls);
|
||||
auto const& indent = current_indentation(inative_cxt);
|
||||
std::string klass_since;
|
||||
|
||||
if (!documentation_helpers::generate_since_tag_line(std::back_inserter(klass_since), cls.documentation, indent, context))
|
||||
return false;
|
||||
|
||||
std::string base_name;
|
||||
if(!root)
|
||||
|
@ -421,7 +425,10 @@ struct klass
|
|||
if(!as_generator
|
||||
(
|
||||
indent << lit("/// <summary>Wrapper for native methods and virtual method delegates.\n")
|
||||
<< indent << "/// For internal use by generated code only.</summary>\n"
|
||||
<< indent << "/// For internal use by generated code only.\n"
|
||||
<< klass_since
|
||||
<< indent << "/// </summary>\n"
|
||||
<< indent << "[EditorBrowsable(EditorBrowsableState.Never)]\n"
|
||||
<< indent << "internal new class " << native_inherit_name << " : " << (root ? "Efl.Eo.EoWrapper.NativeMethods" : base_name) << "\n"
|
||||
<< indent << "{\n"
|
||||
).generate(sink, attributes::unused, inative_cxt))
|
||||
|
@ -437,7 +444,9 @@ struct klass
|
|||
}
|
||||
|
||||
if(!as_generator(
|
||||
indent << scope_tab << "/// <summary>Gets the list of Eo operations to override.</summary>\n"
|
||||
indent << scope_tab << "/// <summary>Gets the list of Eo operations to override.\n"
|
||||
<< klass_since
|
||||
<< indent << "/// </summary>\n"
|
||||
<< indent << scope_tab << "/// <returns>The list of Eo operations to be overload.</returns>\n"
|
||||
<< indent << scope_tab << "internal override System.Collections.Generic.List<EflOpDescription> GetEoOps(System.Type type, bool includeInherited)\n"
|
||||
<< indent << scope_tab << "{\n"
|
||||
|
@ -485,9 +494,14 @@ struct klass
|
|||
).generate(sink, attributes::unused, inative_cxt))
|
||||
return false;
|
||||
|
||||
if (!klass_since.empty())
|
||||
klass_since = static_cast<std::string>(scope_tab) + klass_since;
|
||||
|
||||
// Attribute getter of the native 'Efl_Class *' handle (for proper inheritance from additional explicit interfaces)
|
||||
if(!as_generator(
|
||||
indent << scope_tab << "/// <summary>Returns the Eo class for the native methods of this class.</summary>\n"
|
||||
indent << scope_tab << "/// <summary>Returns the Eo class for the native methods of this class.\n"
|
||||
<< klass_since
|
||||
<< indent << scope_tab << "/// </summary>\n"
|
||||
<< indent << scope_tab << "/// <returns>The native class pointer.</returns>\n"
|
||||
<< indent << scope_tab << "internal override IntPtr GetEflClass()\n"
|
||||
<< indent << scope_tab << "{\n"
|
||||
|
@ -558,9 +572,15 @@ struct klass
|
|||
return !blacklist::is_function_blacklisted(ctor.function, context);
|
||||
});
|
||||
|
||||
std::string klass_since;
|
||||
if (!documentation_helpers::generate_since_tag_line(std::back_inserter(klass_since), cls.documentation, scope_tab, context))
|
||||
return false;
|
||||
|
||||
// Public (API) constructors
|
||||
if (!as_generator(
|
||||
scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.</summary>\n"
|
||||
scope_tab << "/// <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)
|
||||
// For constructors with arguments, the parent is also required, as optional parameters can't come before non-optional paramenters.
|
||||
|
@ -572,13 +592,17 @@ struct klass
|
|||
<< 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.</summary>\n"
|
||||
<< scope_tab << "/// 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.</summary>\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"
|
||||
<< 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"
|
||||
|
@ -605,7 +629,9 @@ struct klass
|
|||
|
||||
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.</summary>\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"
|
||||
<< 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"
|
||||
|
|
|
@ -53,6 +53,11 @@ struct scope_tab_generator
|
|||
|
||||
int n;
|
||||
int m;
|
||||
|
||||
explicit operator std::string() const
|
||||
{
|
||||
return std::string(n * m, ' ');
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
|
@ -71,6 +76,12 @@ struct scope_tab_terminal
|
|||
{
|
||||
return {1};
|
||||
}
|
||||
|
||||
explicit operator std::string() const
|
||||
{
|
||||
return static_cast<std::string>(scope_tab_generator{1});
|
||||
}
|
||||
|
||||
} const scope_tab = {};
|
||||
|
||||
template <>
|
||||
|
|
Loading…
Reference in New Issue