diff options
author | aunsane <aunsane@gmail.com> | 2018-04-27 21:33:17 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2018-04-27 21:33:17 +0300 |
commit | e1ec72eab6d00b3ba38e5932bc88920f103b6e4a (patch) | |
tree | 999de2725a83e30fbbf6576200525d4ef0c5fe38 /libs/tdlib/td/td/telegram/CallId.h | |
parent | b9ce1d4d98525490ca1a38e2d9fd4f3369adb3e0 (diff) |
Telegram: initial commit
- tdlib moved to telegram dir
Diffstat (limited to 'libs/tdlib/td/td/telegram/CallId.h')
-rw-r--r-- | libs/tdlib/td/td/telegram/CallId.h | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/libs/tdlib/td/td/telegram/CallId.h b/libs/tdlib/td/td/telegram/CallId.h deleted file mode 100644 index 227e2240d9..0000000000 --- a/libs/tdlib/td/td/telegram/CallId.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2018 -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -#pragma once - -#include "td/telegram/td_api.h" - -#include "td/utils/common.h" -#include "td/utils/StringBuilder.h" - -#include <functional> -#include <type_traits> - -namespace td { -class CallId { - public: - CallId() = default; - - explicit CallId(int32 call_id) : id(call_id) { - } - - template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>> - CallId(T call_id) = delete; - - bool is_valid() const { - return id != 0; - } - - int32 get() const { - return id; - } - - auto as_td_api() const { - return make_tl_object<td_api::callId>(id); - } - - bool operator==(const CallId &other) const { - return id == other.id; - } - - private: - int32 id{0}; -}; - -struct CallIdHash { - std::size_t operator()(CallId call_id) const { - return std::hash<int32>()(call_id.get()); - } -}; - -inline StringBuilder &operator<<(StringBuilder &sb, const CallId call_id) { - return sb << "CallId(" << call_id.get() << ")"; -} -} // namespace td |