<!--
Sample API v0.1.5 that generates code with all supported features.
-->
<!-- <config />: Include an optional config file with type and name redefinitions.
You can include as many configs as you want.
* Required attributes:
- file - Path to config file.
* Optional attributes: none
* Valid children: none
-->
<!-- Include config file for Rust -->
<!-- <var />: Generate a single variable. If nested by <func> tags, the variable
becomes the function's input parameter.
* Required attributes:
- type - Type of the variable. Tag will be ignored in generated code if
'type' is overriden to "" in language config (see ellipsis example).
- name - Variable name. Requried for standalone variables, optional for function parameters.
* Optional attributes:
- value - Initialization value for the variable or a default value for function parameter.
- qualifier - Variable's qualifier (extern, static, etc.)
* Valid children:
- <fptr /> - If <var /> is a function parameter, it can nest a <fptr /> which will
then be interpreted as the actual parameter. In this case, <var /> requires
no atributes.
-->
<!-- variable: extern void* void_ptr; -->
<!-- variable: int some_number = 1; -->
<!-- ignored variable - no type specified -->
<!-- <enum></enum>: Generate an enumerator.
* Required attributes:
- name - Enum name.
* Optional attributes:
- attribute - Adds an attribute/decorator to the enum. Ignored by C++.
* Valid children:
- <attribute /> - Adds an attribute/decorator to the enum. Use it if you want to
define multiple attributes.
- <var /> - Enumerator field. All fields except 'name' are optional.
If 'type' is specified, it will be ignored by C++ and interpreted
by Rust as a typecast.
-->
<!-- enum: (attribute and var types will be used only by Rust)
enum GenericEnum {
EnumVal1,
EnumVal2,
Count = 2,
};
-->
<!-- <bitflags></bitflags>: Generate a bitflag enumerator. This is a type
native to Rust language, when C++ is generated, it will create a standard enum.
* Required attributes:
- name - Bitflags name.
- type - Underlying data type.
* Optional attributes:
- attribute - Adds an attribute/decorator to bitflags.
* Valid children:
- <attribute /> - Adds an attribute/decorator to bitflags. Use it if you want to
define multiple attributes.
- <var /> - Bitflag numerator field. All fields except 'name' and 'value' are optional.
If 'type' is specified, it will be ignored by C++ and interpreted
by Rust as a typecast.
-->
<!-- bitflags:
//generated C++ code
enum SampleBitflags {
Field1 = 1,
Field2 = 2,
};
//generated Rust code
bitflags! {
#[repr(C)]
#[derive(Debug)]
flags SampleBitflags: c_int {
const FIELD1 = 1 as c_int,
const FIELD2 = 2 as c_int,
}
}
-->
<!-- alternative bitflags example -->
<!-- <func></func>: Generate a function.
* Required attributes:
- type - Function's return type.
- name - Name of the function.
* Optional attributes:
- qualifier - Function's qualifier (extern, static, etc.).
* Valid children:
- <var /> - Function patameter. Name is optional in this case. Function will take no
parameters if no <var />'s are defined.
- <fptr /> - Function parameter expressed as a function pointer.
-->
<!-- function: int get_ascii(char& letter, bool (*callback)(int code)); -->
<!-- function: int get_ascii_alt(char& letter, bool (*callback)(int code)); -->
<!-- Alternative way of defining a <fptr /> as a function parameter -->
<!-- function: static void process_func(); -->
<!-- function: void func_ellipsis(const char* str, ...); -->
<!-- no type specified - variable will be ignored -->
<!-- <fptr></fptr>: Generate a function pointer.
* Required attributes:
- type - Function pointer's return type.
- name - Name of the function pointer.
* Optional attributes:
- qualifier - Function pointer's qualifier (extern, static, etc.).
* Valid children:
- <var /> - Function patameter. Name is optional in this case. Fptr will take no
parameters if no <var />'s are defined.
- <fptr /> - Function parameter expressed as a function pointer.
-->
<!-- function pointer: int (*func_ptr)(); -->
<!-- function pointer: void (*f_ptr)(const int* fmt, void (*fptr_arg)(char&)); -->
<!-- <struct></struct>: Generate a structure.
* Required attributes:
name - Struct name.
* Optional attributes:
attribute - Adds an attribute/decorator to the struct. Ignored by C++.
* Valid children:
- <attribute /> (see enum for description)
- <var />
- <func />
- <fptr />
- <enum />
- <struct />
-->
<!-- Generate a structure with nested elements -->
<!-- unsupported items will be ignored -->