eolian: allow tagging complete classes as BETA

Summary:
This allows using the @beta tag in classes, like this:
class @beta Efl.Foo extends Efl.Bar { ... }

This will surround the class definition in the .eo.h file with an
EFL_BETA_API_SUPPORT #define, equivalent to tag every method and
event with @beta.

Test Plan: Nothing changes since no class uses this tag yet

Reviewers: q66, bu5hm4n, zmike

Reviewed By: q66

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7933
This commit is contained in:
Xavi Artigas 2019-02-13 18:12:59 +01:00
parent 6b7346b7b2
commit 19fcd6e60f
5 changed files with 31 additions and 0 deletions

View File

@ -192,6 +192,10 @@ eo_gen_header_gen(const Eolian_State *state, const Eolian_Class *cl,
/* class definition */
if (!legacy && eolian_class_is_beta(cl))
{
eina_strbuf_append(buf, "#ifdef EFL_BETA_API_SUPPORT\n");
}
if (!legacy)
{
const Eolian_Documentation *doc = eolian_class_documentation_get(cl);
@ -298,6 +302,10 @@ events:
}
eina_iterator_free(itr);
}
if (!legacy && eolian_class_is_beta(cl))
{
eina_strbuf_append(buf, "#endif /* EFL_BETA_API_SUPPORT */\n");
}
free(cname);
free(cnameu);

View File

@ -2298,6 +2298,16 @@ EAPI Eina_Stringshare *eolian_class_c_name_get(const Eolian_Class *klass);
*/
EAPI Eina_Stringshare *eolian_class_c_data_type_get(const Eolian_Class *klass);
/*
* @brief Get whether a class is beta.
*
* @param[in] klass the class
* @return EINA_TRUE if the class has been marked as BETA
*
* @ingroup Eolian
*/
EAPI Eina_Bool eolian_class_is_beta(const Eolian_Class *klass);
/*
* @brief Get the type of a type declaration.
*

View File

@ -228,3 +228,10 @@ eolian_class_c_data_type_get(const Eolian_Class *cl)
*p = '_';
return eina_stringshare_add(buf);
}
EAPI Eina_Bool
eolian_class_is_beta(const Eolian_Class *cl)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
return cl->is_beta;
}

View File

@ -2093,6 +2093,11 @@ parse_class(Eo_Lexer *ls, Eolian_Class_Type type)
eo_lexer_get(ls);
ls->klass->type = type;
eo_lexer_context_push(ls);
if (ls->t.kw == KW_at_beta)
{
ls->klass->is_beta = EINA_TRUE;
eo_lexer_get(ls);
}
parse_name(ls, buf);
bnm = eina_stringshare_ref(ls->filename);
fnm = database_class_to_filename(eina_strbuf_string_get(buf));

View File

@ -196,6 +196,7 @@ struct _Eolian_Class
Eina_List *callables; /* internal for now */
Eina_Bool class_ctor_enable:1;
Eina_Bool class_dtor_enable:1;
Eina_Bool is_beta :1;
};
struct _Eolian_Function