Gradually migrating to new metagen
This commit is contained in:
parent
e1287dbb29
commit
496c3cb082
|
@ -19,6 +19,24 @@ function get_twig(array $inc_path = [])
|
|||
return $twig;
|
||||
}
|
||||
|
||||
function supported_tokens()
|
||||
{
|
||||
return [
|
||||
'POD',
|
||||
'default',
|
||||
'optional',
|
||||
'cloneable',
|
||||
'virtual',
|
||||
'id',
|
||||
'owner',
|
||||
'pkey',
|
||||
//TODO:
|
||||
//'obscured',
|
||||
//'bitfields',
|
||||
//'diffable',
|
||||
];
|
||||
}
|
||||
|
||||
function _add_twig_support(\Twig\Environment $twig)
|
||||
{
|
||||
$twig->addTest(new \Twig\TwigTest('instanceof',
|
||||
|
|
|
@ -16,7 +16,11 @@ static public class AutogenBundle
|
|||
{
|
||||
switch(code)
|
||||
{
|
||||
%create_rpc_by_id%
|
||||
{%- for u in meta.getunits ~%}
|
||||
{%- if u.object is instanceof('\\mtgMetaRPC') ~%}
|
||||
case {{u.object.code}}: { return new {{u.object.name}}(); }
|
||||
{%- endif ~%}
|
||||
{%- endfor ~%}
|
||||
default:
|
||||
{
|
||||
return null;
|
||||
|
@ -28,7 +32,11 @@ static public class AutogenBundle
|
|||
{
|
||||
switch(class_id)
|
||||
{
|
||||
%create_struct_by_crc28%
|
||||
{%- for u in meta.getunits ~%}
|
||||
{%- if u.object is instanceof('\\mtgMetaEnum') or u.object is instanceof('\\mtgMetaStruct')~%}
|
||||
case {{u.object.classid}}: { return new {{u.object.name}}(); }
|
||||
{%- endif ~%}
|
||||
{%- endfor ~%}
|
||||
default:
|
||||
{
|
||||
return null;
|
||||
|
@ -40,7 +48,11 @@ static public class AutogenBundle
|
|||
{
|
||||
switch(class_id)
|
||||
{
|
||||
%id2type%
|
||||
{%- for u in meta.getunits ~%}
|
||||
{%- if u.object is instanceof('\\mtgMetaEnum') or u.object is instanceof('\\mtgMetaStruct')~%}
|
||||
case {{u.object.classid}}: { return typeof({{u.object.name}}); }
|
||||
{%- endif ~%}
|
||||
{%- endfor ~%}
|
||||
default:
|
||||
{
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue