File: template_openxr_reflection.h

package info (click to toggle)
openxr-sdk-source 1.0.14~dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,564 kB
  • sloc: python: 16,103; cpp: 12,052; ansic: 8,813; xml: 3,480; sh: 410; makefile: 338; ruby: 247
file content (103 lines) | stat: -rw-r--r-- 2,819 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef OPENXR_REFLECTION_H_
#define OPENXR_REFLECTION_H_ 1

/*
** Copyright (c) 2017-2021, The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0 OR MIT
*/

/*
** This header is generated from the Khronos OpenXR XML API Registry.
**
*/

#include "openxr.h"

/*
This file contains expansion macros (X Macros) for OpenXR enumerations and structures.
Example of how to use expansion macros to make an enum-to-string function:

#define XR_ENUM_CASE_STR(name, val) case name: return #name;
#define XR_ENUM_STR(enumType)                         \
    constexpr const char* XrEnumStr(enumType e) {     \
        switch (e) {                                  \
            XR_LIST_ENUM_##enumType(XR_ENUM_CASE_STR) \
            default: return "Unknown";                \
        }                                             \
    }                                                 \

XR_ENUM_STR(XrResult);
*/

//# for enum in enums

#define XR_LIST_ENUM_/*{enum.typeName}*/(_) \
//# for member in enum.enumTuples:
    _(/*{", ".join(member)}*/) \
//# endfor
    _(/*{enum.typeNamePrefix}*/_MAX_ENUM/*{enum.typeNameSuffix}*/, 0x7FFFFFFF)

//# endfor

//# for bitmask in bitmasks

#define XR_LIST_BITS_/*{bitmask.typeName}*/(_)/*{" \\" if bitmask.maskTuples else ""}*/
//# for member in bitmask.maskTuples
    _(/*{", ".join(member)}*/) \
//# endfor

//## Preceding line intentionally left blank to absorb the trailing backslash
//# endfor

//# for struct in structs

#define XR_LIST_STRUCT_/*{struct.typeName}*/(_) \
//# for member in struct.members
    _(/*{member}*/) \
//# endfor

//## Preceding line intentionally left blank to absorb the trailing backslash
//# endfor

//## Used when making structure type macros
/*% macro makeStructTypes(typedStructs) -%*/
//# for struct in typedStructs
    _(/*{struct.typeName}*/, /*{struct.structTypeName}*/) \
//# endfor

//## Preceding line intentionally left blank to absorb the trailing backslash
/*% endmacro %*/

#define XR_LIST_STRUCTURE_TYPES_CORE(_) \
/*{ makeStructTypes(unprotectedStructs) }*/


//# for protect, structTypes in protectedStructs

/*{ protect_begin(structTypes[0]) }*/
#define XR_LIST_STRUCTURE_TYPES_/*{protect | join("_")}*/(_) \
/*{ makeStructTypes(structTypes) }*/
#else
#define XR_LIST_STRUCTURE_TYPES_/*{protect | join("_")}*/(_)
#endif

//# endfor


#define XR_LIST_STRUCTURE_TYPES(_) \
    XR_LIST_STRUCTURE_TYPES_CORE(_) \
//# for protect, structTypes in protectedStructs
    XR_LIST_STRUCTURE_TYPES_/*{protect | join("_")}*/(_) \
//# endfor

//## Preceding line intentionally left blank to absorb the trailing backslash

#define XR_LIST_EXTENSIONS(_) \
//# for extname, extdata in extensions
    _(/*{extname}*/, /*{extdata.number}*/) \
//# endfor

//## Preceding line intentionally left blank to absorb the trailing backslash

#endif