Text_Utilities.jinja 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. {####
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. ####-#}
  8. {% macro PrintName(uuid, class) %}
  9. {% if class.Namespace is defined %}
  10. {% set className = "{0}::{1}".format(class.Namespace, class.Name) %}
  11. {% else %}
  12. {% set className = class.Name %}
  13. {% endif %}
  14. {% if class.Id == className %}
  15. {{ uuid }} - {{class.Id}}
  16. {% else %}
  17. {{ uuid }} - {{class.Id}} - {{className}}
  18. {% endif %}
  19. {%- endmacro -%}
  20. {% macro PrintPrimitive(context, uuid) %}
  21. {% if context[uuid] is defined and context[uuid].IsPrimitive %}
  22. [Primitive]
  23. {%- endif -%}
  24. {%- endmacro -%}
  25. {% macro PrintClassContent(context, indention, uuid) %}
  26. {% if context[uuid] is defined %}
  27. {% for base in context[uuid].Bases -%}
  28. {{ ' '|safe*indention}}{{ base.Type }} [Base]
  29. {{ PrintClassContent(context, indention + 2, base.Uuid) -}}
  30. {% endfor -%}
  31. {% for field in context[uuid].Fields -%}
  32. {{ ' '|safe*indention}}{{ field.Type }} {{ field.Name }} {{ PrintPrimitive(context, field.Uuid) }}
  33. {{ PrintClassContent(context, indention + 2, field.Uuid) -}}
  34. {% endfor -%}
  35. {% endif -%}
  36. {% endmacro -%}