redsnow 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -1
- data/README.md +12 -0
- data/ext/snowcrash/bin/snowcrash +0 -0
- data/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.c +5 -2
- data/ext/snowcrash/snowcrash.gyp +7 -2
- data/ext/snowcrash/src/ActionParser.h +141 -81
- data/ext/snowcrash/src/AssetParser.h +19 -11
- data/ext/snowcrash/src/Blueprint.h +44 -14
- data/ext/snowcrash/src/BlueprintParser.h +65 -51
- data/ext/snowcrash/src/BlueprintSourcemap.h +254 -0
- data/ext/snowcrash/src/BlueprintUtility.h +3 -24
- data/ext/snowcrash/src/CBlueprint.cc +40 -31
- data/ext/snowcrash/src/CBlueprint.h +54 -58
- data/ext/snowcrash/src/CBlueprintSourcemap.cc +620 -0
- data/ext/snowcrash/src/CBlueprintSourcemap.h +342 -0
- data/ext/snowcrash/src/CSourceAnnotation.cc +14 -0
- data/ext/snowcrash/src/CodeBlockUtility.h +42 -5
- data/ext/snowcrash/src/HeadersParser.h +84 -42
- data/ext/snowcrash/src/ParameterParser.h +110 -68
- data/ext/snowcrash/src/ParametersParser.h +26 -28
- data/ext/snowcrash/src/PayloadParser.h +164 -83
- data/ext/snowcrash/src/ResourceGroupParser.h +35 -41
- data/ext/snowcrash/src/ResourceParser.h +142 -97
- data/ext/snowcrash/src/SectionParser.h +15 -14
- data/ext/snowcrash/src/SectionParserData.h +11 -2
- data/ext/snowcrash/src/SectionProcessor.h +42 -18
- data/ext/snowcrash/src/Serialize.cc +2 -0
- data/ext/snowcrash/src/Serialize.h +3 -1
- data/ext/snowcrash/src/SerializeJSON.cc +608 -16
- data/ext/snowcrash/src/SerializeJSON.h +4 -1
- data/ext/snowcrash/src/SerializeYAML.cc +367 -19
- data/ext/snowcrash/src/SerializeYAML.h +4 -1
- data/ext/snowcrash/src/SymbolTable.h +12 -1
- data/ext/snowcrash/src/ValuesParser.h +12 -11
- data/ext/snowcrash/src/Version.h +1 -1
- data/ext/snowcrash/src/csnowcrash.cc +7 -3
- data/ext/snowcrash/src/csnowcrash.h +4 -2
- data/ext/snowcrash/src/snowcrash.cc +10 -11
- data/ext/snowcrash/src/snowcrash.h +3 -3
- data/ext/snowcrash/src/snowcrash/snowcrash.cc +38 -8
- data/ext/snowcrash/tools/homebrew/snowcrash.rb +1 -1
- data/lib/redsnow.rb +41 -2
- data/lib/redsnow/binding.rb +93 -8
- data/lib/redsnow/blueprint.rb +48 -25
- data/lib/redsnow/parseresult.rb +9 -2
- data/lib/redsnow/sourcemap.rb +369 -0
- data/lib/redsnow/version.rb +1 -1
- data/test/fixtures/sample-api-ast.json +1 -1
- data/test/fixtures/sample-api-sourcemap.json +169 -0
- data/test/redsnow_binding_test.rb +19 -2
- data/test/redsnow_options_test.rb +42 -0
- data/test/redsnow_parseresult_test.rb +5 -1
- data/test/redsnow_test.rb +5 -0
- metadata +11 -2
@@ -0,0 +1,620 @@
|
|
1
|
+
//
|
2
|
+
// CBlueprintSourcemap.cc
|
3
|
+
// snowcrash
|
4
|
+
// C Implementation of BlueprintSourcemap.h for binding purposes
|
5
|
+
//
|
6
|
+
// Created by Pavan Kumar Sunkara on 15/9/14.
|
7
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
8
|
+
//
|
9
|
+
|
10
|
+
#include "CBlueprintSourcemap.h"
|
11
|
+
#include "snowcrash.h"
|
12
|
+
|
13
|
+
SC_API size_t sc_source_map_size(const sc_source_map_t* source_map)
|
14
|
+
{
|
15
|
+
const mdp::BytesRangeSet* p = AS_CTYPE(mdp::BytesRangeSet, source_map);
|
16
|
+
if(!p)
|
17
|
+
return 0;
|
18
|
+
|
19
|
+
return p->size();
|
20
|
+
}
|
21
|
+
|
22
|
+
SC_API size_t sc_source_map_length(const sc_source_map_t* source_map, size_t index)
|
23
|
+
{
|
24
|
+
const mdp::BytesRangeSet* p = AS_CTYPE(mdp::BytesRangeSet, source_map);
|
25
|
+
if(!p)
|
26
|
+
return 0;
|
27
|
+
|
28
|
+
return p->at(index).length;
|
29
|
+
}
|
30
|
+
|
31
|
+
SC_API size_t sc_source_map_location(const sc_source_map_t* source_map, size_t index)
|
32
|
+
{
|
33
|
+
const mdp::BytesRangeSet* p = AS_CTYPE(mdp::BytesRangeSet, source_map);
|
34
|
+
if(!p)
|
35
|
+
return 0;
|
36
|
+
|
37
|
+
return p->at(index).location;
|
38
|
+
}
|
39
|
+
|
40
|
+
/*----------------------------------------------------------------------*/
|
41
|
+
|
42
|
+
SC_API sc_sm_blueprint_t* sc_sm_blueprint_new()
|
43
|
+
{
|
44
|
+
return AS_TYPE(sc_sm_blueprint_t, ::new snowcrash::SourceMap<snowcrash::Blueprint>);
|
45
|
+
}
|
46
|
+
|
47
|
+
SC_API void sc_sm_blueprint_free(sc_sm_blueprint_t* blueprint)
|
48
|
+
{
|
49
|
+
::delete AS_TYPE(snowcrash::SourceMap<snowcrash::Blueprint>, blueprint);
|
50
|
+
}
|
51
|
+
|
52
|
+
SC_API const sc_source_map_t* sc_sm_blueprint_name(const sc_sm_blueprint_t* blueprint)
|
53
|
+
{
|
54
|
+
const snowcrash::SourceMap<snowcrash::Blueprint>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Blueprint>, blueprint);
|
55
|
+
if (!p)
|
56
|
+
return NULL;
|
57
|
+
|
58
|
+
return AS_CTYPE(sc_source_map_t, &p->name.sourceMap);
|
59
|
+
}
|
60
|
+
|
61
|
+
SC_API const sc_source_map_t* sc_sm_blueprint_description(const sc_sm_blueprint_t* blueprint)
|
62
|
+
{
|
63
|
+
const snowcrash::SourceMap<snowcrash::Blueprint>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Blueprint>, blueprint);
|
64
|
+
if (!p)
|
65
|
+
return NULL;
|
66
|
+
|
67
|
+
return AS_CTYPE(sc_source_map_t, &p->description.sourceMap);
|
68
|
+
}
|
69
|
+
|
70
|
+
/*----------------------------------------------------------------------*/
|
71
|
+
|
72
|
+
SC_API const sc_sm_metadata_collection_t* sc_sm_metadata_collection_handle(const sc_sm_blueprint_t* blueprint)
|
73
|
+
{
|
74
|
+
const snowcrash::SourceMap<snowcrash::Blueprint>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Blueprint>, blueprint);
|
75
|
+
if (!p)
|
76
|
+
return NULL;
|
77
|
+
|
78
|
+
return AS_CTYPE(sc_sm_metadata_collection_t, &p->metadata);
|
79
|
+
}
|
80
|
+
|
81
|
+
SC_API size_t sc_sm_metadata_collection_size(const sc_sm_metadata_collection_t* metadata)
|
82
|
+
{
|
83
|
+
const snowcrash::SourceMap<snowcrash::MetadataCollection>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::MetadataCollection>, metadata);
|
84
|
+
if (!p)
|
85
|
+
return 0;
|
86
|
+
|
87
|
+
return p->collection.size();
|
88
|
+
}
|
89
|
+
|
90
|
+
/*----------------------------------------------------------------------*/
|
91
|
+
|
92
|
+
SC_API const sc_sm_metadata_t* sc_sm_metadata_handle(const sc_sm_metadata_collection_t* metadata_col, size_t index)
|
93
|
+
{
|
94
|
+
const snowcrash::SourceMap<snowcrash::MetadataCollection>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::MetadataCollection>, metadata_col);
|
95
|
+
if (!p)
|
96
|
+
return NULL;
|
97
|
+
|
98
|
+
return AS_CTYPE(sc_sm_metadata_t, &p->collection.at(index));
|
99
|
+
}
|
100
|
+
|
101
|
+
SC_API const sc_source_map_t* sc_sm_metadata(const sc_sm_metadata_t* metadata)
|
102
|
+
{
|
103
|
+
const snowcrash::SourceMap<snowcrash::Metadata>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Metadata>, metadata);
|
104
|
+
if (!p)
|
105
|
+
return NULL;
|
106
|
+
|
107
|
+
return AS_CTYPE(sc_source_map_t, &p->sourceMap);
|
108
|
+
}
|
109
|
+
|
110
|
+
/*----------------------------------------------------------------------*/
|
111
|
+
|
112
|
+
SC_API const sc_sm_resource_group_collection_t* sc_sm_resource_group_collection_handle(const sc_sm_blueprint_t* blueprint)
|
113
|
+
{
|
114
|
+
const snowcrash::SourceMap<snowcrash::Blueprint>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Blueprint>, blueprint);
|
115
|
+
if (!p)
|
116
|
+
return NULL;
|
117
|
+
|
118
|
+
return AS_CTYPE(sc_sm_resource_group_collection_t, &p->resourceGroups);
|
119
|
+
}
|
120
|
+
|
121
|
+
SC_API size_t sc_sm_resource_group_collection_size(const sc_sm_resource_group_collection_t* resource)
|
122
|
+
{
|
123
|
+
const snowcrash::SourceMap<snowcrash::ResourceGroups>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::ResourceGroups>, resource);
|
124
|
+
if (!p)
|
125
|
+
return 0;
|
126
|
+
|
127
|
+
return p->collection.size();
|
128
|
+
}
|
129
|
+
|
130
|
+
/*----------------------------------------------------------------------*/
|
131
|
+
|
132
|
+
SC_API const sc_sm_resource_group_t* sc_sm_resource_group_handle(const sc_sm_resource_group_collection_t* resource, size_t index)
|
133
|
+
{
|
134
|
+
const snowcrash::SourceMap<snowcrash::ResourceGroups>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::ResourceGroups>, resource);
|
135
|
+
if (!p)
|
136
|
+
return NULL;
|
137
|
+
|
138
|
+
return AS_CTYPE(sc_sm_resource_group_t, &p->collection.at(index));
|
139
|
+
}
|
140
|
+
|
141
|
+
SC_API const sc_source_map_t* sc_sm_resource_group_name(const sc_sm_resource_group_t* handle)
|
142
|
+
{
|
143
|
+
const snowcrash::SourceMap<snowcrash::ResourceGroup>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::ResourceGroup>, handle);
|
144
|
+
if(!p)
|
145
|
+
return NULL;
|
146
|
+
|
147
|
+
return AS_CTYPE(sc_source_map_t, &p->name.sourceMap);
|
148
|
+
}
|
149
|
+
|
150
|
+
SC_API const sc_source_map_t* sc_sm_resource_group_description(const sc_sm_resource_group_t* handle)
|
151
|
+
{
|
152
|
+
const snowcrash::SourceMap<snowcrash::ResourceGroup>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::ResourceGroup>, handle);
|
153
|
+
if(!p)
|
154
|
+
return NULL;
|
155
|
+
|
156
|
+
return AS_CTYPE(sc_source_map_t, &p->description.sourceMap);
|
157
|
+
}
|
158
|
+
|
159
|
+
/*----------------------------------------------------------------------*/
|
160
|
+
|
161
|
+
SC_API const sc_sm_resource_collection_t* sc_sm_resource_collection_handle(const sc_sm_resource_group_t* handle)
|
162
|
+
{
|
163
|
+
const snowcrash::SourceMap<snowcrash::ResourceGroup>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::ResourceGroup>, handle);
|
164
|
+
if (!p)
|
165
|
+
return NULL;
|
166
|
+
|
167
|
+
return AS_CTYPE(sc_sm_resource_collection_t, &p->resources);
|
168
|
+
}
|
169
|
+
|
170
|
+
SC_API size_t sc_sm_resource_collection_size(const sc_sm_resource_collection_t* resource)
|
171
|
+
{
|
172
|
+
const snowcrash::SourceMap<snowcrash::Resources>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Resources>, resource);
|
173
|
+
if (!p)
|
174
|
+
return 0;
|
175
|
+
|
176
|
+
return p->collection.size();
|
177
|
+
}
|
178
|
+
|
179
|
+
/*----------------------------------------------------------------------*/
|
180
|
+
|
181
|
+
SC_API const sc_sm_resource_t* sc_sm_resource_handle(const sc_sm_resource_collection_t* resource, size_t index)
|
182
|
+
{
|
183
|
+
const snowcrash::SourceMap<snowcrash::Resources>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Resources>, resource);
|
184
|
+
if (!p)
|
185
|
+
return NULL;
|
186
|
+
|
187
|
+
return AS_CTYPE(sc_sm_resource_t, &p->collection.at(index));
|
188
|
+
}
|
189
|
+
|
190
|
+
SC_API const sc_source_map_t* sc_sm_resource_uritemplate(const sc_sm_resource_t* handle)
|
191
|
+
{
|
192
|
+
const snowcrash::SourceMap<snowcrash::Resource>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Resource>, handle);
|
193
|
+
if(!p)
|
194
|
+
return NULL;
|
195
|
+
|
196
|
+
return AS_CTYPE(sc_source_map_t, &p->uriTemplate.sourceMap);
|
197
|
+
}
|
198
|
+
|
199
|
+
SC_API const sc_source_map_t* sc_sm_resource_name(const sc_sm_resource_t* handle)
|
200
|
+
{
|
201
|
+
const snowcrash::SourceMap<snowcrash::Resource>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Resource>, handle);
|
202
|
+
if(!p)
|
203
|
+
return NULL;
|
204
|
+
|
205
|
+
return AS_CTYPE(sc_source_map_t, &p->name.sourceMap);
|
206
|
+
}
|
207
|
+
|
208
|
+
SC_API const sc_source_map_t* sc_sm_resource_description(const sc_sm_resource_t* handle)
|
209
|
+
{
|
210
|
+
const snowcrash::SourceMap<snowcrash::Resource>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Resource>, handle);
|
211
|
+
if(!p)
|
212
|
+
return NULL;
|
213
|
+
|
214
|
+
return AS_CTYPE(sc_source_map_t, &p->description.sourceMap);
|
215
|
+
}
|
216
|
+
|
217
|
+
/*----------------------------------------------------------------------*/
|
218
|
+
|
219
|
+
SC_API const sc_sm_payload_collection_t* sc_sm_payload_collection_handle_requests(const sc_sm_transaction_example_t* handle)
|
220
|
+
{
|
221
|
+
const snowcrash::SourceMap<snowcrash::TransactionExample>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::TransactionExample>, handle);
|
222
|
+
if (!p)
|
223
|
+
return NULL;
|
224
|
+
|
225
|
+
return AS_CTYPE(sc_sm_payload_collection_t, &p->requests);
|
226
|
+
}
|
227
|
+
|
228
|
+
SC_API const sc_sm_payload_collection_t* sc_sm_payload_collection_handle_responses(const sc_sm_transaction_example_t* handle)
|
229
|
+
{
|
230
|
+
const snowcrash::SourceMap<snowcrash::TransactionExample>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::TransactionExample>, handle);
|
231
|
+
if (!p)
|
232
|
+
return NULL;
|
233
|
+
|
234
|
+
return AS_CTYPE(sc_sm_payload_collection_t, &p->responses);
|
235
|
+
}
|
236
|
+
|
237
|
+
SC_API size_t sc_sm_payload_collection_size(const sc_sm_payload_collection_t* handle)
|
238
|
+
{
|
239
|
+
const snowcrash::SourceMap<snowcrash::Requests>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Requests>, handle);
|
240
|
+
if (!p)
|
241
|
+
return 0;
|
242
|
+
|
243
|
+
return p->collection.size();
|
244
|
+
}
|
245
|
+
|
246
|
+
/*----------------------------------------------------------------------*/
|
247
|
+
|
248
|
+
SC_API const sc_sm_payload_t* sc_sm_payload_handle(const sc_sm_payload_collection_t* handle, size_t index)
|
249
|
+
{
|
250
|
+
const snowcrash::SourceMap<snowcrash::Requests>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Requests>, handle);
|
251
|
+
if(!p)
|
252
|
+
return NULL;
|
253
|
+
|
254
|
+
return AS_CTYPE(sc_sm_payload_t, &p->collection.at(index));
|
255
|
+
}
|
256
|
+
|
257
|
+
SC_API const sc_sm_payload_t* sc_sm_payload_handle_resource(const sc_sm_resource_t* handle)
|
258
|
+
{
|
259
|
+
const snowcrash::SourceMap<snowcrash::Resource>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Resource>, handle);
|
260
|
+
if(!p)
|
261
|
+
return NULL;
|
262
|
+
|
263
|
+
return AS_CTYPE(sc_sm_payload_t, &p->model);
|
264
|
+
}
|
265
|
+
|
266
|
+
SC_API const sc_source_map_t* sc_sm_payload_name(const sc_sm_payload_t* handle)
|
267
|
+
{
|
268
|
+
const snowcrash::SourceMap<snowcrash::Payload>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Payload>, handle);
|
269
|
+
if(!p)
|
270
|
+
return NULL;
|
271
|
+
|
272
|
+
return AS_CTYPE(sc_source_map_t, &p->name.sourceMap);
|
273
|
+
}
|
274
|
+
|
275
|
+
/** TODO: Need to change this to use the "Reference" data structure */
|
276
|
+
SC_API const sc_source_map_t* sc_sm_payload_symbol(const sc_sm_payload_t* handle)
|
277
|
+
{
|
278
|
+
const snowcrash::SourceMap<snowcrash::Payload>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Payload>, handle);
|
279
|
+
if (!p)
|
280
|
+
return NULL;
|
281
|
+
|
282
|
+
return AS_CTYPE(sc_source_map_t, &p->symbol.sourceMap);
|
283
|
+
}
|
284
|
+
|
285
|
+
SC_API const sc_source_map_t* sc_sm_payload_description(const sc_sm_payload_t* handle)
|
286
|
+
{
|
287
|
+
const snowcrash::SourceMap<snowcrash::Payload>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Payload>, handle);
|
288
|
+
if(!p)
|
289
|
+
return NULL;
|
290
|
+
|
291
|
+
return AS_CTYPE(sc_source_map_t, &p->description.sourceMap);
|
292
|
+
}
|
293
|
+
|
294
|
+
SC_API const sc_source_map_t* sc_sm_payload_body(const sc_sm_payload_t* handle)
|
295
|
+
{
|
296
|
+
const snowcrash::SourceMap<snowcrash::Payload>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Payload>, handle);
|
297
|
+
if(!p)
|
298
|
+
return NULL;
|
299
|
+
|
300
|
+
return AS_CTYPE(sc_source_map_t, &p->body.sourceMap);
|
301
|
+
}
|
302
|
+
|
303
|
+
SC_API const sc_source_map_t* sc_sm_payload_schema(const sc_sm_payload_t* handle)
|
304
|
+
{
|
305
|
+
const snowcrash::SourceMap<snowcrash::Payload>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Payload>, handle);
|
306
|
+
if(!p)
|
307
|
+
return NULL;
|
308
|
+
|
309
|
+
return AS_CTYPE(sc_source_map_t, &p->schema.sourceMap);
|
310
|
+
}
|
311
|
+
|
312
|
+
/*----------------------------------------------------------------------*/
|
313
|
+
|
314
|
+
SC_API const sc_sm_parameter_collection_t* sc_sm_parameter_collection_handle_payload(const sc_sm_payload_t* handle)
|
315
|
+
{
|
316
|
+
const snowcrash::SourceMap<snowcrash::Payload>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Payload>, handle);
|
317
|
+
if(!p)
|
318
|
+
return NULL;
|
319
|
+
|
320
|
+
return AS_CTYPE(sc_sm_parameter_collection_t, &p->parameters);
|
321
|
+
}
|
322
|
+
|
323
|
+
SC_API const sc_sm_parameter_collection_t* sc_sm_parameter_collection_handle_resource(const sc_sm_resource_t* handle)
|
324
|
+
{
|
325
|
+
const snowcrash::SourceMap<snowcrash::Resource>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Resource>, handle);
|
326
|
+
if(!p)
|
327
|
+
return NULL;
|
328
|
+
|
329
|
+
return AS_CTYPE(sc_sm_parameter_collection_t, &p->parameters);
|
330
|
+
}
|
331
|
+
|
332
|
+
SC_API const sc_sm_parameter_collection_t* sc_sm_parameter_collection_handle_action(const sc_sm_action_t* handle)
|
333
|
+
{
|
334
|
+
const snowcrash::SourceMap<snowcrash::Action>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Action>, handle);
|
335
|
+
if(!p)
|
336
|
+
return NULL;
|
337
|
+
|
338
|
+
return AS_CTYPE(sc_sm_parameter_collection_t, &p->parameters);
|
339
|
+
}
|
340
|
+
|
341
|
+
SC_API size_t sc_sm_parameter_collection_size(const sc_sm_parameter_collection_t* handle)
|
342
|
+
{
|
343
|
+
const snowcrash::SourceMap<snowcrash::Parameters>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Parameters>, handle);
|
344
|
+
if(!p)
|
345
|
+
return 0;
|
346
|
+
|
347
|
+
return p->collection.size();
|
348
|
+
}
|
349
|
+
|
350
|
+
/*----------------------------------------------------------------------*/
|
351
|
+
|
352
|
+
SC_API const sc_sm_parameter_t* sc_sm_parameter_handle(const sc_sm_parameter_collection_t* handle, size_t index)
|
353
|
+
{
|
354
|
+
const snowcrash::SourceMap<snowcrash::Parameters>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Parameters>, handle);
|
355
|
+
if(!p)
|
356
|
+
return NULL;
|
357
|
+
|
358
|
+
return AS_CTYPE(sc_sm_parameter_t, &p->collection.at(index));
|
359
|
+
}
|
360
|
+
|
361
|
+
SC_API const sc_source_map_t* sc_sm_parameter_name(const sc_sm_parameter_t* handle)
|
362
|
+
{
|
363
|
+
const snowcrash::SourceMap<snowcrash::Parameter>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Parameter>, handle);
|
364
|
+
if (!p)
|
365
|
+
return NULL;
|
366
|
+
|
367
|
+
return AS_CTYPE(sc_source_map_t, &p->name.sourceMap);
|
368
|
+
}
|
369
|
+
|
370
|
+
SC_API const sc_source_map_t* sc_sm_parameter_description(const sc_sm_parameter_t* handle)
|
371
|
+
{
|
372
|
+
const snowcrash::SourceMap<snowcrash::Parameter>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Parameter>, handle);
|
373
|
+
if (!p)
|
374
|
+
return NULL;
|
375
|
+
|
376
|
+
return AS_CTYPE(sc_source_map_t, &p->description.sourceMap);
|
377
|
+
}
|
378
|
+
|
379
|
+
SC_API const sc_source_map_t* sc_sm_parameter_type(const sc_sm_parameter_t* handle)
|
380
|
+
{
|
381
|
+
const snowcrash::SourceMap<snowcrash::Parameter>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Parameter>, handle);
|
382
|
+
if (!p)
|
383
|
+
return NULL;
|
384
|
+
|
385
|
+
return AS_CTYPE(sc_source_map_t, &p->type.sourceMap);
|
386
|
+
}
|
387
|
+
|
388
|
+
SC_API const sc_source_map_t* sc_sm_parameter_parameter_use(const sc_sm_parameter_t* handle)
|
389
|
+
{
|
390
|
+
const snowcrash::SourceMap<snowcrash::Parameter>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Parameter>, handle);
|
391
|
+
if (!p)
|
392
|
+
return NULL;
|
393
|
+
|
394
|
+
return AS_CTYPE(sc_source_map_t, &p->use.sourceMap);
|
395
|
+
}
|
396
|
+
|
397
|
+
SC_API const sc_source_map_t* sc_sm_parameter_default_value(const sc_sm_parameter_t* handle)
|
398
|
+
{
|
399
|
+
const snowcrash::SourceMap<snowcrash::Parameter>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Parameter>, handle);
|
400
|
+
if (!p)
|
401
|
+
return NULL;
|
402
|
+
|
403
|
+
return AS_CTYPE(sc_source_map_t, &p->defaultValue.sourceMap);
|
404
|
+
}
|
405
|
+
|
406
|
+
SC_API const sc_source_map_t* sc_sm_parameter_example_value(const sc_sm_parameter_t* handle)
|
407
|
+
{
|
408
|
+
const snowcrash::SourceMap<snowcrash::Parameter>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Parameter>, handle);
|
409
|
+
if (!p)
|
410
|
+
return NULL;
|
411
|
+
|
412
|
+
return AS_CTYPE(sc_source_map_t, &p->exampleValue.sourceMap);
|
413
|
+
}
|
414
|
+
|
415
|
+
/*----------------------------------------------------------------------*/
|
416
|
+
|
417
|
+
SC_API const sc_sm_value_collection_t* sc_sm_value_collection_handle(const sc_sm_parameter_t* handle)
|
418
|
+
{
|
419
|
+
const snowcrash::SourceMap<snowcrash::Parameter>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Parameter>, handle);
|
420
|
+
if (!p)
|
421
|
+
return NULL;
|
422
|
+
|
423
|
+
return AS_CTYPE(sc_sm_value_collection_t, &p->values);
|
424
|
+
}
|
425
|
+
|
426
|
+
SC_API size_t sc_sm_value_collection_size(const sc_sm_value_collection_t* handle)
|
427
|
+
{
|
428
|
+
const snowcrash::SourceMap<snowcrash::Values>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Values>, handle);
|
429
|
+
if (!p)
|
430
|
+
return 0;
|
431
|
+
|
432
|
+
return p->collection.size();
|
433
|
+
}
|
434
|
+
|
435
|
+
/*----------------------------------------------------------------------*/
|
436
|
+
|
437
|
+
SC_API const sc_sm_value_t* sc_sm_value_handle(const sc_sm_value_collection_t* handle, size_t index)
|
438
|
+
{
|
439
|
+
const snowcrash::SourceMap<snowcrash::Values>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Values>, handle);
|
440
|
+
if (!p)
|
441
|
+
return NULL;
|
442
|
+
|
443
|
+
return AS_CTYPE(sc_sm_value_t, &p->collection.at(index));
|
444
|
+
}
|
445
|
+
|
446
|
+
SC_API const sc_source_map_t* sc_sm_value(const sc_sm_value_t* handle)
|
447
|
+
{
|
448
|
+
const snowcrash::SourceMap<snowcrash::Value>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Value>, handle);
|
449
|
+
if(!p)
|
450
|
+
return NULL;
|
451
|
+
|
452
|
+
return AS_CTYPE(sc_source_map_t, &p->sourceMap);
|
453
|
+
}
|
454
|
+
|
455
|
+
/*----------------------------------------------------------------------*/
|
456
|
+
|
457
|
+
SC_API const sc_sm_header_collection_t* sc_sm_header_collection_handle_payload(const sc_sm_payload_t* handle)
|
458
|
+
{
|
459
|
+
const snowcrash::SourceMap<snowcrash::Payload>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Payload>, handle);
|
460
|
+
if (!p)
|
461
|
+
return NULL;
|
462
|
+
|
463
|
+
return AS_CTYPE(sc_sm_header_collection_t, &p->headers);
|
464
|
+
}
|
465
|
+
|
466
|
+
SC_API const sc_sm_header_collection_t* sc_sm_header_collection_handle_resource(const sc_sm_resource_t* handle)
|
467
|
+
{
|
468
|
+
const snowcrash::SourceMap<snowcrash::Resource>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Resource>, handle);
|
469
|
+
if (!p)
|
470
|
+
return NULL;
|
471
|
+
|
472
|
+
return AS_CTYPE(sc_sm_header_collection_t, &p->headers);
|
473
|
+
}
|
474
|
+
|
475
|
+
SC_API const sc_sm_header_collection_t* sc_sm_header_collection_handle_action(const sc_sm_action_t* handle)
|
476
|
+
{
|
477
|
+
const snowcrash::SourceMap<snowcrash::Action>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Action>, handle);
|
478
|
+
if (!p)
|
479
|
+
return NULL;
|
480
|
+
|
481
|
+
return AS_CTYPE(sc_sm_header_collection_t, &p->headers);
|
482
|
+
}
|
483
|
+
|
484
|
+
SC_API size_t sc_sm_header_collection_size(const sc_sm_header_collection_t* handle)
|
485
|
+
{
|
486
|
+
const snowcrash::SourceMap<snowcrash::Headers>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Headers>, handle);
|
487
|
+
if (!p)
|
488
|
+
return 0;
|
489
|
+
|
490
|
+
return p->collection.size();
|
491
|
+
}
|
492
|
+
|
493
|
+
/*----------------------------------------------------------------------*/
|
494
|
+
|
495
|
+
SC_API const sc_sm_header_t* sc_sm_header_handle(const sc_sm_header_collection_t* handle, size_t index)
|
496
|
+
{
|
497
|
+
const snowcrash::SourceMap<snowcrash::Headers>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Headers>, handle);
|
498
|
+
if (!p)
|
499
|
+
return NULL;
|
500
|
+
|
501
|
+
return AS_CTYPE( sc_sm_header_t, &p->collection.at(index));
|
502
|
+
}
|
503
|
+
|
504
|
+
SC_API const sc_source_map_t* sc_sm_header(const sc_sm_header_t* handle)
|
505
|
+
{
|
506
|
+
const snowcrash::SourceMap<snowcrash::Header>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Header>, handle);
|
507
|
+
if(!p)
|
508
|
+
return NULL;
|
509
|
+
|
510
|
+
return AS_CTYPE(sc_source_map_t, &p->sourceMap);
|
511
|
+
}
|
512
|
+
|
513
|
+
/*----------------------------------------------------------------------*/
|
514
|
+
|
515
|
+
SC_API const sc_sm_action_collection_t* sc_sm_action_collection_handle(const sc_sm_resource_t* handle)
|
516
|
+
{
|
517
|
+
const snowcrash::SourceMap<snowcrash::Resource>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Resource>, handle);
|
518
|
+
if(!p)
|
519
|
+
return NULL;
|
520
|
+
|
521
|
+
return AS_CTYPE(sc_sm_action_collection_t, &p->actions);
|
522
|
+
}
|
523
|
+
|
524
|
+
SC_API size_t sc_sm_action_collection_size(const sc_sm_action_collection_t* handle)
|
525
|
+
{
|
526
|
+
const snowcrash::SourceMap<snowcrash::Actions>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Actions>, handle);
|
527
|
+
if (!p)
|
528
|
+
return 0;
|
529
|
+
|
530
|
+
return p->collection.size();
|
531
|
+
}
|
532
|
+
|
533
|
+
/*----------------------------------------------------------------------*/
|
534
|
+
|
535
|
+
SC_API const sc_sm_action_t* sc_sm_action_handle(const sc_sm_action_collection_t* handle, size_t index)
|
536
|
+
{
|
537
|
+
const snowcrash::SourceMap<snowcrash::Actions>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Actions>, handle);
|
538
|
+
if(!p)
|
539
|
+
return NULL;
|
540
|
+
|
541
|
+
return AS_CTYPE(sc_sm_action_t, &p->collection.at(index));
|
542
|
+
}
|
543
|
+
|
544
|
+
SC_API const sc_source_map_t* sc_sm_action_httpmethod(const sc_sm_action_t* handle)
|
545
|
+
{
|
546
|
+
const snowcrash::SourceMap<snowcrash::Action>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Action>, handle);
|
547
|
+
if (!p)
|
548
|
+
return NULL;
|
549
|
+
|
550
|
+
return AS_CTYPE(sc_source_map_t, &p->method.sourceMap);
|
551
|
+
}
|
552
|
+
|
553
|
+
SC_API const sc_source_map_t* sc_sm_action_name(const sc_sm_action_t* handle)
|
554
|
+
{
|
555
|
+
const snowcrash::SourceMap<snowcrash::Action>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Action>, handle);
|
556
|
+
if (!p)
|
557
|
+
return NULL;
|
558
|
+
|
559
|
+
return AS_CTYPE(sc_source_map_t, &p->name.sourceMap);
|
560
|
+
}
|
561
|
+
|
562
|
+
SC_API const sc_source_map_t* sc_sm_action_description(const sc_sm_action_t* handle)
|
563
|
+
{
|
564
|
+
const snowcrash::SourceMap<snowcrash::Action>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Action>, handle);
|
565
|
+
if (!p)
|
566
|
+
return NULL;
|
567
|
+
|
568
|
+
return AS_CTYPE(sc_source_map_t, &p->description.sourceMap);
|
569
|
+
}
|
570
|
+
|
571
|
+
/*----------------------------------------------------------------------*/
|
572
|
+
|
573
|
+
SC_API const sc_sm_transaction_example_collection_t* sc_sm_transaction_example_collection_handle(const sc_sm_action_t* handle)
|
574
|
+
{
|
575
|
+
const snowcrash::SourceMap<snowcrash::Action>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::Action>, handle);
|
576
|
+
if(!p)
|
577
|
+
return NULL;
|
578
|
+
|
579
|
+
return AS_CTYPE(sc_sm_transaction_example_collection_t, &p->examples);
|
580
|
+
}
|
581
|
+
|
582
|
+
SC_API size_t sc_sm_transaction_example_collection_size(const sc_sm_transaction_example_collection_t* handle)
|
583
|
+
{
|
584
|
+
const snowcrash::SourceMap<snowcrash::TransactionExamples>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::TransactionExamples>, handle);
|
585
|
+
if (!p)
|
586
|
+
return 0;
|
587
|
+
|
588
|
+
return p->collection.size();
|
589
|
+
}
|
590
|
+
|
591
|
+
/*----------------------------------------------------------------------*/
|
592
|
+
|
593
|
+
SC_API const sc_sm_transaction_example_t* sc_sm_transaction_example_handle(const sc_sm_transaction_example_collection_t* handle, size_t index)
|
594
|
+
{
|
595
|
+
const snowcrash::SourceMap<snowcrash::TransactionExamples>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::TransactionExamples>, handle);
|
596
|
+
if(!p)
|
597
|
+
return NULL;
|
598
|
+
|
599
|
+
return AS_CTYPE(sc_sm_transaction_example_t, &p->collection.at(index));
|
600
|
+
}
|
601
|
+
|
602
|
+
SC_API const sc_source_map_t* sc_sm_transaction_example_name(const sc_sm_transaction_example_t* handle)
|
603
|
+
{
|
604
|
+
const snowcrash::SourceMap<snowcrash::TransactionExample>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::TransactionExample>, handle);
|
605
|
+
if (!p)
|
606
|
+
return NULL;
|
607
|
+
|
608
|
+
return AS_CTYPE(sc_source_map_t, &p->name.sourceMap);
|
609
|
+
}
|
610
|
+
|
611
|
+
SC_API const sc_source_map_t* sc_sm_transaction_example_description(const sc_sm_transaction_example_t* handle)
|
612
|
+
{
|
613
|
+
const snowcrash::SourceMap<snowcrash::TransactionExample>* p = AS_CTYPE(snowcrash::SourceMap<snowcrash::TransactionExample>, handle);
|
614
|
+
if (!p)
|
615
|
+
return NULL;
|
616
|
+
|
617
|
+
return AS_CTYPE(sc_source_map_t, &p->description.sourceMap);
|
618
|
+
}
|
619
|
+
|
620
|
+
/*----------------------------------------------------------------------*/
|