Generic macros for initializing a discord_attributes.
More...
Go to the source code of this file.
|
#define | _RET_COPY_TYPED(dest, src) |
|
#define | _RET_COPY_TYPELESS(dest, src) |
|
#define | DISCORD_ATTR_INIT(attr, type, ret, _reason) |
| Helper for setting attributes for a specs-generated return struct. More...
|
|
#define | DISCORD_ATTR_LIST_INIT(attr, type, ret, _reason) |
| Helper for setting attributes for a specs-generated list. More...
|
|
#define | DISCORD_ATTR_BLANK_INIT(attr, ret, _reason) |
| Helper for setting attributes for attruests that doensn't expect a response object. More...
|
|
#define | DISCORD_ATTACHMENTS_IDS_INIT(attchs) |
| Helper for initializing attachments ids. More...
|
|
Generic macros for initializing a discord_attributes.
- Author
- Cogmasters
◆ _RET_COPY_TYPED
#define _RET_COPY_TYPED |
( |
|
dest, |
|
|
|
src |
|
) |
| |
Value: do { \
(dest).has_type = true; \
(dest).sync = (src).sync; \
} while (0)
void(* cast_done_typed)(struct discord *, struct discord_response *, const void *)
Definition: discord-request.h:12
Definition: discord-request.h:20
◆ _RET_COPY_TYPELESS
#define _RET_COPY_TYPELESS |
( |
|
dest, |
|
|
|
src |
|
) |
| |
Value: do { \
(dest).has_type = false; \
(dest).done.typeless = (src).done; \
(dest).sync = (void *)(src).sync; \
} while (0)
◆ DISCORD_ATTR_INIT
#define DISCORD_ATTR_INIT |
( |
|
attr, |
|
|
|
type, |
|
|
|
ret, |
|
|
|
_reason |
|
) |
| |
Value: do { \
(attr).response.size = sizeof(struct type); \
(attr).response.init = (
cast_init)type##_init; \
(attr).reason = _reason; \
} while (0)
size_t(* cast_from_json)(const char *, size_t, void *)
Definition: discord-request.h:17
void(* cast_init)(void *)
Definition: discord-request.h:15
#define _RET_COPY_TYPED(dest, src)
Definition: discord-request.h:24
void(* cast_cleanup)(void *)
Definition: discord-request.h:16
Helper for setting attributes for a specs-generated return struct.
- Parameters
-
[out] | attr | discord_attributes handler to be initialized |
[in] | type | datatype of the struct |
[in] | ret | dispatch attributes |
[in] | _reason | reason for request (if available) |
◆ DISCORD_ATTR_LIST_INIT
#define DISCORD_ATTR_LIST_INIT |
( |
|
attr, |
|
|
|
type, |
|
|
|
ret, |
|
|
|
_reason |
|
) |
| |
Value: do { \
(attr).response.size = sizeof(struct type); \
(attr).reason = _reason; \
} while (0)
Helper for setting attributes for a specs-generated list.
- Parameters
-
[out] | attr | discord_attributes handler to be initialized |
[in] | type | datatype of the list |
[in] | ret | dispatch attributes |
[in] | _reason | reason for request (if available) |
◆ DISCORD_ATTR_BLANK_INIT
#define DISCORD_ATTR_BLANK_INIT |
( |
|
attr, |
|
|
|
ret, |
|
|
|
_reason |
|
) |
| |
Value: do { \
(attr).reason = _reason; \
} while (0)
#define _RET_COPY_TYPELESS(dest, src)
Definition: discord-request.h:32
Helper for setting attributes for attruests that doensn't expect a response object.
- Parameters
-
[out] | attr | discord_attributes handler to be initialized |
[in] | ret | dispatch attributes |
[in] | _reason | reason for request (if available) |
◆ DISCORD_ATTACHMENTS_IDS_INIT
#define DISCORD_ATTACHMENTS_IDS_INIT |
( |
|
attchs | ) |
|
Value: do { \
for (int i = 0; i < attchs->size; ++i) { \
} \
} while (0)
uint64_t u64snowflake
Snowflake datatype.
Definition: types.h:28
Helper for initializing attachments ids.
- Parameters
-
◆ cast_done_typed
◆ cast_init
typedef void(* cast_init) (void *) |
◆ cast_cleanup
typedef void(* cast_cleanup) (void *) |
◆ cast_from_json
typedef size_t(* cast_from_json) (const char *, size_t, void *) |