forked from enlightenment/efl
eolian: add mstring
This is a new type representing a mutable string (no const). Regular strings cannot be made mutable with @owned because they might be hidden behind typedefs.
This commit is contained in:
parent
fdd27cadf8
commit
f36e5bd543
|
@ -383,7 +383,7 @@ class Efl.Net.Dialer.Http (Efl.Loop_User, Efl.Net.Dialer, Efl.Io.Sizer) {
|
||||||
params {
|
params {
|
||||||
epochtime: int64; [[UNIX Epoch time - seconds since 1/1/1970]]
|
epochtime: int64; [[UNIX Epoch time - seconds since 1/1/1970]]
|
||||||
}
|
}
|
||||||
return: string @owned @warn_unused; [[Newly allocated null-terminated string on success or NULL on errors]]
|
return: mstring @owned @warn_unused; [[Newly allocated null-terminated string on success or NULL on errors]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ mixin Efl.Access.Action ()
|
||||||
params {
|
params {
|
||||||
@in id: int; [[ID for widget]]
|
@in id: int; [[ID for widget]]
|
||||||
}
|
}
|
||||||
return: string @owned @warn_unused; [[Should be freed by the user.]]
|
return: mstring @owned @warn_unused; [[Should be freed by the user.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -632,7 +632,7 @@ class Elm.Entry (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
|
||||||
Only the text is returned, any format that may exist will not be part
|
Only the text is returned, any format that may exist will not be part
|
||||||
of the return value. You must free the string when done with \@ref free.
|
of the return value. You must free the string when done with \@ref free.
|
||||||
]]
|
]]
|
||||||
return: string @owned @warn_unused; [[Character]]
|
return: mstring @owned @warn_unused; [[Character]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property selection {
|
@property selection {
|
||||||
|
|
|
@ -70,7 +70,7 @@ interface Elm.Interface.Atspi.Text ()
|
||||||
end_offset: ptr(int); [[Offset indicating end of string according to given granularity. -1 in case of error.]]
|
end_offset: ptr(int); [[Offset indicating end of string according to given granularity. -1 in case of error.]]
|
||||||
}
|
}
|
||||||
values {
|
values {
|
||||||
string: string @owned; [[Newly allocated UTF-8 encoded string. Must be free by a user.]]
|
string: mstring @owned; [[Newly allocated UTF-8 encoded string. Must be free by a user.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property text @protected {
|
@property text @protected {
|
||||||
|
@ -82,7 +82,7 @@ interface Elm.Interface.Atspi.Text ()
|
||||||
end_offset: int; [[End offset of text.]]
|
end_offset: int; [[End offset of text.]]
|
||||||
}
|
}
|
||||||
values {
|
values {
|
||||||
text: string @owned; [[UTF-8 encoded text.]]
|
text: mstring @owned; [[UTF-8 encoded text.]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property caret_offset @protected {
|
@property caret_offset @protected {
|
||||||
|
@ -108,7 +108,7 @@ interface Elm.Interface.Atspi.Text ()
|
||||||
end_offset: ptr(int); [[Position in text to which given attribute is set.]]
|
end_offset: ptr(int); [[Position in text to which given attribute is set.]]
|
||||||
}
|
}
|
||||||
values {
|
values {
|
||||||
value: string @owned; [[Value of text attribute. Should be free()]]
|
value: mstring @owned; [[Value of text attribute. Should be free()]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property attributes @protected {
|
@property attributes @protected {
|
||||||
|
|
|
@ -339,8 +339,8 @@ class Elm.Web (Elm.Widget)
|
||||||
The string returned must be freed by the user when it's done
|
The string returned must be freed by the user when it's done
|
||||||
with it.
|
with it.
|
||||||
]]
|
]]
|
||||||
/* FIXME: const doesn't belong here */
|
/* FIXME: owned const string? */
|
||||||
return: const(string) @owned @warn_unused; [[A newly allocated string, or
|
return: string @owned @warn_unused; [[A newly allocated string, or
|
||||||
$null if nothing is selected
|
$null if nothing is selected
|
||||||
or an error occurred.]]
|
or an error occurred.]]
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,12 +146,7 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name,
|
||||||
}
|
}
|
||||||
int kw = eo_lexer_keyword_str_to_id(tp->name);
|
int kw = eo_lexer_keyword_str_to_id(tp->name);
|
||||||
if (kw && eo_lexer_is_type_keyword(kw))
|
if (kw && eo_lexer_is_type_keyword(kw))
|
||||||
{
|
eina_strbuf_append(buf, eo_lexer_get_c_type(kw));
|
||||||
/* FIXME: deal with aliased strings? */
|
|
||||||
if ((kw == KW_string) && !tp->owned)
|
|
||||||
eina_strbuf_append(buf, "const ");
|
|
||||||
eina_strbuf_append(buf, eo_lexer_get_c_type(kw));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
eina_strbuf_append(buf, tp->name);
|
eina_strbuf_append(buf, tp->name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ static const char * const ctypes[] =
|
||||||
|
|
||||||
"Eina_Accessor", "Eina_Array", "Eina_Iterator", "Eina_Hash", "Eina_List",
|
"Eina_Accessor", "Eina_Array", "Eina_Iterator", "Eina_Hash", "Eina_List",
|
||||||
"Efl_Future",
|
"Efl_Future",
|
||||||
"Eina_Value", "char *", "Eina_Stringshare *",
|
"Eina_Value", "char *", "const char *", "Eina_Stringshare *",
|
||||||
|
|
||||||
"void *",
|
"void *",
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,8 @@ enum Tokens
|
||||||
\
|
\
|
||||||
KW(accessor), KW(array), KW(iterator), KW(hash), KW(list), \
|
KW(accessor), KW(array), KW(iterator), KW(hash), KW(list), \
|
||||||
KW(future), \
|
KW(future), \
|
||||||
KW(generic_value), KW(string), KW(stringshare), \
|
KW(generic_value), \
|
||||||
|
KW(mstring), KW(string), KW(stringshare), \
|
||||||
\
|
\
|
||||||
KW(void_ptr), \
|
KW(void_ptr), \
|
||||||
KW(__builtin_free_cb), \
|
KW(__builtin_free_cb), \
|
||||||
|
|
|
@ -159,7 +159,7 @@ Efl.Text.Font, Efl.Text.Style, Efl.Text.Format, Efl.Text.Cursor, Efl.Text.Annota
|
||||||
@since 1.18
|
@since 1.18
|
||||||
]]
|
]]
|
||||||
legacy: null;
|
legacy: null;
|
||||||
return: string @owned; [[The text in the given range]]
|
return: mstring @owned; [[The text in the given range]]
|
||||||
params {
|
params {
|
||||||
@in cur1: const(ptr(Efl.Text.Cursor.Cursor)); [[Start of range]]
|
@in cur1: const(ptr(Efl.Text.Cursor.Cursor)); [[Start of range]]
|
||||||
@in cur2: const(ptr(Efl.Text.Cursor.Cursor)); [[End of range]]
|
@in cur2: const(ptr(Efl.Text.Cursor.Cursor)); [[End of range]]
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Complex_Type {
|
||||||
}
|
}
|
||||||
foo {
|
foo {
|
||||||
params {
|
params {
|
||||||
buf: string @owned;
|
buf: mstring @owned;
|
||||||
}
|
}
|
||||||
return: list<stringshare> @owned; [[comment for method return]]
|
return: list<stringshare> @owned; [[comment for method return]]
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Decl {
|
||||||
params {
|
params {
|
||||||
idx: int;
|
idx: int;
|
||||||
}
|
}
|
||||||
return: string @owned;
|
return: mstring @owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Enum {
|
||||||
params {
|
params {
|
||||||
idx: int;
|
idx: int;
|
||||||
}
|
}
|
||||||
return: string @owned;
|
return: mstring @owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Extern {
|
||||||
params {
|
params {
|
||||||
idx: int;
|
idx: int;
|
||||||
}
|
}
|
||||||
return: string @owned;
|
return: mstring @owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Free_Func {
|
||||||
params {
|
params {
|
||||||
idx: int;
|
idx: int;
|
||||||
}
|
}
|
||||||
return: string @owned;
|
return: mstring @owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Function_As_Argument {
|
||||||
a: int;
|
a: int;
|
||||||
b: double;
|
b: double;
|
||||||
}
|
}
|
||||||
return: string @owned;
|
return: mstring @owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ function SimpleFunc {
|
||||||
function ComplexFunc {
|
function ComplexFunc {
|
||||||
params {
|
params {
|
||||||
@in c: string;
|
@in c: string;
|
||||||
@out d: string @owned;
|
@out d: mstring @owned;
|
||||||
}
|
}
|
||||||
return: double;
|
return: double;
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Struct {
|
||||||
params {
|
params {
|
||||||
idx: int;
|
idx: int;
|
||||||
}
|
}
|
||||||
return: string @owned;
|
return: mstring @owned;
|
||||||
}
|
}
|
||||||
bar {
|
bar {
|
||||||
return: ptr(Named);
|
return: ptr(Named);
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Typedef {
|
||||||
params {
|
params {
|
||||||
idx: int;
|
idx: int;
|
||||||
}
|
}
|
||||||
return: string @owned;
|
return: mstring @owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Var {
|
||||||
params {
|
params {
|
||||||
idx: int;
|
idx: int;
|
||||||
}
|
}
|
||||||
return: string @owned;
|
return: mstring @owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Complex (Efl.Object)
|
||||||
}
|
}
|
||||||
instringowncont {
|
instringowncont {
|
||||||
params {
|
params {
|
||||||
l: list<string @owned>;
|
l: list<mstring @owned>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
instringcontown {
|
instringcontown {
|
||||||
|
@ -121,7 +121,7 @@ class Complex (Efl.Object)
|
||||||
}
|
}
|
||||||
outstringowncont {
|
outstringowncont {
|
||||||
params {
|
params {
|
||||||
@out l: list<string @owned>;
|
@out l: list<mstring @owned>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outstringcontown {
|
outstringcontown {
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Name1.Name2.Type_Generation (Efl.Object)
|
||||||
}
|
}
|
||||||
instringown {
|
instringown {
|
||||||
params {
|
params {
|
||||||
@in v: string @owned;
|
@in v: mstring @owned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
instringptrown {
|
instringptrown {
|
||||||
|
@ -102,7 +102,7 @@ class Name1.Name2.Type_Generation (Efl.Object)
|
||||||
return: ptr(string);
|
return: ptr(string);
|
||||||
}
|
}
|
||||||
returnstringown {
|
returnstringown {
|
||||||
return: string @owned;
|
return: mstring @owned;
|
||||||
}
|
}
|
||||||
returnstringownptr {
|
returnstringownptr {
|
||||||
return: ptr(string) @owned;
|
return: ptr(string) @owned;
|
||||||
|
|
Loading…
Reference in New Issue