Concord - C Discord API library
A Discord API wrapper library written in C
custom.h
Go to the documentation of this file.
1
6#ifndef API_CUSTOM_H
7#define API_CUSTOM_H
8/* Allow symbols usage without GENCODECS_ prefix */
9#include <stddef.h>
10#include <stdbool.h>
11#include <inttypes.h>
12#include "carray.h"
13#include "cog-utils.h"
14#include "types.h"
15/* Custom JSON encoding macros */
16/* Custom JSON decoding macros */
17/* Custom field macros */
18/* if GENCODECS_READ is not specified then generate for all files */
20struct strings { int size;
21 char * * array; int realsize; };
24struct json_values { int size;
25 json_char * * array; int realsize; };
28struct snowflakes { int size;
29 u64snowflake *array; int realsize; };
32struct bitmasks { int size;
33 u64bitmask *array; int realsize; };
36struct integers { int size;
37 int *array; int realsize; };
39#include <stddef.h>
40#include <stdbool.h>
41#define JSMN_STRICT
42#define JSMN_HEADER
43#include "jsmn.h"
44#include "jsmn-find.h"
45#define JSONB_HEADER
46#include "json-build.h"
47#include <inttypes.h>
48#include "carray.h"
49#include "cog-utils.h"
50#include "types.h"
51void strings_cleanup(struct strings *self);
52
53
55
56
57void snowflakes_cleanup(struct snowflakes *self);
58
59
60void bitmasks_cleanup(struct bitmasks *self);
61
62
63void integers_cleanup(struct integers *self);
64
65
66long strings_from_jsmnf(jsmnf_pair *root, const char *js, struct strings *self); size_t strings_from_json(const char buf[], size_t size, struct strings *self);
67
68
69long json_values_from_jsmnf(jsmnf_pair *root, const char *js, struct json_values *self); size_t json_values_from_json(const char buf[], size_t size, struct json_values *self);
70
71
72long snowflakes_from_jsmnf(jsmnf_pair *root, const char *js, struct snowflakes *self); size_t snowflakes_from_json(const char buf[], size_t size, struct snowflakes *self);
73
74
75long bitmasks_from_jsmnf(jsmnf_pair *root, const char *js, struct bitmasks *self); size_t bitmasks_from_json(const char buf[], size_t size, struct bitmasks *self);
76
77
78long integers_from_jsmnf(jsmnf_pair *root, const char *js, struct integers *self); size_t integers_from_json(const char buf[], size_t size, struct integers *self);
79
80
81jsonbcode strings_to_jsonb(jsonb *b, char buf[], size_t size, const struct strings *self); size_t strings_to_json(char buf[], size_t size, const struct strings *self);
82
83
84jsonbcode json_values_to_jsonb(jsonb *b, char buf[], size_t size, const struct json_values *self); size_t json_values_to_json(char buf[], size_t size, const struct json_values *self);
85
86
87jsonbcode snowflakes_to_jsonb(jsonb *b, char buf[], size_t size, const struct snowflakes *self); size_t snowflakes_to_json(char buf[], size_t size, const struct snowflakes *self);
88
89
90jsonbcode bitmasks_to_jsonb(jsonb *b, char buf[], size_t size, const struct bitmasks *self); size_t bitmasks_to_json(char buf[], size_t size, const struct bitmasks *self);
91
92
93jsonbcode integers_to_jsonb(jsonb *b, char buf[], size_t size, const struct integers *self); size_t integers_to_json(char buf[], size_t size, const struct integers *self);
94
95
96#endif /* API_CUSTOM_H */
void bitmasks_cleanup(struct bitmasks *self)
size_t json_values_from_json(const char buf[], size_t size, struct json_values *self)
long bitmasks_from_jsmnf(jsmnf_pair *root, const char *js, struct bitmasks *self)
size_t bitmasks_to_json(char buf[], size_t size, const struct bitmasks *self)
void snowflakes_cleanup(struct snowflakes *self)
size_t snowflakes_to_json(char buf[], size_t size, const struct snowflakes *self)
size_t integers_from_json(const char buf[], size_t size, struct integers *self)
void integers_cleanup(struct integers *self)
void strings_cleanup(struct strings *self)
long integers_from_jsmnf(jsmnf_pair *root, const char *js, struct integers *self)
long strings_from_jsmnf(jsmnf_pair *root, const char *js, struct strings *self)
jsonbcode integers_to_jsonb(jsonb *b, char buf[], size_t size, const struct integers *self)
long json_values_from_jsmnf(jsmnf_pair *root, const char *js, struct json_values *self)
jsonbcode strings_to_jsonb(jsonb *b, char buf[], size_t size, const struct strings *self)
size_t integers_to_json(char buf[], size_t size, const struct integers *self)
jsonbcode json_values_to_jsonb(jsonb *b, char buf[], size_t size, const struct json_values *self)
void json_values_cleanup(struct json_values *self)
long snowflakes_from_jsmnf(jsmnf_pair *root, const char *js, struct snowflakes *self)
jsonbcode snowflakes_to_jsonb(jsonb *b, char buf[], size_t size, const struct snowflakes *self)
size_t json_values_to_json(char buf[], size_t size, const struct json_values *self)
size_t strings_to_json(char buf[], size_t size, const struct strings *self)
size_t snowflakes_from_json(const char buf[], size_t size, struct snowflakes *self)
size_t strings_from_json(const char buf[], size_t size, struct strings *self)
jsonbcode bitmasks_to_jsonb(jsonb *b, char buf[], size_t size, const struct bitmasks *self)
size_t bitmasks_from_json(const char buf[], size_t size, struct bitmasks *self)
uint64_t u64snowflake
Snowflake datatype.
Definition: types.h:28
uint64_t u64bitmask
Bitmask primitive.
Definition: types.h:35
char json_char
Raw JSON string.
Definition: types.h:44
jsonbcode
json-builder return codes
Definition: json-build.h:34
Definition: custom.h:32
int size
Definition: custom.h:32
u64bitmask * array
Definition: custom.h:33
Definition: custom.h:36
int * array
Definition: custom.h:37
int size
Definition: custom.h:36
JSON object.
Definition: jsmn-find.h:21
Definition: custom.h:24
json_char ** array
Definition: custom.h:25
int size
Definition: custom.h:24
Handle for building a JSON string.
Definition: json-build.h:61
Definition: custom.h:28
u64snowflake * array
Definition: custom.h:29
int size
Definition: custom.h:28
Definition: custom.h:20
char ** array
Definition: custom.h:21
int size
Definition: custom.h:20