From b816c6f8e3ced0f65f3f749e9e6ecb0edd313628 Mon Sep 17 00:00:00 2001 From: iphydf Date: Thu, 9 Apr 2020 21:33:34 +0000 Subject: Stop using the "inline namespace" feature of apidsl. This adds complexity for very little value. --- toxcore/tox.api.h | 97 ++++++++++++++++++++++++++++--------------------------- toxcore/tox.h | 28 ++++++++-------- 2 files changed, 63 insertions(+), 62 deletions(-) diff --git a/toxcore/tox.api.h b/toxcore/tox.api.h index 87c3219a..fcd43f7a 100644 --- a/toxcore/tox.api.h +++ b/toxcore/tox.api.h @@ -854,7 +854,7 @@ enum class CONNECTION { } -inline namespace self { +namespace self { CONNECTION connection_status { /** @@ -908,7 +908,7 @@ void iterate(any user_data); ******************************************************************************/ -inline namespace self { +namespace self { uint8_t[ADDRESS_SIZE] address { /** @@ -986,7 +986,7 @@ error for set_info { } -inline namespace self { +namespace self { uint8_t[length <= MAX_NAME_LENGTH] name { /** @@ -1226,7 +1226,7 @@ namespace friend { } -inline namespace self { +namespace self { uint32_t[size] friend_list { /** @@ -1514,8 +1514,14 @@ namespace friend { * ******************************************************************************/ +error for set_typing { + /** + * The friend number did not designate a valid friend. + */ + FRIEND_NOT_FOUND, +} -inline namespace self { +namespace self { bool typing { /** @@ -1528,12 +1534,7 @@ inline namespace self { * * @return true on success. */ - set(uint32_t friend_number) { - /** - * The friend number did not designate a valid friend. - */ - FRIEND_NOT_FOUND, - } + set(uint32_t friend_number) with error for set_typing; } } @@ -2655,36 +2656,36 @@ namespace conference { namespace friend { - inline namespace send { + error for custom_packet { + NULL, + /** + * The friend number did not designate a valid friend. + */ + FRIEND_NOT_FOUND, + /** + * This client is currently not connected to the friend. + */ + FRIEND_NOT_CONNECTED, + /** + * The first byte of data was not in the specified range for the packet type. + * This range is 200-254 for lossy, and 160-191 for lossless packets. + */ + INVALID, + /** + * Attempted to send an empty packet. + */ + EMPTY, + /** + * Packet data length exceeded $MAX_CUSTOM_PACKET_SIZE. + */ + TOO_LONG, + /** + * Packet queue is full. + */ + SENDQ, + } - error for custom_packet { - NULL, - /** - * The friend number did not designate a valid friend. - */ - FRIEND_NOT_FOUND, - /** - * This client is currently not connected to the friend. - */ - FRIEND_NOT_CONNECTED, - /** - * The first byte of data was not in the specified range for the packet type. - * This range is 200-254 for lossy, and 160-191 for lossless packets. - */ - INVALID, - /** - * Attempted to send an empty packet. - */ - EMPTY, - /** - * Packet data length exceeded $MAX_CUSTOM_PACKET_SIZE. - */ - TOO_LONG, - /** - * Packet queue is full. - */ - SENDQ, - } + namespace send { /** * Send a custom lossy packet to a friend. @@ -2762,7 +2763,14 @@ namespace friend { ******************************************************************************/ -inline namespace self { +error for get_port { + /** + * The instance was not bound to any port. + */ + NOT_BOUND, +} + +namespace self { uint8_t[PUBLIC_KEY_SIZE] dht_id { /** @@ -2781,13 +2789,6 @@ inline namespace self { } - error for get_port { - /** - * The instance was not bound to any port. - */ - NOT_BOUND, - } - uint16_t udp_port { /** diff --git a/toxcore/tox.h b/toxcore/tox.h index fd57e20d..dc873f3b 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -3168,20 +3168,6 @@ void tox_callback_friend_lossless_packet(Tox *tox, tox_friend_lossless_packet_cb -/** - * Writes the temporary DHT public key of this instance to a byte array. - * - * This can be used in combination with an externally accessible IP address and - * the bound port (from tox_self_get_udp_port) to run a temporary bootstrap node. - * - * Be aware that every time a new instance is created, the DHT public key - * changes, meaning this cannot be used to run a permanent bootstrap node. - * - * @param dht_id A memory region of at least TOX_PUBLIC_KEY_SIZE bytes. If this - * parameter is NULL, this function has no effect. - */ -void tox_self_get_dht_id(const Tox *tox, uint8_t *dht_id); - typedef enum TOX_ERR_GET_PORT { /** @@ -3197,6 +3183,20 @@ typedef enum TOX_ERR_GET_PORT { } TOX_ERR_GET_PORT; +/** + * Writes the temporary DHT public key of this instance to a byte array. + * + * This can be used in combination with an externally accessible IP address and + * the bound port (from tox_self_get_udp_port) to run a temporary bootstrap node. + * + * Be aware that every time a new instance is created, the DHT public key + * changes, meaning this cannot be used to run a permanent bootstrap node. + * + * @param dht_id A memory region of at least TOX_PUBLIC_KEY_SIZE bytes. If this + * parameter is NULL, this function has no effect. + */ +void tox_self_get_dht_id(const Tox *tox, uint8_t *dht_id); + /** * Return the UDP port this Tox instance is bound to. */ -- cgit v1.2.3