eolian: APIs to check if an implement references get/set
authorDaniel Kolesa <d.kolesa@samsung.com>
Fri, 29 Aug 2014 14:30:51 +0000 (15:30 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Fri, 29 Aug 2014 14:30:51 +0000 (15:30 +0100)
src/bin/eolian/eo_generator.c
src/bin/eolian/impl_generator.c
src/lib/eolian/Eolian.h
src/lib/eolian/database_implement_api.c

index 9826d4a..c4cc89c 100644 (file)
@@ -661,6 +661,8 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
         const char *rets;
         char *tp = implname;
 
+        const char *names[] = { "", "getter ", "setter " };
+
         if ((impl_class = eolian_implement_class_get(impl_desc)))
           {
              fnid = eolian_implement_function_get(impl_desc, &ftype);
@@ -673,8 +675,10 @@ eo_source_end_generate(const Eolian_Class *class, Eina_Strbuf *buf)
 
         if (!fnid)
           {
-             ERR ("Failed to generate implementation of %s - missing form super class",
-                   eolian_implement_full_name_get(impl_desc));
+             const char *name = names[eolian_implement_is_prop_get(impl_desc)
+                                   | (eolian_implement_is_prop_set(impl_desc) << 1)];
+             ERR ("Failed to generate implementation of %s%s - missing form super class",
+                   name, eolian_implement_full_name_get(impl_desc));
              goto end;
           }
 
index e024199..c91ca42 100644 (file)
@@ -276,13 +276,16 @@ impl_source_generate(const Eolian_Class *class, Eina_Strbuf *buffer)
    if (itr)
      {
         Eolian_Implement *impl_desc;
+        const char *names[] = { "", "getter ", "setter " };
         EINA_ITERATOR_FOREACH(itr, impl_desc)
           {
              Eolian_Function_Type ftype;
              if (!(foo = eolian_implement_function_get(impl_desc, &ftype)))
                {
-                  ERR ("Failed to generate implementation of %s - missing form super class",
-                        eolian_implement_full_name_get(impl_desc));
+                  const char *name = names[eolian_implement_is_prop_get(impl_desc)
+                                        | (eolian_implement_is_prop_set(impl_desc) << 1)];
+                  ERR ("Failed to generate implementation of %s%s - missing form super class",
+                        name, eolian_implement_full_name_get(impl_desc));
                   goto end;
                }
              switch (ftype)
index 84076a7..4996315 100644 (file)
@@ -946,6 +946,26 @@ EAPI Eina_Bool eolian_implement_is_auto(const Eolian_Implement *impl);
 EAPI Eina_Bool eolian_implement_is_empty(const Eolian_Implement *impl);
 
 /*
+ * @brief Get whether an implement references a property getter.
+ *
+ * @param[in] impl the handle of the implement
+ * @return EINA_TRUE when it does, EINA_FALSE when it's not.
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Bool eolian_implement_is_prop_get(const Eolian_Implement *impl);
+
+/*
+ * @brief Get whether an implement references a property setter.
+ *
+ * @param[in] impl the handle of the implement
+ * @return EINA_TRUE when it does, EINA_FALSE when it's not.
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Bool eolian_implement_is_prop_set(const Eolian_Implement *impl);
+
+/*
  * @brief Get an iterator to the overriding functions defined in a class.
  *
  * @param[in] klass the class.
index d3c03de..38cdd26 100644 (file)
@@ -121,3 +121,17 @@ eolian_implement_is_empty(const Eolian_Implement *impl)
    EINA_SAFETY_ON_NULL_RETURN_VAL(impl, EINA_FALSE);
    return impl->is_empty;
 }
+
+EAPI Eina_Bool
+eolian_implement_is_prop_get(const Eolian_Implement *impl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(impl, EINA_FALSE);
+   return impl->is_prop_get;
+}
+
+EAPI Eina_Bool
+eolian_implement_is_prop_set(const Eolian_Implement *impl)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(impl, EINA_FALSE);
+   return impl->is_prop_set;
+}