aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/gtad.yaml
blob: cb68ad1be11bad2ab584fe9bc33de66573487381 (plain)
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
analyzer:
  subst:
    "%CLIENT_RELEASE_LABEL%": r0
    "%CLIENT_MAJOR_VERSION%": r0
  identifiers:
    signed: signedData
    unsigned: unsignedData
    default: isDefault
    origin_server_ts: originServerTimestamp # Instead of originServerTs
    start: begin # Because start() is a method in BaseJob

  types:
    # Structure:
    # swaggerType: <targetTypeSpec>
    # OR
    # swaggerType:
    #   - swaggerFormat: <targetTypeSpec>
    #   - /swaggerFormatRegEx/: <targetTypeSpec>
    #   - //: <targetTypeSpec> # default, if the format doesn't mach anything above
    # WHERE
    # targetTypeSpec = targetType OR
    #   { type: targetType, imports: <filename OR [ filenames... ]>, <other attributes...> }
    integer:
    - int64: qint64
    - int32: qint32
    - //: int
    number:
    - float: float
    - //: double
    boolean: { type: bool, omitted: false }
    string:
    - byte: &ByteStream
        type: QIODevice*
        imports: <QtCore/QIODevice>
    - binary: *ByteStream
    - date:
        type: QDate
        initializer: QDate::fromString("{{defaultValue}}")
        avoidCopy?: true
        imports: <QtCore/QDate>
    - dateTime:
        type: QDateTime
        initializer: QDateTime::fromString("{{defaultValue}}")
        avoidCopy?: true
        imports: <QtCore/QDateTime>
    - //:
        type: QString
        initializer: QStringLiteral("{{defaultValue}}")
        string?: true
        avoidCopy?: true
    file: *ByteStream
    object:
    - /state_event.yaml$/:
        type: StateEventPtr
        noCopy?: true
        imports: '"events/event.h"'
    - /room_event.yaml$/:
        type: RoomEventPtr
        noCopy?: true
        imports: '"events/event.h"'
    - /event.yaml$/:
        type: EventPtr
        noCopy?: true
        imports: '"events/event.h"'
    - //:
        type: QJsonObject
        avoidCopy?: true
        imports: <QtCore/QJsonObject>
    array:
    - string:
        type: QStringList
        avoidCopy?: true
        imports: <QtCore/QStringList>
    - /^Notification|Result$/:
        type: "std::vector<{{1}}>"
        noCopy?: true
        imports: '"events/event.h"'
    - /m\.room\.member$/:
        type: "EventsArray<RoomMemberEvent>"
        noCopy?: true
        imports: '"events/roommemberevent.h"'
    - /state_event.yaml$/:
        type: StateEvents
        noCopy?: true
    - /room_event.yaml$/:
        type: RoomEvents
        noCopy?: true
    - /event.yaml$/:
        type: Events
        noCopy?: true
    - /.+/:
        type: "QVector<{{1}}>"
        avoidCopy?: true
        imports: <QtCore/QVector>
    - //: { type: QJsonArray, "avoidCopy?": true, imports: <QtCore/QJsonArray> }
    map:
    - RoomState:
        type: "std::unordered_map<QString, {{1}}>"
        noCopy?: true
        imports: <unordered_map>
    - /.+/:
        type: "QHash<QString, {{1}}>"
        avoidCopy?: true
        imports: <QtCore/QHash>
    - //:
        type: QVariantHash
        avoidCopy?: true
        imports: '"variant_converters.h"'
    variant:
      type: QVariant
      avoidCopy?: true
      imports: '"variant_converters.h"'
    schema: # Properties of inline structure definitions
      avoidCopy?: true
      omitted: omitted<{{dataType.name}}>()
      imports: '"converters.h"'

  #operations:

mustache:
  definitions:
    _scopeRenderer: "{{scopeCamelCase}}Job::"
    _literalQuote: '"'
    # Default value for omitted
    omitted: '{}'
    maybeCrefType: "{{#avoidCopy?}}const {{/avoidCopy?}}{{dataType.name}}{{#avoidCopy?}}&{{/avoidCopy?}}{{#noCopy?}}&&{{/noCopy?}}"
    qualifiedMaybeCrefType:
      "{{#avoidCopy?}}const {{/avoidCopy?}}{{dataType.qualifiedName}}{{#avoidCopy?}}&{{/avoidCopy?}}{{#noCopy?}}&&{{/noCopy?}}"
    initializeDefaultValue: "{{#defaultValue}}{{#initializer}}{{>initializer}}{{/initializer}}{{/defaultValue}}{{^defaultValue}}{{>omitted}}{{/defaultValue}}"
    joinedParamDecl: '{{>maybeCrefType}} {{paramName}}{{^required?}} = {{>initializeDefaultValue}}{{/required?}}{{#@join}}, {{/@join}}'
    joinedParamDef: '{{>maybeCrefType}} {{paramName}}{{#@join}}, {{/@join}}'
    passQueryParams: '{{#queryParams}}{{paramName}}{{#@join}}, {{/@join}}{{/queryParams}}'
    paramToString: '{{#string?}}{{nameCamelCase}}{{/string?}}{{^string?}}QString("%1").arg({{nameCamelCase}}){{/string?}}'
  #  preamble: preamble.mustache
    copyrightName: Kitsune Ral
    copyrightEmail: <kitsune-ral@users.sf.net>

  templates:
  - "{{base}}.h.mustache"
  - "{{base}}.cpp.mustache"

  #outFilesList: apifiles.txt