added implementation of flt_i18n getter setter generation
Publish PHP Package / docker (push) Successful in 6s
Details
Publish PHP Package / docker (push) Successful in 6s
Details
This commit is contained in:
parent
06a96bfdca
commit
8a1fb3126e
|
@ -160,12 +160,23 @@ public FieldsMask fields_mask;
|
|||
|
||||
{%- macro decl_struct_field(o, f) -%}
|
||||
{{_self.attributes(f)}}
|
||||
public {{f.type|cs_type|obscure_type(f)}} {{f.name}} {% if not has_token(o, 'POD') -%} {{_self.decl_init_value(f)}} {%- endif -%};
|
||||
{% if has_token(f, 'flt_i18n') -%}
|
||||
{{f.type}} _{{f.name}} = "";
|
||||
List<{{f.type}}> __{{f.name}} = new List<{{f.type}}>();
|
||||
{%- endif ~%}
|
||||
public {{f.type|cs_type|obscure_type(f)}} {{f.name}} {% if not has_token(o, 'POD') -%} {{_self.decl_init_value(f)}} {%- endif -%} {% if not has_token(f, 'flt_i18n') -%};{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro decl_init_value(f) %}
|
||||
{%- if f.type is instanceof('\\mtgBuiltinType') -%}
|
||||
{%- if f.type.isstring -%} = ""{%- endif -%}
|
||||
{%- if f.type.isstring -%}
|
||||
{% if has_token(f, 'flt_i18n') -%}
|
||||
{get{return plural_{{f.name}}(double.NaN);}set{_{{f.name}}=value;}}
|
||||
{{f.type}} plural_{{f.name}}(double force_n){return MetaI18N.I18NPick(_{{f.name}},__{{f.name}},"#",force_n);}
|
||||
{%- else -%}
|
||||
= ""
|
||||
{%- endif ~%}
|
||||
{%- endif -%}
|
||||
{%- else -%}
|
||||
{%- if has_token(f, 'default') and token(f, 'default') == 'null' -%}
|
||||
/*null*/
|
||||
|
@ -180,7 +191,12 @@ public {{f.type|cs_type|obscure_type(f)}} {{f.name}} {% if not has_token(o, 'POD
|
|||
base.Reset();
|
||||
{%- endif -%}
|
||||
{%- for f in o.fields ~%}
|
||||
{{var_reset(f.name, f.type, token_or(f, 'default', null))}}
|
||||
{% set fname = f.name %}
|
||||
{% if has_token(f, 'flt_i18n') -%}
|
||||
{% set fname = '_' ~ f.name %}
|
||||
if(_{{fname}} == null) _{{fname}} = new(); else _{{fname}}.Clear();
|
||||
{%- endif ~%}
|
||||
{{var_reset(fname, f.type, token_or(f, 'default', null))}}
|
||||
{%- endfor -%}
|
||||
{%- if has_token(o, 'bitfields') ~%}
|
||||
ResetFieldMask();
|
||||
|
@ -279,7 +295,11 @@ bitctx.SyncMaskHeader();
|
|||
base.SyncFields(ctx);
|
||||
{%- endif -%}
|
||||
{%- for f in o.fields ~%}
|
||||
{{var_sync(f.name, f.type, 'ctx', f.tokens, get_sync_opts(o, 'bitctx'))}}
|
||||
{% set fname = f.name %}
|
||||
{% if has_token(f, 'flt_i18n') -%}
|
||||
{% set fname = '_' ~ f.name %}
|
||||
{%- endif -%}
|
||||
{{var_sync(fname, f.type, 'ctx', f.tokens, get_sync_opts(o, 'bitctx'))}}
|
||||
{%- endfor -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
|
|
Loading…
Reference in New Issue