From d41f654087549f4ac31c1be43ad0278a1d1dfe17 Mon Sep 17 00:00:00 2001 From: Lauro Moura Date: Tue, 8 Oct 2019 10:04:57 +0200 Subject: [PATCH] csharp: Add some docs to MVVM infrastructure Reviewers: SanghyeonLee, felipealmeida, cedric, segfaultxavi Reviewed By: segfaultxavi Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10301 --- src/bindings/mono/efl_mono/GenericModel.cs | 13 ++++++++++--- src/bindings/mono/efl_mono/UserModel.cs | 18 ++++++++++++------ src/lib/efl_mono/efl_mono_model_internal.eo | 12 ++++++++++-- .../efl_mono/efl_mono_model_internal_child.eo | 4 ++++ 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/bindings/mono/efl_mono/GenericModel.cs b/src/bindings/mono/efl_mono/GenericModel.cs index 79cca5f2a5..b9ef325750 100644 --- a/src/bindings/mono/efl_mono/GenericModel.cs +++ b/src/bindings/mono/efl_mono/GenericModel.cs @@ -9,10 +9,17 @@ using Eina; namespace Efl { -/// Generic implementation for MVVM models based on +/// +/// Generic helper class to ease manual implementation of C# models. /// -/// Since EFL 1.23. +/// It provides an expanded API like async helpers to get children. +/// +/// For MVVM-based models, provides a simpler API. +/// +/// Since EFL 1.24. /// +/// The type of the child model. It is the type used when adding/removing/getting items to this +/// model. public class GenericModel : Efl.Object, Efl.IModel, IDisposable { private Efl.IModel model; @@ -78,7 +85,7 @@ public class GenericModel : Efl.Object, Efl.IModel, IDisposable ModelHelper.SetProperties(o, child); } - /// Adds a new childs to the model and returns it. + /// Adds a new child to the model and returns it. public Efl.Object AddChild() { return model.AddChild(); diff --git a/src/bindings/mono/efl_mono/UserModel.cs b/src/bindings/mono/efl_mono/UserModel.cs index 08e6f6e371..c2597cc421 100644 --- a/src/bindings/mono/efl_mono/UserModel.cs +++ b/src/bindings/mono/efl_mono/UserModel.cs @@ -49,8 +49,8 @@ internal class ModelHelper /// Helper class to simplify the creation of MVVM Models based on . /// -/// This class works together with to wrap user defined classes as MVVM models. -/// Example: +/// This class enables usage of simple model classes to define the data to be stored in the native model +/// and presented in a friendly manner to the C# developer. Example: /// /// /// public class PersonModel @@ -65,12 +65,18 @@ internal class ModelHelper /// PersonModel p = await model.GetAtAsync(0); /// /// -/// Since EFL 1.23. +/// Since EFL 1.24. /// +/// The enclosed C# model class with the properties to be added to the native model. [Efl.Eo.BindingEntity] public class UserModel : Efl.MonoModelInternal, IDisposable { - /// Creates a new model. + /// + /// Creates a new root model. + /// + /// The properties of T will be added to the underlying native model as properties the user can get/set on children + /// of this model. + /// /// The parent of the model. public UserModel (Efl.Object parent = null) : base(Efl.MonoModelInternal.efl_mono_model_internal_class_get(), parent) { @@ -87,9 +93,9 @@ public class UserModel : Efl.MonoModelInternal, IDisposable Dispose(false); } - /// Adds a new child to the model wrapping the properites of o + /// Adds a new child to the model wrapping the properties of o /// - /// Reflection is used to instantiate a new for this child and + /// Reflection is used to instantiate a new -based class for this child and /// set the mirroring properties correctly. /// /// diff --git a/src/lib/efl_mono/efl_mono_model_internal.eo b/src/lib/efl_mono/efl_mono_model_internal.eo index 3a639defe7..71b331378b 100644 --- a/src/lib/efl_mono/efl_mono_model_internal.eo +++ b/src/lib/efl_mono/efl_mono_model_internal.eo @@ -1,10 +1,18 @@ class @beta Efl.Mono_Model_Internal extends Efl.Loop_Consumer implements Efl.Model { + [[Internal @Efl.Model implementation for the root models in C# MVVM infrastructure. + + This represents the root model, containing @Efl.Mono_Model_Internal_Child elements. It is inherited from classes + like the C#-only Efl.UserModel, which the end user will actually instantiate. + ]] methods { add_property { + [[Adds a new property to the wrapped children models. + + When adding new children models, these children will have the properties that were added from this method.]] params { - @in name: string; - @in type: ptr(const(Eina.Value_Type)); + @in name: string; [[Name of the property being added.]] + @in type: ptr(const(Eina.Value_Type)); [[Type of the property being added, as an @Eina.Value_Type.]] } } } diff --git a/src/lib/efl_mono/efl_mono_model_internal_child.eo b/src/lib/efl_mono/efl_mono_model_internal_child.eo index eebb79794c..b8bf3ac1be 100644 --- a/src/lib/efl_mono/efl_mono_model_internal_child.eo +++ b/src/lib/efl_mono/efl_mono_model_internal_child.eo @@ -1,5 +1,9 @@ class @beta Efl.Mono_Model_Internal_Child extends Efl.Loop_Consumer implements Efl.Model { + [[Internal @Efl.Model implementation for the actual model data contained in a root @Efl.Mono_Model_Internal. + + This model's properties are added through C# reflection on the user-provided model through Efl.GenericModel. + ]] implements { Efl.Object.constructor; Efl.Object.destructor;