summaryrefslogtreecommitdiff
path: root/src/lib/eo
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-04-26 16:18:49 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-04-26 16:19:06 +0200
commit6af85271177f41a07d59b14759236c9f4a5bd1de (patch)
tree0540680073b34cad4141089ab9063bdf4ee28bf5 /src/lib/eo
parent20d1cf94c30fa21c823142a37dd7dcf08b69f205 (diff)
eo: move all the key_ properties to C
Diffstat (limited to 'src/lib/eo')
-rw-r--r--src/lib/eo/Eo.h111
-rw-r--r--src/lib/eo/efl_object.eo84
-rw-r--r--src/lib/eo/eo_base_class.c34
3 files changed, 144 insertions, 85 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index a89dec6fc1..dd7ecabe1d 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -1441,6 +1441,117 @@ EOAPI void efl_wref_add(Eo *obj, Efl_Object **wref);
1441 */ 1441 */
1442EOAPI void efl_wref_del(Eo *obj, Efl_Object **wref); 1442EOAPI void efl_wref_del(Eo *obj, Efl_Object **wref);
1443 1443
1444
1445/**
1446 * @brief Generic data with string key on an object.
1447 *
1448 * The user is in charge of freeing the data.
1449 *
1450 * @param[in] key The key associated with the data
1451 * @param[in] data The data to set
1452 */
1453EOAPI void efl_key_data_set(Eo *obj, const char * key, const void *data);
1454
1455/**
1456 * @brief Generic data with string key on an object.
1457 *
1458 * The user is in charge of freeing the data.
1459 *
1460 * @param[in] key The key associated with the data
1461 *
1462 * @return The data to set
1463 */
1464EOAPI void *efl_key_data_get(const Eo *obj, const char * key);
1465
1466/**
1467 * @brief Generic object reference with string key to object.
1468 *
1469 * The object will be automatically ref'd when set and unref'd when replaced or
1470 * deleted or referring object is deleted. If the referenced object is deleted
1471 * then the key is deleted automatically.
1472 *
1473 * This is the same key store used by key_data and key_value so keys are shared
1474 * and can store only one thing
1475 *
1476 * @param[in] key The key associated with the object ref
1477 * @param[in] objdata The object to set
1478 */
1479EOAPI void efl_key_ref_set(Eo *obj, const char * key, const Efl_Object *objdata);
1480
1481/**
1482 * @brief Generic object reference with string key to object.
1483 *
1484 * The object will be automatically ref'd when set and unref'd when replaced or
1485 * deleted or referring object is deleted. If the referenced object is deleted
1486 * then the key is deleted automatically.
1487 *
1488 * This is the same key store used by key_data and key_value so keys are shared
1489 * and can store only one thing
1490 *
1491 * @param[in] key The key associated with the object ref
1492 *
1493 * @return The object to set
1494 */
1495EOAPI Efl_Object *efl_key_ref_get(const Eo *obj, const char * key);
1496
1497/**
1498 * @brief Generic weak object reference with string key to object.
1499 *
1500 * The object key will be removed if the object is removed, but will not take
1501 * or removed references like key_obj.
1502 *
1503 * This is the same key store used by key_data and key_value so keys are shared
1504 * and can store only one thing
1505 *
1506 * @param[in] key The key associated with the object ref
1507 * @param[in] objdata The object to set
1508 */
1509EOAPI void efl_key_wref_set(Eo *obj, const char * key, const Efl_Object *objdata);
1510
1511/**
1512 * @brief Generic weak object reference with string key to object.
1513 *
1514 * The object key will be removed if the object is removed, but will not take
1515 * or removed references like key_obj.
1516 *
1517 * This is the same key store used by key_data and key_value so keys are shared
1518 * and can store only one thing
1519 *
1520 * @param[in] key The key associated with the object ref
1521 *
1522 * @return The object to set
1523 */
1524EOAPI Efl_Object *efl_key_wref_get(const Eo *obj, const char * key);
1525
1526/**
1527 * @brief Value on with string key on the object.
1528 *
1529 * This stores the value with the given string key on the object and it will be
1530 * freed when replaced or deleted or the referring object is deleted.
1531 *
1532 * This is the same key store used by key_data and key_obj so keys are shared
1533 * and can store only one thing
1534 *
1535 * @param[in] key The key associated with the value
1536 * @param[in] value The value to set
1537 */
1538EOAPI void efl_key_value_set(Eo *obj, const char * key, Eina_Value *value);
1539
1540/**
1541 * @brief Value on with string key on the object.
1542 *
1543 * This stores the value with the given string key on the object and it will be
1544 * freed when replaced or deleted or the referring object is deleted.
1545 *
1546 * This is the same key store used by key_data and key_obj so keys are shared
1547 * and can store only one thing
1548 *
1549 * @param[in] key The key associated with the value
1550 *
1551 * @return The value to set
1552 */
1553EOAPI Eina_Value *efl_key_value_get(const Eo *obj, const char * key);
1554
1444/** 1555/**
1445 * @brief Enable or disable the manual free feature. 1556 * @brief Enable or disable the manual free feature.
1446 * @param obj the object to work on. 1557 * @param obj the object to work on.
diff --git a/src/lib/eo/efl_object.eo b/src/lib/eo/efl_object.eo
index 8430b8aec7..33188756f5 100644
--- a/src/lib/eo/efl_object.eo
+++ b/src/lib/eo/efl_object.eo
@@ -156,90 +156,6 @@ abstract Efl.Object ()
156 } 156 }
157 return: Efl.Object; [[The first object found]] 157 return: Efl.Object; [[The first object found]]
158 } 158 }
159 @property key_data {
160 [[Generic data with string key on an object.
161
162 The user is in charge of freeing the data.
163 ]]
164 keys {
165 key: string; [[The key associated with the data]]
166 }
167 set {
168 values {
169 data: const(void_ptr); [[The data to set]]
170 }
171 }
172 get {
173 values {
174 data: void_ptr; [[The data to set]]
175 }
176 }
177 }
178 @property key_ref {
179 [[Generic object reference with string key to object.
180
181 The object will be automatically ref'd when set and unref'd
182 when replaced or deleted or referring object is deleted. If
183 the referenced object is deleted then the key is deleted
184 automatically.
185
186 This is the same key store used by key_data and key_value so keys
187 are shared and can store only one thing
188 ]]
189 keys {
190 key: string; [[The key associated with the object ref]]
191 }
192 set {
193 values {
194 objdata: const(Efl.Object); [[The object to set]]
195 }
196 }
197 get {
198 values {
199 objdata: Efl.Object; [[The object to set]]
200 }
201 }
202 }
203 @property key_wref {
204 [[Generic weak object reference with string key to object.
205
206 The object key will be removed if the object is removed, but
207 will not take or removed references like key_obj.
208
209 This is the same key store used by key_data and key_value so keys
210 are shared and can store only one thing
211 ]]
212 keys {
213 key: string; [[The key associated with the object ref]]
214 }
215 set {
216 values {
217 objdata: const(Efl.Object); [[The object to set]]
218 }
219 }
220 get {
221 values {
222 objdata: Efl.Object; [[The object to set]]
223 }
224 }
225 }
226 @property key_value {
227 [[Value on with string key on the object.
228
229 This stores the value with the given string key on the object
230 and it will be freed when replaced or deleted or the referring
231 object is deleted.
232
233 This is the same key store used by key_data and key_obj so keys
234 are shared and can store only one thing
235 ]]
236 keys {
237 key: string; [[The key associated with the value]]
238 }
239 values {
240 value: ptr(generic_value); [[The value to set]]
241 }
242 }
243 event_thaw { 159 event_thaw {
244 [[Thaw events of object. 160 [[Thaw events of object.
245 161
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 964a8c10c9..18c25bfc4d 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -283,12 +283,18 @@ _efl_object_key_data_set(Eo *obj, Efl_Object_Data *pd, const char *key, const vo
283 _key_generic_set(obj, pd, key, data, DATA_PTR, EINA_TRUE); 283 _key_generic_set(obj, pd, key, data, DATA_PTR, EINA_TRUE);
284} 284}
285 285
286EOAPI EFL_VOID_FUNC_BODYV(efl_key_data_set, EFL_FUNC_CALL(key, data),
287 const char *key, const void *data);
288
286EOLIAN static void * 289EOLIAN static void *
287_efl_object_key_data_get(Eo *obj, Efl_Object_Data *pd, const char *key) 290_efl_object_key_data_get(Eo *obj, Efl_Object_Data *pd, const char *key)
288{ 291{
289 return _key_generic_get(obj, pd, key, DATA_PTR); 292 return _key_generic_get(obj, pd, key, DATA_PTR);
290} 293}
291 294
295EOAPI EFL_FUNC_BODYV_CONST(efl_key_data_get, void *, NULL, EFL_FUNC_CALL(key),
296 const char *key);
297
292EOLIAN static void 298EOLIAN static void
293_efl_object_key_ref_set(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *key, const Eo *objdata) 299_efl_object_key_ref_set(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *key, const Eo *objdata)
294{ 300{
@@ -303,12 +309,18 @@ _efl_object_key_ref_set(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *ke
303 } 309 }
304} 310}
305 311
312EOAPI EFL_VOID_FUNC_BODYV(efl_key_ref_set, EFL_FUNC_CALL(key, objdata),
313 const char *key, const Efl_Object *objdata);
314
306EOLIAN static Eo * 315EOLIAN static Eo *
307_efl_object_key_ref_get(Eo *obj, Efl_Object_Data *pd, const char *key) 316_efl_object_key_ref_get(Eo *obj, Efl_Object_Data *pd, const char *key)
308{ 317{
309 return _key_generic_get(obj, pd, key, DATA_OBJ); 318 return _key_generic_get(obj, pd, key, DATA_OBJ);
310} 319}
311 320
321EOAPI EFL_FUNC_BODYV_CONST(efl_key_ref_get, Efl_Object *, NULL,
322 EFL_FUNC_CALL(key), const char *key);
323
312EOLIAN static void 324EOLIAN static void
313_efl_object_key_wref_set(Eo *obj, Efl_Object_Data *pd, const char * key, const Efl_Object *objdata) 325_efl_object_key_wref_set(Eo *obj, Efl_Object_Data *pd, const char * key, const Efl_Object *objdata)
314{ 326{
@@ -322,24 +334,36 @@ _efl_object_key_wref_set(Eo *obj, Efl_Object_Data *pd, const char * key, const E
322 } 334 }
323} 335}
324 336
337EOAPI EFL_VOID_FUNC_BODYV(efl_key_wref_set, EFL_FUNC_CALL(key, objdata),
338 const char *key, const Efl_Object *objdata);
339
325EOLIAN static Eo * 340EOLIAN static Eo *
326_efl_object_key_wref_get(Eo *obj, Efl_Object_Data *pd, const char * key) 341_efl_object_key_wref_get(Eo *obj, Efl_Object_Data *pd, const char * key)
327{ 342{
328 return _key_generic_get(obj, pd, key, DATA_OBJ_WEAK); 343 return _key_generic_get(obj, pd, key, DATA_OBJ_WEAK);
329} 344}
330 345
346EOAPI EFL_FUNC_BODYV_CONST(efl_key_wref_get, Efl_Object *, NULL,
347 EFL_FUNC_CALL(key), const char *key);
348
331EOLIAN static void 349EOLIAN static void
332_efl_object_key_value_set(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *key, Eina_Value *value) 350_efl_object_key_value_set(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *key, Eina_Value *value)
333{ 351{
334 _key_generic_set(obj, pd, key, value, DATA_VAL, EINA_TRUE); 352 _key_generic_set(obj, pd, key, value, DATA_VAL, EINA_TRUE);
335} 353}
336 354
355EOAPI EFL_VOID_FUNC_BODYV(efl_key_value_set, EFL_FUNC_CALL(key, value),
356 const char *key, Eina_Value *value);
357
337EOLIAN static Eina_Value * 358EOLIAN static Eina_Value *
338_efl_object_key_value_get(Eo *obj, Efl_Object_Data *pd, const char *key) 359_efl_object_key_value_get(Eo *obj, Efl_Object_Data *pd, const char *key)
339{ 360{
340 return _key_generic_get(obj, pd, key, DATA_VAL); 361 return _key_generic_get(obj, pd, key, DATA_VAL);
341} 362}
342 363
364EOAPI EFL_FUNC_BODYV_CONST(efl_key_value_get, Eina_Value *, NULL,
365 EFL_FUNC_CALL(key), const char *key);
366
343EOLIAN static void 367EOLIAN static void
344_efl_object_name_set(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *name) 368_efl_object_name_set(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *name)
345{ 369{
@@ -1980,6 +2004,14 @@ _efl_object_future_link(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, Efl_Future *li
1980 EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_object_dbg_info_get), \ 2004 EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_object_dbg_info_get), \
1981 EFL_OBJECT_OP_FUNC(efl_future_link, _efl_object_future_link), \ 2005 EFL_OBJECT_OP_FUNC(efl_future_link, _efl_object_future_link), \
1982 EFL_OBJECT_OP_FUNC(efl_wref_add, _efl_object_wref_add), \ 2006 EFL_OBJECT_OP_FUNC(efl_wref_add, _efl_object_wref_add), \
1983 EFL_OBJECT_OP_FUNC(efl_wref_del, _efl_object_wref_del) 2007 EFL_OBJECT_OP_FUNC(efl_wref_del, _efl_object_wref_del), \
2008 EFL_OBJECT_OP_FUNC(efl_key_data_set, _efl_object_key_data_set), \
2009 EFL_OBJECT_OP_FUNC(efl_key_data_get, _efl_object_key_data_get), \
2010 EFL_OBJECT_OP_FUNC(efl_key_ref_set, _efl_object_key_ref_set), \
2011 EFL_OBJECT_OP_FUNC(efl_key_ref_get, _efl_object_key_ref_get), \
2012 EFL_OBJECT_OP_FUNC(efl_key_wref_set, _efl_object_key_wref_set), \
2013 EFL_OBJECT_OP_FUNC(efl_key_wref_get, _efl_object_key_wref_get), \
2014 EFL_OBJECT_OP_FUNC(efl_key_value_set, _efl_object_key_value_set), \
2015 EFL_OBJECT_OP_FUNC(efl_key_value_get, _efl_object_key_value_get) \
1984 2016
1985#include "efl_object.eo.c" 2017#include "efl_object.eo.c"