Start getting rid of the terrible _information_get APIs, starting with events.
itr = eolian_class_events_get(class);
EINA_ITERATOR_FOREACH(itr, event)
{
- const char *evname = NULL;
- const char *evdesc = NULL;
- eolian_class_event_information_get(event, &evname, NULL, &evdesc);
+ const char *evname = eolian_event_name_get(event);
+ const char *evdesc = eolian_event_description_get(event);
if (!evdesc) evdesc = "No description";
eina_strbuf_reset(tmpbuf);
itr = eolian_class_events_get(class);
EINA_ITERATOR_FOREACH(itr, event)
{
- const char *evname;
- const char *evdesc;
+ const char *evname = eolian_event_name_get(event);
+ const char *evdesc = eolian_event_description_get(event);
char *evdesc_line1;
char *p;
eina_strbuf_reset(str_ev);
- eolian_class_event_information_get(event, &evname, NULL, &evdesc);
evdesc_line1 = _source_desc_get(evdesc);
eina_strbuf_append_printf(str_ev, "%s_EVENT_%s", class_env.upper_classname, evname);
p = (char *)eina_strbuf_string_get(str_ev);
itr = eolian_class_events_get(class);
EINA_ITERATOR_FOREACH(itr, event)
{
- const char *evname;
+ const char *evname = eolian_event_name_get(event);
char *p;
eina_strbuf_reset(tmpbuf);
- eolian_class_event_information_get(event, &evname, NULL, NULL);
eina_strbuf_append_printf(tmpbuf, "%s_EVENT_%s", class_env.upper_classname, evname);
p = (char *)eina_strbuf_string_get(tmpbuf);
eina_str_toupper(&p);
event_create(Eolian_Class const& klass, const Eolian_Event *event_)
{
efl::eolian::eo_event event;
- const char *name, *comment;
- if(::eolian_class_event_information_get(event_, &name, NULL, &comment))
+ const char *name = ::eolian_event_name_get(event_);
+ if (name)
{
std::string name_ = safe_str(name);
std::transform(name_.begin(), name_.end(), name_.begin(),
event.name = normalize_spaces(name_);
event.eo_name = safe_upper
(find_replace(class_full_name(klass), ".", "_") + "_EVENT_" + event.name);
- event.comment = safe_str(comment);
+ event.comment = safe_str(eolian_event_description_get(event_));
}
return event;
}
EAPI Eina_Iterator *eolian_class_events_get(const Eolian_Class *klass);
/*
- * @brief Get information about an event.
+ * @brief Get the name of an event.
*
- * @param[in] event handle of the event
- * @param[out] event_name name of the event
- * @param[out] event_type type of the event
- * @param[out] event_desc description of the event
- * @return EINA_TRUE on success, EINA_FALSE otherwise.
+ * @param[in] event the event handle
+ * @return the name or NULL
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Stringshare *eolian_event_name_get(const Eolian_Event *event);
+
+/*
+ * @brief Get the type of an event.
+ *
+ * @param[in] event the event handle
+ * @return the type or NULL
+ *
+ * @ingroup Eolian
+ */
+EAPI Eolian_Type *eolian_event_type_get(const Eolian_Event *event);
+
+/*
+ * @brief Get the description of an event.
+ *
+ * @param[in] event the event handle
+ * @return the description or NULL
*
* @ingroup Eolian
*/
-EAPI Eina_Bool eolian_class_event_information_get(const Eolian_Event *event, const char **event_name, const Eolian_Type **event_type, const char **event_desc);
+EAPI Eina_Stringshare *eolian_event_description_get(const Eolian_Event *event);
/*
* @brief Returns the scope of an event
*
* @ingroup Eolian
*/
-EAPI Eolian_Object_Scope eolian_class_event_scope_get(const Eolian_Event *event);
+EAPI Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event);
/*
* @brief Indicates if the class constructor has to invoke
#include <Eina.h>
#include "eolian_database.h"
-EAPI Eina_Bool
-eolian_class_event_information_get(const Eolian_Event *event, const char **event_name, const Eolian_Type **event_type, const char **event_comment)
+EAPI Eina_Stringshare *
+eolian_event_name_get(const Eolian_Event *event)
{
- EINA_SAFETY_ON_NULL_RETURN_VAL(event, EINA_FALSE);
- if (event_name) *event_name = event->name;
- if (event_type) *event_type = event->type;
- if (event_comment) *event_comment = event->comment;
- return EINA_TRUE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(event, NULL);
+ return event->name;
+}
+
+EAPI Eolian_Type *
+eolian_event_type_get(const Eolian_Event *event)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(event, NULL);
+ return event->type;
+}
+
+EAPI Eina_Stringshare *
+eolian_event_description_get(const Eolian_Event *event)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(event, NULL);
+ return event->comment;
}
EAPI Eolian_Object_Scope
-eolian_class_event_scope_get(const Eolian_Event *event)
+eolian_event_scope_get(const Eolian_Event *event)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(event, EOLIAN_SCOPE_PUBLIC);
return event->scope;
static void
_event_print(Eolian_Event *ev, int nb_spaces)
{
- const char *name, *comment;
- const Eolian_Type *type;
-
- eolian_class_event_information_get(ev, &name, &type, &comment);
- printf("%*s <%s> <", nb_spaces + 5, "", name);
+ const Eolian_Type *type = eolian_event_type_get(ev);
+ const char *desc = eolian_event_description_get(ev);
+ printf("%*s <%s> <", nb_spaces + 5, "", eolian_event_name_get(ev));
if (type) database_type_print((Eolian_Type*)type);
- printf("> <%s>\n", comment);
+ printf("> <%s>\n", desc ? desc : "");
}
static Eina_Bool _function_print(const Eolian_Function *fid, int nb_spaces)