fix: update BMapSharp virtools type.
- update BMapSharp virtools types. - fix enum migration generation error.
This commit is contained in:
@@ -65,6 +65,24 @@ class RenderUtils:
|
||||
"""
|
||||
return RenderUtils.REGEX_PY_TO_LITERAL_NUMBER.sub("", numstr, 1)
|
||||
|
||||
REGEX_CS_TO_LITERAL_NUMBER: typing.ClassVar[re.Pattern] = re.compile("[lL]+$")
|
||||
|
||||
@staticmethod
|
||||
def to_cs_num_literal(numstr: str) -> str:
|
||||
"""
|
||||
Convert given string into C# number literal style.
|
||||
|
||||
Number literal declaration in C# is slightly different with C#.
|
||||
C# support U but do not support L.
|
||||
So this function actually just remove "L" suffix.
|
||||
|
||||
This function is only served for C# code generation.
|
||||
|
||||
:param numstr: The captured number.
|
||||
:return: The C# style number string.
|
||||
"""
|
||||
return RenderUtils.REGEX_CS_TO_LITERAL_NUMBER.sub("", numstr, 1)
|
||||
|
||||
REGEX_PY_EXT_HUMANRDABLE_ENTRY_NAME: typing.ClassVar[re.Pattern] = re.compile("^[a-zA-Z0-9]+_")
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -5,7 +5,12 @@
|
||||
[Flags]{%- endif %}
|
||||
public enum {{ benum.get_enum_name() }} : {% if benum.get_can_unsigned() -%} uint {%- else -%} int {%- endif %} {
|
||||
{%- for entry in benum.iter_entries() %}
|
||||
{{ entry.get_entry_name() }} {%- if entry.get_entry_value() is not none %} = {{ entry.get_entry_value() }} {%- endif %}, {%- if entry.get_entry_comment() is not none %} /// {{ entry.get_entry_comment() | line_comment }} {%- endif %}
|
||||
{%- if entry.get_entry_comment() is not none %}
|
||||
/// <summary>
|
||||
/// {{ entry.get_entry_comment() | line_comment }}
|
||||
/// </summary>
|
||||
{%- endif %}
|
||||
{{ entry.get_entry_name() }} {%- if entry.get_entry_value() is not none %} = {{ utils.to_cs_num_literal(entry.get_entry_value()) }} {%- endif %},
|
||||
{%- endfor %}
|
||||
};
|
||||
{%- endfor %}
|
||||
|
||||
Reference in New Issue
Block a user