mirror of
https://github.com/justinian/j6-uefi-headers.git
synced 2025-12-10 00:24:32 -08:00
Move proto generation template into separate file
This commit is contained in:
54
templates/proto.j2
Normal file
54
templates/proto.j2
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
#ifndef _uefi_protos_{{ name }}_h_
|
||||
#define _uefi_protos_{{ name }}_h_
|
||||
|
||||
// This file was auto generated by the j6-uefi-headers project. Please see
|
||||
// https://github.com/justinian/j6-uefi-headers for more information.
|
||||
|
||||
#include <uefi/guid.h>
|
||||
#include <uefi/types.h>
|
||||
{%- for header in headers %}
|
||||
#include <{{ header }}>
|
||||
{%- endfor %}
|
||||
|
||||
namespace uefi {
|
||||
namespace protos {
|
||||
struct {{ name }};
|
||||
|
||||
struct {{ name }}
|
||||
{
|
||||
{% if guid %}static constexpr uefi::guid guid{ {{ guid }} };{% endif %}
|
||||
{% for method in methods %}
|
||||
inline uefi::status {{ method.name }}(
|
||||
{%- for arg in method.args -%}
|
||||
{% if not loop.first %}, {% endif -%}
|
||||
{{ arg.type }} {{ arg.name }}
|
||||
{%- endfor %}) {
|
||||
return _{{ method.name }}(
|
||||
{%- if not method.get("skip_this", false) -%}this{%- endif -%}
|
||||
{%- if not method.get("skip_this", false) and method.args %}, {% endif -%}
|
||||
{{ method.args|join(', ', attribute='name') }});
|
||||
}
|
||||
{% endfor %}
|
||||
{%- for datum in pre_data %}
|
||||
{{ datum.type }} {{ datum.name }};
|
||||
{%- endfor %}
|
||||
|
||||
protected:
|
||||
{%- for method in methods %}
|
||||
using _{{ method.name }}_def = uefi::status (*)(
|
||||
{%- if not method.get("skip_this", false) -%}uefi::protos::{{ name }} *{%- endif -%}
|
||||
{%- if not method.get("skip_this", false) and method.args %}, {% endif -%}
|
||||
{{ method.args|join(', ', attribute='type') }});
|
||||
_{{ method.name }}_def _{{ method.name }};
|
||||
{% endfor %}
|
||||
public:
|
||||
{%- for datum in post_data %}
|
||||
{{ datum.type }} {{ datum.name }};
|
||||
{%- endfor %}
|
||||
};
|
||||
|
||||
} // namespace protos
|
||||
} // namespace uefi
|
||||
|
||||
#endif // _uefi_protos_{{ name }}_h_
|
||||
Reference in New Issue
Block a user