Move STORE/PARSE FLAGS to a dedicated block.

GitOrigin-RevId: c682b9b2a444a4b86c7c3c09736d3489c4e4f297
This commit is contained in:
levlam 2018-11-09 15:38:41 +03:00
parent e59261ee10
commit 5160e083b0
3 changed files with 24 additions and 16 deletions

View File

@ -2218,8 +2218,8 @@ updateChatDraftMessage chat_id:int53 draft_message:draftMessage order:int64 = Up
//@description A list of active notifications in a notification group has changed @notification_group_id Unique notification group identifier @chat_id Identifier of a chat to which all notifications in the group belong //@description A list of active notifications in a notification group has changed @notification_group_id Unique notification group identifier @chat_id Identifier of a chat to which all notifications in the group belong
//@notification_settings_chat_id Chat identifier, which notification settings must be applied @silent True, if the notifications should be shown without sound //@notification_settings_chat_id Chat identifier, which notification settings must be applied @silent True, if the notifications should be shown without sound
//@total_count Total number of active notifications in the group @new_notifications List of new group notifications @edited_notifications List of edited group notifications @deleted_notification_ids Identifiers of deleted group notifications //@total_count Total number of active notifications in the group @new_notifications List of new group notifications @edited_notifications List of edited group notifications @removed_notification_ids Identifiers of removed group notifications
updateNotificationGroup chat_id:int53 notification_group_id:int32 notification_settings_chat_id:int53 silent:Bool total_count:int32 new_notifications:vector<notification> edited_notifications:vector<notification> deleted_notification_ids:vector<int32> = Update; updateNotificationGroup chat_id:int53 notification_group_id:int32 notification_settings_chat_id:int53 silent:Bool total_count:int32 new_notifications:vector<notification> edited_notifications:vector<notification> removed_notification_ids:vector<int32> = Update;
//@description Contains active notifications that was shown on previous application launches. This update is sent only if a message database is used. In that case it comes once before any updateNotificationGroup update @groups Lists of active notification groups //@description Contains active notifications that was shown on previous application launches. This update is sent only if a message database is used. In that case it comes once before any updateNotificationGroup update @groups Lists of active notification groups
updateActiveNotifications groups:vector<notificationGroup> = Update; updateActiveNotifications groups:vector<notificationGroup> = Update;

Binary file not shown.

View File

@ -19,34 +19,42 @@
#include <unordered_set> #include <unordered_set>
#define BEGIN_STORE_FLAGS() \ #define BEGIN_STORE_FLAGS() \
uint32 flags_store = 0; \ do { \
uint32 flags_store = 0; \
uint32 bit_offset_store = 0 uint32 bit_offset_store = 0
#define STORE_FLAG(flag) \ #define STORE_FLAG(flag) \
flags_store |= (flag) << bit_offset_store; \ flags_store |= (flag) << bit_offset_store; \
bit_offset_store++ bit_offset_store++
#define END_STORE_FLAGS() \ #define END_STORE_FLAGS() \
CHECK(bit_offset_store < 31); \ CHECK(bit_offset_store < 31); \
td::store(flags_store, storer) td::store(flags_store, storer); \
} \
while (false)
#define BEGIN_PARSE_FLAGS() \ #define BEGIN_PARSE_FLAGS() \
uint32 flags_parse; \ do { \
uint32 bit_offset_parse = 0; \ uint32 flags_parse; \
uint32 bit_offset_parse = 0; \
td::parse(flags_parse, parser) td::parse(flags_parse, parser)
#define PARSE_FLAG(flag) \ #define PARSE_FLAG(flag) \
flag = ((flags_parse >> bit_offset_parse) & 1) != 0; \ flag = ((flags_parse >> bit_offset_parse) & 1) != 0; \
bit_offset_parse++ bit_offset_parse++
#define END_PARSE_FLAGS() \ #define END_PARSE_FLAGS() \
CHECK(bit_offset_parse < 31); \ CHECK(bit_offset_parse < 31); \
CHECK((flags_parse & ~((1 << bit_offset_parse) - 1)) == 0) \ CHECK((flags_parse & ~((1 << bit_offset_parse) - 1)) == 0) \
<< flags_parse << " " << bit_offset_parse << " " << parser.version(); << flags_parse << " " << bit_offset_parse << " " << parser.version(); \
} \
while (false)
#define END_PARSE_FLAGS_GENERIC() \ #define END_PARSE_FLAGS_GENERIC() \
CHECK(bit_offset_parse < 31); \ CHECK(bit_offset_parse < 31); \
CHECK((flags_parse & ~((1 << bit_offset_parse) - 1)) == 0) << flags_parse << " " << bit_offset_parse; CHECK((flags_parse & ~((1 << bit_offset_parse) - 1)) == 0) << flags_parse << " " << bit_offset_parse; \
} \
while (false)
namespace td { namespace td {
template <class StorerT> template <class StorerT>