Move Bitmask output operator to cpp.

GitOrigin-RevId: 2b308d08ffa9e1babca61f3d3c99f34f73253d9f
This commit is contained in:
levlam 2018-12-28 02:33:07 +03:00
parent 2face56d10
commit 239fd79523
3 changed files with 12 additions and 8 deletions

View File

@ -15,7 +15,8 @@ namespace td {
enum class NotificationGroupType : int8 { Messages, Mentions, SecretChat, Calls };
inline td_api::object_ptr<td_api::NotificationGroupType> get_notification_group_type_object(NotificationGroupType type) {
inline td_api::object_ptr<td_api::NotificationGroupType> get_notification_group_type_object(
NotificationGroupType type) {
switch (type) {
case NotificationGroupType::Messages:
return td_api::make_object<td_api::notificationGroupTypeMessages>();
@ -31,7 +32,8 @@ inline td_api::object_ptr<td_api::NotificationGroupType> get_notification_group_
}
}
inline NotificationGroupType get_notification_group_type(const td_api::object_ptr<td_api::NotificationGroupType> &type) {
inline NotificationGroupType get_notification_group_type(
const td_api::object_ptr<td_api::NotificationGroupType> &type) {
CHECK(type != nullptr);
switch (type->get_id()) {
case td_api::notificationGroupTypeMessages::ID:

View File

@ -130,4 +130,11 @@ int64 Bitmask::size() const {
return static_cast<int64>(data_.size() * 8);
}
StringBuilder &operator<<(StringBuilder &sb, const Bitmask &mask) {
for (int64 i = 0; i < mask.size(); i++) {
sb << (mask.get(i) ? '1' : '0');
}
return sb;
}
} // namespace td

View File

@ -34,11 +34,6 @@ class Bitmask {
std::string data_;
};
inline StringBuilder &operator<<(StringBuilder &sb, const Bitmask &mask) {
for (int64 i = 0; i < mask.size(); i++) {
sb << (mask.get(i) ? '1' : '0');
}
return sb;
}
StringBuilder &operator<<(StringBuilder &sb, const Bitmask &mask);
} // namespace td