summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-06-28 10:40:52 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-06-28 10:44:52 -0300
commit4496022a3ca5223baceb11609d7659e1f34d6549 (patch)
tree2862533df5585cd75520032df9df7d60bdff10a9 /src
parentb7fa7d48ac9eff4b360e83de4d974a92c84c0291 (diff)
csharp: fix Eina_Stringshare support in containers for manual and generated API
Summary: Both C strings and eina stringshares are bound as regular strings in EFL#, as working directly with these types would demand unnecessary hassle from the user viewpoint. But for eina containers this distinction is important, and since C# generics do not provide a convenient way of dealing with the same type requiring a different management based on some other condition (at least not without compromising the usability for other types), we added a simple `System.String` wrapper named `Eina.Stringshare` that works as a placeholder for signaling this distinction. Working with this class should be transparent in most use cases because it converts to and from `System.String` implicitly. It also implements equality/inequality methods for easier comparison with strings and other stringshare objects. Add new methods and a new container element trait for dealing specifically with `Eina_Stringshare` elements. Adapt eolian_mono to identify and generate the proper placeholder in methods that require stringshare containers. Remove some direct uses of DllImport-ed functions in favor of more flexible manual binding methods. Move `Eina.Stringshare` DllImport directives to a static class named `NativeMethods`, in accordance with the code design warning CA1060. Also add a TODO comment to move all other DllImport directives to this class. Change parameter of the method `Efl.Csharp.Application.OnInitialize` from `Eina.Array<System.String>` to `string[]`. This will make this API more similar with the default C# way of receiving command line arguments. Add tests for containers storing stringshare elements. Reviewers: felipealmeida, lauromoura, segfaultxavi, bu5hm4n Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9178
Diffstat (limited to 'src')
-rw-r--r--src/bin/eolian_mono/eolian/mono/marshall_type.hh34
-rw-r--r--src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh47
-rw-r--r--src/bin/eolian_mono/eolian/mono/struct_definition.hh2
-rw-r--r--src/bin/eolian_mono/eolian/mono/type.hh38
-rw-r--r--src/bin/eolian_mono/eolian/mono/type_impl.hh5
-rw-r--r--src/bindings/mono/efl_mono/efl_csharp_application.cs16
-rw-r--r--src/bindings/mono/eina_mono/eina_common.cs43
-rw-r--r--src/bindings/mono/eina_mono/eina_container_common.cs153
-rw-r--r--src/bindings/mono/eina_mono/eina_hash.cs6
-rw-r--r--src/bindings/mono/eina_mono/eina_stringshare.cs220
-rw-r--r--src/bindings/mono/eo_mono/iwrapper.cs8
-rw-r--r--src/lib/efl_mono/efl_custom_exports_mono.c11
-rw-r--r--src/tests/efl_mono/Eina.cs738
-rw-r--r--src/tests/efl_mono/EinaTestData.cs4
-rw-r--r--src/tests/efl_mono/dummy_test_object.c788
-rw-r--r--src/tests/efl_mono/dummy_test_object.eo190
16 files changed, 2260 insertions, 43 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/marshall_type.hh b/src/bin/eolian_mono/eolian/mono/marshall_type.hh
index 5c350adebe..2b05e636c3 100644
--- a/src/bin/eolian_mono/eolian/mono/marshall_type.hh
+++ b/src/bin/eolian_mono/eolian/mono/marshall_type.hh
@@ -26,23 +26,41 @@ struct marshall_annotation_visitor_generate;
26 */ 26 */
27struct marshall_type_generator 27struct marshall_type_generator
28{ 28{
29 marshall_type_generator(bool is_return = false) 29 marshall_type_generator(bool is_return = false, bool is_special_subtype = false)
30 : is_return(is_return) {} 30 : is_return(is_return)
31 31 , is_special_subtype(is_special_subtype)
32 {}
33
32 template <typename OutputIterator, typename Context> 34 template <typename OutputIterator, typename Context>
33 bool generate(OutputIterator sink, attributes::type_def const& type, Context const& context) const 35 bool generate(OutputIterator sink, attributes::type_def const& type, Context const& context) const
34 { 36 {
35 return type.original_type.visit(detail::marshall_type_visitor_generate<OutputIterator, Context>{sink, &context, type.c_type, false, is_return, type.is_ptr }); 37 return type.original_type.visit(detail::marshall_type_visitor_generate<OutputIterator, Context>{
38 sink
39 , &context
40 , type.c_type
41 , false
42 , is_return
43 , type.is_ptr
44 , is_special_subtype
45 });
36 } 46 }
37 /* Some types may require a different conversion when they are in @out parameters. */ 47 /* Some types may require a different conversion when they are in @out parameters. */
38 template <typename OutputIterator, typename Context> 48 template <typename OutputIterator, typename Context>
39 bool generate(OutputIterator sink, attributes::parameter_def const& param, Context const& context) const 49 bool generate(OutputIterator sink, attributes::parameter_def const& param, Context const& context) const
40 { 50 {
41 return param.type.original_type.visit(detail::marshall_type_visitor_generate<OutputIterator, Context>{sink, &context, param.type.c_type 51 return param.type.original_type.visit(detail::marshall_type_visitor_generate<OutputIterator, Context>{
42 , param.direction != attributes::parameter_direction::in, false, param.type.is_ptr}); 52 sink
53 , &context
54 , param.type.c_type
55 , param.direction != attributes::parameter_direction::in
56 , false
57 , param.type.is_ptr
58 , is_special_subtype
59 });
43 } 60 }
44 61
45 bool is_return; 62 bool is_return;
63 bool is_special_subtype;
46}; 64};
47 65
48/* 66/*
@@ -73,9 +91,9 @@ struct marshall_annotation_generator
73 91
74struct marshall_type_terminal 92struct marshall_type_terminal
75{ 93{
76 marshall_type_generator const operator()(bool is_return) const 94 marshall_type_generator const operator()(bool is_return, bool is_special_subtype = false) const
77 { 95 {
78 return marshall_type_generator(is_return); 96 return marshall_type_generator(is_return, is_special_subtype);
79 } 97 }
80} const marshall_type = {}; 98} const marshall_type = {};
81 99
diff --git a/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh b/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh
index b50c88f768..d3fcbfa41e 100644
--- a/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh
+++ b/src/bin/eolian_mono/eolian/mono/marshall_type_impl.hh
@@ -25,6 +25,7 @@ struct marshall_type_visitor_generate
25 bool is_out; 25 bool is_out;
26 bool is_return; 26 bool is_return;
27 bool is_ptr; 27 bool is_ptr;
28 bool is_special_subtype;
28 29
29 typedef marshall_type_visitor_generate<OutputIterator, Context> visitor_type; 30 typedef marshall_type_visitor_generate<OutputIterator, Context> visitor_type;
30 typedef bool result_type; 31 typedef bool result_type;
@@ -70,12 +71,16 @@ struct marshall_type_visitor_generate
70 { 71 {
71 regular_type_def r = regular; 72 regular_type_def r = regular;
72 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 73 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
74 if (is_special_subtype)
75 return replace_base_type(r, "Eina.Stringshare");
73 return replace_base_type(r, "System.String"); 76 return replace_base_type(r, "System.String");
74 }} 77 }}
75 , {"stringshare", false, [&] 78 , {"stringshare", false, [&]
76 { 79 {
77 regular_type_def r = regular; 80 regular_type_def r = regular;
78 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 81 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
82 if (is_special_subtype)
83 return replace_base_type(r, "Eina.Stringshare");
79 return replace_base_type(r, "System.String"); 84 return replace_base_type(r, "System.String");
80 }} 85 }}
81 , {"strbuf", nullptr, [&] 86 , {"strbuf", nullptr, [&]
@@ -171,16 +176,40 @@ struct marshall_type_visitor_generate
171 regular_type_def r = regular; 176 regular_type_def r = regular;
172 r.base_type = "System.IntPtr"; 177 r.base_type = "System.IntPtr";
173 r.namespaces.clear(); 178 r.namespaces.clear();
174 return visitor_generate<OutputIterator, Context>{sink, context, c_type, is_out, is_return, is_ptr}(r); 179 return visitor_generate<OutputIterator, Context>{
180 sink
181 , context
182 , c_type
183 , is_out
184 , is_return
185 , is_ptr
186 , is_special_subtype
187 }(r);
175 } 188 }
176 else 189 else
177 { 190 {
178 return visitor_generate<OutputIterator, Context>{sink, context, c_type, is_out, is_return, is_ptr}(regular); 191 return visitor_generate<OutputIterator, Context>{
192 sink
193 , context
194 , c_type
195 , is_out
196 , is_return
197 , is_ptr
198 , is_special_subtype
199 }(regular);
179 } 200 }
180 } 201 }
181 bool operator()(attributes::klass_name klass_name) const 202 bool operator()(attributes::klass_name klass_name) const
182 { 203 {
183 return visitor_generate<OutputIterator, Context>{sink, context, c_type, is_out, is_return, is_ptr}(klass_name); 204 return visitor_generate<OutputIterator, Context>{
205 sink
206 , context
207 , c_type
208 , is_out
209 , is_return
210 , is_ptr
211 , is_special_subtype
212 }(klass_name);
184 } 213 }
185 bool operator()(attributes::complex_type_def const& complex) const 214 bool operator()(attributes::complex_type_def const& complex) const
186 { 215 {
@@ -225,7 +254,7 @@ struct marshall_type_visitor_generate
225 { 254 {
226 regular_type_def no_pointer_regular = complex.outer; 255 regular_type_def no_pointer_regular = complex.outer;
227 return visitor_type{sink, context, c_type, false}(no_pointer_regular) 256 return visitor_type{sink, context, c_type, false}(no_pointer_regular)
228 && as_generator("<" << (type % ", ") << ">").generate(sink, complex.subtypes, *context); 257 && as_generator("<" << (type(false, false, true) % ", ") << ">").generate(sink, complex.subtypes, *context);
229 }; 258 };
230 259
231 if(eina::optional<bool> b = call_match 260 if(eina::optional<bool> b = call_match
@@ -250,7 +279,15 @@ struct marshall_type_visitor_generate
250 return *b; 279 return *b;
251 } 280 }
252 281
253 return visitor_generate<OutputIterator, Context>{sink, context, c_type, is_out, is_return, is_ptr}(complex); 282 return visitor_generate<OutputIterator, Context>{
283 sink
284 , context
285 , c_type
286 , is_out
287 , is_return
288 , is_ptr
289 , is_special_subtype
290 }(complex);
254 } 291 }
255}; 292};
256} } 293} }
diff --git a/src/bin/eolian_mono/eolian/mono/struct_definition.hh b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
index 204484c2b0..851b9c4025 100644
--- a/src/bin/eolian_mono/eolian/mono/struct_definition.hh
+++ b/src/bin/eolian_mono/eolian/mono/struct_definition.hh
@@ -88,7 +88,7 @@ struct to_internal_field_convert_generator
88 else if (regular && regular->base_type == "stringshare") 88 else if (regular && regular->base_type == "stringshare")
89 { 89 {
90 if (!as_generator( 90 if (!as_generator(
91 indent << scope_tab << scope_tab << "_internal_struct." << string << " = Eina.Stringshare.eina_stringshare_add(_external_struct." << string << ");\n") 91 indent << scope_tab << scope_tab << "_internal_struct." << string << " = Eina.MemoryNative.AddStringshare(_external_struct." << string << ");\n")
92 .generate(sink, std::make_tuple(field_name, field_name), context)) 92 .generate(sink, std::make_tuple(field_name, field_name), context))
93 return false; 93 return false;
94 } 94 }
diff --git a/src/bin/eolian_mono/eolian/mono/type.hh b/src/bin/eolian_mono/eolian/mono/type.hh
index f6a52853d0..cae2ad185f 100644
--- a/src/bin/eolian_mono/eolian/mono/type.hh
+++ b/src/bin/eolian_mono/eolian/mono/type.hh
@@ -14,29 +14,49 @@ struct visitor_generate;
14 14
15struct type_generator 15struct type_generator
16{ 16{
17 type_generator(bool is_return = false, bool is_optional = false) 17 type_generator(bool is_return = false, bool is_optional = false, bool is_special_subtype = false)
18 : is_return(is_return), is_optional(is_optional) {} 18 : is_return(is_return)
19 19 , is_optional(is_optional)
20 , is_special_subtype(is_special_subtype)
21 {}
22
20 template <typename OutputIterator, typename Context> 23 template <typename OutputIterator, typename Context>
21 bool generate(OutputIterator sink, attributes::type_def const& type, Context const& context) const 24 bool generate(OutputIterator sink, attributes::type_def const& type, Context const& context) const
22 { 25 {
23 return type.original_type.visit(visitor_generate<OutputIterator, Context>{sink, &context, type.c_type, false, is_return, type.is_ptr, is_optional}); 26 return type.original_type.visit(visitor_generate<OutputIterator, Context>{
27 sink
28 , &context
29 , type.c_type
30 , false
31 , is_return
32 , type.is_ptr
33 , is_optional
34 , is_special_subtype
35 });
24 } 36 }
25 template <typename OutputIterator, typename Context> 37 template <typename OutputIterator, typename Context>
26 bool generate(OutputIterator sink, attributes::parameter_def const& param, Context const& context) const 38 bool generate(OutputIterator sink, attributes::parameter_def const& param, Context const& context) const
27 { 39 {
28 return param.type.original_type.visit(visitor_generate<OutputIterator, Context>{sink, &context, param.type.c_type 40 return param.type.original_type.visit(visitor_generate<OutputIterator, Context>{
29 , param.direction != attributes::parameter_direction::in, false, param.type.is_ptr, is_optional}); 41 sink
42 , &context
43 , param.type.c_type
44 , param.direction != attributes::parameter_direction::in
45 , false
46 , param.type.is_ptr
47 , is_optional
48 , is_special_subtype
49 });
30 } 50 }
31 51
32 bool is_return, is_optional; 52 bool is_return, is_optional, is_special_subtype;
33}; 53};
34 54
35struct type_terminal 55struct type_terminal
36{ 56{
37 type_generator const operator()(bool is_return, bool is_optional = false) const 57 type_generator const operator()(bool is_return, bool is_optional = false, bool is_special_subtype = false) const
38 { 58 {
39 return type_generator(is_return, is_optional); 59 return type_generator(is_return, is_optional, is_special_subtype);
40 } 60 }
41} const type = {}; 61} const type = {};
42 62
diff --git a/src/bin/eolian_mono/eolian/mono/type_impl.hh b/src/bin/eolian_mono/eolian/mono/type_impl.hh
index 4b3f097dd4..8991247782 100644
--- a/src/bin/eolian_mono/eolian/mono/type_impl.hh
+++ b/src/bin/eolian_mono/eolian/mono/type_impl.hh
@@ -99,6 +99,7 @@ struct visitor_generate
99 bool is_return; 99 bool is_return;
100 bool is_ptr; 100 bool is_ptr;
101 mutable bool is_optional; 101 mutable bool is_optional;
102 bool is_special_subtype;
102 103
103 typedef visitor_generate<OutputIterator, Context> visitor_type; 104 typedef visitor_generate<OutputIterator, Context> visitor_type;
104 typedef bool result_type; 105 typedef bool result_type;
@@ -205,6 +206,8 @@ struct visitor_generate
205 { 206 {
206 regular_type_def r = regular; 207 regular_type_def r = regular;
207 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 208 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
209 if (is_special_subtype)
210 return replace_base_type(r, "Eina.Stringshare");
208 return replace_base_type(r, "System.String"); 211 return replace_base_type(r, "System.String");
209 }} 212 }}
210 , {"strbuf", nullptr, [&] 213 , {"strbuf", nullptr, [&]
@@ -400,7 +403,7 @@ struct visitor_generate
400 // if(is_out) 403 // if(is_out)
401 // pointers.push_back({{attributes::qualifier_info::is_none, {}}, true}); 404 // pointers.push_back({{attributes::qualifier_info::is_none, {}}, true});
402 return visitor_type{sink, context, c_type, false}(no_pointer_regular) 405 return visitor_type{sink, context, c_type, false}(no_pointer_regular)
403 && as_generator("<" << (type % ", ") << ">").generate(sink, complex.subtypes, *context) 406 && as_generator("<" << (type(false, false, true) % ", ") << ">").generate(sink, complex.subtypes, *context)
404 ; 407 ;
405 // && detail::generate_pointers(sink, pointers, *context, false); 408 // && detail::generate_pointers(sink, pointers, *context, false);
406 }; 409 };
diff --git a/src/bindings/mono/efl_mono/efl_csharp_application.cs b/src/bindings/mono/efl_mono/efl_csharp_application.cs
index ea29376c6c..4e3a2522cc 100644
--- a/src/bindings/mono/efl_mono/efl_csharp_application.cs
+++ b/src/bindings/mono/efl_mono/efl_csharp_application.cs
@@ -88,7 +88,7 @@ public abstract class Application
88 /// <summary> 88 /// <summary>
89 /// Called when the application is started. Arguments from the command line are passed here. 89 /// Called when the application is started. Arguments from the command line are passed here.
90 /// </summary> 90 /// </summary>
91 protected abstract void OnInitialize(Eina.Array<System.String> args); 91 protected abstract void OnInitialize(string[] args);
92 92
93 /// <summary> 93 /// <summary>
94 /// Arguments are passed here, Additional calls to this function may occure, 94 /// Arguments are passed here, Additional calls to this function may occure,
@@ -130,8 +130,8 @@ public abstract class Application
130 { 130 {
131 Init(components); 131 Init(components);
132 Efl.App app = Efl.App.AppMain; 132 Efl.App app = Efl.App.AppMain;
133 Eina.Array<String> command_line = new Eina.Array<String>(); 133 var command_line = new Eina.Array<Eina.Stringshare>();
134 command_line.Append(Environment.GetCommandLineArgs()); 134 command_line.Append(Array.ConvertAll(Environment.GetCommandLineArgs(), s => (Eina.Stringshare)s));
135#if EFL_BETA 135#if EFL_BETA
136 app.SetCommandArray(command_line); 136 app.SetCommandArray(command_line);
137#endif 137#endif
@@ -139,7 +139,15 @@ public abstract class Application
139 { 139 {
140 if (evt.arg.Initialization) 140 if (evt.arg.Initialization)
141 { 141 {
142 OnInitialize(evt.arg.Argv); 142 var evtArgv = evt.arg.Argv;
143 int n = evtArgv.Length;
144 var argv = new string[n];
145 for (int i = 0; i < n; ++i)
146 {
147 argv[i] = evtArgv[i];
148 }
149
150 OnInitialize(argv);
143 } 151 }
144 152
145 OnArguments(evt.arg); 153 OnArguments(evt.arg);
diff --git a/src/bindings/mono/eina_mono/eina_common.cs b/src/bindings/mono/eina_mono/eina_common.cs
index 199b92bc06..029b08e820 100644
--- a/src/bindings/mono/eina_mono/eina_common.cs
+++ b/src/bindings/mono/eina_mono/eina_common.cs
@@ -75,6 +75,30 @@ public static class MemoryNative
75 return NativeCustomExportFunctions.efl_mono_native_strdup(str); 75 return NativeCustomExportFunctions.efl_mono_native_strdup(str);
76 } 76 }
77 77
78 public static IntPtr AddStringshare(string str)
79 {
80 IntPtr nativeStr = StringConversion.ManagedStringToNativeUtf8Alloc(str);
81 try
82 {
83 var strShare = NativeMethods.eina_stringshare_add(nativeStr);
84 return strShare;
85 }
86 finally
87 {
88 Eina.MemoryNative.Free(nativeStr);
89 }
90 }
91
92 public static void DelStringshare(IntPtr str)
93 {
94 NativeMethods.eina_stringshare_del(str);
95 }
96
97 public static void DelStringshareRef(IntPtr ptr)
98 {
99 NativeMethods.efl_mono_native_stringshare_del_ref(ptr);
100 }
101
78 // IntPtr's for some native functions 102 // IntPtr's for some native functions
79 public static IntPtr PtrCompareFuncPtrGet() 103 public static IntPtr PtrCompareFuncPtrGet()
80 { 104 {
@@ -91,6 +115,11 @@ public static class MemoryNative
91 return NativeCustomExportFunctions.efl_mono_native_free_addr_get(); 115 return NativeCustomExportFunctions.efl_mono_native_free_addr_get();
92 } 116 }
93 117
118 public static IntPtr StringshareDelFuncPtrGet()
119 {
120 return NativeMethods.efl_mono_native_stringshare_del_addr_get();
121 }
122
94 public static IntPtr EflUnrefFuncPtrGet() 123 public static IntPtr EflUnrefFuncPtrGet()
95 { 124 {
96 return NativeCustomExportFunctions.efl_mono_native_efl_unref_addr_get(); 125 return NativeCustomExportFunctions.efl_mono_native_efl_unref_addr_get();
@@ -130,9 +159,17 @@ public static class StringConversion
130 159
131 byte[] strbuf = Encoding.UTF8.GetBytes(managedString); 160 byte[] strbuf = Encoding.UTF8.GetBytes(managedString);
132 IntPtr native = MemoryNative.Alloc(strbuf.Length + 1); 161 IntPtr native = MemoryNative.Alloc(strbuf.Length + 1);
133 Marshal.Copy(strbuf, 0, native, strbuf.Length); 162 try
134 Marshal.WriteByte(native + strbuf.Length, 0); // write the terminating null 163 {
135 return native; 164 Marshal.Copy(strbuf, 0, native, strbuf.Length);
165 Marshal.WriteByte(native + strbuf.Length, 0); // write the terminating null
166 return native;
167 }
168 catch(Exception e)
169 {
170 MemoryNative.Free(native);
171 throw e;
172 }
136 } 173 }
137 174
138 public static string NativeUtf8ToManagedString(IntPtr pNativeData) 175 public static string NativeUtf8ToManagedString(IntPtr pNativeData)
diff --git a/src/bindings/mono/eina_mono/eina_container_common.cs b/src/bindings/mono/eina_mono/eina_container_common.cs
index 7bc17d9215..603b0694ec 100644
--- a/src/bindings/mono/eina_mono/eina_container_common.cs
+++ b/src/bindings/mono/eina_mono/eina_container_common.cs
@@ -19,6 +19,7 @@ public enum ElementType
19{ 19{
20 NumericType, 20 NumericType,
21 StringType, 21 StringType,
22 StringshareType,
22 ObjectType 23 ObjectType
23}; 24};
24 25
@@ -195,6 +196,145 @@ public class StringElementTraits : IBaseElementTraits<string>
195 } 196 }
196} 197}
197 198
199public class StringshareElementTraits : IBaseElementTraits<Eina.Stringshare>
200{
201 public StringshareElementTraits()
202 {
203 }
204
205 public IntPtr ManagedToNativeAlloc(Eina.Stringshare man)
206 {
207 var strShare = MemoryNative.AddStringshare(man);
208 return strShare;
209 }
210
211 public IntPtr ManagedToNativeAllocInlistNode(Eina.Stringshare man)
212 {
213 var node = new InlistNode<IntPtr>();
214 node.Val = ManagedToNativeAlloc(man);
215 GCHandle pinnedData = GCHandle.Alloc(node, GCHandleType.Pinned);
216 IntPtr ptr = pinnedData.AddrOfPinnedObject();
217 IntPtr nat = MemoryNative.AllocCopy
218 (ptr, Marshal.SizeOf<InlistMem>() + Marshal.SizeOf<IntPtr>());
219 pinnedData.Free();
220 return nat;
221 }
222
223 public void ManagedToNativeCopyTo(Eina.Stringshare man, IntPtr mem)
224 {
225 IntPtr stringptr = ManagedToNativeAlloc(man);
226 Marshal.WriteIntPtr(mem, stringptr);
227 }
228
229 public void NativeFree(IntPtr nat)
230 {
231 if (nat != IntPtr.Zero)
232 {
233 MemoryNative.DelStringshare(nat);
234 }
235 }
236
237 public void NativeFreeInlistNodeElement(IntPtr nat)
238 {
239 if (nat == IntPtr.Zero)
240 {
241 return;
242 }
243
244 var val = Marshal.PtrToStructure<IntPtr>
245 (nat + Marshal.SizeOf<InlistMem>());
246 NativeFree(val);
247 }
248
249 public void NativeFreeInlistNode(IntPtr nat, bool freeElement)
250 {
251 if (nat == IntPtr.Zero)
252 {
253 return;
254 }
255
256 if (freeElement)
257 {
258 NativeFreeInlistNodeElement(nat);
259 }
260
261 MemoryNative.Free(nat);
262 }
263
264 public void NativeFreeInplace(IntPtr nat)
265 {
266 MemoryNative.DelStringshareRef(nat);
267 }
268
269 public void ResidueFreeInplace(IntPtr nat)
270 {
271 }
272
273 public Eina.Stringshare NativeToManaged(IntPtr nat)
274 {
275 if (nat == IntPtr.Zero)
276 {
277 return default(Eina.Stringshare);
278 }
279
280 return StringConversion.NativeUtf8ToManagedString(nat);
281 }
282
283 public Eina.Stringshare NativeToManagedInlistNode(IntPtr nat)
284 {
285 if (nat == IntPtr.Zero)
286 {
287 Eina.Log.Error("Null pointer for Inlist node.");
288 return default(Eina.Stringshare);
289 }
290
291 IntPtr ptr_location = nat + Marshal.SizeOf<InlistMem>();
292 return NativeToManaged(Marshal.ReadIntPtr(ptr_location));
293 }
294
295 // Strings inplaced are always a pointer, because they are variable-sized
296 public Eina.Stringshare NativeToManagedInplace(IntPtr nat)
297 {
298 if (nat == IntPtr.Zero)
299 {
300 return default(Eina.Stringshare);
301 }
302
303 nat = Marshal.ReadIntPtr(nat);
304 if (nat == IntPtr.Zero)
305 {
306 return default(Eina.Stringshare);
307 }
308
309 return NativeToManaged(nat);
310 }
311
312 public IntPtr EinaCompareCb()
313 {
314 return MemoryNative.StrCompareFuncPtrGet();
315 }
316
317 public IntPtr EinaFreeCb()
318 {
319 return MemoryNative.StringshareDelFuncPtrGet();
320 }
321
322 public IntPtr EinaHashNew()
323 {
324 return eina_hash_stringshared_new(MemoryNative.StringshareDelFuncPtrGet());
325 }
326
327 public IntPtr EinaInarrayNew(uint step)
328 {
329 return eina_inarray_new((uint)Marshal.SizeOf<IntPtr>(), step);
330 }
331
332 public IntPtr EinaHashIteratorKeyNew(IntPtr hash)
333 {
334 return eina_hash_iterator_key_new(hash);
335 }
336}
337
198public class EflObjectElementTraits<T> : IBaseElementTraits<T> 338public class EflObjectElementTraits<T> : IBaseElementTraits<T>
199{ 339{
200 public IntPtr ManagedToNativeAlloc(T man) 340 public IntPtr ManagedToNativeAlloc(T man)
@@ -709,6 +849,11 @@ public static class TraitFunctions
709 return type == typeof(string); 849 return type == typeof(string);
710 } 850 }
711 851
852 public static bool IsStringshare(System.Type type)
853 {
854 return type == typeof(Eina.Stringshare);
855 }
856
712 public static Eina.ElementType GetElementTypeCode(System.Type type) 857 public static Eina.ElementType GetElementTypeCode(System.Type type)
713 { 858 {
714 if (IsEflObject(type)) 859 if (IsEflObject(type))
@@ -719,6 +864,10 @@ public static class TraitFunctions
719 { 864 {
720 return ElementType.StringType; 865 return ElementType.StringType;
721 } 866 }
867 else if (IsStringshare(type))
868 {
869 return ElementType.StringshareType;
870 }
722 else 871 else
723 { 872 {
724 return ElementType.NumericType; 873 return ElementType.NumericType;
@@ -764,6 +913,10 @@ public static class TraitFunctions
764 { 913 {
765 traits = new StringElementTraits(); 914 traits = new StringElementTraits();
766 } 915 }
916 else if (IsStringshare(type))
917 {
918 traits = new StringshareElementTraits();
919 }
767 else if (type.IsValueType) 920 else if (type.IsValueType)
768 { 921 {
769 if (type == typeof(int)) 922 if (type == typeof(int))
diff --git a/src/bindings/mono/eina_mono/eina_hash.cs b/src/bindings/mono/eina_mono/eina_hash.cs
index 1617eba961..38522dc0e3 100644
--- a/src/bindings/mono/eina_mono/eina_hash.cs
+++ b/src/bindings/mono/eina_mono/eina_hash.cs
@@ -363,7 +363,9 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>, IDi
363 363
364 private static bool ForceRefKey<T>() 364 private static bool ForceRefKey<T>()
365 { 365 {
366 return (!typeof(T).IsValueType) && (typeof(T) != typeof(string)); 366 return (!typeof(T).IsValueType)
367 && (typeof(T) != typeof(string))
368 && (typeof(T) != typeof(Eina.Stringshare));
367 } 369 }
368 370
369 private static IntPtr CopyNativeObject<T>(T value, bool forceRef) 371 private static IntPtr CopyNativeObject<T>(T value, bool forceRef)
@@ -439,7 +441,7 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>, IDi
439 IntPtr old = eina_hash_set(Handle, nk, nv); 441 IntPtr old = eina_hash_set(Handle, nk, nv);
440 FreeNativeIndirection<TKey>(gchnk, ForceRefKey<TKey>()); 442 FreeNativeIndirection<TKey>(gchnk, ForceRefKey<TKey>());
441 FreeNativeIndirection<TValue>(gchnv, false); 443 FreeNativeIndirection<TValue>(gchnv, false);
442 if (OwnValue || old != IntPtr.Zero) 444 if (OwnValue && old != IntPtr.Zero)
443 { 445 {
444 NativeFree<TValue>(old); 446 NativeFree<TValue>(old);
445 } 447 }
diff --git a/src/bindings/mono/eina_mono/eina_stringshare.cs b/src/bindings/mono/eina_mono/eina_stringshare.cs
index 3b41bfbe3f..087db51bce 100644
--- a/src/bindings/mono/eina_mono/eina_stringshare.cs
+++ b/src/bindings/mono/eina_mono/eina_stringshare.cs
@@ -7,14 +7,224 @@ using System.Runtime.InteropServices;
7namespace Eina 7namespace Eina
8{ 8{
9 9
10public class Stringshare 10// TODO: move all native functions to a "NativeMethods" class
11public static partial class NativeMethods
11{ 12{
13 [DllImport(efl.Libs.Eina)] public static extern IntPtr
14 eina_stringshare_add(IntPtr str);
12 [DllImport(efl.Libs.Eina)] public static extern System.IntPtr 15 [DllImport(efl.Libs.Eina)] public static extern System.IntPtr
13 eina_stringshare_add_length(string str, System.UInt32 slen); 16 eina_stringshare_add_length(IntPtr str, UInt32 slen);
14 [DllImport(efl.Libs.Eina)] public static extern System.IntPtr
15 eina_stringshare_add(string str);
16 [DllImport(efl.Libs.Eina)] public static extern void 17 [DllImport(efl.Libs.Eina)] public static extern void
17 eina_stringshare_del(System.IntPtr str); 18 eina_stringshare_del(IntPtr str);
19 [DllImport(efl.Libs.CustomExports)] public static extern void
20 efl_mono_native_stringshare_del_ref(IntPtr str);
21 [DllImport(efl.Libs.CustomExports)] public static extern IntPtr
22 efl_mono_native_stringshare_del_addr_get();
23}
24
25/// <summary>
26/// Placeholder type to interact with the native type Eina_Stringshare, mainly for eina containers.
27/// </summary>
28/// <remarks>
29/// Using System.String and merely converting this type to it (by cast or implicitly)
30/// is recommended for simplicity and ease of use.
31///
32/// This type is just a System.String wrapper that works as a placeholder for
33/// instrumentalizing proper interaction with native EFL API that demands
34/// strings to be stringshares.
35///
36/// Both C strings and eina stringshares are bound as regular strings in EFL#,
37/// as working directly with these types would demand unnecessary hassle from
38/// the user viewpoint.
39/// But for eina containers this distinction is important, and since C# generics
40/// do not provide a convenient way of dealing with the same type requiring
41/// a different management based on some other condition (at least not without
42/// compromising the usability for other types), we use this string wrapper
43/// in order to signal this distinction.
44///
45/// Implements equality/inequality methods for easier comparison with strings and
46/// other Stringshare objects. For more specific operations convert to a string.
47/// </remarks>
48public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
49{
50 /// <sumary>
51 /// Main constructor. Wrap the given string.
52 /// Have private acess to avoid wrapping a null reference,
53 /// use convertion or the factory method to create a new instance.
54 /// <see cref="Stringshare.Create(string s)"/>
55 /// <see cref="Stringshare.operator Stringshare(string s)"/>
56 /// </sumary>
57 private Stringshare(string s)
58 {
59 Str = s;
60 }
61
62 /// <sumary>
63 /// Auto-implemented property that holds the wrapped string value.
64 /// </sumary>
65 public string Str { get; private set; }
66
67 /// <sumary>
68 /// Factory method to instantiate a new object.
69 /// Get a wrappper for the given string or a null reference if the given
70 /// string reference is also null.
71 /// <seealso cref="Stringshare.operator Stringshare(string s)"/>
72 /// </sumary>
73 /// <returns>
74 /// A new instance wrapping the given string, or a null reference if
75 /// the given string reference is also null.
76 /// </returns>
77 public static Stringshare Create(string s)
78 {
79 if (s == null)
80 {
81 return null;
82 }
83
84 return new Stringshare(s);
85 }
86
87 /// <sumary>
88 /// Implicit convertion to string.
89 /// </sumary>
90 public static implicit operator string(Stringshare ss)
91 {
92 if (ReferenceEquals(null, ss))
93 {
94 return null;
95 }
96
97 return ss.Str;
98 }
99
100 /// <sumary>
101 /// Implicit convertion from string to Stringshare.
102 /// </sumary>
103 /// <remarks>
104 /// Note that this method can be used to create an instance of this class,
105 /// either via an explicit cast or an implicit convertion.
106 /// <seealso cref="Stringshare.Create(string s)"/>
107 /// </remarks>
108 public static implicit operator Stringshare(string s)
109 {
110 if (ReferenceEquals(null, s))
111 {
112 return null;
113 }
114
115 return new Stringshare(s);
116 }
117
118 /// <sumary>
119 /// Check two Stringshare objects for equality.
120 /// </sumary>
121 /// <returns>
122 /// True if both wrapped strings have the same content or if both
123 /// references are null, false otherwise.
124 /// </returns>
125 public static bool operator==(Stringshare ss1, Stringshare ss2)
126 {
127 return ((string)ss1) == ((string)ss2);
128 }
129
130
131 /// <sumary>
132 /// Check two Stringshare objects for inequality.
133 /// </sumary>
134 /// <returns>
135 /// True if the wrapped strings have different content or if one reference is null
136 /// and the other is not, false otherwise.
137 /// </returns>
138 public static bool operator!=(Stringshare ss1, Stringshare ss2)
139 {
140 return !(ss1 == ss2);
141 }
142
143 /// <sumary>
144 /// Returns the wrapped string.
145 /// <seealso cref="Stringshare.Str"/>
146 /// <seealso cref="Stringshare.Get()"/>
147 /// </sumary>
148 /// <returns>The wrapped string. Same as the property Str.</returns>
149 public override string ToString()
150 {
151 return Str;
152 }
153
154 /// <sumary>
155 /// Override of GetHashCode for consistency with user-defined equality methods.
156 /// </sumary>
157 /// <returns>
158 /// The wrapped string hash code.
159 /// </returns>
160 public override int GetHashCode()
161 {
162 return Str.GetHashCode();
163 }
164
165 /// <sumary>
166 /// Check the given object for equality.
167 /// </sumary>
168 /// <returns>
169 /// True if the given object is the same object or if it is another Stringshare object
170 /// and both wrapped strings are equal or if it is a string object and its content
171 /// is the same of the wrapped string.
172 /// In any other case it returns false.
173 /// </returns>
174 public override bool Equals(object other)
175 {
176 if (ReferenceEquals(null, other))
177 {
178 return false;
179 }
180
181 if (ReferenceEquals(this, other))
182 {
183 return true;
184 }
185
186 if (other.GetType() == typeof(string))
187 {
188 return this.Str == (string)other;
189 }
190
191 return other.GetType() == typeof(Stringshare) && this == ((Stringshare)other);
192 }
193
194 /// <sumary>
195 /// Check the given Stringshare for equality.
196 /// </sumary>
197 /// <returns>
198 /// True if the given Stringshare object is not null and its wrapped string
199 /// have the same content of this.Str, false otherwise.
200 /// </returns>
201 public bool Equals(Stringshare other)
202 {
203 return this == other;
204 }
205
206 /// <sumary>
207 /// Check the given Stringshare for equality.
208 /// </sumary>
209 /// <returns>
210 /// True if the given string is not null and the wrapped string have the same
211 /// content of the given string, false otherwise.
212 /// </returns>
213 public bool Equals(string other)
214 {
215 return this.Str == other;
216 }
217
218 /// <sumary>
219 /// Get the wrapped string.
220 /// <seealso cref="Stringshare.Str"/>
221 /// <seealso cref="Stringshare.ToString()"/>
222 /// </sumary>
223 /// <returns>The wrapped string. Same as the property Str.</returns>
224 public string Get()
225 {
226 return Str;
227 }
18} 228}
19 229
20} 230}
diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs
index 966759b314..caf28a700f 100644
--- a/src/bindings/mono/eo_mono/iwrapper.cs
+++ b/src/bindings/mono/eo_mono/iwrapper.cs
@@ -494,7 +494,7 @@ public class Globals
494 { 494 {
495 foreach (IntPtr ptr in dict.Values) 495 foreach (IntPtr ptr in dict.Values)
496 { 496 {
497 Eina.Stringshare.eina_stringshare_del(ptr); 497 Eina.NativeMethods.eina_stringshare_del(ptr);
498 } 498 }
499 } 499 }
500 500
@@ -1148,13 +1148,13 @@ public class StringsharePassOwnershipMarshaler : ICustomMarshaler
1148 public object MarshalNativeToManaged(IntPtr pNativeData) 1148 public object MarshalNativeToManaged(IntPtr pNativeData)
1149 { 1149 {
1150 var ret = Eina.StringConversion.NativeUtf8ToManagedString(pNativeData); 1150 var ret = Eina.StringConversion.NativeUtf8ToManagedString(pNativeData);
1151 Eina.Stringshare.eina_stringshare_del(pNativeData); 1151 Eina.NativeMethods.eina_stringshare_del(pNativeData);
1152 return ret; 1152 return ret;
1153 } 1153 }
1154 1154
1155 public IntPtr MarshalManagedToNative(object managedObj) 1155 public IntPtr MarshalManagedToNative(object managedObj)
1156 { 1156 {
1157 return Eina.Stringshare.eina_stringshare_add((string)managedObj); 1157 return Eina.MemoryNative.AddStringshare((string)managedObj);
1158 } 1158 }
1159 1159
1160 public void CleanUpNativeData(IntPtr pNativeData) 1160 public void CleanUpNativeData(IntPtr pNativeData)
@@ -1193,7 +1193,7 @@ public class StringshareKeepOwnershipMarshaler : ICustomMarshaler
1193 1193
1194 public IntPtr MarshalManagedToNative(object managedObj) 1194 public IntPtr MarshalManagedToNative(object managedObj)
1195 { 1195 {
1196 return Eina.Stringshare.eina_stringshare_add((string)managedObj); 1196 return Eina.MemoryNative.AddStringshare((string)managedObj);
1197 } 1197 }
1198 1198
1199 public void CleanUpNativeData(IntPtr pNativeData) 1199 public void CleanUpNativeData(IntPtr pNativeData)
diff --git a/src/lib/efl_mono/efl_custom_exports_mono.c b/src/lib/efl_mono/efl_custom_exports_mono.c
index 8d57ad730f..aa2572f49d 100644
--- a/src/lib/efl_mono/efl_custom_exports_mono.c
+++ b/src/lib/efl_mono/efl_custom_exports_mono.c
@@ -125,6 +125,12 @@ EAPI void efl_mono_native_free_ref(void **ptr)
125 free(*ptr); 125 free(*ptr);
126} 126}
127 127
128EAPI void efl_mono_native_stringshare_del_ref(void **str)
129{
130 if (!str) return;
131 eina_stringshare_del(*str);
132}
133
128EAPI void *efl_mono_native_alloc_copy(const void *val, unsigned int size) 134EAPI void *efl_mono_native_alloc_copy(const void *val, unsigned int size)
129{ 135{
130 if (!val) return NULL; 136 if (!val) return NULL;
@@ -161,6 +167,11 @@ EAPI Eina_Free_Cb efl_mono_native_free_addr_get()
161 return (Eina_Free_Cb)free; 167 return (Eina_Free_Cb)free;
162} 168}
163 169
170EAPI Eina_Free_Cb efl_mono_native_stringshare_del_addr_get()
171{
172 return (Eina_Free_Cb)eina_stringshare_del;
173}
174
164EAPI Eina_Free_Cb efl_mono_native_efl_unref_addr_get() 175EAPI Eina_Free_Cb efl_mono_native_efl_unref_addr_get()
165{ 176{
166 return (Eina_Free_Cb)efl_mono_thread_safe_efl_unref; 177 return (Eina_Free_Cb)efl_mono_thread_safe_efl_unref;
diff --git a/src/tests/efl_mono/Eina.cs b/src/tests/efl_mono/Eina.cs
index c15e062002..90e8586d93 100644
--- a/src/tests/efl_mono/Eina.cs
+++ b/src/tests/efl_mono/Eina.cs
@@ -492,6 +492,14 @@ class TestEinaArray
492 Test.AssertEquals("test string §éΨبÿツ", a[0]); 492 Test.AssertEquals("test string §éΨبÿツ", a[0]);
493 } 493 }
494 494
495 public static void push_stringshare()
496 {
497 var a = new Eina.Array<Eina.Stringshare>();
498 Test.Assert(a.Handle != IntPtr.Zero);
499 Test.Assert(a.Push("test string §éΨبÿツ"));
500 Test.AssertEquals("test string §éΨبÿツ", a[0].Str);
501 }
502
495 public static void push_obj() 503 public static void push_obj()
496 { 504 {
497 var a = new Eina.Array<Dummy.Numberwrapper>(); 505 var a = new Eina.Array<Dummy.Numberwrapper>();
@@ -521,6 +529,15 @@ class TestEinaArray
521 Test.Assert(a.Count() == 0); 529 Test.Assert(a.Count() == 0);
522 } 530 }
523 531
532 public static void pop_stringshare()
533 {
534 var a = new Eina.Array<Eina.Stringshare>();
535 Test.Assert(a.Handle != IntPtr.Zero);
536 Test.Assert(a.Push("test string"));
537 Test.Assert(a.Pop() == "test string");
538 Test.Assert(a.Count() == 0);
539 }
540
524 public static void pop_obj() 541 public static void pop_obj()
525 { 542 {
526 var a = new Eina.Array<Dummy.Numberwrapper>(); 543 var a = new Eina.Array<Dummy.Numberwrapper>();
@@ -558,6 +575,18 @@ class TestEinaArray
558 Test.Assert(a[0] == "abc"); 575 Test.Assert(a[0] == "abc");
559 } 576 }
560 577
578 public static void data_set_stringshare()
579 {
580 var a = new Eina.Array<Eina.Stringshare>();
581 Test.Assert(a.Handle != IntPtr.Zero);
582 Test.Assert(a.Push("test string"));
583 Test.Assert(a[0] == "test string");
584 a.DataSet(0, "other string");
585 Test.Assert(a[0] == "other string");
586 a[0] = "abc";
587 Test.Assert(a[0] == "abc");
588 }
589
561 public static void data_set_obj() 590 public static void data_set_obj()
562 { 591 {
563 var a = new Eina.Array<Dummy.Numberwrapper>(); 592 var a = new Eina.Array<Dummy.Numberwrapper>();
@@ -617,6 +646,22 @@ class TestEinaArray
617 Test.Assert(a.Count() == 3); 646 Test.Assert(a.Count() == 3);
618 } 647 }
619 648
649 public static void count_stringshare()
650 {
651 var a = new Eina.Array<Eina.Stringshare>();
652 Test.Assert(a.Handle != IntPtr.Zero);
653 Test.Assert(a.Count() == 0);
654 Test.Assert(a.Push("a"));
655 Test.Assert(a[0] == "a");
656 Test.Assert(a.Count() == 1);
657 Test.Assert(a.Push("b"));
658 Test.Assert(a[1] == "b");
659 Test.Assert(a.Count() == 2);
660 Test.Assert(a.Push("c"));
661 Test.Assert(a[2] == "c");
662 Test.Assert(a.Count() == 3);
663 }
664
620 public static void count_obj() 665 public static void count_obj()
621 { 666 {
622 var a = new Eina.Array<Dummy.Numberwrapper>(); 667 var a = new Eina.Array<Dummy.Numberwrapper>();
@@ -678,6 +723,22 @@ class TestEinaArray
678 Test.Assert(a.Length == 3); 723 Test.Assert(a.Length == 3);
679 } 724 }
680 725
726 public static void length_stringshare()
727 {
728 var a = new Eina.Array<Eina.Stringshare>();
729 Test.Assert(a.Handle != IntPtr.Zero);
730 Test.Assert(a.Length == 0);
731 Test.Assert(a.Push("a"));
732 Test.Assert(a[0] == "a");
733 Test.Assert(a.Length == 1);
734 Test.Assert(a.Push("b"));
735 Test.Assert(a[1] == "b");
736 Test.Assert(a.Length == 2);
737 Test.Assert(a.Push("c"));
738 Test.Assert(a[2] == "c");
739 Test.Assert(a.Length == 3);
740 }
741
681 public static void eina_array_as_ienumerable_int() 742 public static void eina_array_as_ienumerable_int()
682 { 743 {
683 var a = new Eina.Array<int>(); 744 var a = new Eina.Array<int>();
@@ -710,6 +771,22 @@ class TestEinaArray
710 } 771 }
711 } 772 }
712 773
774 public static void eina_array_as_ienumerable_stringshare()
775 {
776 var a = new Eina.Array<Eina.Stringshare>();
777 Test.Assert(a.Handle != IntPtr.Zero);
778 Test.Assert(a.Push("X"));
779 Test.Assert(a.Push("XX"));
780 Test.Assert(a.Push("XXX"));
781
782 string cmp = "X";
783 foreach (string e in a)
784 {
785 Test.AssertEquals(cmp, e);
786 cmp = cmp + "X";
787 }
788 }
789
713 public static void eina_array_as_ienumerable_obj() 790 public static void eina_array_as_ienumerable_obj()
714 { 791 {
715 var a = new Dummy.Numberwrapper(); 792 var a = new Dummy.Numberwrapper();
@@ -888,6 +965,80 @@ class TestEinaArray
888 Test.Assert(arr.Handle == IntPtr.Zero); 965 Test.Assert(arr.Handle == IntPtr.Zero);
889 } 966 }
890 967
968 // Eina.Stringshare //
969 public static void test_eina_array_strshare_in()
970 {
971 var t = new Dummy.TestObject();
972 var arr = new Eina.Array<Eina.Stringshare>();
973 arr.Append(base_seq_strshare);
974 Test.Assert(t.EinaArrayStrshareIn(arr));
975 Test.Assert(arr.Own);
976 Test.Assert(arr.ToArray().SequenceEqual(modified_seq_strshare));
977 arr.Dispose();
978 Test.Assert(arr.Handle == IntPtr.Zero);
979 }
980
981 public static void test_eina_array_strshare_in_own()
982 {
983 var t = new Dummy.TestObject();
984 var arr = new Eina.Array<Eina.Stringshare>();
985 arr.Append(base_seq_strshare);
986 Test.Assert(t.EinaArrayStrshareInOwn(arr));
987 Test.Assert(!arr.Own);
988 Test.Assert(arr.ToArray().SequenceEqual(modified_seq_strshare));
989 arr.Dispose();
990 Test.Assert(arr.Handle == IntPtr.Zero);
991 Test.Assert(t.CheckEinaArrayStrshareInOwn());
992 }
993
994 public static void test_eina_array_strshare_out()
995 {
996 var t = new Dummy.TestObject();
997 Eina.Array<Eina.Stringshare> arr;
998 Test.Assert(t.EinaArrayStrshareOut(out arr));
999 Test.Assert(!arr.Own);
1000 Test.Assert(arr.ToArray().SequenceEqual(base_seq_strshare));
1001 Test.Assert(arr.Append(append_seq_strshare));
1002 arr.Dispose();
1003 Test.Assert(arr.Handle == IntPtr.Zero);
1004 Test.Assert(t.CheckEinaArrayStrshareOut());
1005 }
1006
1007 public static void test_eina_array_strshare_out_own()
1008 {
1009 var t = new Dummy.TestObject();
1010 Eina.Array<Eina.Stringshare> arr;
1011 Test.Assert(t.EinaArrayStrshareOutOwn(out arr));
1012 Test.Assert(arr.Own);
1013 Test.Assert(arr.ToArray().SequenceEqual(base_seq_strshare));
1014 Test.Assert(arr.Append(append_seq_strshare));
1015 arr.Dispose();
1016 Test.Assert(arr.Handle == IntPtr.Zero);
1017 }
1018
1019 public static void test_eina_array_strshare_return()
1020 {
1021 var t = new Dummy.TestObject();
1022 var arr = t.EinaArrayStrshareReturn();
1023 Test.Assert(!arr.Own);
1024 Test.Assert(arr.ToArray().SequenceEqual(base_seq_strshare));
1025 Test.Assert(arr.Append(append_seq_strshare));
1026 arr.Dispose();
1027 Test.Assert(arr.Handle == IntPtr.Zero);
1028 Test.Assert(t.CheckEinaArrayStrshareReturn());
1029 }
1030
1031 public static void test_eina_array_strshare_return_own()
1032 {
1033 var t = new Dummy.TestObject();
1034 var arr = t.EinaArrayStrshareReturnOwn();
1035 Test.Assert(arr.Own);
1036 Test.Assert(arr.ToArray().SequenceEqual(base_seq_strshare));
1037 Test.Assert(arr.Append(append_seq_strshare));
1038 arr.Dispose();
1039 Test.Assert(arr.Handle == IntPtr.Zero);
1040 }
1041
891 // Object // 1042 // Object //
892 1043
893 public static void test_eina_array_obj_in() 1044 public static void test_eina_array_obj_in()
@@ -1315,6 +1466,17 @@ class TestEinaList
1315 Test.Assert(lst[0] == "abc"); 1466 Test.Assert(lst[0] == "abc");
1316 } 1467 }
1317 1468
1469 public static void data_set_stringshare()
1470 {
1471 var lst = new Eina.List<Eina.Stringshare>();
1472 lst.Append("test string");
1473 Test.Assert(lst[0] == "test string");
1474 lst.DataSet(0, "other string");
1475 Test.Assert(lst[0] == "other string");
1476 lst[0] = "abc";
1477 Test.Assert(lst[0] == "abc");
1478 }
1479
1318 public static void data_set_obj() 1480 public static void data_set_obj()
1319 { 1481 {
1320 var lst = new Eina.List<Dummy.Numberwrapper>(); 1482 var lst = new Eina.List<Dummy.Numberwrapper>();
@@ -1371,6 +1533,21 @@ class TestEinaList
1371 Test.Assert(lst.Count() == 3); 1533 Test.Assert(lst.Count() == 3);
1372 } 1534 }
1373 1535
1536 public static void append_count_stringshare()
1537 {
1538 var lst = new Eina.List<Eina.Stringshare>();
1539 Test.Assert(lst.Count() == 0);
1540 lst.Append("a");
1541 Test.Assert(lst[0] == "a");
1542 Test.Assert(lst.Count() == 1);
1543 lst.Append("b");
1544 Test.Assert(lst[1] == "b");
1545 Test.Assert(lst.Count() == 2);
1546 lst.Append("c");
1547 Test.Assert(lst[2] == "c");
1548 Test.Assert(lst.Count() == 3);
1549 }
1550
1374 public static void append_count_obj() 1551 public static void append_count_obj()
1375 { 1552 {
1376 var lst = new Eina.List<Dummy.Numberwrapper>(); 1553 var lst = new Eina.List<Dummy.Numberwrapper>();
@@ -1429,6 +1606,21 @@ class TestEinaList
1429 Test.Assert(lst.Length == 3); 1606 Test.Assert(lst.Length == 3);
1430 } 1607 }
1431 1608
1609 public static void length_stringshare()
1610 {
1611 var lst = new Eina.List<Eina.Stringshare>();
1612 Test.Assert(lst.Length == 0);
1613 lst.Append("a");
1614 Test.Assert(lst[0] == "a");
1615 Test.Assert(lst.Length == 1);
1616 lst.Append("b");
1617 Test.Assert(lst[1] == "b");
1618 Test.Assert(lst.Length == 2);
1619 lst.Append("c");
1620 Test.Assert(lst[2] == "c");
1621 Test.Assert(lst.Length == 3);
1622 }
1623
1432 public static void prepend_count_int() 1624 public static void prepend_count_int()
1433 { 1625 {
1434 var lst = new Eina.List<int>(); 1626 var lst = new Eina.List<int>();
@@ -1459,6 +1651,21 @@ class TestEinaList
1459 Test.Assert(lst.Count() == 3); 1651 Test.Assert(lst.Count() == 3);
1460 } 1652 }
1461 1653
1654 public static void prepend_count_stringshare()
1655 {
1656 var lst = new Eina.List<Eina.Stringshare>();
1657 Test.Assert(lst.Count() == 0);
1658 lst.Prepend("a");
1659 Test.Assert(lst[0] == "a");
1660 Test.Assert(lst.Count() == 1);
1661 lst.Prepend("b");
1662 Test.Assert(lst[0] == "b");
1663 Test.Assert(lst.Count() == 2);
1664 lst.Prepend("c");
1665 Test.Assert(lst[0] == "c");
1666 Test.Assert(lst.Count() == 3);
1667 }
1668
1462 public static void prepend_count_obj() 1669 public static void prepend_count_obj()
1463 { 1670 {
1464 var lst = new Eina.List<Dummy.Numberwrapper>(); 1671 var lst = new Eina.List<Dummy.Numberwrapper>();
@@ -1511,6 +1718,18 @@ class TestEinaList
1511 1718
1512 } 1719 }
1513 1720
1721 public static void sorted_insert_stringshare()
1722 {
1723 var lst = new Eina.List<Eina.Stringshare>();
1724 lst.SortedInsert("c");
1725 Test.Assert(lst.ToArray().SequenceEqual(new Eina.Stringshare[]{"c"}));
1726 lst.SortedInsert("a");
1727 Test.Assert(lst.ToArray().SequenceEqual(new Eina.Stringshare[]{"a","c"}));
1728 lst.SortedInsert("b");
1729 Test.Assert(lst.ToArray().SequenceEqual(new Eina.Stringshare[]{"a","b","c"}));
1730
1731 }
1732
1514 public static void sort_int() 1733 public static void sort_int()
1515 { 1734 {
1516 var lst = new Eina.List<int>(); 1735 var lst = new Eina.List<int>();
@@ -1536,6 +1755,18 @@ class TestEinaList
1536 Test.Assert(lst.ToArray().SequenceEqual(new string[]{"a","b","c","d"})); 1755 Test.Assert(lst.ToArray().SequenceEqual(new string[]{"a","b","c","d"}));
1537 } 1756 }
1538 1757
1758 public static void sort_stringshare()
1759 {
1760 var lst = new Eina.List<Eina.Stringshare>();
1761 lst.Append("d");
1762 lst.Append("b");
1763 lst.Append("a");
1764 lst.Append("c");
1765 Test.Assert(lst.ToArray().SequenceEqual(new Eina.Stringshare[]{"d","b","a","c"}));
1766 lst.Sort();
1767 Test.Assert(lst.ToArray().SequenceEqual(new Eina.Stringshare[]{"a","b","c","d"}));
1768 }
1769
1539 public static void reverse_int() 1770 public static void reverse_int()
1540 { 1771 {
1541 var lst = new Eina.List<int>(); 1772 var lst = new Eina.List<int>();
@@ -1559,6 +1790,17 @@ class TestEinaList
1559 Test.Assert(lst.ToArray().SequenceEqual(new string[]{"c","b","a"})); 1790 Test.Assert(lst.ToArray().SequenceEqual(new string[]{"c","b","a"}));
1560 } 1791 }
1561 1792
1793 public static void reverse_stringshare()
1794 {
1795 var lst = new Eina.List<Eina.Stringshare>();
1796 lst.Append("a");
1797 lst.Append("b");
1798 lst.Append("c");
1799 Test.Assert(lst.ToArray().SequenceEqual(new Eina.Stringshare[]{"a","b","c"}));
1800 lst.Reverse();
1801 Test.Assert(lst.ToArray().SequenceEqual(new Eina.Stringshare[]{"c","b","a"}));
1802 }
1803
1562 public static void eina_list_as_ienumerable_int() 1804 public static void eina_list_as_ienumerable_int()
1563 { 1805 {
1564 var lst = new Eina.List<int>(); 1806 var lst = new Eina.List<int>();
@@ -1589,6 +1831,21 @@ class TestEinaList
1589 } 1831 }
1590 } 1832 }
1591 1833
1834 public static void eina_list_as_ienumerable_stringshare()
1835 {
1836 var lst = new Eina.List<Eina.Stringshare>();
1837 lst.Append("X");
1838 lst.Append("XX");
1839 lst.Append("XXX");
1840
1841 string cmp = "X";
1842 foreach (string e in lst)
1843 {
1844 Test.AssertEquals(cmp, e);
1845 cmp = cmp + "X";
1846 }
1847 }
1848
1592 public static void eina_list_as_ienumerable_obj() 1849 public static void eina_list_as_ienumerable_obj()
1593 { 1850 {
1594 var a = new Dummy.Numberwrapper(); 1851 var a = new Dummy.Numberwrapper();
@@ -1760,6 +2017,77 @@ class TestEinaList
1760 Test.Assert(lst.Handle == IntPtr.Zero); 2017 Test.Assert(lst.Handle == IntPtr.Zero);
1761 } 2018 }
1762 2019
2020 // Eina.Stringshare //
2021 public static void test_eina_list_strshare_in()
2022 {
2023 var t = new Dummy.TestObject();
2024 var lst = new Eina.List<Eina.Stringshare>();
2025 lst.AppendArray(base_seq_strshare);
2026 Test.Assert(t.EinaListStrshareIn(lst));
2027 Test.Assert(lst.Own);
2028 Test.Assert(lst.ToArray().SequenceEqual(base_seq_strshare));
2029 lst.Dispose();
2030 Test.Assert(lst.Handle == IntPtr.Zero);
2031 }
2032
2033 public static void test_eina_list_strshare_in_own()
2034 {
2035 var t = new Dummy.TestObject();
2036 var lst = new Eina.List<Eina.Stringshare>();
2037 lst.AppendArray(base_seq_strshare);
2038 Test.Assert(t.EinaListStrshareInOwn(lst));
2039 Test.Assert(!lst.Own);
2040 lst.Dispose();
2041 Test.Assert(lst.Handle == IntPtr.Zero);
2042 Test.Assert(t.CheckEinaListStrshareInOwn());
2043 }
2044
2045 public static void test_eina_list_strshare_out()
2046 {
2047 var t = new Dummy.TestObject();
2048 Eina.List<Eina.Stringshare> lst;
2049 Test.Assert(t.EinaListStrshareOut(out lst));
2050 Test.Assert(!lst.Own);
2051 Test.Assert(lst.ToArray().SequenceEqual(base_seq_strshare));
2052 lst.Dispose();
2053 Test.Assert(lst.Handle == IntPtr.Zero);
2054 Test.Assert(t.CheckEinaListStrshareOut());
2055 }
2056
2057 public static void test_eina_list_strshare_out_own()
2058 {
2059 var t = new Dummy.TestObject();
2060 Eina.List<Eina.Stringshare> lst;
2061 Test.Assert(t.EinaListStrshareOutOwn(out lst));
2062 Test.Assert(lst.Own);
2063 Test.Assert(lst.ToArray().SequenceEqual(base_seq_strshare));
2064 lst.AppendArray(append_seq_strshare);
2065 lst.Dispose();
2066 Test.Assert(lst.Handle == IntPtr.Zero);
2067 }
2068
2069 public static void test_eina_list_strshare_return()
2070 {
2071 var t = new Dummy.TestObject();
2072 var lst = t.EinaListStrshareReturn();
2073 Test.Assert(!lst.Own);
2074 Test.Assert(lst.ToArray().SequenceEqual(base_seq_strshare));
2075 lst.Dispose();
2076 Test.Assert(lst.Handle == IntPtr.Zero);
2077 Test.Assert(t.CheckEinaListStrshareReturn());
2078 }
2079
2080 public static void test_eina_list_strshare_return_own()
2081 {
2082 var t = new Dummy.TestObject();
2083 var lst = t.EinaListStrshareReturnOwn();
2084 Test.Assert(lst.Own);
2085 Test.Assert(lst.ToArray().SequenceEqual(base_seq_strshare));
2086 lst.AppendArray(append_seq_strshare);
2087 lst.Dispose();
2088 Test.Assert(lst.Handle == IntPtr.Zero);
2089 }
2090
1763 // Object // 2091 // Object //
1764 2092
1765 public static void test_eina_list_obj_in() 2093 public static void test_eina_list_obj_in()
@@ -2149,6 +2477,26 @@ class TestEinaHash
2149 hsh.Dispose(); 2477 hsh.Dispose();
2150 } 2478 }
2151 2479
2480 public static void data_set_strshare()
2481 {
2482 var hsh = new Eina.Hash<Eina.Stringshare, Eina.Stringshare>();
2483 Test.Assert(hsh.Count == 0);
2484
2485 hsh["aa"] = "aaa";
2486 Test.Assert(hsh["aa"] == "aaa");
2487 Test.Assert(hsh.Count == 1);
2488
2489 hsh["bb"] = "bbb";
2490 Test.Assert(hsh["bb"] == "bbb");
2491 Test.Assert(hsh.Count == 2);
2492
2493 hsh["cc"] = "ccc";
2494 Test.Assert(hsh["cc"] == "ccc");
2495 Test.Assert(hsh.Count == 3);
2496
2497 hsh.Dispose();
2498 }
2499
2152 public static void data_set_obj() 2500 public static void data_set_obj()
2153 { 2501 {
2154 var hsh = new Eina.Hash<Dummy.Numberwrapper, Dummy.Numberwrapper>(); 2502 var hsh = new Eina.Hash<Dummy.Numberwrapper, Dummy.Numberwrapper>();
@@ -2236,6 +2584,34 @@ class TestEinaHash
2236 hsh.Dispose(); 2584 hsh.Dispose();
2237 } 2585 }
2238 2586
2587 public static void eina_hash_as_ienumerable_strshare()
2588 {
2589 var hsh = new Eina.Hash<Eina.Stringshare, Eina.Stringshare>();
2590 var dct = new Dictionary<Eina.Stringshare, Eina.Stringshare>();
2591
2592 hsh["aa"] = "aaa";
2593 hsh["bb"] = "bbb";
2594 hsh["cc"] = "ccc";
2595
2596 dct["aa"] = "aaa";
2597 dct["bb"] = "bbb";
2598 dct["cc"] = "ccc";
2599
2600 int count = 0;
2601
2602 foreach (KeyValuePair<Eina.Stringshare, Eina.Stringshare> kvp in hsh)
2603 {
2604 Test.Assert(dct[kvp.Key] == kvp.Value);
2605 dct.Remove(kvp.Key);
2606 ++count;
2607 }
2608
2609 Test.AssertEquals(count, 3);
2610 Test.AssertEquals(dct.Count, 0);
2611
2612 hsh.Dispose();
2613 }
2614
2239 public static void eina_hash_as_ienumerable_obj() 2615 public static void eina_hash_as_ienumerable_obj()
2240 { 2616 {
2241 var hsh = new Eina.Hash<Dummy.Numberwrapper, Dummy.Numberwrapper>(); 2617 var hsh = new Eina.Hash<Dummy.Numberwrapper, Dummy.Numberwrapper>();
@@ -2444,6 +2820,90 @@ class TestEinaHash
2444 Test.Assert(t.CheckEinaHashStrReturnOwn()); 2820 Test.Assert(t.CheckEinaHashStrReturnOwn());
2445 } 2821 }
2446 2822
2823 // Eina.Stringshare //
2824
2825 /*public static void test_eina_hash_strshare_in()
2826 {
2827 var t = new Dummy.TestObject();
2828 var hsh = new Eina.Hash<Eina.Stringshare, Eina.Stringshare>();
2829 hsh["aa"] = "aaa";
2830 Test.Assert(t.EinaHashStrshareIn(hsh));
2831 Test.Assert(hsh.Own);
2832 Test.Assert(hsh["aa"] == "aaa");
2833 Test.Assert(hsh["bb"] == "bbb");
2834 hsh.Dispose();
2835 Test.Assert(hsh.Handle == IntPtr.Zero);
2836 }
2837
2838 public static void test_eina_hash_strshare_in_own()
2839 {
2840 var t = new Dummy.TestObject();
2841 var hsh = new Eina.Hash<Eina.Stringshare, Eina.Stringshare>();
2842 hsh["aa"] = "aaa";
2843 Test.Assert(t.EinaHashStrshareInOwn(hsh));
2844 Test.Assert(!hsh.Own);
2845 Test.Assert(hsh["aa"] == "aaa");
2846 Test.Assert(hsh["bb"] == "bbb");
2847 hsh["cc"] = "ccc";
2848 hsh.Dispose();
2849 Test.Assert(hsh.Handle == IntPtr.Zero);
2850 Test.Assert(t.CheckEinaHashStrshareInOwn());
2851 }
2852
2853 public static void test_eina_hash_strshare_out()
2854 {
2855 var t = new Dummy.TestObject();
2856 Eina.Hash<string,string> hsh;
2857 Test.Assert(t.EinaHashStrshareOut(out hsh));
2858 Test.Assert(!hsh.Own);
2859 Test.Assert(hsh["aa"] == "aaa");
2860 hsh["bb"] = "bbb";
2861 Test.Assert(hsh["bb"] == "bbb");
2862 hsh.Dispose();
2863 Test.Assert(hsh.Handle == IntPtr.Zero);
2864 Test.Assert(t.CheckEinaHashStrshareOut());
2865 }
2866
2867 public static void test_eina_hash_strshare_out_own()
2868 {
2869 var t = new Dummy.TestObject();
2870 Eina.Hash<string,string> hsh;
2871 Test.Assert(t.EinaHashStrshareOutOwn(out hsh));
2872 Test.Assert(hsh.Own);
2873 Test.Assert(hsh["aa"] == "aaa");
2874 hsh["bb"] = "bbb";
2875 Test.Assert(hsh["bb"] == "bbb");
2876 hsh.Dispose();
2877 Test.Assert(hsh.Handle == IntPtr.Zero);
2878 Test.Assert(t.CheckEinaHashStrshareOutOwn());
2879 }
2880
2881 public static void test_eina_hash_strshare_return()
2882 {
2883 var t = new Dummy.TestObject();
2884 var hsh = t.EinaHashStrshareReturn();
2885 Test.Assert(!hsh.Own);
2886 Test.Assert(hsh["aa"] == "aaa");
2887 hsh["bb"] = "bbb";
2888 Test.Assert(hsh["bb"] == "bbb");
2889 hsh.Dispose();
2890 Test.Assert(hsh.Handle == IntPtr.Zero);
2891 Test.Assert(t.CheckEinaHashStrshareReturn());
2892 }
2893
2894 public static void test_eina_hash_strshare_return_own()
2895 {
2896 var t = new Dummy.TestObject();
2897 var hsh = t.EinaHashStrshareReturnOwn();
2898 Test.Assert(hsh.Own);
2899 Test.Assert(hsh["aa"] == "aaa");
2900 hsh["bb"] = "bbb";
2901 Test.Assert(hsh["bb"] == "bbb");
2902 hsh.Dispose();
2903 Test.Assert(hsh.Handle == IntPtr.Zero);
2904 Test.Assert(t.CheckEinaHashStrshareReturnOwn());
2905 }*/
2906
2447 // Object // 2907 // Object //
2448 2908
2449 public static void test_eina_hash_obj_in() 2909 public static void test_eina_hash_obj_in()
@@ -2643,6 +3103,38 @@ class TestEinaIterator
2643 arr.Dispose(); 3103 arr.Dispose();
2644 } 3104 }
2645 3105
3106 public static void eina_array_strshare_empty_iterator()
3107 {
3108 var arr = new Eina.Array<Eina.Stringshare>();
3109 var itr = arr.GetIterator();
3110 int idx = 0;
3111 foreach (string e in itr)
3112 {
3113 ++idx;
3114 }
3115 Test.AssertEquals(idx, 0);
3116
3117 itr.Dispose();
3118 arr.Dispose();
3119 }
3120
3121 public static void eina_array_strshare_filled_iterator()
3122 {
3123 var arr = new Eina.Array<Eina.Stringshare>();
3124 arr.Append(base_seq_strshare);
3125 var itr = arr.GetIterator();
3126 int idx = 0;
3127 foreach (string e in itr)
3128 {
3129 Test.Assert(e == base_seq_strshare[idx]);
3130 ++idx;
3131 }
3132 Test.AssertEquals(idx, base_seq_strshare.Length);
3133
3134 itr.Dispose();
3135 arr.Dispose();
3136 }
3137
2646 public static void eina_array_obj_empty_iterator() 3138 public static void eina_array_obj_empty_iterator()
2647 { 3139 {
2648 var arr = new Eina.Array<Dummy.Numberwrapper>(); 3140 var arr = new Eina.Array<Dummy.Numberwrapper>();
@@ -2777,6 +3269,38 @@ class TestEinaIterator
2777 lst.Dispose(); 3269 lst.Dispose();
2778 } 3270 }
2779 3271
3272 public static void eina_list_strshare_empty_iterator()
3273 {
3274 var lst = new Eina.List<Eina.Stringshare>();
3275 var itr = lst.GetIterator();
3276 int idx = 0;
3277 foreach (string e in itr)
3278 {
3279 ++idx;
3280 }
3281 Test.AssertEquals(idx, 0);
3282
3283 itr.Dispose();
3284 lst.Dispose();
3285 }
3286
3287 public static void eina_list_strshare_filled_iterator()
3288 {
3289 var lst = new Eina.List<Eina.Stringshare>();
3290 lst.AppendArray(base_seq_strshare);
3291 var itr = lst.GetIterator();
3292 int idx = 0;
3293 foreach (string e in itr)
3294 {
3295 Test.Assert(e == base_seq_strshare[idx]);
3296 ++idx;
3297 }
3298 Test.AssertEquals(idx, base_seq_strshare.Length);
3299
3300 itr.Dispose();
3301 lst.Dispose();
3302 }
3303
2780 public static void eina_list_obj_empty_iterator() 3304 public static void eina_list_obj_empty_iterator()
2781 { 3305 {
2782 var lst = new Eina.List<Dummy.Numberwrapper>(); 3306 var lst = new Eina.List<Dummy.Numberwrapper>();
@@ -3015,6 +3539,92 @@ class TestEinaIterator
3015 hsh.Dispose(); 3539 hsh.Dispose();
3016 } 3540 }
3017 3541
3542/*
3543 public static void eina_hash_keys_strshare_empty_iterator()
3544 {
3545 var hsh = new Eina.Hash<Eina.Stringshare, Eina.Stringshare>();
3546 var itr = hsh.Keys();
3547 bool entered = false;
3548 foreach (string e in itr)
3549 {
3550 entered = true;
3551 }
3552 Test.Assert(!entered);
3553
3554 itr.Dispose();
3555 hsh.Dispose();
3556 }
3557
3558 public static void eina_hash_values_strshare_empty_iterator()
3559 {
3560 var hsh = new Eina.Hash<Eina.Stringshare, Eina.Stringshare>();
3561 var itr = hsh.Values();
3562 bool entered = false;
3563 foreach (string e in itr)
3564 {
3565 entered = true;
3566 }
3567 Test.Assert(!entered);
3568
3569 itr.Dispose();
3570 hsh.Dispose();
3571 }
3572
3573 public static void eina_hash_keys_strshare_filled_iterator()
3574 {
3575 var hsh = new Eina.Hash<Eina.Stringshare, Eina.Stringshare>();
3576 var dct = new Dictionary<Eina.Stringshare, bool>();
3577 hsh["aa"] = "aaa";
3578 hsh["bb"] = "bbb";
3579 hsh["cc"] = "ccc";
3580 dct["aa"] = true;
3581 dct["bb"] = true;
3582 dct["cc"] = true;
3583
3584 var itr = hsh.Keys();
3585
3586 int idx = 0;
3587 foreach (string e in itr)
3588 {
3589 Test.Assert(dct[e]);
3590 dct.Remove(e);
3591 ++idx;
3592 }
3593 Test.AssertEquals(dct.Count, 0);
3594 Test.AssertEquals(idx, 3);
3595
3596 itr.Dispose();
3597 hsh.Dispose();
3598 }
3599
3600 public static void eina_hash_values_strshare_filled_iterator()
3601 {
3602 var hsh = new Eina.Hash<Eina.Stringshare, Eina.Stringshare>();
3603 var dct = new Dictionary<Eina.Stringshare, bool>();
3604 hsh["aa"] = "aaa";
3605 hsh["bb"] = "bbb";
3606 hsh["cc"] = "ccc";
3607 dct["aaa"] = true;
3608 dct["bbb"] = true;
3609 dct["ccc"] = true;
3610
3611 var itr = hsh.Values();
3612
3613 int idx = 0;
3614 foreach (string e in itr)
3615 {
3616 Test.Assert(dct[e]);
3617 dct.Remove(e);
3618 ++idx;
3619 }
3620 Test.AssertEquals(dct.Count, 0);
3621 Test.AssertEquals(idx, 3);
3622
3623 itr.Dispose();
3624 hsh.Dispose();
3625 }
3626*/
3627
3018 public static void eina_hash_keys_obj_empty_iterator() 3628 public static void eina_hash_keys_obj_empty_iterator()
3019 { 3629 {
3020 var hsh = new Eina.Hash<Dummy.Numberwrapper, Dummy.Numberwrapper>(); 3630 var hsh = new Eina.Hash<Dummy.Numberwrapper, Dummy.Numberwrapper>();
@@ -3377,6 +3987,134 @@ class TestEinaIterator
3377 itr.Dispose(); 3987 itr.Dispose();
3378 } 3988 }
3379 3989
3990 // Eina.Stringshare //
3991
3992 public static void test_eina_iterator_strshare_in()
3993 {
3994 var t = new Dummy.TestObject();
3995 var arr = new Eina.Array<Eina.Stringshare>();
3996 arr.Append(base_seq_strshare);
3997 var itr = arr.GetIterator();
3998
3999 Test.Assert(itr.Own);
4000 Test.Assert(arr.Own);
4001 Test.Assert(arr.OwnContent);
4002
4003 Test.Assert(t.EinaIteratorStrshareIn(itr));
4004
4005 Test.Assert(itr.Own);
4006 Test.Assert(arr.Own);
4007 Test.Assert(arr.OwnContent);
4008
4009 itr.Dispose();
4010 arr.Dispose();
4011 }
4012
4013 public static void test_eina_iterator_strshare_in_own()
4014 {
4015 var t = new Dummy.TestObject();
4016 var arr = new Eina.Array<Eina.Stringshare>();
4017 arr.Append(base_seq_strshare);
4018 var itr = arr.GetIterator();
4019
4020 Test.Assert(itr.Own);
4021 Test.Assert(arr.Own);
4022 Test.Assert(arr.OwnContent);
4023
4024 Test.Assert(t.EinaIteratorStrshareInOwn(itr));
4025
4026 Test.Assert(!itr.Own);
4027 Test.Assert(arr.Own);
4028 Test.Assert(arr.OwnContent);
4029
4030 itr.Dispose();
4031 arr.Dispose();
4032
4033 Test.Assert(t.CheckEinaIteratorStrshareInOwn());
4034 }
4035
4036 public static void test_eina_iterator_strshare_out()
4037 {
4038 var t = new Dummy.TestObject();
4039 Eina.Iterator<Eina.Stringshare> itr;
4040
4041 Test.Assert(t.EinaIteratorStrshareOut(out itr));
4042
4043 Test.Assert(!itr.Own);
4044
4045 int idx = 0;
4046 foreach (Eina.Stringshare e in itr)
4047 {
4048 Test.AssertEquals(e, base_seq_strshare[idx]);
4049 ++idx;
4050 }
4051 Test.AssertEquals(idx, base_seq_strshare.Length);
4052
4053 itr.Dispose();
4054
4055 Test.Assert(t.CheckEinaIteratorStrshareOut());
4056 }
4057
4058 public static void test_eina_iterator_strshare_out_own()
4059 {
4060 var t = new Dummy.TestObject();
4061 Eina.Iterator<Eina.Stringshare> itr;
4062
4063 Test.Assert(t.EinaIteratorStrshareOutOwn(out itr));
4064
4065 Test.Assert(itr.Own);
4066
4067 int idx = 0;
4068 foreach (Eina.Stringshare e in itr)
4069 {
4070 Test.AssertEquals(e, base_seq_strshare[idx]);
4071 ++idx;
4072 }
4073 Test.AssertEquals(idx, base_seq_strshare.Length);
4074
4075 itr.Dispose();
4076 }
4077
4078 public static void test_eina_iterator_strshare_return()
4079 {
4080 var t = new Dummy.TestObject();
4081
4082 var itr = t.EinaIteratorStrshareReturn();
4083
4084 Test.Assert(!itr.Own);
4085
4086 int idx = 0;
4087 foreach (Eina.Stringshare e in itr)
4088 {
4089 Test.AssertEquals(e, base_seq_strshare[idx]);
4090 ++idx;
4091 }
4092 Test.AssertEquals(idx, base_seq_strshare.Length);
4093
4094 itr.Dispose();
4095
4096 Test.Assert(t.CheckEinaIteratorStrshareReturn());
4097 }
4098
4099 public static void test_eina_iterator_strshare_return_own()
4100 {
4101 var t = new Dummy.TestObject();
4102
4103 var itr = t.EinaIteratorStrshareReturnOwn();
4104
4105 Test.Assert(itr.Own);
4106
4107 int idx = 0;
4108 foreach (Eina.Stringshare e in itr)
4109 {
4110 Test.AssertEquals(e, base_seq_strshare[idx]);
4111 ++idx;
4112 }
4113 Test.AssertEquals(idx, base_seq_strshare.Length);
4114
4115 itr.Dispose();
4116 }
4117
3380 // Object // 4118 // Object //
3381 4119
3382 public static void test_eina_iterator_obj_in() 4120 public static void test_eina_iterator_obj_in()
diff --git a/src/tests/efl_mono/EinaTestData.cs b/src/tests/efl_mono/EinaTestData.cs
index c4272a8ca2..b64040d5eb 100644
--- a/src/tests/efl_mono/EinaTestData.cs
+++ b/src/tests/efl_mono/EinaTestData.cs
@@ -24,6 +24,10 @@ public static class BaseData
24 public static readonly string[] append_seq_str = {"42","43","33"}; 24 public static readonly string[] append_seq_str = {"42","43","33"};
25 public static readonly string[] modified_seq_str = {"0x0","0x2A","0x42","42","43","33"}; 25 public static readonly string[] modified_seq_str = {"0x0","0x2A","0x42","42","43","33"};
26 26
27 public static readonly Eina.Stringshare[] base_seq_strshare = {"0x0","0x2A","0x42"};
28 public static readonly Eina.Stringshare[] append_seq_strshare = {"42","43","33"};
29 public static readonly Eina.Stringshare[] modified_seq_strshare = {"0x0","0x2A","0x42","42","43","33"};
30
27 public static Dummy.Numberwrapper NW(int n) 31 public static Dummy.Numberwrapper NW(int n)
28 { 32 {
29 var nw = new Dummy.Numberwrapper(); 33 var nw = new Dummy.Numberwrapper();
diff --git a/src/tests/efl_mono/dummy_test_object.c b/src/tests/efl_mono/dummy_test_object.c
index 57d2a06ae6..93eaeb084d 100644
--- a/src/tests/efl_mono/dummy_test_object.c
+++ b/src/tests/efl_mono/dummy_test_object.c
@@ -19,6 +19,7 @@ typedef struct Dummy_Test_Object_Data
19 19
20 // Containers passed to C# as iterator/accessors 20 // Containers passed to C# as iterator/accessors
21 Eina_Array *out_array; 21 Eina_Array *out_array;
22 Eina_Free_Cb out_array_free_element_cb;
22} Dummy_Test_Object_Data; 23} Dummy_Test_Object_Data;
23 24
24static 25static
@@ -101,7 +102,15 @@ _dummy_test_object_efl_object_destructor(Eo *obj, Dummy_Test_Object_Data *pd)
101 } 102 }
102 103
103 if (pd->out_array) 104 if (pd->out_array)
104 eina_array_free(pd->out_array); 105 {
106 if (pd->out_array_free_element_cb)
107 {
108 unsigned n = eina_array_count(pd->out_array);
109 for (unsigned i = 0; i < n; ++i)
110 pd->out_array_free_element_cb(eina_array_data_get(pd->out_array, i));
111 }
112 eina_array_free(pd->out_array);
113 }
105 114
106 efl_destructor(efl_super(obj, DUMMY_TEST_OBJECT_CLASS)); 115 efl_destructor(efl_super(obj, DUMMY_TEST_OBJECT_CLASS));
107} 116}
@@ -728,6 +737,139 @@ Eina_Array *_dummy_test_object_eina_array_str_return_own(EINA_UNUSED Eo *obj, EI
728 return arr; 737 return arr;
729} 738}
730 739
740// Eina_Stringshare
741
742Eina_Bool _array_strshare_equal(const Eina_Array *arr, const char * const base[], unsigned int len)
743{
744 Eina_Bool result = EINA_TRUE;
745 if (eina_array_count(arr) != len)
746 return EINA_FALSE;
747 for (unsigned int i = 0; i < len && result; ++i)
748 {
749 Eina_Stringshare *ssa = eina_array_data_get(arr, i);
750 Eina_Stringshare *sse = eina_stringshare_add(base[i]);
751 result = (ssa == sse);
752 if (!result)
753 fprintf(stderr, "Unexpected stringshare value. Expected: \"%s\" [%p]; Actual: \"%s\" [%p].\n", sse, sse, ssa, ssa);
754 eina_stringshare_del(sse);
755 }
756 return result;
757}
758
759Eina_Bool _dummy_test_object_eina_array_strshare_in(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Array *arr)
760{
761 Eina_Bool r = _array_strshare_equal(arr, base_seq_str, base_seq_str_size);
762 eina_array_push(arr, eina_stringshare_add("42"));
763 eina_array_push(arr, eina_stringshare_add("43"));
764 eina_array_push(arr, eina_stringshare_add("33"));
765 return r;
766}
767
768static Eina_Array *_array_strshare_in_own_to_check = NULL;
769
770Eina_Bool _dummy_test_object_eina_array_strshare_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Array *arr)
771{
772 Eina_Bool r = _array_strshare_equal(arr, base_seq_str, base_seq_str_size);
773 eina_array_push(arr, eina_stringshare_add("42"));
774 eina_array_push(arr, eina_stringshare_add("43"));
775 eina_array_push(arr, eina_stringshare_add("33"));
776 _array_strshare_in_own_to_check = arr;
777 return r;
778}
779
780Eina_Bool _dummy_test_object_check_eina_array_strshare_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
781{
782 if (!_array_strshare_in_own_to_check) return EINA_FALSE;
783
784 Eina_Bool r = _array_strshare_equal(_array_strshare_in_own_to_check, modified_seq_str, modified_seq_str_size);
785
786 unsigned int i;
787 Eina_Stringshare *ele;
788 Eina_Array_Iterator it;
789 EINA_ARRAY_ITER_NEXT(_array_strshare_in_own_to_check, i, ele, it)
790 eina_stringshare_del(ele);
791
792 eina_array_free(_array_strshare_in_own_to_check);
793 _array_strshare_in_own_to_check = NULL;
794 return r;
795}
796
797Eina_Array *_array_strshare_out_to_check = NULL;
798
799Eina_Bool _dummy_test_object_eina_array_strshare_out(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Array **arr)
800{
801 if (!arr) return EINA_FALSE;
802 *arr = eina_array_new(default_step);
803 eina_array_push(*arr, eina_stringshare_add("0x0"));
804 eina_array_push(*arr, eina_stringshare_add("0x2A"));
805 eina_array_push(*arr, eina_stringshare_add("0x42"));
806 _array_strshare_out_to_check = *arr;
807 return EINA_TRUE;
808}
809Eina_Bool _dummy_test_object_check_eina_array_strshare_out(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
810{
811 if (!_array_strshare_out_to_check) return EINA_FALSE;
812
813 Eina_Bool r = _array_strshare_equal(_array_strshare_out_to_check, modified_seq_str, modified_seq_str_size);
814
815 unsigned int i;
816 Eina_Stringshare *ele;
817 Eina_Array_Iterator it;
818 EINA_ARRAY_ITER_NEXT(_array_strshare_out_to_check, i, ele, it)
819 eina_stringshare_del(ele);
820
821 eina_array_free(_array_strshare_out_to_check);
822 _array_strshare_out_to_check = NULL;
823 return r;
824}
825
826Eina_Bool _dummy_test_object_eina_array_strshare_out_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Array **arr)
827{
828 if (!arr) return EINA_FALSE;
829 *arr = eina_array_new(default_step);
830 eina_array_push(*arr, eina_stringshare_add("0x0"));
831 eina_array_push(*arr, eina_stringshare_add("0x2A"));
832 eina_array_push(*arr, eina_stringshare_add("0x42"));
833 return EINA_TRUE;
834}
835
836Eina_Array *_array_strshare_return_to_check = NULL;
837
838Eina_Array *_dummy_test_object_eina_array_strshare_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
839{
840 Eina_Array *arr = eina_array_new(default_step);
841 eina_array_push(arr, eina_stringshare_add("0x0"));
842 eina_array_push(arr, eina_stringshare_add("0x2A"));
843 eina_array_push(arr, eina_stringshare_add("0x42"));
844 _array_strshare_return_to_check = arr;
845 return arr;
846}
847Eina_Bool _dummy_test_object_check_eina_array_strshare_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
848{
849 if (!_array_strshare_return_to_check) return EINA_FALSE;
850
851 Eina_Bool r = _array_strshare_equal(_array_strshare_return_to_check, modified_seq_str, modified_seq_str_size);
852
853 unsigned int i;
854 Eina_Stringshare *ele;
855 Eina_Array_Iterator it;
856 EINA_ARRAY_ITER_NEXT(_array_strshare_return_to_check, i, ele, it)
857 eina_stringshare_del(ele);
858
859 eina_array_free(_array_strshare_return_to_check);
860 _array_strshare_return_to_check = NULL;
861 return r;
862}
863
864Eina_Array *_dummy_test_object_eina_array_strshare_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
865{
866 Eina_Array *arr = eina_array_new(default_step);
867 eina_array_push(arr, eina_stringshare_add("0x0"));
868 eina_array_push(arr, eina_stringshare_add("0x2A"));
869 eina_array_push(arr, eina_stringshare_add("0x42"));
870 return arr;
871}
872
731// Object 873// Object
732 874
733Eina_Bool _array_obj_equal(const Eina_Array *arr, const Dummy_Numberwrapper * const base[], unsigned int len) 875Eina_Bool _array_obj_equal(const Eina_Array *arr, const Dummy_Numberwrapper * const base[], unsigned int len)
@@ -1488,6 +1630,136 @@ Eina_List *_dummy_test_object_eina_list_str_return_own(EINA_UNUSED Eo *obj, EINA
1488 return lst; 1630 return lst;
1489} 1631}
1490 1632
1633// Eina_Stringshare
1634
1635Eina_Bool _list_strshare_equal(const Eina_List *lst, const char * const base[], unsigned int len)
1636{
1637 if (eina_list_count(lst) != len)
1638 return EINA_FALSE;
1639
1640 const Eina_List *l;
1641 Eina_Stringshare *data;
1642 int i = 0;
1643 EINA_LIST_FOREACH(lst, l, data)
1644 {
1645 Eina_Stringshare *ssa = data;
1646 Eina_Stringshare *sse = eina_stringshare_add(base[i]);
1647 if (ssa != sse)
1648 {
1649 fprintf(stderr, "Unexpected stringshare value. Expected: \"%s\" [%p]; Actual: \"%s\" [%p].\n", sse, sse, ssa, ssa);
1650 eina_stringshare_del(sse);
1651 return EINA_FALSE;
1652 }
1653 eina_stringshare_del(sse);
1654 ++i;
1655 }
1656 return EINA_TRUE;
1657}
1658
1659Eina_Bool _dummy_test_object_eina_list_strshare_in(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_List *lst)
1660{
1661 Eina_Bool r = _list_strshare_equal(lst, base_seq_str, base_seq_str_size);
1662 return r;
1663}
1664
1665static Eina_List *_list_strshare_in_own_to_check = NULL;
1666
1667Eina_Bool _dummy_test_object_eina_list_strshare_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_List *lst)
1668{
1669 Eina_Bool r = _list_strshare_equal(lst, base_seq_str, base_seq_str_size);
1670 if (!r) return r;
1671 lst = eina_list_append(lst, eina_stringshare_add("42"));
1672 lst = eina_list_append(lst, eina_stringshare_add("43"));
1673 lst = eina_list_append(lst, eina_stringshare_add("33"));
1674 _list_strshare_in_own_to_check = lst;
1675 return r;
1676}
1677
1678Eina_Bool _dummy_test_object_check_eina_list_strshare_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
1679{
1680 if (!_list_strshare_in_own_to_check) return EINA_FALSE;
1681
1682 Eina_Bool r = _list_strshare_equal(_list_strshare_in_own_to_check, modified_seq_str, modified_seq_str_size);
1683 if (!r) return r;
1684
1685 Eina_Stringshare *ele;
1686 EINA_LIST_FREE(_list_strshare_in_own_to_check, ele)
1687 eina_stringshare_del(ele);
1688
1689 _list_strshare_in_own_to_check = NULL;
1690 return r;
1691}
1692
1693Eina_List *_list_strshare_out_to_check = NULL;
1694
1695Eina_Bool _dummy_test_object_eina_list_strshare_out(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_List **lst)
1696{
1697 if (!lst) return EINA_FALSE;
1698 *lst = eina_list_append(*lst, eina_stringshare_add("0x0"));
1699 *lst = eina_list_append(*lst, eina_stringshare_add("0x2A"));
1700 *lst = eina_list_append(*lst, eina_stringshare_add("0x42"));
1701 _list_strshare_out_to_check = *lst;
1702 return EINA_TRUE;
1703}
1704Eina_Bool _dummy_test_object_check_eina_list_strshare_out(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
1705{
1706 if (!_list_strshare_out_to_check) return EINA_FALSE;
1707
1708 Eina_Bool r = _list_strshare_equal(_list_strshare_out_to_check, base_seq_str, base_seq_str_size);
1709 if (!r) return r;
1710
1711 Eina_Stringshare *ele;
1712 EINA_LIST_FREE(_list_strshare_out_to_check, ele)
1713 eina_stringshare_del(ele);
1714
1715 _list_strshare_out_to_check = NULL;
1716 return r;
1717}
1718
1719Eina_Bool _dummy_test_object_eina_list_strshare_out_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_List **lst)
1720{
1721 if (!lst) return EINA_FALSE;
1722 *lst = eina_list_append(*lst, eina_stringshare_add("0x0"));
1723 *lst = eina_list_append(*lst, eina_stringshare_add("0x2A"));
1724 *lst = eina_list_append(*lst, eina_stringshare_add("0x42"));
1725 return EINA_TRUE;
1726}
1727
1728Eina_List *_list_strshare_return_to_check = NULL;
1729
1730Eina_List *_dummy_test_object_eina_list_strshare_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
1731{
1732 Eina_List *lst = NULL;
1733 lst = eina_list_append(lst, eina_stringshare_add("0x0"));
1734 lst = eina_list_append(lst, eina_stringshare_add("0x2A"));
1735 lst = eina_list_append(lst, eina_stringshare_add("0x42"));
1736 _list_strshare_return_to_check = lst;
1737 return lst;
1738}
1739Eina_Bool _dummy_test_object_check_eina_list_strshare_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
1740{
1741 if (!_list_strshare_return_to_check) return EINA_FALSE;
1742
1743 Eina_Bool r = _list_strshare_equal(_list_strshare_return_to_check, base_seq_str, base_seq_str_size);
1744 if (!r) return r;
1745
1746 Eina_Stringshare *ele;
1747 EINA_LIST_FREE(_list_strshare_return_to_check, ele)
1748 eina_stringshare_del(ele);
1749
1750 _list_strshare_return_to_check = NULL;
1751 return r;
1752}
1753
1754Eina_List *_dummy_test_object_eina_list_strshare_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
1755{
1756 Eina_List *lst = NULL;
1757 lst = eina_list_append(lst, eina_stringshare_add("0x0"));
1758 lst = eina_list_append(lst, eina_stringshare_add("0x2A"));
1759 lst = eina_list_append(lst, eina_stringshare_add("0x42"));
1760 return lst;
1761}
1762
1491// Object 1763// Object
1492 1764
1493Eina_Bool _list_obj_equal(const Eina_List *lst, const Dummy_Numberwrapper * const base[], unsigned int len) 1765Eina_Bool _list_obj_equal(const Eina_List *lst, const Dummy_Numberwrapper * const base[], unsigned int len)
@@ -1923,6 +2195,164 @@ Eina_Inlist *_dummy_test_object_eina_inlist_str_return_own(EINA_UNUSED Eo *obj,
1923 return lst; 2195 return lst;
1924} 2196}
1925 2197
2198// Eina_Stringshare
2199
2200typedef struct _Dummy_Inlist_Node_Strshare
2201{
2202 EINA_INLIST;
2203 Eina_Stringshare *val;
2204} Dummy_Inlist_Node_Strshare;
2205
2206
2207Eina_Inlist *_new_inlist_strshare(const char *v)
2208{
2209 Dummy_Inlist_Node_Strshare *node = malloc(sizeof(Dummy_Inlist_Node_Strshare));
2210 node->val = eina_stringshare_add(v);
2211 return EINA_INLIST_GET(node);
2212}
2213
2214Eina_Bool _inlist_strshare_equal(const Eina_Inlist *lst, const char * const base[], unsigned int len)
2215{
2216 if (eina_inlist_count(lst) != len)
2217 return EINA_FALSE;
2218
2219 const Dummy_Inlist_Node_Strshare *node;
2220 int i = 0;
2221 EINA_INLIST_FOREACH(lst, node)
2222 {
2223 Eina_Stringshare *ssa = node->val;
2224 Eina_Stringshare *sse = eina_stringshare_add(base[i]);
2225 if (ssa != sse)
2226 {
2227 fprintf(stderr, "Unexpected stringshare value. Expected: \"%s\" [%p]; Actual: \"%s\" [%p].\n", sse, sse, ssa, ssa);
2228 eina_stringshare_del(sse);
2229 return EINA_FALSE;
2230 }
2231 eina_stringshare_del(sse);
2232 ++i;
2233 }
2234 return EINA_TRUE;
2235}
2236
2237Eina_Bool _dummy_test_object_eina_inlist_strshare_in(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Inlist *lst)
2238{
2239 Eina_Bool r = _inlist_strshare_equal(lst, base_seq_str, base_seq_str_size);
2240 return r;
2241}
2242
2243static Eina_Inlist *_inlist_strshare_in_own_to_check = NULL;
2244
2245Eina_Bool _dummy_test_object_eina_inlist_strshare_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Inlist *lst)
2246{
2247 Eina_Bool r = _inlist_strshare_equal(lst, base_seq_str, base_seq_str_size);
2248 if (!r) return r;
2249 lst = eina_inlist_append(lst, _new_inlist_strshare("42"));
2250 lst = eina_inlist_append(lst, _new_inlist_strshare("43"));
2251 lst = eina_inlist_append(lst, _new_inlist_strshare("33"));
2252 _inlist_strshare_in_own_to_check = lst;
2253 return r;
2254}
2255
2256Eina_Bool _dummy_test_object_check_eina_inlist_strshare_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
2257{
2258 Eina_Inlist *lst = _inlist_strshare_in_own_to_check;
2259 if (!lst) return EINA_FALSE;
2260 _inlist_strshare_in_own_to_check = NULL;
2261
2262 Eina_Bool r = _inlist_strshare_equal(lst, modified_seq_str, modified_seq_str_size);
2263 if (!r) return r;
2264
2265 Dummy_Inlist_Node_Strshare *node;
2266 EINA_INLIST_FREE(lst, node)
2267 {
2268 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
2269 eina_stringshare_del(node->val);
2270 free(node);
2271 }
2272
2273 return r;
2274}
2275
2276Eina_Inlist *_inlist_strshare_out_to_check = NULL;
2277
2278Eina_Bool _dummy_test_object_eina_inlist_strshare_out(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Inlist **lst)
2279{
2280 if (!lst) return EINA_FALSE;
2281 *lst = eina_inlist_append(*lst, _new_inlist_strshare("0x0"));
2282 *lst = eina_inlist_append(*lst, _new_inlist_strshare("0x2A"));
2283 *lst = eina_inlist_append(*lst, _new_inlist_strshare("0x42"));
2284 _inlist_strshare_out_to_check = *lst;
2285 return EINA_TRUE;
2286}
2287Eina_Bool _dummy_test_object_check_eina_inlist_strshare_out(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
2288{
2289 Eina_Inlist *lst = _inlist_strshare_out_to_check;
2290 if (!lst) return EINA_FALSE;
2291 _inlist_strshare_out_to_check = NULL;
2292
2293 Eina_Bool r = _inlist_strshare_equal(lst, base_seq_str, base_seq_str_size);
2294 if (!r) return r;
2295
2296 Dummy_Inlist_Node_Strshare *node;
2297 EINA_INLIST_FREE(lst, node)
2298 {
2299 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
2300 eina_stringshare_del(node->val);
2301 free(node);
2302 }
2303
2304 return r;
2305}
2306
2307Eina_Bool _dummy_test_object_eina_inlist_strshare_out_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Inlist **lst)
2308{
2309 if (!lst) return EINA_FALSE;
2310 *lst = eina_inlist_append(*lst, _new_inlist_strshare("0x0"));
2311 *lst = eina_inlist_append(*lst, _new_inlist_strshare("0x2A"));
2312 *lst = eina_inlist_append(*lst, _new_inlist_strshare("0x42"));
2313 return EINA_TRUE;
2314}
2315
2316Eina_Inlist *_inlist_strshare_return_to_check = NULL;
2317
2318Eina_Inlist *_dummy_test_object_eina_inlist_strshare_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
2319{
2320 Eina_Inlist *lst = NULL;
2321 lst = eina_inlist_append(lst, _new_inlist_strshare("0x0"));
2322 lst = eina_inlist_append(lst, _new_inlist_strshare("0x2A"));
2323 lst = eina_inlist_append(lst, _new_inlist_strshare("0x42"));
2324 _inlist_strshare_return_to_check = lst;
2325 return lst;
2326}
2327Eina_Bool _dummy_test_object_check_eina_inlist_strshare_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
2328{
2329 Eina_Inlist *lst = _inlist_strshare_return_to_check;
2330 if (!lst) return EINA_FALSE;
2331 _inlist_strshare_return_to_check = NULL;
2332
2333 Eina_Bool r = _inlist_strshare_equal(lst, base_seq_str, base_seq_str_size);
2334 if (!r) return r;
2335
2336 Dummy_Inlist_Node_Strshare *node;
2337 EINA_INLIST_FREE(lst, node)
2338 {
2339 lst = eina_inlist_remove(lst, EINA_INLIST_GET(node));
2340 eina_stringshare_del(node->val);
2341 free(node);
2342 }
2343
2344 return r;
2345}
2346
2347Eina_Inlist *_dummy_test_object_eina_inlist_strshare_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
2348{
2349 Eina_Inlist *lst = NULL;
2350 lst = eina_inlist_append(lst, _new_inlist_strshare("0x0"));
2351 lst = eina_inlist_append(lst, _new_inlist_strshare("0x2A"));
2352 lst = eina_inlist_append(lst, _new_inlist_strshare("0x42"));
2353 return lst;
2354}
2355
1926// Object 2356// Object
1927 2357
1928typedef struct _Dummy_Inlist_Node_Obj 2358typedef struct _Dummy_Inlist_Node_Obj
@@ -2444,6 +2874,194 @@ Eina_Bool _dummy_test_object_check_eina_hash_str_return_own(EINA_UNUSED Eo *obj,
2444} 2874}
2445 2875
2446 2876
2877// Eina_Stringshare //
2878
2879Eina_Bool _hash_strshare_check(const Eina_Hash *hsh, const char *key, const char *expected_val)
2880{
2881 Eina_Stringshare *ssk = eina_stringshare_add(key);
2882 Eina_Stringshare *sse = eina_stringshare_add(expected_val);
2883 Eina_Stringshare *ssa = eina_hash_find(hsh, ssk);
2884 Eina_Bool result = (ssa == sse);
2885 if (!result)
2886 fprintf(stderr, "Unexpected stringshare value. Expected: \"%s\" [%p]; Actual: \"%s\" [%p].\n", sse, sse, ssa, ssa);
2887 eina_stringshare_del(ssk);
2888 eina_stringshare_del(sse);
2889 return result;
2890}
2891
2892static inline Eina_Bool _hash_strshare_add(Eina_Hash *hsh, const char *key, const char *val)
2893{
2894 return eina_hash_add(hsh, eina_stringshare_add(key), eina_stringshare_add(val));
2895}
2896
2897
2898// strshare in
2899
2900Eina_Bool _dummy_test_object_eina_hash_strshare_in(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Hash *hsh)
2901{
2902 if (!_hash_strshare_check(hsh, "aa", "aaa"))
2903 return EINA_FALSE;
2904
2905 return _hash_strshare_add(hsh, "bb", "bbb");
2906}
2907
2908
2909// strshare in own
2910
2911static Eina_Bool _hash_strshare_in_own_free_flag = EINA_FALSE;
2912static void _hash_strshare_in_own_free_cb(void *data)
2913{
2914 _hash_strshare_in_own_free_flag = EINA_TRUE;
2915 eina_stringshare_del(data);
2916}
2917static Eina_Hash *_hash_strshare_in_own_to_check = NULL;
2918
2919Eina_Bool _dummy_test_object_eina_hash_strshare_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Hash *hsh)
2920{
2921 eina_hash_free_cb_set(hsh, _hash_strshare_in_own_free_cb);
2922
2923 if (!_hash_strshare_check(hsh, "aa", "aaa"))
2924 return EINA_FALSE;
2925
2926 _hash_strshare_in_own_to_check = hsh;
2927
2928 return _hash_strshare_add(hsh, "bb", "bbb");
2929}
2930Eina_Bool _dummy_test_object_check_eina_hash_strshare_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
2931{
2932 if (!_hash_strshare_in_own_to_check) return EINA_FALSE;
2933
2934 Eina_Hash *hsh = _hash_strshare_in_own_to_check;
2935
2936 if (!_hash_strshare_check(hsh, "aa", "aaa")
2937 || !_hash_strshare_check(hsh, "bb", "bbb")
2938 || !_hash_strshare_check(hsh, "cc", "ccc"))
2939 return EINA_FALSE;
2940
2941 eina_hash_free(hsh);
2942
2943 return _hash_strshare_in_own_free_flag;
2944}
2945
2946
2947// strshare out
2948
2949static Eina_Bool _hash_strshare_out_free_flag = EINA_FALSE;
2950static void _hash_strshare_out_free_cb(void *data)
2951{
2952 _hash_strshare_out_free_flag = EINA_TRUE;
2953 eina_stringshare_del(data);
2954}
2955Eina_Hash *_hash_strshare_out_to_check = NULL;
2956
2957Eina_Bool _dummy_test_object_eina_hash_strshare_out(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Hash **hsh)
2958{
2959 if (!hsh) return EINA_FALSE;
2960
2961 *hsh = eina_hash_string_superfast_new(_hash_strshare_out_free_cb);
2962
2963 _hash_strshare_out_to_check = *hsh;
2964
2965 return _hash_strshare_add(*hsh, "aa", "aaa");
2966}
2967Eina_Bool _dummy_test_object_check_eina_hash_strshare_out(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
2968{
2969 if (!_hash_strshare_out_to_check) return EINA_FALSE;
2970
2971 Eina_Hash *hsh = _hash_strshare_out_to_check;
2972
2973 if (!_hash_strshare_check(hsh, "aa", "aaa")
2974 || !_hash_strshare_check(hsh, "bb", "bbb"))
2975 return EINA_FALSE;
2976
2977 eina_hash_free(hsh);
2978
2979 _hash_strshare_out_to_check = NULL;
2980 return _hash_strshare_out_free_flag;
2981}
2982
2983
2984// strshare out own
2985
2986static Eina_Bool _hash_strshare_out_own_free_flag = EINA_FALSE;
2987static void _hash_strshare_out_own_free_cb(void *data)
2988{
2989 _hash_strshare_out_own_free_flag = EINA_TRUE;
2990 eina_stringshare_del(data);
2991}
2992Eina_Bool _dummy_test_object_eina_hash_strshare_out_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Hash **hsh)
2993{
2994 if (!hsh) return EINA_FALSE;
2995
2996 *hsh = eina_hash_string_superfast_new(_hash_strshare_out_own_free_cb);
2997
2998 return _hash_strshare_add(*hsh, "aa", "aaa");
2999}
3000Eina_Bool _dummy_test_object_check_eina_hash_strshare_out_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
3001{
3002 return !_hash_strshare_out_own_free_flag;
3003}
3004
3005
3006// strshare return
3007
3008static Eina_Bool _hash_strshare_return_free_flag = EINA_FALSE;
3009static void _hash_strshare_return_free_cb(void *data)
3010{
3011 _hash_strshare_return_free_flag = EINA_TRUE;
3012 eina_stringshare_del(data);
3013}
3014Eina_Hash *_hash_strshare_return_to_check = NULL;
3015
3016Eina_Hash *_dummy_test_object_eina_hash_strshare_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
3017{
3018 Eina_Hash *hsh = eina_hash_string_superfast_new(_hash_strshare_return_free_cb);
3019
3020 _hash_strshare_add(hsh, "aa", "aaa");
3021
3022 _hash_strshare_return_to_check = hsh;
3023
3024 return hsh;
3025}
3026Eina_Bool _dummy_test_object_check_eina_hash_strshare_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
3027{
3028 if (!_hash_strshare_return_to_check) return EINA_FALSE;
3029
3030 Eina_Hash *hsh = _hash_strshare_return_to_check;
3031
3032 if (!_hash_strshare_check(hsh, "aa", "aaa")
3033 || !_hash_strshare_check(hsh, "bb", "bbb"))
3034 return EINA_FALSE;
3035
3036 eina_hash_free(hsh);
3037
3038 _hash_strshare_return_to_check = NULL;
3039 return _hash_strshare_return_free_flag;
3040}
3041
3042
3043// strshare return own
3044
3045static Eina_Bool _hash_strshare_return_own_free_flag = EINA_FALSE;
3046static void _hash_strshare_return_own_free_cb(void *data)
3047{
3048 _hash_strshare_return_own_free_flag = EINA_TRUE;
3049 eina_stringshare_del(data);
3050}
3051Eina_Hash *_dummy_test_object_eina_hash_strshare_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
3052{
3053 Eina_Hash *hsh = eina_hash_string_superfast_new(_hash_strshare_return_own_free_cb);
3054
3055 _hash_strshare_add(hsh, "aa", "aaa");
3056
3057 return hsh;
3058}
3059Eina_Bool _dummy_test_object_check_eina_hash_strshare_return_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
3060{
3061 return !_hash_strshare_return_own_free_flag;
3062}
3063
3064
2447// Object // 3065// Object //
2448 3066
2449Eina_Bool _hash_obj_check(const Eina_Hash *hsh, Dummy_Numberwrapper *key, Dummy_Numberwrapper *expected_val, int knum, int vnum) 3067Eina_Bool _hash_obj_check(const Eina_Hash *hsh, Dummy_Numberwrapper *key, Dummy_Numberwrapper *expected_val, int knum, int vnum)
@@ -2966,6 +3584,174 @@ Eina_Iterator *_dummy_test_object_eina_iterator_str_return_own(EINA_UNUSED Eo *o
2966 return eina_array_iterator_new(pd->out_array); 3584 return eina_array_iterator_new(pd->out_array);
2967} 3585}
2968 3586
3587// Eina_Stringshare //
3588
3589Eina_Bool _iterator_strshare_equal(Eina_Iterator *itr, const char * const base[], unsigned int len, Eina_Bool release)
3590{
3591 Eina_Stringshare *ssa;
3592 unsigned i = 0;
3593 EINA_ITERATOR_FOREACH(itr, ssa)
3594 {
3595 Eina_Stringshare *sse = eina_stringshare_add(base[i]);
3596 if (ssa != sse)
3597 {
3598 fprintf(stderr, "Unexpected stringshare value. Expected: \"%s\" [%p]; Actual: \"%s\" [%p].\n", sse, sse, ssa, ssa);
3599 eina_stringshare_del(sse);
3600 return EINA_FALSE;
3601 }
3602 eina_stringshare_del(sse);
3603 if (release)
3604 eina_stringshare_del(ssa);
3605 ++i;
3606 }
3607
3608 if (i != len)
3609 return EINA_FALSE;
3610
3611 return EINA_TRUE;
3612}
3613
3614Eina_Array *_iterator_strshare_eina_array_new()
3615{
3616 Eina_Array *arr = eina_array_new(32);
3617 for (unsigned i = 0; i < base_seq_str_size; ++i)
3618 {
3619 eina_array_push(arr, eina_stringshare_add(base_seq_str[i]));
3620 }
3621 return arr;
3622}
3623
3624Eina_Bool _iterator_strshare_test_array(Eina_Array *arr)
3625{
3626 if (eina_array_count(arr) != base_seq_str_size)
3627 return EINA_FALSE;
3628
3629 for (unsigned i = 0; i < base_seq_str_size; ++i)
3630 {
3631 Eina_Stringshare *ssa = eina_array_data_get(arr, i);
3632 Eina_Stringshare *sse = eina_stringshare_add(base_seq_str[i]);
3633 if (ssa != sse)
3634 return EINA_FALSE;
3635 eina_stringshare_del(ssa);
3636 eina_stringshare_del(sse);
3637 }
3638
3639 eina_array_free(arr);
3640
3641 return EINA_TRUE;
3642}
3643
3644// <strshare> in
3645
3646Eina_Bool _dummy_test_object_eina_iterator_strshare_in(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Iterator *itr)
3647{
3648 Eina_Bool r = _iterator_strshare_equal(itr, base_seq_str, base_seq_str_size, EINA_FALSE);
3649 return r;
3650}
3651
3652// <strshare> in own
3653
3654static Eina_Iterator *_iterator_strshare_in_own_to_check = NULL;
3655
3656Eina_Bool _dummy_test_object_eina_iterator_strshare_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Iterator *itr)
3657{
3658 Eina_Bool r = _iterator_strshare_equal(itr, base_seq_str, base_seq_str_size, EINA_FALSE);
3659 _iterator_strshare_in_own_to_check = itr;
3660 return r;
3661}
3662Eina_Bool _dummy_test_object_check_eina_iterator_strshare_in_own(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
3663{
3664 eina_iterator_free(_iterator_strshare_in_own_to_check);
3665 _iterator_strshare_in_own_to_check = NULL;
3666 return EINA_TRUE;
3667}
3668
3669// <strshare> out
3670
3671Eina_Iterator *_iterator_strshare_out_to_check = NULL;
3672Eina_Array *_iterator_strshare_out_array = NULL;
3673
3674Eina_Bool _dummy_test_object_eina_iterator_strshare_out(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Iterator **itr)
3675{
3676 if (!itr) return EINA_FALSE;
3677
3678 _iterator_strshare_out_array = _iterator_strshare_eina_array_new();
3679
3680 *itr = eina_array_iterator_new(_iterator_strshare_out_array);
3681 _iterator_strshare_out_to_check = *itr;
3682
3683 return EINA_TRUE;
3684}
3685Eina_Bool _dummy_test_object_check_eina_iterator_strshare_out(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
3686{
3687 Eina_Iterator *itr = _iterator_strshare_out_to_check;
3688 if (!itr) return EINA_FALSE;
3689 _iterator_strshare_out_to_check = NULL;
3690
3691 Eina_Array *arr = _iterator_strshare_out_array;
3692 if (!arr) return EINA_FALSE;
3693 _iterator_strshare_out_array = NULL;
3694
3695 Eina_Bool r = _iterator_strshare_test_array(arr);
3696 if (!r) return r;
3697
3698 eina_iterator_free(itr);
3699
3700 return r;
3701}
3702
3703// <strshare> out own
3704
3705Eina_Bool _dummy_test_object_eina_iterator_strshare_out_own(EINA_UNUSED Eo *obj, Dummy_Test_Object_Data *pd, Eina_Iterator **itr)
3706{
3707 if (!itr) return EINA_FALSE;
3708
3709 pd->out_array = _iterator_strshare_eina_array_new();
3710 pd->out_array_free_element_cb = (Eina_Free_Cb) eina_stringshare_del;
3711
3712 *itr = eina_array_iterator_new(pd->out_array);
3713
3714 return EINA_TRUE;
3715}
3716
3717// <strshare> return
3718
3719Eina_Iterator *_iterator_strshare_return_to_check = NULL;
3720Eina_Array *_iterator_strshare_return_array = NULL;
3721
3722Eina_Iterator *_dummy_test_object_eina_iterator_strshare_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
3723{
3724 _iterator_strshare_return_array = _iterator_strshare_eina_array_new();
3725 _iterator_strshare_return_to_check = eina_array_iterator_new(_iterator_strshare_return_array);
3726 return _iterator_strshare_return_to_check;
3727}
3728Eina_Bool _dummy_test_object_check_eina_iterator_strshare_return(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
3729{
3730 Eina_Iterator *itr = _iterator_strshare_return_to_check;
3731 if (!itr) return EINA_FALSE;
3732 _iterator_strshare_return_to_check = NULL;
3733
3734 Eina_Array *arr = _iterator_strshare_return_array;
3735 if (!arr) return EINA_FALSE;
3736 _iterator_strshare_return_array = NULL;
3737
3738 Eina_Bool r = _iterator_strshare_test_array(arr);
3739 if (!r) return r;
3740
3741 eina_iterator_free(itr);
3742
3743 return r;
3744}
3745
3746// <strshare> return own
3747
3748Eina_Iterator *_dummy_test_object_eina_iterator_strshare_return_own(EINA_UNUSED Eo *obj, Dummy_Test_Object_Data *pd)
3749{
3750 pd->out_array = _iterator_strshare_eina_array_new();
3751 pd->out_array_free_element_cb = (Eina_Free_Cb) eina_stringshare_del;
3752 return eina_array_iterator_new(pd->out_array);
3753}
3754
2969// Object // 3755// Object //
2970 3756
2971Eina_Bool _iterator_obj_equal(Eina_Iterator *itr, const Dummy_Numberwrapper * const base[], unsigned int len, Eina_Bool release) 3757Eina_Bool _iterator_obj_equal(Eina_Iterator *itr, const Dummy_Numberwrapper * const base[], unsigned int len, Eina_Bool release)
diff --git a/src/tests/efl_mono/dummy_test_object.eo b/src/tests/efl_mono/dummy_test_object.eo
index 529b246418..22c9d69eb8 100644
--- a/src/tests/efl_mono/dummy_test_object.eo
+++ b/src/tests/efl_mono/dummy_test_object.eo
@@ -468,6 +468,52 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
468 return: array<mstring @owned> @owned; 468 return: array<mstring @owned> @owned;
469 } 469 }
470 470
471 /* Eina_Stringshare */
472 eina_array_strshare_in {
473 params {
474 @in arr: array<stringshare>;
475 }
476 return: bool;
477 }
478
479 eina_array_strshare_in_own {
480 params {
481 @in arr: array<stringshare @owned> @owned;
482 }
483 return: bool;
484 }
485 check_eina_array_strshare_in_own {
486 return: bool;
487 }
488
489 eina_array_strshare_out {
490 params {
491 @out arr: array<stringshare>;
492 }
493 return: bool;
494 }
495 check_eina_array_strshare_out {
496 return: bool;
497 }
498
499 eina_array_strshare_out_own {
500 params {
501 @out arr: array<stringshare @owned> @owned;
502 }
503 return: bool;
504 }
505
506 eina_array_strshare_return {
507 return: array<stringshare>;
508 }
509 check_eina_array_strshare_return {
510 return: bool;
511 }
512
513 eina_array_strshare_return_own {
514 return: array<stringshare @owned> @owned;
515 }
516
471 /* Object */ 517 /* Object */
472 eina_array_obj_in { 518 eina_array_obj_in {
473 params { 519 params {
@@ -615,6 +661,52 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
615 return: list<mstring @owned> @owned; 661 return: list<mstring @owned> @owned;
616 } 662 }
617 663
664 /* Eina_Stringshare */
665 eina_list_strshare_in {
666 params {
667 @in lst: list<stringshare>;
668 }
669 return: bool;
670 }
671
672 eina_list_strshare_in_own {
673 params {
674 @in lst: list<stringshare @owned> @owned;
675 }
676 return: bool;
677 }
678 check_eina_list_strshare_in_own {
679 return: bool;
680 }
681
682 eina_list_strshare_out {
683 params {
684 @out lst: list<stringshare>;
685 }
686 return: bool;
687 }
688 check_eina_list_strshare_out {
689 return: bool;
690 }
691
692 eina_list_strshare_out_own {
693 params {
694 @out lst: list<stringshare @owned> @owned;
695 }
696 return: bool;
697 }
698
699 eina_list_strshare_return {
700 return: list<stringshare>;
701 }
702 check_eina_list_strshare_return {
703 return: bool;
704 }
705
706 eina_list_strshare_return_own {
707 return: list<stringshare @owned> @owned;
708 }
709
618 /* Object */ 710 /* Object */
619 eina_list_obj_in { 711 eina_list_obj_in {
620 params { 712 params {
@@ -774,6 +866,58 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
774 return: bool; 866 return: bool;
775 } 867 }
776 868
869 // Eina_Stringshare //
870 eina_hash_strshare_in {
871 params {
872 @in hsh: hash<stringshare, stringshare>;
873 }
874 return: bool;
875 }
876
877 eina_hash_strshare_in_own {
878 params {
879 @in hsh: hash<stringshare, stringshare @owned> @owned;
880 }
881 return: bool;
882 }
883 check_eina_hash_strshare_in_own {
884 return: bool;
885 }
886
887 eina_hash_strshare_out {
888 params {
889 @out hsh: hash<stringshare, stringshare>;
890 }
891 return: bool;
892 }
893 check_eina_hash_strshare_out {
894 return: bool;
895 }
896
897 eina_hash_strshare_out_own {
898 params {
899 @out hsh: hash<stringshare, stringshare @owned> @owned;
900 }
901 return: bool;
902 }
903 check_eina_hash_strshare_out_own {
904 return: bool;
905 }
906
907 eina_hash_strshare_return {
908 return: hash<stringshare, stringshare>;
909 }
910 check_eina_hash_strshare_return {
911 return: bool;
912 }
913
914 eina_hash_strshare_return_own {
915 return: hash<stringshare, stringshare @owned> @owned;
916 }
917 check_eina_hash_strshare_return_own {
918 return: bool;
919 }
920
777 // Object // 921 // Object //
778 eina_hash_obj_in { 922 eina_hash_obj_in {
779 params { 923 params {
@@ -958,6 +1102,52 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
958 return: iterator<mstring> @owned; 1102 return: iterator<mstring> @owned;
959 } 1103 }
960 1104
1105 /* Eina_Stringshare */
1106 eina_iterator_strshare_in {
1107 params {
1108 @in itr: iterator<stringshare>;
1109 }
1110 return: bool;
1111 }
1112
1113 eina_iterator_strshare_in_own {
1114 params {
1115 @in itr: iterator<stringshare> @owned;
1116 }
1117 return: bool;
1118 }
1119 check_eina_iterator_strshare_in_own {
1120 return: bool;
1121 }
1122
1123 eina_iterator_strshare_out {
1124 params {
1125 @out itr: iterator<stringshare>;
1126 }
1127 return: bool;
1128 }
1129 check_eina_iterator_strshare_out {
1130 return: bool;
1131 }
1132
1133 eina_iterator_strshare_out_own {
1134 params {
1135 @out itr: iterator<stringshare> @owned;
1136 }
1137 return: bool;
1138 }
1139
1140 eina_iterator_strshare_return {
1141 return: iterator<stringshare>;
1142 }
1143 check_eina_iterator_strshare_return {
1144 return: bool;
1145 }
1146
1147 eina_iterator_strshare_return_own {
1148 return: iterator<stringshare> @owned;
1149 }
1150
961 /* Object */ 1151 /* Object */
962 eina_iterator_obj_in { 1152 eina_iterator_obj_in {
963 params { 1153 params {