csharp: add SetKeyValue and GetKeyValue to EoWrapper

Summary:
SetKeyValue adds a value object associated with a key object to hash
table.
GetKeyValue returns a value object associated with a key object from
hash table.

Reviewers: felipealmeida, lauromoura, vitor.sousa, woohyun, cedric

Subscribers: zmike, bu5hm4n, segfaultxavi, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9622
This commit is contained in:
Jaehyun Cho 2019-09-02 21:26:58 +09:00
parent ac99e2ac94
commit b7bab9aa8e
1 changed files with 24 additions and 0 deletions

View File

@ -3,6 +3,7 @@ using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Reflection;
using System.Collections;
namespace Efl
{
@ -26,6 +27,7 @@ public abstract class EoWrapper : IWrapper, IDisposable
private static Efl.EventCb ownershipUniqueDelegate = new Efl.EventCb(OwnershipUniqueCallback);
private static Efl.EventCb ownershipSharedDelegate = new Efl.EventCb(OwnershipSharedCallback);
private Hashtable keyValueHash = null;
/// <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
@ -322,6 +324,28 @@ public abstract class EoWrapper : IWrapper, IDisposable
public IntPtr NativeHandle { get; private set; }
}
/// <summary>
/// Set a value object associated with a key object.
/// </summary>
public void SetKeyValue(object key, object val)
{
if (keyValueHash == null)
keyValueHash = new Hashtable();
keyValueHash.Add(key, val);
}
/// <summary>
/// Get a value object associated with a key object.
/// </summary>
public object GetKeyValue(object key)
{
if (keyValueHash == null)
return null;
return keyValueHash[key];
}
/// <summary>Wrapper for native methods and virtual method delegates.
/// For internal use by generated code only.</summary>
public abstract class NativeMethods : Efl.Eo.NativeClass