csharp: Add since information to EoWrapper.cs

Reviewers: brunobelo, segfaultxavi, felipealmeida, woohyun

Reviewed By: segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10429
This commit is contained in:
Lauro Moura 2019-10-24 18:42:40 +02:00 committed by Xavi Artigas
parent 59ad959e85
commit f33183ba04
1 changed files with 66 additions and 23 deletions

View File

@ -31,6 +31,8 @@ namespace Eo
/// ///
/// Most of it is protected functionalities to serve the generated /// Most of it is protected functionalities to serve the generated
/// binding classes that inherit from it. /// binding classes that inherit from it.
///
/// <para>Since EFL 1.23.</para>
/// </summary> /// </summary>
public abstract class EoWrapper : IWrapper, IDisposable public abstract class EoWrapper : IWrapper, IDisposable
{ {
@ -45,14 +47,17 @@ public abstract class EoWrapper : IWrapper, IDisposable
private Hashtable keyValueHash = null; private Hashtable keyValueHash = null;
/// <summary>Constructor to be used when objects are expected to be constructed from native code. /// <summary>Constructor to be used when objects are expected to be constructed from native code.
/// For a class that inherited from an EFL# class to be properly constructed from native code /// <para>For a class that inherited from an EFL# class to be properly constructed from native code
/// one must create a constructor with this signature and calls this base constructor from it. /// one must create a constructor with this signature and calls this base constructor from it.
/// This constructor will take care of calling base constructors of the native classes and /// This constructor will take care of calling base constructors of the native classes and
/// perform additional setup so objects are ready to use. /// perform additional setup so objects are ready to use.</para>
/// It is advisable to check for the <see cref="NativeHandle"/> property in the top level /// <para>It is advisable to check for the <see cref="NativeHandle"/> property in the top level
/// constructor and signal an error when it has a value of IntPtr.Zero after this /// constructor and signal an error when it has a value of IntPtr.Zero after this
/// constructor completion. /// constructor completion.</para>
/// Warning: Do not use this constructor directly from a `new` statement.</summary> /// <para>Warning: Do not use this constructor directly from a `new` statement.</para>
/// <para>Since EFL 1.23.</para>
/// </summary>
///
/// <param name="ch">Tag struct storing the native handle of the object being constructed.</param> /// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
protected EoWrapper(ConstructingHandle ch) protected EoWrapper(ConstructingHandle ch)
{ {
@ -71,8 +76,10 @@ public abstract class EoWrapper : IWrapper, IDisposable
} }
/// <summary>Initializes a new instance of the <see cref="Object"/> class. /// <summary>Initializes a new instance of the <see cref="Object"/> class.
/// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly. /// <para>Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</para>
/// Do not implement this constructor.</summary> /// <para>Do not implement this constructor.</para>
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="wh">The native pointer to be wrapped.</param> /// <param name="wh">The native pointer to be wrapped.</param>
protected EoWrapper(Efl.Eo.Globals.WrappingHandle wh) protected EoWrapper(Efl.Eo.Globals.WrappingHandle wh)
{ {
@ -81,8 +88,10 @@ public abstract class EoWrapper : IWrapper, IDisposable
} }
/// <summary>Initializes a new instance of the <see cref="Object"/> class. /// <summary>Initializes a new instance of the <see cref="Object"/> class.
/// Internal usage: Constructor to actually call the native library constructors. C# subclasses /// <para>Internal usage: Constructor to actually call the native library constructors. C# subclasses
/// must use the public constructor only.</summary> /// must use the public constructor only.</para>
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="baseKlass">The pointer to the base native Eo class.</param> /// <param name="baseKlass">The pointer to the base native Eo class.</param>
/// <param name="parent">The Efl.Object parent of this instance.</param> /// <param name="parent">The Efl.Object parent of this instance.</param>
/// <param name="file">Name of the file from where the constructor is called.</param> /// <param name="file">Name of the file from where the constructor is called.</param>
@ -129,19 +138,25 @@ public abstract class EoWrapper : IWrapper, IDisposable
AddWrapperSupervisor(); AddWrapperSupervisor();
} }
/// <summary>Destructor.</summary> /// <summary>Destructor.
/// <para>Since EFL 1.23.</para>
/// </summary>
~EoWrapper() ~EoWrapper()
{ {
Dispose(false); Dispose(false);
} }
/// <summary>Pointer to the native instance.</summary> /// <summary>Pointer to the native instance.
/// <para>Since EFL 1.23.</para>
/// </summary>
public System.IntPtr NativeHandle public System.IntPtr NativeHandle
{ {
get { return handle; } get { return handle; }
} }
/// <summary>Pointer to the native class description.</summary> /// <summary>Pointer to the native class description.
/// <para>Since EFL 1.23.</para>
/// </summary>
public abstract System.IntPtr NativeClass public abstract System.IntPtr NativeClass
{ {
get; get;
@ -150,6 +165,7 @@ public abstract class EoWrapper : IWrapper, IDisposable
/// <summary> /// <summary>
/// Whether this object type is one of the generated binding classes or a custom /// Whether this object type is one of the generated binding classes or a custom
/// class defined by the user and that inherit from one of the generated ones. /// class defined by the user and that inherit from one of the generated ones.
/// <para>Since EFL 1.23.</para>
/// </summary> /// </summary>
/// <returns> /// <returns>
/// True if this object type is one of the generated binding classes, /// True if this object type is one of the generated binding classes,
@ -161,7 +177,9 @@ public abstract class EoWrapper : IWrapper, IDisposable
get { return generated; } get { return generated; }
} }
/// <summary>Releases the underlying native instance.</summary> /// <summary>Releases the underlying native instance.
/// <para>Since EFL 1.23.</para>
/// </summary>
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)
{ {
if (disposing && handle != System.IntPtr.Zero) if (disposing && handle != System.IntPtr.Zero)
@ -182,14 +200,18 @@ public abstract class EoWrapper : IWrapper, IDisposable
} }
} }
/// <summary>Turns the native pointer into a string representation.</summary> /// <summary>Turns the native pointer into a string representation.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>A string with the type and the native pointer for this object.</returns> /// <returns>A string with the type and the native pointer for this object.</returns>
public override String ToString() public override String ToString()
{ {
return $"{this.GetType().Name}@[0x{(UInt64)handle:x}]"; return $"{this.GetType().Name}@[0x{(UInt64)handle:x}]";
} }
/// <summary>Releases the underlying native instance.</summary> /// <summary>Releases the underlying native instance.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void Dispose() public void Dispose()
{ {
Dispose(true); Dispose(true);
@ -200,6 +222,7 @@ public abstract class EoWrapper : IWrapper, IDisposable
/// ///
/// This method is a C# counterpart to the C `efl_del` function. It removes the parent of the object /// This method is a C# counterpart to the C `efl_del` function. It removes the parent of the object
/// and releases the Eo reference it was holding. /// and releases the Eo reference it was holding.
/// <para>Since EFL 1.23.</para>
/// </summary> /// </summary>
public void Del() public void Del()
{ {
@ -209,7 +232,9 @@ public abstract class EoWrapper : IWrapper, IDisposable
} }
/// <summary>Finishes instantiating this object. /// <summary>Finishes instantiating this object.
/// Internal usage by generated code.</summary> /// <para>Internal usage by generated code.</para>
/// <para>Since EFL 1.23.</para>
/// </summary>
protected void FinishInstantiation() protected void FinishInstantiation()
{ {
Eina.Log.Debug("calling efl_add_internal_end"); Eina.Log.Debug("calling efl_add_internal_end");
@ -223,7 +248,10 @@ public abstract class EoWrapper : IWrapper, IDisposable
handle = h; handle = h;
} }
/// <summary>Adds a new event handler, registering it to the native event. For internal use only.</summary> /// <summary>Adds a new event handler, registering it to the native event.
/// <para>For internal use only.</para>
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="lib">The name of the native library definining the event.</param> /// <param name="lib">The name of the native library definining the event.</param>
/// <param name="key">The name of the native event.</param> /// <param name="key">The name of the native event.</param>
/// <param name="evtCaller">Delegate to be called by native code on event raising.</param> /// <param name="evtCaller">Delegate to be called by native code on event raising.</param>
@ -259,7 +287,10 @@ public abstract class EoWrapper : IWrapper, IDisposable
} }
} }
/// <summary>Removes the given event handler for the given event. For internal use only.</summary> /// <summary>Removes the given event handler for the given event.
/// <para>For internal use only.</para>
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="lib">The name of the native library definining the event.</param> /// <param name="lib">The name of the native library definining the event.</param>
/// <param name="key">The name of the native event.</param> /// <param name="key">The name of the native event.</param>
/// <param name="evtDelegate">The delegate to be removed.</param> /// <param name="evtDelegate">The delegate to be removed.</param>
@ -331,22 +362,29 @@ public abstract class EoWrapper : IWrapper, IDisposable
/// <summary> /// <summary>
/// Struct to be used when constructing objects from native code. /// Struct to be used when constructing objects from native code.
/// Wraps the pointer handle to the native object instance. /// <para>For internal use by generated code only.</para>
/// <para>Wraps the pointer handle to the native object instance.</para>
/// <para>Since EFL 1.23.</para>
/// </summary> /// </summary>
protected struct ConstructingHandle protected struct ConstructingHandle
{ {
/// <summary>Constructor for wrapping the native handle.</summary> /// <summary>Constructor for wrapping the native handle.
/// <para>Since EFL 1.23.</para>
/// </summary>
public ConstructingHandle(IntPtr h) public ConstructingHandle(IntPtr h)
{ {
NativeHandle = h; NativeHandle = h;
} }
/// <summary>Pointer to the native instance.</summary> /// <summary>Pointer to the native instance.
/// <para>Since EFL 1.23.</para>
/// </summary>
public IntPtr NativeHandle { get; private set; } public IntPtr NativeHandle { get; private set; }
} }
/// <summary> /// <summary>
/// Set a value object associated with a key object. /// Set a value object associated with a key object.
/// <para>Since EFL 1.23.</para>
/// </summary> /// </summary>
public void SetKeyValue(object key, object val) public void SetKeyValue(object key, object val)
{ {
@ -358,6 +396,7 @@ public abstract class EoWrapper : IWrapper, IDisposable
/// <summary> /// <summary>
/// Get a value object associated with a key object. /// Get a value object associated with a key object.
/// <para>Since EFL 1.23.</para>
/// </summary> /// </summary>
public object GetKeyValue(object key) public object GetKeyValue(object key)
{ {
@ -368,7 +407,9 @@ public abstract class EoWrapper : IWrapper, IDisposable
} }
/// <summary>Wrapper for native methods and virtual method delegates. /// <summary>Wrapper for native methods and virtual method delegates.
/// For internal use by generated code only.</summary> /// <para>For internal use by generated code only.</para>
/// <para>Since EFL 1.23.</para>
/// </summary>
public abstract class NativeMethods : Efl.Eo.NativeClass public abstract class NativeMethods : Efl.Eo.NativeClass
{ {
private static EflConstructorDelegate csharpEflConstructorStaticDelegate = new EflConstructorDelegate(Constructor); private static EflConstructorDelegate csharpEflConstructorStaticDelegate = new EflConstructorDelegate(Constructor);
@ -376,7 +417,9 @@ public abstract class EoWrapper : IWrapper, IDisposable
private delegate IntPtr EflConstructorDelegate(IntPtr obj, IntPtr pd); private delegate IntPtr EflConstructorDelegate(IntPtr obj, IntPtr pd);
/// <summary>Gets the list of Eo operations to override.</summary> /// <summary>Gets the list of Eo operations to override.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The list of Eo operations to be overload.</returns> /// <returns>The list of Eo operations to be overload.</returns>
public override System.Collections.Generic.List<EflOpDescription> GetEoOps(Type type, bool includeInherited) public override System.Collections.Generic.List<EflOpDescription> GetEoOps(Type type, bool includeInherited)
{ {