summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-02-12 13:24:06 +0000
committerDaniel Kolesa <d.kolesa@samsung.com>2015-02-12 13:24:06 +0000
commit430169053570ba4c3dc21ec2ae07f5b295939f6a (patch)
tree87f59e004541d85616fd8dd98b9ab95cdfabce82 /src
parent5b8f3a083b5e3d2e84e8d6c2ddfefab530792683 (diff)
eolian: add APIs for nullable/optional (+ lua bindings)
Diffstat (limited to 'src')
-rw-r--r--src/bindings/luajit/eolian.lua10
-rw-r--r--src/lib/eolian/Eolian.h20
-rw-r--r--src/lib/eolian/database_function_parameter_api.c14
3 files changed, 44 insertions, 0 deletions
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index f92f0961c6..986817065a 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -227,6 +227,8 @@ ffi.cdef [[
227 const char *eolian_parameter_description_get(const Eolian_Function_Parameter *param); 227 const char *eolian_parameter_description_get(const Eolian_Function_Parameter *param);
228 Eina_Bool eolian_parameter_const_attribute_get(const Eolian_Function_Parameter *param_desc, Eina_Bool is_get); 228 Eina_Bool eolian_parameter_const_attribute_get(const Eolian_Function_Parameter *param_desc, Eina_Bool is_get);
229 Eina_Bool eolian_parameter_is_nonull(const Eolian_Function_Parameter *param_desc); 229 Eina_Bool eolian_parameter_is_nonull(const Eolian_Function_Parameter *param_desc);
230 Eina_Bool eolian_parameter_is_nullable(const Eolian_Function_Parameter *param_desc);
231 Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc);
230 const Eolian_Type *eolian_function_return_type_get(const Eolian_Function *function_id, Eolian_Function_Type ftype); 232 const Eolian_Type *eolian_function_return_type_get(const Eolian_Function *function_id, Eolian_Function_Type ftype);
231 const Eolian_Expression *eolian_function_return_default_value_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype); 233 const Eolian_Expression *eolian_function_return_default_value_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
232 const char *eolian_function_return_comment_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype); 234 const char *eolian_function_return_comment_get(const Eolian_Function *foo_id, Eolian_Function_Type ftype);
@@ -766,6 +768,14 @@ ffi.metatype("Eolian_Function_Parameter", {
766 768
767 is_nonull = function(self) 769 is_nonull = function(self)
768 return eolian.eolian_parameter_is_nonull(self) ~= 0 770 return eolian.eolian_parameter_is_nonull(self) ~= 0
771 end,
772
773 is_nullable = function(self)
774 return eolian.eolian_parameter_is_nullable(self) ~= 0
775 end,
776
777 is_optional = function(self)
778 return eolian.eolian_parameter_is_optional(self) ~= 0
769 end 779 end
770 } 780 }
771}) 781})
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 9464cdfb4d..e5531803b7 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -1010,6 +1010,26 @@ EAPI Eina_Bool eolian_parameter_const_attribute_get(const Eolian_Function_Parame
1010EAPI Eina_Bool eolian_parameter_is_nonull(const Eolian_Function_Parameter *param_desc); 1010EAPI Eina_Bool eolian_parameter_is_nonull(const Eolian_Function_Parameter *param_desc);
1011 1011
1012/* 1012/*
1013 * @brief Indicates if a parameter is nullable.
1014 *
1015 * @param[in] param_desc parameter handle
1016 * @return EINA_TRUE if nullable, EINA_FALSE otherwise
1017 *
1018 * @ingroup Eolian
1019 */
1020EAPI Eina_Bool eolian_parameter_is_nullable(const Eolian_Function_Parameter *param_desc);
1021
1022/*
1023 * @brief Indicates if a parameter is optional.
1024 *
1025 * @param[in] param_desc parameter handle
1026 * @return EINA_TRUE if optional, EINA_FALSE otherwise
1027 *
1028 * @ingroup Eolian
1029 */
1030EAPI Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc);
1031
1032/*
1013 * @brief Get the return type of a function. 1033 * @brief Get the return type of a function.
1014 * 1034 *
1015 * @param[in] function_id id of the function 1035 * @param[in] function_id id of the function
diff --git a/src/lib/eolian/database_function_parameter_api.c b/src/lib/eolian/database_function_parameter_api.c
index 744926e37c..6d7ad81d0c 100644
--- a/src/lib/eolian/database_function_parameter_api.c
+++ b/src/lib/eolian/database_function_parameter_api.c
@@ -56,3 +56,17 @@ eolian_parameter_is_nonull(const Eolian_Function_Parameter *param)
56 EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE); 56 EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
57 return param->nonull; 57 return param->nonull;
58} 58}
59
60EAPI Eina_Bool
61eolian_parameter_is_nullable(const Eolian_Function_Parameter *param)
62{
63 EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
64 return param->nullable;
65}
66
67EAPI Eina_Bool
68eolian_parameter_is_optional(const Eolian_Function_Parameter *param)
69{
70 EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
71 return param->optional;
72}