From 3b373e236ea745f17474b78eb55a62a42a457bbf Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 9 Mar 2017 21:13:55 +0300 Subject: [PATCH] Make all owned MTPD types immutable. Remove custom refcounting in mtpData, use std::shared_ptr instead. --- Telegram/SourceFiles/mtproto/connection.cpp | 104 +- Telegram/SourceFiles/mtproto/connection.h | 4 + Telegram/SourceFiles/mtproto/core_types.cpp | 2 +- Telegram/SourceFiles/mtproto/core_types.h | 144 +- Telegram/SourceFiles/mtproto/generate.py | 61 +- Telegram/SourceFiles/mtproto/mtp_instance.cpp | 2 +- Telegram/SourceFiles/mtproto/scheme_auto.h | 16091 +++++++--------- Telegram/SourceFiles/mtproto/session.cpp | 12 +- Telegram/SourceFiles/ui/text/text_entity.cpp | 8 +- 9 files changed, 7191 insertions(+), 9237 deletions(-) diff --git a/Telegram/SourceFiles/mtproto/connection.cpp b/Telegram/SourceFiles/mtproto/connection.cpp index 5078bdf20..da6d990e6 100644 --- a/Telegram/SourceFiles/mtproto/connection.cpp +++ b/Telegram/SourceFiles/mtproto/connection.cpp @@ -2042,7 +2042,7 @@ mtpBuffer ConnectionPrivate::ungzip(const mtpPrime *from, const mtpPrime *end) c return result; } stream.avail_in = packedLen; - stream.next_in = (Bytef*)&packed._string().v[0]; + stream.next_in = const_cast(reinterpret_cast(packed.c_string().v.data())); stream.avail_out = 0; while (!stream.avail_out) { @@ -2382,7 +2382,7 @@ void ConnectionPrivate::pqAnswered() { return restart(); } - const auto &res_pq_data(res_pq.c_resPQ()); + auto &res_pq_data = res_pq.c_resPQ(); if (res_pq_data.vnonce != _authKeyData->nonce) { LOG(("AuthKey Error: received nonce <> sent nonce (in res_pq)!")); DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&res_pq_data.vnonce, 16).str()).arg(Logs::mb(&_authKeyData->nonce, 16).str())); @@ -2391,8 +2391,8 @@ void ConnectionPrivate::pqAnswered() { static MTP::internal::RSAPublicKeys RSAKeys = MTP::internal::InitRSAPublicKeys(); const MTP::internal::RSAPublicKey *rsaKey = nullptr; - const auto &fingerPrints(res_pq.c_resPQ().vserver_public_key_fingerprints.c_vector().v); - for (const auto &fingerPrint : fingerPrints) { + auto &fingerPrints = res_pq.c_resPQ().vserver_public_key_fingerprints.c_vector().v; + for (auto &fingerPrint : fingerPrints) { auto it = RSAKeys.constFind(static_cast(fingerPrint.v)); if (it != RSAKeys.cend()) { rsaKey = &it.value(); @@ -2401,7 +2401,7 @@ void ConnectionPrivate::pqAnswered() { } if (!rsaKey) { QStringList suggested, my; - for (const auto &fingerPrint : fingerPrints) { + for (auto &fingerPrint : fingerPrints) { suggested.push_back(QString("%1").arg(fingerPrint.v)); } for (auto i = RSAKeys.cbegin(), e = RSAKeys.cend(); i != e; ++i) { @@ -2412,49 +2412,54 @@ void ConnectionPrivate::pqAnswered() { } _authKeyData->server_nonce = res_pq_data.vserver_nonce; + _authKeyData->new_nonce = rand_value(); - MTPP_Q_inner_data p_q_inner; - MTPDp_q_inner_data &p_q_inner_data(p_q_inner._p_q_inner_data()); - p_q_inner_data.vnonce = _authKeyData->nonce; - p_q_inner_data.vserver_nonce = _authKeyData->server_nonce; - p_q_inner_data.vpq = res_pq_data.vpq; - - const string &pq(res_pq_data.vpq.c_string().v); - string &p(p_q_inner_data.vp._string().v), &q(p_q_inner_data.vq._string().v); - + auto &pq = res_pq_data.vpq.c_string().v; + auto p = std::string(); + auto q = std::string(); if (!MTP::internal::parsePQ(pq, p, q)) { LOG(("AuthKey Error: could not factor pq!")); DEBUG_LOG(("AuthKey Error: problematic pq: %1").arg(Logs::mb(&pq[0], pq.length()).str())); return restart(); } - _authKeyData->new_nonce = rand_value(); - p_q_inner_data.vnew_nonce = _authKeyData->new_nonce; + auto p_q_inner = MTP_p_q_inner_data(res_pq_data.vpq, MTP_string(std::move(p)), MTP_string(std::move(q)), _authKeyData->nonce, _authKeyData->server_nonce, _authKeyData->new_nonce); + auto dhEncString = encryptPQInnerRSA(p_q_inner, rsaKey); + if (dhEncString.empty()) { + return restart(); + } + + connect(_conn, SIGNAL(receivedData()), this, SLOT(dhParamsAnswered())); + + DEBUG_LOG(("AuthKey Info: sending Req_DH_params...")); MTPReq_DH_params req_DH_params; req_DH_params.vnonce = _authKeyData->nonce; req_DH_params.vserver_nonce = _authKeyData->server_nonce; req_DH_params.vpublic_key_fingerprint = MTP_long(rsaKey->getFingerPrint()); - req_DH_params.vp = p_q_inner_data.vp; - req_DH_params.vq = p_q_inner_data.vq; + req_DH_params.vp = p_q_inner.c_p_q_inner_data().vp; + req_DH_params.vq = p_q_inner.c_p_q_inner_data().vq; + req_DH_params.vencrypted_data = MTP_string(std::move(dhEncString)); + sendRequestNotSecure(req_DH_params); +} - string &dhEncString(req_DH_params.vencrypted_data._string().v); - - uint32 p_q_inner_size = p_q_inner.innerLength(), encSize = (p_q_inner_size >> 2) + 6; +std::string ConnectionPrivate::encryptPQInnerRSA(const MTPP_Q_inner_data &data, const MTP::internal::RSAPublicKey *key) { + auto p_q_inner_size = data.innerLength(); + auto encSize = (p_q_inner_size >> 2) + 6; if (encSize >= 65) { - mtpBuffer tmp; + auto tmp = mtpBuffer(); tmp.reserve(encSize); - p_q_inner.write(tmp); + data.write(tmp); LOG(("AuthKey Error: too large data for RSA encrypt, size %1").arg(encSize * sizeof(mtpPrime))); DEBUG_LOG(("AuthKey Error: bad data for RSA encrypt %1").arg(Logs::mb(&tmp[0], tmp.size() * 4).str())); - return restart(); // can't be 255-byte string + return std::string(); // can't be 255-byte string } - mtpBuffer encBuffer; + auto encBuffer = mtpBuffer(); encBuffer.reserve(65); // 260 bytes encBuffer.resize(6); encBuffer[0] = 0; - p_q_inner.write(encBuffer); + data.write(encBuffer); hashSha1(&encBuffer[6], p_q_inner_size, &encBuffer[1]); if (encSize < 65) { @@ -2462,13 +2467,11 @@ void ConnectionPrivate::pqAnswered() { memset_rand(&encBuffer[encSize], (65 - encSize) * sizeof(mtpPrime)); } - if (!rsaKey->encrypt(reinterpret_cast(&encBuffer[0]) + 3, dhEncString)) { - return restart(); + auto dhEncString = std::string(); + if (!key->encrypt(reinterpret_cast(&encBuffer[0]) + 3, dhEncString)) { + return std::string(); } - connect(_conn, SIGNAL(receivedData()), this, SLOT(dhParamsAnswered())); - - DEBUG_LOG(("AuthKey Info: sending Req_DH_params...")); - sendRequestNotSecure(req_DH_params); + return dhEncString; } void ConnectionPrivate::dhParamsAnswered() { @@ -2598,15 +2601,11 @@ void ConnectionPrivate::dhClientParamsSend() { return restart(); } - MTPClient_DH_Inner_Data client_dh_inner; - MTPDclient_DH_inner_data &client_dh_inner_data(client_dh_inner._client_DH_inner_data()); - client_dh_inner_data.vnonce = _authKeyData->nonce; - client_dh_inner_data.vserver_nonce = _authKeyData->server_nonce; - client_dh_inner_data.vretry_id = _authKeyData->retry_id; - client_dh_inner_data.vg_b._string().v.resize(256); + auto g_b_string = std::string(256, ' '); // gen rand 'b' - uint32 b[64], *g_b((uint32*)&client_dh_inner_data.vg_b._string().v[0]); + uint32 b[64]; + auto g_b = reinterpret_cast(&g_b_string[0]); memset_rand(b, sizeof(b)); // count g_b and auth_key using openssl BIGNUM methods @@ -2620,21 +2619,33 @@ void ConnectionPrivate::dhClientParamsSend() { memcpy(&_authKeyData->auth_key_aux_hash, auth_key_sha.data(), 8); memcpy(&_authKeyData->auth_key_hash, auth_key_sha.data() + 12, 8); + auto client_dh_inner = MTP_client_DH_inner_data(_authKeyData->nonce, _authKeyData->server_nonce, _authKeyData->retry_id, MTP_string(std::move(g_b_string))); + + auto sdhEncString = encryptClientDHInner(client_dh_inner); + + connect(_conn, SIGNAL(receivedData()), this, SLOT(dhClientParamsAnswered())); + MTPSet_client_DH_params req_client_DH_params; req_client_DH_params.vnonce = _authKeyData->nonce; req_client_DH_params.vserver_nonce = _authKeyData->server_nonce; + req_client_DH_params.vencrypted_data = MTP_string(std::move(sdhEncString)); - string &sdhEncString(req_client_DH_params.vencrypted_data._string().v); + DEBUG_LOG(("AuthKey Info: sending Req_client_DH_params...")); + sendRequestNotSecure(req_client_DH_params); +} - uint32 client_dh_inner_size = client_dh_inner.innerLength(), encSize = (client_dh_inner_size >> 2) + 5, encFullSize = encSize; +std::string ConnectionPrivate::encryptClientDHInner(const MTPClient_DH_Inner_Data &data) { + auto client_dh_inner_size = data.innerLength(); + auto encSize = (client_dh_inner_size >> 2) + 5; + auto encFullSize = encSize; if (encSize & 0x03) { encFullSize += 4 - (encSize & 0x03); } - mtpBuffer encBuffer; + auto encBuffer = mtpBuffer(); encBuffer.reserve(encFullSize); encBuffer.resize(5); - client_dh_inner.write(encBuffer); + data.write(encBuffer); hashSha1(&encBuffer[5], client_dh_inner_size, &encBuffer[0]); if (encSize < encFullSize) { @@ -2642,14 +2653,11 @@ void ConnectionPrivate::dhClientParamsSend() { memset_rand(&encBuffer[encSize], (encFullSize - encSize) * sizeof(mtpPrime)); } - sdhEncString.resize(encFullSize * 4); + auto sdhEncString = std::string(encFullSize * 4, ' '); aesIgeEncrypt(&encBuffer[0], &sdhEncString[0], encFullSize * sizeof(mtpPrime), _authKeyData->aesKey, _authKeyData->aesIV); - connect(_conn, SIGNAL(receivedData()), this, SLOT(dhClientParamsAnswered())); - - DEBUG_LOG(("AuthKey Info: sending Req_client_DH_params...")); - sendRequestNotSecure(req_client_DH_params); + return sdhEncString; } void ConnectionPrivate::dhClientParamsAnswered() { diff --git a/Telegram/SourceFiles/mtproto/connection.h b/Telegram/SourceFiles/mtproto/connection.h index 1d2eaf3d3..8973876cd 100644 --- a/Telegram/SourceFiles/mtproto/connection.h +++ b/Telegram/SourceFiles/mtproto/connection.h @@ -33,6 +33,7 @@ namespace internal { class AbstractConnection; class ConnectionPrivate; class SessionData; +class RSAPublicKey; class Thread : public QThread { Q_OBJECT @@ -179,6 +180,9 @@ private: bool setState(int32 state, int32 ifState = Connection::UpdateAlways); + std::string encryptPQInnerRSA(const MTPP_Q_inner_data &data, const MTP::internal::RSAPublicKey *key); + std::string encryptClientDHInner(const MTPClient_DH_Inner_Data &data); + Instance *_instance = nullptr; mutable QReadWriteLock stateConnMutex; diff --git a/Telegram/SourceFiles/mtproto/core_types.cpp b/Telegram/SourceFiles/mtproto/core_types.cpp index a142864f4..eb6c48519 100644 --- a/Telegram/SourceFiles/mtproto/core_types.cpp +++ b/Telegram/SourceFiles/mtproto/core_types.cpp @@ -104,7 +104,7 @@ void mtpTextSerializeCore(MTPStringLogger &to, const mtpPrime *&from, const mtpP throw Exception(QString("ungzip init, code: %1").arg(res)); } stream.avail_in = packedLen; - stream.next_in = (Bytef*)&packed._string().v[0]; + stream.next_in = const_cast(reinterpret_cast(packed.c_string().v.data())); stream.avail_out = 0; while (!stream.avail_out) { result.resize(result.size() + unpackedChunk); diff --git a/Telegram/SourceFiles/mtproto/core_types.h b/Telegram/SourceFiles/mtproto/core_types.h index 79c43f223..4026c5e29 100644 --- a/Telegram/SourceFiles/mtproto/core_types.h +++ b/Telegram/SourceFiles/mtproto/core_types.h @@ -29,7 +29,7 @@ namespace MTP { using DcId = int32; using ShiftedDcId = int32; -} +} // namespace MTP using mtpPrime = int32; using mtpRequestId = int32; @@ -177,68 +177,23 @@ public: class mtpData { public: - mtpData() : cnt(1) { - } - mtpData(const mtpData &) : cnt(1) { - } - - mtpData *incr() { - ++cnt; - return this; - } - bool decr() { - return !--cnt; - } - bool needSplit() { - return (cnt > 1); - } - - virtual mtpData *clone() = 0; virtual ~mtpData() { } -private: - uint32 cnt; - -}; - -template -class mtpDataImpl : public mtpData { -public: - virtual mtpData *clone() { - return new T(*(T*)this); - } }; class mtpDataOwner { public: - mtpDataOwner(const mtpDataOwner &v) : data(v.data ? v.data->incr() : 0) { - } - mtpDataOwner &operator=(const mtpDataOwner &v) { - setData(v.data ? v.data->incr() : v.data); - return *this; - } - ~mtpDataOwner() { - if (data && data->decr()) delete data; - } + mtpDataOwner(mtpDataOwner &&other) = default; + mtpDataOwner(const mtpDataOwner &other) = default; + mtpDataOwner &operator=(mtpDataOwner &&other) = default; + mtpDataOwner &operator=(const mtpDataOwner &other) = default; protected: - explicit mtpDataOwner(mtpData *_data) : data(_data) { + explicit mtpDataOwner(std::shared_ptr &&data) : data(data) { } - void split() { - if (data && data->needSplit()) { - mtpData *clone = data->clone(); - if (data->decr()) delete data; - data = clone; - } - } - void setData(mtpData *_data) { - if (data != _data) { - if (data && data->decr()) delete data; - data = _data; - } - } - mtpData *data; + std::shared_ptr data; + }; enum { @@ -614,12 +569,14 @@ inline bool operator!=(const MTPdouble &a, const MTPdouble &b) { return a.v != b.v; } -class MTPDstring : public mtpDataImpl { +class MTPDstring : public mtpData { public: MTPDstring() { } MTPDstring(const std::string &val) : v(val) { } + MTPDstring(std::string &&val) : v(std::move(val)) { + } MTPDstring(const QString &val) : v(val.toUtf8().constData()) { } MTPDstring(const QByteArray &val) : v(val.constData(), val.size()) { @@ -628,24 +585,20 @@ public: } std::string v; + }; class MTPstring : private mtpDataOwner { public: - MTPstring() : mtpDataOwner(new MTPDstring()) { + MTPstring() : mtpDataOwner(nullptr) { } MTPstring(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_string) : mtpDataOwner(0) { read(from, end, cons); } - MTPDstring &_string() { - t_assert(data != nullptr); - split(); - return *(MTPDstring*)data; - } const MTPDstring &c_string() const { t_assert(data != nullptr); - return *(const MTPDstring*)data; + return static_cast(*data); } uint32 innerLength() const { @@ -679,10 +632,8 @@ public: } if (from > end) throw mtpErrorInsufficient(); - if (!data) setData(new MTPDstring()); - MTPDstring &v(_string()); - v.v.resize(l); - memcpy(&v.v[0], buf, l); + auto string = std::string(reinterpret_cast(buf), l); + data = std::make_shared(std::move(string)); } void write(mtpBuffer &to) const { uint32 l = c_string().v.length(), s = l + ((l < 254) ? 1 : 4), was = to.size(); @@ -705,23 +656,28 @@ public: } private: - explicit MTPstring(MTPDstring *_data) : mtpDataOwner(_data) { + explicit MTPstring(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } friend MTPstring MTP_string(const std::string &v); + friend MTPstring MTP_string(std::string &&v); friend MTPstring MTP_string(const QString &v); friend MTPstring MTP_string(const char *v); friend MTPstring MTP_bytes(const QByteArray &v); + }; inline MTPstring MTP_string(const std::string &v) { - return MTPstring(new MTPDstring(v)); + return MTPstring(std::make_shared(v)); +} +inline MTPstring MTP_string(std::string &&v) { + return MTPstring(std::make_shared(std::move(v))); } inline MTPstring MTP_string(const QString &v) { - return MTPstring(new MTPDstring(v)); + return MTPstring(std::make_shared(v)); } inline MTPstring MTP_string(const char *v) { - return MTPstring(new MTPDstring(v)); + return MTPstring(std::make_shared(v)); } MTPstring MTP_string(const QByteArray &v) = delete; using MTPString = MTPBoxed; @@ -730,7 +686,7 @@ using MTPbytes = MTPstring; using MTPBytes = MTPBoxed; inline MTPbytes MTP_bytes(const QByteArray &v) { - return MTPbytes(new MTPDstring(v)); + return MTPbytes(std::make_shared(v)); } inline bool operator==(const MTPstring &a, const MTPstring &b) { @@ -751,7 +707,7 @@ inline QByteArray qba(const MTPstring &v) { } template -class MTPDvector : public mtpDataImpl > { +class MTPDvector : public mtpData { public: MTPDvector() { } @@ -769,26 +725,21 @@ public: template class MTPvector : private mtpDataOwner { public: - MTPvector() : mtpDataOwner(new MTPDvector()) { + MTPvector() : mtpDataOwner(nullptr) { } MTPvector(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_vector) : mtpDataOwner(0) { read(from, end, cons); } - MTPDvector &_vector() { - t_assert(data != nullptr); - split(); - return *(MTPDvector*)data; - } const MTPDvector &c_vector() const { t_assert(data != nullptr); - return *(const MTPDvector*)data; + return static_cast&>(*data); } uint32 innerLength() const { uint32 result(sizeof(uint32)); - for (typename VType::const_iterator i = c_vector().v.cbegin(), e = c_vector().v.cend(); i != e; ++i) { - result += i->innerLength(); + for_const (auto &item, c_vector().v) { + result += item.innerLength(); } return result; } @@ -800,23 +751,22 @@ public: if (cons != mtpc_vector) throw mtpErrorUnexpected(cons, "MTPvector"); uint32 count = (uint32)*(from++); - if (!data) setData(new MTPDvector()); - MTPDvector &v(_vector()); - v.v.resize(0); - v.v.reserve(count); - for (uint32 i = 0; i < count; ++i) { - v.v.push_back(T(from, end)); + auto vector = QVector(); + vector.reserve(count); + for (auto i = 0; i != count; ++i) { + vector.push_back(T(from, end)); } + data = std::make_shared>(std::move(vector)); } void write(mtpBuffer &to) const { to.push_back(c_vector().v.size()); - for (typename VType::const_iterator i = c_vector().v.cbegin(), e = c_vector().v.cend(); i != e; ++i) { - (*i).write(to); + for_const (auto &item, c_vector().v) { + item.write(to); } } private: - explicit MTPvector(MTPDvector *_data) : mtpDataOwner(_data) { + explicit MTPvector(std::shared_ptr> &&data) : mtpDataOwner(std::move(data)) { } template @@ -825,19 +775,25 @@ private: friend MTPvector MTP_vector(uint32 count, const U &value); template friend MTPvector MTP_vector(const QVector &v); - using VType = typename MTPDvector::VType; + template + friend MTPvector MTP_vector(QVector &&v); + }; template inline MTPvector MTP_vector(uint32 count) { - return MTPvector(new MTPDvector(count)); + return MTPvector(std::make_shared>(count)); } template inline MTPvector MTP_vector(uint32 count, const T &value) { - return MTPvector(new MTPDvector(count, value)); + return MTPvector(std::make_shared>(count, value)); } template inline MTPvector MTP_vector(const QVector &v) { - return MTPvector(new MTPDvector(v)); + return MTPvector(std::make_shared>(v)); +} +template +inline MTPvector MTP_vector(QVector &&v) { + return MTPvector(std::make_shared>(std::move(v))); } template using MTPVector = MTPBoxed>; @@ -866,7 +822,7 @@ struct MTPStringLogger { } MTPStringLogger &add(const QString &data) { - QByteArray d = data.toUtf8(); + auto d = data.toUtf8(); return add(d.constData(), d.size()); } diff --git a/Telegram/SourceFiles/mtproto/generate.py b/Telegram/SourceFiles/mtproto/generate.py index 868279cd6..36926062c 100644 --- a/Telegram/SourceFiles/mtproto/generate.py +++ b/Telegram/SourceFiles/mtproto/generate.py @@ -573,7 +573,7 @@ for restype in typesList: trivialConditions = data[7]; dataText = ''; - dataText += '\nclass MTPD' + name + ' : public mtpDataImpl {\n'; # data class + dataText += '\nclass MTPD' + name + ' : public mtpData {\n'; # data class dataText += 'public:\n'; sizeList = []; @@ -608,28 +608,20 @@ for restype in typesList: dataText += '\tMTPD' + name + '() {\n\t}\n'; # default constructor switchLines += '\t\tcase mtpc_' + name + ': '; # for by-type-id type constructor if (len(prms) > len(trivialConditions)): - switchLines += 'setData(new MTPD' + name + '()); '; + switchLines += 'data = std::make_shared(); '; withData = 1; - getters += '\n\tMTPD' + name + ' &_' + name + '() {\n'; # splitting getter + getters += '\tconst MTPD' + name + ' &c_' + name + '() const;\n'; # const getter + constructsInline += 'inline const MTPD' + name + ' &MTP' + restype + '::c_' + name + '() const {\n'; if (withType): - getters += '\t\tt_assert(data != nullptr && _type == mtpc_' + name + ');\n'; + constructsInline += '\tt_assert(data != nullptr && _type == mtpc_' + name + ');\n'; else: - getters += '\t\tt_assert(data != nullptr);\n'; - getters += '\t\tsplit();\n'; - getters += '\t\treturn *(MTPD' + name + '*)data;\n'; - getters += '\t}\n'; + constructsInline += '\tt_assert(data != nullptr);\n'; + constructsInline += '\treturn static_cast(*data);\n'; + constructsInline += '}\n'; - getters += '\tconst MTPD' + name + ' &c_' + name + '() const {\n'; # const getter - if (withType): - getters += '\t\tt_assert(data != nullptr && _type == mtpc_' + name + ');\n'; - else: - getters += '\t\tt_assert(data != nullptr);\n'; - getters += '\t\treturn *(const MTPD' + name + '*)data;\n'; - getters += '\t}\n'; - - constructsText += '\texplicit MTP' + restype + '(MTPD' + name + ' *_data);\n'; # by-data type constructor - constructsInline += 'inline MTP' + restype + '::MTP' + restype + '(MTPD' + name + ' *_data) : mtpDataOwner(_data)'; + constructsText += '\texplicit MTP' + restype + '(std::shared_ptr &&data);\n'; # by-data type constructor + constructsInline += 'inline MTP' + restype + '::MTP' + restype + '(std::shared_ptr &&data) : mtpDataOwner(std::move(data))'; if (withType): constructsInline += ', _type(mtpc_' + name + ')'; constructsInline += ' {\n}\n'; @@ -654,11 +646,11 @@ for restype in typesList: readText += '\t\t'; writeText += '\t\t'; if (paramName in conditions): - readText += '\tif (v.has_' + paramName + '()) { v.v' + paramName + '.read(from, end); } else { v.v' + paramName + ' = MTP' + paramType + '(); }\n'; + readText += '\tif (v->has_' + paramName + '()) { v->v' + paramName + '.read(from, end); } else { v->v' + paramName + ' = MTP' + paramType + '(); }\n'; writeText += '\tif (v.has_' + paramName + '()) v.v' + paramName + '.write(to);\n'; sizeList.append('(v.has_' + paramName + '() ? v.v' + paramName + '.innerLength() : 0)'); else: - readText += '\tv.v' + paramName + '.read(from, end);\n'; + readText += '\tv->v' + paramName + '.read(from, end);\n'; writeText += '\tv.v' + paramName + '.write(to);\n'; sizeList.append('v.v' + paramName + '.innerLength()'); @@ -677,7 +669,7 @@ for restype in typesList: sizeCases += '\t\t\treturn ' + ' + '.join(sizeList) + ';\n'; sizeCases += '\t\t}\n'; sizeFast = '\tconst MTPD' + name + ' &v(c_' + name + '());\n\treturn ' + ' + '.join(sizeList) + ';\n'; - newFast = 'new MTPD' + name + '()'; + newFast = 'std::make_shared()'; else: sizeFast = '\treturn 0;\n'; @@ -691,7 +683,7 @@ for restype in typesList: friendDecl += '\tfriend class MTP::internal::TypeCreator;\n'; creatorProxyText += '\tinline static MTP' + restype + ' new_' + name + '(' + ', '.join(creatorParams) + ') {\n'; if (len(prms) > len(trivialConditions)): # creator with params - creatorProxyText += '\t\treturn MTP' + restype + '(new MTPD' + name + '(' + ', '.join(creatorParamsList) + '));\n'; + creatorProxyText += '\t\treturn MTP' + restype + '(std::make_shared(' + ', '.join(creatorParamsList) + '));\n'; else: if (withType): # creator by type creatorProxyText += '\t\treturn MTP' + restype + '(mtpc_' + name + ');\n'; @@ -708,24 +700,24 @@ for restype in typesList: reader += '\t\tcase mtpc_' + name + ': _type = cons; '; # read switch line if (len(prms) > len(trivialConditions)): reader += '{\n'; - reader += '\t\t\tif (!data) setData(new MTPD' + name + '());\n'; - reader += '\t\t\tMTPD' + name + ' &v(_' + name + '());\n'; + reader += '\t\t\tauto v = std::make_shared();\n'; reader += readText; + reader += '\t\t\tdata = std::move(v);\n'; reader += '\t\t} break;\n'; writer += '\t\tcase mtpc_' + name + ': {\n'; # write switch line - writer += '\t\t\tconst MTPD' + name + ' &v(c_' + name + '());\n'; + writer += '\t\t\tauto &v = c_' + name + '();\n'; writer += writeText; writer += '\t\t} break;\n'; else: reader += 'break;\n'; else: if (len(prms) > len(trivialConditions)): - reader += '\n\tif (!data) setData(new MTPD' + name + '());\n'; - reader += '\tMTPD' + name + ' &v(_' + name + '());\n'; + reader += '\n\tauto v = std::make_shared();\n'; reader += readText; + reader += '\tdata = std::move(v);\n'; - writer += '\tconst MTPD' + name + ' &v(c_' + name + '());\n'; + writer += '\tauto &v = c_' + name + '();\n'; writer += writeText; forwards += '\n'; @@ -739,8 +731,7 @@ for restype in typesList: inits = []; if (withType): if (withData): - inits.append('mtpDataOwner(0)'); - inits.append('_type(0)'); + inits.append('mtpDataOwner(nullptr)'); else: if (withData): inits.append('mtpDataOwner(' + newFast + ')'); @@ -757,9 +748,7 @@ for restype in typesList: inits = []; if (withData): - inits.append('mtpDataOwner(0)'); - if (withType): - inits.append('_type(0)'); + inits.append('mtpDataOwner(nullptr)'); typesText += '\tMTP' + restype + '(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons'; if (not withType): typesText += ' = mtpc_' + name; @@ -798,7 +787,7 @@ for restype in typesList: inlineMethods += 'inline void MTP' + restype + '::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) {\n'; if (withData): if (withType): - inlineMethods += '\tif (cons != _type) setData(0);\n'; + inlineMethods += '\tdata.reset();\n'; else: inlineMethods += '\tif (cons != mtpc_' + v[0][0] + ') throw mtpErrorUnexpected(cons, "MTP' + restype + '");\n'; if (withType): @@ -827,7 +816,7 @@ for restype in typesList: typesText += '\texplicit MTP' + restype + '(mtpTypeId type);\n'; inlineMethods += 'inline MTP' + restype + '::MTP' + restype + '(mtpTypeId type) : '; if (withData): - inlineMethods += 'mtpDataOwner(0), '; + inlineMethods += 'mtpDataOwner(nullptr), '; inlineMethods += '_type(type)'; inlineMethods += ' {\n'; inlineMethods += '\tswitch (type) {\n'; # type id check @@ -843,7 +832,7 @@ for restype in typesList: typesText += '\n' + friendDecl; if (withType): - typesText += '\n\tmtpTypeId _type;\n'; # type field var + typesText += '\n\tmtpTypeId _type = 0;\n'; # type field var typesText += '};\n'; # type class ended diff --git a/Telegram/SourceFiles/mtproto/mtp_instance.cpp b/Telegram/SourceFiles/mtproto/mtp_instance.cpp index 1d4e43a1f..e75d43291 100644 --- a/Telegram/SourceFiles/mtproto/mtp_instance.cpp +++ b/Telegram/SourceFiles/mtproto/mtp_instance.cpp @@ -262,7 +262,7 @@ DcId Instance::Private::mainDcId() const { } void Instance::Private::configLoadRequest() { - if (_configLoader) { + if (_configLoader || true) { return; } _configLoader = std::make_unique(_instance, rpcDone([this](const MTPConfig &result) { diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.h b/Telegram/SourceFiles/mtproto/scheme_auto.h index a47333f79..04f5ae6ca 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.h +++ b/Telegram/SourceFiles/mtproto/scheme_auto.h @@ -1775,19 +1775,10 @@ typedef MTPBoxed MTPPhoneCallDiscardReason; class MTPresPQ : private mtpDataOwner { public: MTPresPQ(); - MTPresPQ(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_resPQ) : mtpDataOwner(0) { + MTPresPQ(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_resPQ) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDresPQ &_resPQ() { - t_assert(data != nullptr); - split(); - return *(MTPDresPQ*)data; - } - const MTPDresPQ &c_resPQ() const { - t_assert(data != nullptr); - return *(const MTPDresPQ*)data; - } + const MTPDresPQ &c_resPQ() const; uint32 innerLength() const; mtpTypeId type() const; @@ -1797,7 +1788,7 @@ public: typedef void ResponseType; private: - explicit MTPresPQ(MTPDresPQ *_data); + explicit MTPresPQ(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -1806,19 +1797,10 @@ typedef MTPBoxed MTPResPQ; class MTPp_Q_inner_data : private mtpDataOwner { public: MTPp_Q_inner_data(); - MTPp_Q_inner_data(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_p_q_inner_data) : mtpDataOwner(0) { + MTPp_Q_inner_data(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_p_q_inner_data) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDp_q_inner_data &_p_q_inner_data() { - t_assert(data != nullptr); - split(); - return *(MTPDp_q_inner_data*)data; - } - const MTPDp_q_inner_data &c_p_q_inner_data() const { - t_assert(data != nullptr); - return *(const MTPDp_q_inner_data*)data; - } + const MTPDp_q_inner_data &c_p_q_inner_data() const; uint32 innerLength() const; mtpTypeId type() const; @@ -1828,7 +1810,7 @@ public: typedef void ResponseType; private: - explicit MTPp_Q_inner_data(MTPDp_q_inner_data *_data); + explicit MTPp_Q_inner_data(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -1836,31 +1818,13 @@ typedef MTPBoxed MTPP_Q_inner_data; class MTPserver_DH_Params : private mtpDataOwner { public: - MTPserver_DH_Params() : mtpDataOwner(0), _type(0) { + MTPserver_DH_Params() : mtpDataOwner(nullptr) { } - MTPserver_DH_Params(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPserver_DH_Params(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDserver_DH_params_fail &_server_DH_params_fail() { - t_assert(data != nullptr && _type == mtpc_server_DH_params_fail); - split(); - return *(MTPDserver_DH_params_fail*)data; - } - const MTPDserver_DH_params_fail &c_server_DH_params_fail() const { - t_assert(data != nullptr && _type == mtpc_server_DH_params_fail); - return *(const MTPDserver_DH_params_fail*)data; - } - - MTPDserver_DH_params_ok &_server_DH_params_ok() { - t_assert(data != nullptr && _type == mtpc_server_DH_params_ok); - split(); - return *(MTPDserver_DH_params_ok*)data; - } - const MTPDserver_DH_params_ok &c_server_DH_params_ok() const { - t_assert(data != nullptr && _type == mtpc_server_DH_params_ok); - return *(const MTPDserver_DH_params_ok*)data; - } + const MTPDserver_DH_params_fail &c_server_DH_params_fail() const; + const MTPDserver_DH_params_ok &c_server_DH_params_ok() const; uint32 innerLength() const; mtpTypeId type() const; @@ -1871,31 +1835,22 @@ public: private: explicit MTPserver_DH_Params(mtpTypeId type); - explicit MTPserver_DH_Params(MTPDserver_DH_params_fail *_data); - explicit MTPserver_DH_Params(MTPDserver_DH_params_ok *_data); + explicit MTPserver_DH_Params(std::shared_ptr &&data); + explicit MTPserver_DH_Params(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPServer_DH_Params; class MTPserver_DH_inner_data : private mtpDataOwner { public: MTPserver_DH_inner_data(); - MTPserver_DH_inner_data(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_server_DH_inner_data) : mtpDataOwner(0) { + MTPserver_DH_inner_data(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_server_DH_inner_data) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDserver_DH_inner_data &_server_DH_inner_data() { - t_assert(data != nullptr); - split(); - return *(MTPDserver_DH_inner_data*)data; - } - const MTPDserver_DH_inner_data &c_server_DH_inner_data() const { - t_assert(data != nullptr); - return *(const MTPDserver_DH_inner_data*)data; - } + const MTPDserver_DH_inner_data &c_server_DH_inner_data() const; uint32 innerLength() const; mtpTypeId type() const; @@ -1905,7 +1860,7 @@ public: typedef void ResponseType; private: - explicit MTPserver_DH_inner_data(MTPDserver_DH_inner_data *_data); + explicit MTPserver_DH_inner_data(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -1914,19 +1869,10 @@ typedef MTPBoxed MTPServer_DH_inner_data; class MTPclient_DH_Inner_Data : private mtpDataOwner { public: MTPclient_DH_Inner_Data(); - MTPclient_DH_Inner_Data(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_client_DH_inner_data) : mtpDataOwner(0) { + MTPclient_DH_Inner_Data(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_client_DH_inner_data) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDclient_DH_inner_data &_client_DH_inner_data() { - t_assert(data != nullptr); - split(); - return *(MTPDclient_DH_inner_data*)data; - } - const MTPDclient_DH_inner_data &c_client_DH_inner_data() const { - t_assert(data != nullptr); - return *(const MTPDclient_DH_inner_data*)data; - } + const MTPDclient_DH_inner_data &c_client_DH_inner_data() const; uint32 innerLength() const; mtpTypeId type() const; @@ -1936,7 +1882,7 @@ public: typedef void ResponseType; private: - explicit MTPclient_DH_Inner_Data(MTPDclient_DH_inner_data *_data); + explicit MTPclient_DH_Inner_Data(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -1944,41 +1890,14 @@ typedef MTPBoxed MTPClient_DH_Inner_Data; class MTPset_client_DH_params_answer : private mtpDataOwner { public: - MTPset_client_DH_params_answer() : mtpDataOwner(0), _type(0) { + MTPset_client_DH_params_answer() : mtpDataOwner(nullptr) { } - MTPset_client_DH_params_answer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPset_client_DH_params_answer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDdh_gen_ok &_dh_gen_ok() { - t_assert(data != nullptr && _type == mtpc_dh_gen_ok); - split(); - return *(MTPDdh_gen_ok*)data; - } - const MTPDdh_gen_ok &c_dh_gen_ok() const { - t_assert(data != nullptr && _type == mtpc_dh_gen_ok); - return *(const MTPDdh_gen_ok*)data; - } - - MTPDdh_gen_retry &_dh_gen_retry() { - t_assert(data != nullptr && _type == mtpc_dh_gen_retry); - split(); - return *(MTPDdh_gen_retry*)data; - } - const MTPDdh_gen_retry &c_dh_gen_retry() const { - t_assert(data != nullptr && _type == mtpc_dh_gen_retry); - return *(const MTPDdh_gen_retry*)data; - } - - MTPDdh_gen_fail &_dh_gen_fail() { - t_assert(data != nullptr && _type == mtpc_dh_gen_fail); - split(); - return *(MTPDdh_gen_fail*)data; - } - const MTPDdh_gen_fail &c_dh_gen_fail() const { - t_assert(data != nullptr && _type == mtpc_dh_gen_fail); - return *(const MTPDdh_gen_fail*)data; - } + const MTPDdh_gen_ok &c_dh_gen_ok() const; + const MTPDdh_gen_retry &c_dh_gen_retry() const; + const MTPDdh_gen_fail &c_dh_gen_fail() const; uint32 innerLength() const; mtpTypeId type() const; @@ -1989,21 +1908,21 @@ public: private: explicit MTPset_client_DH_params_answer(mtpTypeId type); - explicit MTPset_client_DH_params_answer(MTPDdh_gen_ok *_data); - explicit MTPset_client_DH_params_answer(MTPDdh_gen_retry *_data); - explicit MTPset_client_DH_params_answer(MTPDdh_gen_fail *_data); + explicit MTPset_client_DH_params_answer(std::shared_ptr &&data); + explicit MTPset_client_DH_params_answer(std::shared_ptr &&data); + explicit MTPset_client_DH_params_answer(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPSet_client_DH_params_answer; class MTPdestroyAuthKeyRes { public: - MTPdestroyAuthKeyRes() : _type(0) { + MTPdestroyAuthKeyRes() { } - MTPdestroyAuthKeyRes(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPdestroyAuthKeyRes(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -2019,26 +1938,17 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPDestroyAuthKeyRes; class MTPmsgsAck : private mtpDataOwner { public: MTPmsgsAck(); - MTPmsgsAck(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_msgs_ack) : mtpDataOwner(0) { + MTPmsgsAck(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_msgs_ack) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmsgs_ack &_msgs_ack() { - t_assert(data != nullptr); - split(); - return *(MTPDmsgs_ack*)data; - } - const MTPDmsgs_ack &c_msgs_ack() const { - t_assert(data != nullptr); - return *(const MTPDmsgs_ack*)data; - } + const MTPDmsgs_ack &c_msgs_ack() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2048,7 +1958,7 @@ public: typedef void ResponseType; private: - explicit MTPmsgsAck(MTPDmsgs_ack *_data); + explicit MTPmsgsAck(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2056,31 +1966,13 @@ typedef MTPBoxed MTPMsgsAck; class MTPbadMsgNotification : private mtpDataOwner { public: - MTPbadMsgNotification() : mtpDataOwner(0), _type(0) { + MTPbadMsgNotification() : mtpDataOwner(nullptr) { } - MTPbadMsgNotification(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPbadMsgNotification(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDbad_msg_notification &_bad_msg_notification() { - t_assert(data != nullptr && _type == mtpc_bad_msg_notification); - split(); - return *(MTPDbad_msg_notification*)data; - } - const MTPDbad_msg_notification &c_bad_msg_notification() const { - t_assert(data != nullptr && _type == mtpc_bad_msg_notification); - return *(const MTPDbad_msg_notification*)data; - } - - MTPDbad_server_salt &_bad_server_salt() { - t_assert(data != nullptr && _type == mtpc_bad_server_salt); - split(); - return *(MTPDbad_server_salt*)data; - } - const MTPDbad_server_salt &c_bad_server_salt() const { - t_assert(data != nullptr && _type == mtpc_bad_server_salt); - return *(const MTPDbad_server_salt*)data; - } + const MTPDbad_msg_notification &c_bad_msg_notification() const; + const MTPDbad_server_salt &c_bad_server_salt() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2091,31 +1983,22 @@ public: private: explicit MTPbadMsgNotification(mtpTypeId type); - explicit MTPbadMsgNotification(MTPDbad_msg_notification *_data); - explicit MTPbadMsgNotification(MTPDbad_server_salt *_data); + explicit MTPbadMsgNotification(std::shared_ptr &&data); + explicit MTPbadMsgNotification(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPBadMsgNotification; class MTPmsgsStateReq : private mtpDataOwner { public: MTPmsgsStateReq(); - MTPmsgsStateReq(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_msgs_state_req) : mtpDataOwner(0) { + MTPmsgsStateReq(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_msgs_state_req) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmsgs_state_req &_msgs_state_req() { - t_assert(data != nullptr); - split(); - return *(MTPDmsgs_state_req*)data; - } - const MTPDmsgs_state_req &c_msgs_state_req() const { - t_assert(data != nullptr); - return *(const MTPDmsgs_state_req*)data; - } + const MTPDmsgs_state_req &c_msgs_state_req() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2125,7 +2008,7 @@ public: typedef void ResponseType; private: - explicit MTPmsgsStateReq(MTPDmsgs_state_req *_data); + explicit MTPmsgsStateReq(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2134,19 +2017,10 @@ typedef MTPBoxed MTPMsgsStateReq; class MTPmsgsStateInfo : private mtpDataOwner { public: MTPmsgsStateInfo(); - MTPmsgsStateInfo(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_msgs_state_info) : mtpDataOwner(0) { + MTPmsgsStateInfo(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_msgs_state_info) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmsgs_state_info &_msgs_state_info() { - t_assert(data != nullptr); - split(); - return *(MTPDmsgs_state_info*)data; - } - const MTPDmsgs_state_info &c_msgs_state_info() const { - t_assert(data != nullptr); - return *(const MTPDmsgs_state_info*)data; - } + const MTPDmsgs_state_info &c_msgs_state_info() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2156,7 +2030,7 @@ public: typedef void ResponseType; private: - explicit MTPmsgsStateInfo(MTPDmsgs_state_info *_data); + explicit MTPmsgsStateInfo(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2165,19 +2039,10 @@ typedef MTPBoxed MTPMsgsStateInfo; class MTPmsgsAllInfo : private mtpDataOwner { public: MTPmsgsAllInfo(); - MTPmsgsAllInfo(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_msgs_all_info) : mtpDataOwner(0) { + MTPmsgsAllInfo(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_msgs_all_info) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmsgs_all_info &_msgs_all_info() { - t_assert(data != nullptr); - split(); - return *(MTPDmsgs_all_info*)data; - } - const MTPDmsgs_all_info &c_msgs_all_info() const { - t_assert(data != nullptr); - return *(const MTPDmsgs_all_info*)data; - } + const MTPDmsgs_all_info &c_msgs_all_info() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2187,7 +2052,7 @@ public: typedef void ResponseType; private: - explicit MTPmsgsAllInfo(MTPDmsgs_all_info *_data); + explicit MTPmsgsAllInfo(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2195,31 +2060,13 @@ typedef MTPBoxed MTPMsgsAllInfo; class MTPmsgDetailedInfo : private mtpDataOwner { public: - MTPmsgDetailedInfo() : mtpDataOwner(0), _type(0) { + MTPmsgDetailedInfo() : mtpDataOwner(nullptr) { } - MTPmsgDetailedInfo(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmsgDetailedInfo(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmsg_detailed_info &_msg_detailed_info() { - t_assert(data != nullptr && _type == mtpc_msg_detailed_info); - split(); - return *(MTPDmsg_detailed_info*)data; - } - const MTPDmsg_detailed_info &c_msg_detailed_info() const { - t_assert(data != nullptr && _type == mtpc_msg_detailed_info); - return *(const MTPDmsg_detailed_info*)data; - } - - MTPDmsg_new_detailed_info &_msg_new_detailed_info() { - t_assert(data != nullptr && _type == mtpc_msg_new_detailed_info); - split(); - return *(MTPDmsg_new_detailed_info*)data; - } - const MTPDmsg_new_detailed_info &c_msg_new_detailed_info() const { - t_assert(data != nullptr && _type == mtpc_msg_new_detailed_info); - return *(const MTPDmsg_new_detailed_info*)data; - } + const MTPDmsg_detailed_info &c_msg_detailed_info() const; + const MTPDmsg_new_detailed_info &c_msg_new_detailed_info() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2230,31 +2077,22 @@ public: private: explicit MTPmsgDetailedInfo(mtpTypeId type); - explicit MTPmsgDetailedInfo(MTPDmsg_detailed_info *_data); - explicit MTPmsgDetailedInfo(MTPDmsg_new_detailed_info *_data); + explicit MTPmsgDetailedInfo(std::shared_ptr &&data); + explicit MTPmsgDetailedInfo(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPMsgDetailedInfo; class MTPmsgResendReq : private mtpDataOwner { public: MTPmsgResendReq(); - MTPmsgResendReq(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_msg_resend_req) : mtpDataOwner(0) { + MTPmsgResendReq(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_msg_resend_req) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmsg_resend_req &_msg_resend_req() { - t_assert(data != nullptr); - split(); - return *(MTPDmsg_resend_req*)data; - } - const MTPDmsg_resend_req &c_msg_resend_req() const { - t_assert(data != nullptr); - return *(const MTPDmsg_resend_req*)data; - } + const MTPDmsg_resend_req &c_msg_resend_req() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2264,7 +2102,7 @@ public: typedef void ResponseType; private: - explicit MTPmsgResendReq(MTPDmsg_resend_req *_data); + explicit MTPmsgResendReq(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2273,19 +2111,10 @@ typedef MTPBoxed MTPMsgResendReq; class MTPrpcError : private mtpDataOwner { public: MTPrpcError(); - MTPrpcError(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_rpc_error) : mtpDataOwner(0) { + MTPrpcError(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_rpc_error) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDrpc_error &_rpc_error() { - t_assert(data != nullptr); - split(); - return *(MTPDrpc_error*)data; - } - const MTPDrpc_error &c_rpc_error() const { - t_assert(data != nullptr); - return *(const MTPDrpc_error*)data; - } + const MTPDrpc_error &c_rpc_error() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2295,7 +2124,7 @@ public: typedef void ResponseType; private: - explicit MTPrpcError(MTPDrpc_error *_data); + explicit MTPrpcError(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2303,21 +2132,12 @@ typedef MTPBoxed MTPRpcError; class MTPrpcDropAnswer : private mtpDataOwner { public: - MTPrpcDropAnswer() : mtpDataOwner(0), _type(0) { + MTPrpcDropAnswer() : mtpDataOwner(nullptr) { } - MTPrpcDropAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPrpcDropAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDrpc_answer_dropped &_rpc_answer_dropped() { - t_assert(data != nullptr && _type == mtpc_rpc_answer_dropped); - split(); - return *(MTPDrpc_answer_dropped*)data; - } - const MTPDrpc_answer_dropped &c_rpc_answer_dropped() const { - t_assert(data != nullptr && _type == mtpc_rpc_answer_dropped); - return *(const MTPDrpc_answer_dropped*)data; - } + const MTPDrpc_answer_dropped &c_rpc_answer_dropped() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2328,30 +2148,21 @@ public: private: explicit MTPrpcDropAnswer(mtpTypeId type); - explicit MTPrpcDropAnswer(MTPDrpc_answer_dropped *_data); + explicit MTPrpcDropAnswer(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPRpcDropAnswer; class MTPfutureSalt : private mtpDataOwner { public: MTPfutureSalt(); - MTPfutureSalt(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_future_salt) : mtpDataOwner(0) { + MTPfutureSalt(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_future_salt) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDfuture_salt &_future_salt() { - t_assert(data != nullptr); - split(); - return *(MTPDfuture_salt*)data; - } - const MTPDfuture_salt &c_future_salt() const { - t_assert(data != nullptr); - return *(const MTPDfuture_salt*)data; - } + const MTPDfuture_salt &c_future_salt() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2361,7 +2172,7 @@ public: typedef void ResponseType; private: - explicit MTPfutureSalt(MTPDfuture_salt *_data); + explicit MTPfutureSalt(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2370,19 +2181,10 @@ typedef MTPBoxed MTPFutureSalt; class MTPfutureSalts : private mtpDataOwner { public: MTPfutureSalts(); - MTPfutureSalts(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_future_salts) : mtpDataOwner(0) { + MTPfutureSalts(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_future_salts) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDfuture_salts &_future_salts() { - t_assert(data != nullptr); - split(); - return *(MTPDfuture_salts*)data; - } - const MTPDfuture_salts &c_future_salts() const { - t_assert(data != nullptr); - return *(const MTPDfuture_salts*)data; - } + const MTPDfuture_salts &c_future_salts() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2392,7 +2194,7 @@ public: typedef void ResponseType; private: - explicit MTPfutureSalts(MTPDfuture_salts *_data); + explicit MTPfutureSalts(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2401,19 +2203,10 @@ typedef MTPBoxed MTPFutureSalts; class MTPpong : private mtpDataOwner { public: MTPpong(); - MTPpong(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_pong) : mtpDataOwner(0) { + MTPpong(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_pong) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDpong &_pong() { - t_assert(data != nullptr); - split(); - return *(MTPDpong*)data; - } - const MTPDpong &c_pong() const { - t_assert(data != nullptr); - return *(const MTPDpong*)data; - } + const MTPDpong &c_pong() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2423,7 +2216,7 @@ public: typedef void ResponseType; private: - explicit MTPpong(MTPDpong *_data); + explicit MTPpong(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2431,31 +2224,13 @@ typedef MTPBoxed MTPPong; class MTPdestroySessionRes : private mtpDataOwner { public: - MTPdestroySessionRes() : mtpDataOwner(0), _type(0) { + MTPdestroySessionRes() : mtpDataOwner(nullptr) { } - MTPdestroySessionRes(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPdestroySessionRes(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDdestroy_session_ok &_destroy_session_ok() { - t_assert(data != nullptr && _type == mtpc_destroy_session_ok); - split(); - return *(MTPDdestroy_session_ok*)data; - } - const MTPDdestroy_session_ok &c_destroy_session_ok() const { - t_assert(data != nullptr && _type == mtpc_destroy_session_ok); - return *(const MTPDdestroy_session_ok*)data; - } - - MTPDdestroy_session_none &_destroy_session_none() { - t_assert(data != nullptr && _type == mtpc_destroy_session_none); - split(); - return *(MTPDdestroy_session_none*)data; - } - const MTPDdestroy_session_none &c_destroy_session_none() const { - t_assert(data != nullptr && _type == mtpc_destroy_session_none); - return *(const MTPDdestroy_session_none*)data; - } + const MTPDdestroy_session_ok &c_destroy_session_ok() const; + const MTPDdestroy_session_none &c_destroy_session_none() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2466,31 +2241,22 @@ public: private: explicit MTPdestroySessionRes(mtpTypeId type); - explicit MTPdestroySessionRes(MTPDdestroy_session_ok *_data); - explicit MTPdestroySessionRes(MTPDdestroy_session_none *_data); + explicit MTPdestroySessionRes(std::shared_ptr &&data); + explicit MTPdestroySessionRes(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPDestroySessionRes; class MTPnewSession : private mtpDataOwner { public: MTPnewSession(); - MTPnewSession(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_new_session_created) : mtpDataOwner(0) { + MTPnewSession(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_new_session_created) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDnew_session_created &_new_session_created() { - t_assert(data != nullptr); - split(); - return *(MTPDnew_session_created*)data; - } - const MTPDnew_session_created &c_new_session_created() const { - t_assert(data != nullptr); - return *(const MTPDnew_session_created*)data; - } + const MTPDnew_session_created &c_new_session_created() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2500,7 +2266,7 @@ public: typedef void ResponseType; private: - explicit MTPnewSession(MTPDnew_session_created *_data); + explicit MTPnewSession(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2509,19 +2275,10 @@ typedef MTPBoxed MTPNewSession; class MTPhttpWait : private mtpDataOwner { public: MTPhttpWait(); - MTPhttpWait(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_http_wait) : mtpDataOwner(0) { + MTPhttpWait(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_http_wait) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDhttp_wait &_http_wait() { - t_assert(data != nullptr); - split(); - return *(MTPDhttp_wait*)data; - } - const MTPDhttp_wait &c_http_wait() const { - t_assert(data != nullptr); - return *(const MTPDhttp_wait*)data; - } + const MTPDhttp_wait &c_http_wait() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2531,7 +2288,7 @@ public: typedef void ResponseType; private: - explicit MTPhttpWait(MTPDhttp_wait *_data); + explicit MTPhttpWait(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2539,9 +2296,9 @@ typedef MTPBoxed MTPHttpWait; class MTPbool { public: - MTPbool() : _type(0) { + MTPbool() { } - MTPbool(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPbool(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -2557,7 +2314,7 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPBool; @@ -2585,19 +2342,10 @@ typedef MTPBoxed MTPTrue; class MTPerror : private mtpDataOwner { public: MTPerror(); - MTPerror(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_error) : mtpDataOwner(0) { + MTPerror(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_error) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDerror &_error() { - t_assert(data != nullptr); - split(); - return *(MTPDerror*)data; - } - const MTPDerror &c_error() const { - t_assert(data != nullptr); - return *(const MTPDerror*)data; - } + const MTPDerror &c_error() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2607,7 +2355,7 @@ public: typedef void ResponseType; private: - explicit MTPerror(MTPDerror *_data); + explicit MTPerror(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2636,41 +2384,14 @@ typedef MTPBoxed MTPNull; class MTPinputPeer : private mtpDataOwner { public: - MTPinputPeer() : mtpDataOwner(0), _type(0) { + MTPinputPeer() : mtpDataOwner(nullptr) { } - MTPinputPeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputPeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputPeerChat &_inputPeerChat() { - t_assert(data != nullptr && _type == mtpc_inputPeerChat); - split(); - return *(MTPDinputPeerChat*)data; - } - const MTPDinputPeerChat &c_inputPeerChat() const { - t_assert(data != nullptr && _type == mtpc_inputPeerChat); - return *(const MTPDinputPeerChat*)data; - } - - MTPDinputPeerUser &_inputPeerUser() { - t_assert(data != nullptr && _type == mtpc_inputPeerUser); - split(); - return *(MTPDinputPeerUser*)data; - } - const MTPDinputPeerUser &c_inputPeerUser() const { - t_assert(data != nullptr && _type == mtpc_inputPeerUser); - return *(const MTPDinputPeerUser*)data; - } - - MTPDinputPeerChannel &_inputPeerChannel() { - t_assert(data != nullptr && _type == mtpc_inputPeerChannel); - split(); - return *(MTPDinputPeerChannel*)data; - } - const MTPDinputPeerChannel &c_inputPeerChannel() const { - t_assert(data != nullptr && _type == mtpc_inputPeerChannel); - return *(const MTPDinputPeerChannel*)data; - } + const MTPDinputPeerChat &c_inputPeerChat() const; + const MTPDinputPeerUser &c_inputPeerUser() const; + const MTPDinputPeerChannel &c_inputPeerChannel() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2681,33 +2402,24 @@ public: private: explicit MTPinputPeer(mtpTypeId type); - explicit MTPinputPeer(MTPDinputPeerChat *_data); - explicit MTPinputPeer(MTPDinputPeerUser *_data); - explicit MTPinputPeer(MTPDinputPeerChannel *_data); + explicit MTPinputPeer(std::shared_ptr &&data); + explicit MTPinputPeer(std::shared_ptr &&data); + explicit MTPinputPeer(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputPeer; class MTPinputUser : private mtpDataOwner { public: - MTPinputUser() : mtpDataOwner(0), _type(0) { + MTPinputUser() : mtpDataOwner(nullptr) { } - MTPinputUser(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputUser(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputUser &_inputUser() { - t_assert(data != nullptr && _type == mtpc_inputUser); - split(); - return *(MTPDinputUser*)data; - } - const MTPDinputUser &c_inputUser() const { - t_assert(data != nullptr && _type == mtpc_inputUser); - return *(const MTPDinputUser*)data; - } + const MTPDinputUser &c_inputUser() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2718,30 +2430,21 @@ public: private: explicit MTPinputUser(mtpTypeId type); - explicit MTPinputUser(MTPDinputUser *_data); + explicit MTPinputUser(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputUser; class MTPinputContact : private mtpDataOwner { public: MTPinputContact(); - MTPinputContact(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputPhoneContact) : mtpDataOwner(0) { + MTPinputContact(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputPhoneContact) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputPhoneContact &_inputPhoneContact() { - t_assert(data != nullptr); - split(); - return *(MTPDinputPhoneContact*)data; - } - const MTPDinputPhoneContact &c_inputPhoneContact() const { - t_assert(data != nullptr); - return *(const MTPDinputPhoneContact*)data; - } + const MTPDinputPhoneContact &c_inputPhoneContact() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2751,7 +2454,7 @@ public: typedef void ResponseType; private: - explicit MTPinputContact(MTPDinputPhoneContact *_data); + explicit MTPinputContact(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -2759,31 +2462,13 @@ typedef MTPBoxed MTPInputContact; class MTPinputFile : private mtpDataOwner { public: - MTPinputFile() : mtpDataOwner(0), _type(0) { + MTPinputFile() : mtpDataOwner(nullptr) { } - MTPinputFile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputFile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputFile &_inputFile() { - t_assert(data != nullptr && _type == mtpc_inputFile); - split(); - return *(MTPDinputFile*)data; - } - const MTPDinputFile &c_inputFile() const { - t_assert(data != nullptr && _type == mtpc_inputFile); - return *(const MTPDinputFile*)data; - } - - MTPDinputFileBig &_inputFileBig() { - t_assert(data != nullptr && _type == mtpc_inputFileBig); - split(); - return *(MTPDinputFileBig*)data; - } - const MTPDinputFileBig &c_inputFileBig() const { - t_assert(data != nullptr && _type == mtpc_inputFileBig); - return *(const MTPDinputFileBig*)data; - } + const MTPDinputFile &c_inputFile() const; + const MTPDinputFileBig &c_inputFileBig() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2794,142 +2479,34 @@ public: private: explicit MTPinputFile(mtpTypeId type); - explicit MTPinputFile(MTPDinputFile *_data); - explicit MTPinputFile(MTPDinputFileBig *_data); + explicit MTPinputFile(std::shared_ptr &&data); + explicit MTPinputFile(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputFile; class MTPinputMedia : private mtpDataOwner { public: - MTPinputMedia() : mtpDataOwner(0), _type(0) { + MTPinputMedia() : mtpDataOwner(nullptr) { } - MTPinputMedia(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputMedia(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputMediaUploadedPhoto &_inputMediaUploadedPhoto() { - t_assert(data != nullptr && _type == mtpc_inputMediaUploadedPhoto); - split(); - return *(MTPDinputMediaUploadedPhoto*)data; - } - const MTPDinputMediaUploadedPhoto &c_inputMediaUploadedPhoto() const { - t_assert(data != nullptr && _type == mtpc_inputMediaUploadedPhoto); - return *(const MTPDinputMediaUploadedPhoto*)data; - } - - MTPDinputMediaPhoto &_inputMediaPhoto() { - t_assert(data != nullptr && _type == mtpc_inputMediaPhoto); - split(); - return *(MTPDinputMediaPhoto*)data; - } - const MTPDinputMediaPhoto &c_inputMediaPhoto() const { - t_assert(data != nullptr && _type == mtpc_inputMediaPhoto); - return *(const MTPDinputMediaPhoto*)data; - } - - MTPDinputMediaGeoPoint &_inputMediaGeoPoint() { - t_assert(data != nullptr && _type == mtpc_inputMediaGeoPoint); - split(); - return *(MTPDinputMediaGeoPoint*)data; - } - const MTPDinputMediaGeoPoint &c_inputMediaGeoPoint() const { - t_assert(data != nullptr && _type == mtpc_inputMediaGeoPoint); - return *(const MTPDinputMediaGeoPoint*)data; - } - - MTPDinputMediaContact &_inputMediaContact() { - t_assert(data != nullptr && _type == mtpc_inputMediaContact); - split(); - return *(MTPDinputMediaContact*)data; - } - const MTPDinputMediaContact &c_inputMediaContact() const { - t_assert(data != nullptr && _type == mtpc_inputMediaContact); - return *(const MTPDinputMediaContact*)data; - } - - MTPDinputMediaUploadedDocument &_inputMediaUploadedDocument() { - t_assert(data != nullptr && _type == mtpc_inputMediaUploadedDocument); - split(); - return *(MTPDinputMediaUploadedDocument*)data; - } - const MTPDinputMediaUploadedDocument &c_inputMediaUploadedDocument() const { - t_assert(data != nullptr && _type == mtpc_inputMediaUploadedDocument); - return *(const MTPDinputMediaUploadedDocument*)data; - } - - MTPDinputMediaUploadedThumbDocument &_inputMediaUploadedThumbDocument() { - t_assert(data != nullptr && _type == mtpc_inputMediaUploadedThumbDocument); - split(); - return *(MTPDinputMediaUploadedThumbDocument*)data; - } - const MTPDinputMediaUploadedThumbDocument &c_inputMediaUploadedThumbDocument() const { - t_assert(data != nullptr && _type == mtpc_inputMediaUploadedThumbDocument); - return *(const MTPDinputMediaUploadedThumbDocument*)data; - } - - MTPDinputMediaDocument &_inputMediaDocument() { - t_assert(data != nullptr && _type == mtpc_inputMediaDocument); - split(); - return *(MTPDinputMediaDocument*)data; - } - const MTPDinputMediaDocument &c_inputMediaDocument() const { - t_assert(data != nullptr && _type == mtpc_inputMediaDocument); - return *(const MTPDinputMediaDocument*)data; - } - - MTPDinputMediaVenue &_inputMediaVenue() { - t_assert(data != nullptr && _type == mtpc_inputMediaVenue); - split(); - return *(MTPDinputMediaVenue*)data; - } - const MTPDinputMediaVenue &c_inputMediaVenue() const { - t_assert(data != nullptr && _type == mtpc_inputMediaVenue); - return *(const MTPDinputMediaVenue*)data; - } - - MTPDinputMediaGifExternal &_inputMediaGifExternal() { - t_assert(data != nullptr && _type == mtpc_inputMediaGifExternal); - split(); - return *(MTPDinputMediaGifExternal*)data; - } - const MTPDinputMediaGifExternal &c_inputMediaGifExternal() const { - t_assert(data != nullptr && _type == mtpc_inputMediaGifExternal); - return *(const MTPDinputMediaGifExternal*)data; - } - - MTPDinputMediaPhotoExternal &_inputMediaPhotoExternal() { - t_assert(data != nullptr && _type == mtpc_inputMediaPhotoExternal); - split(); - return *(MTPDinputMediaPhotoExternal*)data; - } - const MTPDinputMediaPhotoExternal &c_inputMediaPhotoExternal() const { - t_assert(data != nullptr && _type == mtpc_inputMediaPhotoExternal); - return *(const MTPDinputMediaPhotoExternal*)data; - } - - MTPDinputMediaDocumentExternal &_inputMediaDocumentExternal() { - t_assert(data != nullptr && _type == mtpc_inputMediaDocumentExternal); - split(); - return *(MTPDinputMediaDocumentExternal*)data; - } - const MTPDinputMediaDocumentExternal &c_inputMediaDocumentExternal() const { - t_assert(data != nullptr && _type == mtpc_inputMediaDocumentExternal); - return *(const MTPDinputMediaDocumentExternal*)data; - } - - MTPDinputMediaGame &_inputMediaGame() { - t_assert(data != nullptr && _type == mtpc_inputMediaGame); - split(); - return *(MTPDinputMediaGame*)data; - } - const MTPDinputMediaGame &c_inputMediaGame() const { - t_assert(data != nullptr && _type == mtpc_inputMediaGame); - return *(const MTPDinputMediaGame*)data; - } + const MTPDinputMediaUploadedPhoto &c_inputMediaUploadedPhoto() const; + const MTPDinputMediaPhoto &c_inputMediaPhoto() const; + const MTPDinputMediaGeoPoint &c_inputMediaGeoPoint() const; + const MTPDinputMediaContact &c_inputMediaContact() const; + const MTPDinputMediaUploadedDocument &c_inputMediaUploadedDocument() const; + const MTPDinputMediaUploadedThumbDocument &c_inputMediaUploadedThumbDocument() const; + const MTPDinputMediaDocument &c_inputMediaDocument() const; + const MTPDinputMediaVenue &c_inputMediaVenue() const; + const MTPDinputMediaGifExternal &c_inputMediaGifExternal() const; + const MTPDinputMediaPhotoExternal &c_inputMediaPhotoExternal() const; + const MTPDinputMediaDocumentExternal &c_inputMediaDocumentExternal() const; + const MTPDinputMediaGame &c_inputMediaGame() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2940,52 +2517,34 @@ public: private: explicit MTPinputMedia(mtpTypeId type); - explicit MTPinputMedia(MTPDinputMediaUploadedPhoto *_data); - explicit MTPinputMedia(MTPDinputMediaPhoto *_data); - explicit MTPinputMedia(MTPDinputMediaGeoPoint *_data); - explicit MTPinputMedia(MTPDinputMediaContact *_data); - explicit MTPinputMedia(MTPDinputMediaUploadedDocument *_data); - explicit MTPinputMedia(MTPDinputMediaUploadedThumbDocument *_data); - explicit MTPinputMedia(MTPDinputMediaDocument *_data); - explicit MTPinputMedia(MTPDinputMediaVenue *_data); - explicit MTPinputMedia(MTPDinputMediaGifExternal *_data); - explicit MTPinputMedia(MTPDinputMediaPhotoExternal *_data); - explicit MTPinputMedia(MTPDinputMediaDocumentExternal *_data); - explicit MTPinputMedia(MTPDinputMediaGame *_data); + explicit MTPinputMedia(std::shared_ptr &&data); + explicit MTPinputMedia(std::shared_ptr &&data); + explicit MTPinputMedia(std::shared_ptr &&data); + explicit MTPinputMedia(std::shared_ptr &&data); + explicit MTPinputMedia(std::shared_ptr &&data); + explicit MTPinputMedia(std::shared_ptr &&data); + explicit MTPinputMedia(std::shared_ptr &&data); + explicit MTPinputMedia(std::shared_ptr &&data); + explicit MTPinputMedia(std::shared_ptr &&data); + explicit MTPinputMedia(std::shared_ptr &&data); + explicit MTPinputMedia(std::shared_ptr &&data); + explicit MTPinputMedia(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputMedia; class MTPinputChatPhoto : private mtpDataOwner { public: - MTPinputChatPhoto() : mtpDataOwner(0), _type(0) { + MTPinputChatPhoto() : mtpDataOwner(nullptr) { } - MTPinputChatPhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputChatPhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputChatUploadedPhoto &_inputChatUploadedPhoto() { - t_assert(data != nullptr && _type == mtpc_inputChatUploadedPhoto); - split(); - return *(MTPDinputChatUploadedPhoto*)data; - } - const MTPDinputChatUploadedPhoto &c_inputChatUploadedPhoto() const { - t_assert(data != nullptr && _type == mtpc_inputChatUploadedPhoto); - return *(const MTPDinputChatUploadedPhoto*)data; - } - - MTPDinputChatPhoto &_inputChatPhoto() { - t_assert(data != nullptr && _type == mtpc_inputChatPhoto); - split(); - return *(MTPDinputChatPhoto*)data; - } - const MTPDinputChatPhoto &c_inputChatPhoto() const { - t_assert(data != nullptr && _type == mtpc_inputChatPhoto); - return *(const MTPDinputChatPhoto*)data; - } + const MTPDinputChatUploadedPhoto &c_inputChatUploadedPhoto() const; + const MTPDinputChatPhoto &c_inputChatPhoto() const; uint32 innerLength() const; mtpTypeId type() const; @@ -2996,32 +2555,23 @@ public: private: explicit MTPinputChatPhoto(mtpTypeId type); - explicit MTPinputChatPhoto(MTPDinputChatUploadedPhoto *_data); - explicit MTPinputChatPhoto(MTPDinputChatPhoto *_data); + explicit MTPinputChatPhoto(std::shared_ptr &&data); + explicit MTPinputChatPhoto(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputChatPhoto; class MTPinputGeoPoint : private mtpDataOwner { public: - MTPinputGeoPoint() : mtpDataOwner(0), _type(0) { + MTPinputGeoPoint() : mtpDataOwner(nullptr) { } - MTPinputGeoPoint(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputGeoPoint(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputGeoPoint &_inputGeoPoint() { - t_assert(data != nullptr && _type == mtpc_inputGeoPoint); - split(); - return *(MTPDinputGeoPoint*)data; - } - const MTPDinputGeoPoint &c_inputGeoPoint() const { - t_assert(data != nullptr && _type == mtpc_inputGeoPoint); - return *(const MTPDinputGeoPoint*)data; - } + const MTPDinputGeoPoint &c_inputGeoPoint() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3032,31 +2582,22 @@ public: private: explicit MTPinputGeoPoint(mtpTypeId type); - explicit MTPinputGeoPoint(MTPDinputGeoPoint *_data); + explicit MTPinputGeoPoint(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputGeoPoint; class MTPinputPhoto : private mtpDataOwner { public: - MTPinputPhoto() : mtpDataOwner(0), _type(0) { + MTPinputPhoto() : mtpDataOwner(nullptr) { } - MTPinputPhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputPhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputPhoto &_inputPhoto() { - t_assert(data != nullptr && _type == mtpc_inputPhoto); - split(); - return *(MTPDinputPhoto*)data; - } - const MTPDinputPhoto &c_inputPhoto() const { - t_assert(data != nullptr && _type == mtpc_inputPhoto); - return *(const MTPDinputPhoto*)data; - } + const MTPDinputPhoto &c_inputPhoto() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3067,51 +2608,24 @@ public: private: explicit MTPinputPhoto(mtpTypeId type); - explicit MTPinputPhoto(MTPDinputPhoto *_data); + explicit MTPinputPhoto(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputPhoto; class MTPinputFileLocation : private mtpDataOwner { public: - MTPinputFileLocation() : mtpDataOwner(0), _type(0) { + MTPinputFileLocation() : mtpDataOwner(nullptr) { } - MTPinputFileLocation(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputFileLocation(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputFileLocation &_inputFileLocation() { - t_assert(data != nullptr && _type == mtpc_inputFileLocation); - split(); - return *(MTPDinputFileLocation*)data; - } - const MTPDinputFileLocation &c_inputFileLocation() const { - t_assert(data != nullptr && _type == mtpc_inputFileLocation); - return *(const MTPDinputFileLocation*)data; - } - - MTPDinputEncryptedFileLocation &_inputEncryptedFileLocation() { - t_assert(data != nullptr && _type == mtpc_inputEncryptedFileLocation); - split(); - return *(MTPDinputEncryptedFileLocation*)data; - } - const MTPDinputEncryptedFileLocation &c_inputEncryptedFileLocation() const { - t_assert(data != nullptr && _type == mtpc_inputEncryptedFileLocation); - return *(const MTPDinputEncryptedFileLocation*)data; - } - - MTPDinputDocumentFileLocation &_inputDocumentFileLocation() { - t_assert(data != nullptr && _type == mtpc_inputDocumentFileLocation); - split(); - return *(MTPDinputDocumentFileLocation*)data; - } - const MTPDinputDocumentFileLocation &c_inputDocumentFileLocation() const { - t_assert(data != nullptr && _type == mtpc_inputDocumentFileLocation); - return *(const MTPDinputDocumentFileLocation*)data; - } + const MTPDinputFileLocation &c_inputFileLocation() const; + const MTPDinputEncryptedFileLocation &c_inputEncryptedFileLocation() const; + const MTPDinputDocumentFileLocation &c_inputDocumentFileLocation() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3122,32 +2636,23 @@ public: private: explicit MTPinputFileLocation(mtpTypeId type); - explicit MTPinputFileLocation(MTPDinputFileLocation *_data); - explicit MTPinputFileLocation(MTPDinputEncryptedFileLocation *_data); - explicit MTPinputFileLocation(MTPDinputDocumentFileLocation *_data); + explicit MTPinputFileLocation(std::shared_ptr &&data); + explicit MTPinputFileLocation(std::shared_ptr &&data); + explicit MTPinputFileLocation(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputFileLocation; class MTPinputAppEvent : private mtpDataOwner { public: MTPinputAppEvent(); - MTPinputAppEvent(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputAppEvent) : mtpDataOwner(0) { + MTPinputAppEvent(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputAppEvent) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputAppEvent &_inputAppEvent() { - t_assert(data != nullptr); - split(); - return *(MTPDinputAppEvent*)data; - } - const MTPDinputAppEvent &c_inputAppEvent() const { - t_assert(data != nullptr); - return *(const MTPDinputAppEvent*)data; - } + const MTPDinputAppEvent &c_inputAppEvent() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3157,7 +2662,7 @@ public: typedef void ResponseType; private: - explicit MTPinputAppEvent(MTPDinputAppEvent *_data); + explicit MTPinputAppEvent(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -3165,41 +2670,14 @@ typedef MTPBoxed MTPInputAppEvent; class MTPpeer : private mtpDataOwner { public: - MTPpeer() : mtpDataOwner(0), _type(0) { + MTPpeer() : mtpDataOwner(nullptr) { } - MTPpeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPpeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDpeerUser &_peerUser() { - t_assert(data != nullptr && _type == mtpc_peerUser); - split(); - return *(MTPDpeerUser*)data; - } - const MTPDpeerUser &c_peerUser() const { - t_assert(data != nullptr && _type == mtpc_peerUser); - return *(const MTPDpeerUser*)data; - } - - MTPDpeerChat &_peerChat() { - t_assert(data != nullptr && _type == mtpc_peerChat); - split(); - return *(MTPDpeerChat*)data; - } - const MTPDpeerChat &c_peerChat() const { - t_assert(data != nullptr && _type == mtpc_peerChat); - return *(const MTPDpeerChat*)data; - } - - MTPDpeerChannel &_peerChannel() { - t_assert(data != nullptr && _type == mtpc_peerChannel); - split(); - return *(MTPDpeerChannel*)data; - } - const MTPDpeerChannel &c_peerChannel() const { - t_assert(data != nullptr && _type == mtpc_peerChannel); - return *(const MTPDpeerChannel*)data; - } + const MTPDpeerUser &c_peerUser() const; + const MTPDpeerChat &c_peerChat() const; + const MTPDpeerChannel &c_peerChannel() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3210,21 +2688,21 @@ public: private: explicit MTPpeer(mtpTypeId type); - explicit MTPpeer(MTPDpeerUser *_data); - explicit MTPpeer(MTPDpeerChat *_data); - explicit MTPpeer(MTPDpeerChannel *_data); + explicit MTPpeer(std::shared_ptr &&data); + explicit MTPpeer(std::shared_ptr &&data); + explicit MTPpeer(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPPeer; class MTPstorage_fileType { public: - MTPstorage_fileType() : _type(0) { + MTPstorage_fileType() { } - MTPstorage_fileType(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPstorage_fileType(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -3240,37 +2718,19 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPstorage_FileType; class MTPfileLocation : private mtpDataOwner { public: - MTPfileLocation() : mtpDataOwner(0), _type(0) { + MTPfileLocation() : mtpDataOwner(nullptr) { } - MTPfileLocation(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPfileLocation(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDfileLocationUnavailable &_fileLocationUnavailable() { - t_assert(data != nullptr && _type == mtpc_fileLocationUnavailable); - split(); - return *(MTPDfileLocationUnavailable*)data; - } - const MTPDfileLocationUnavailable &c_fileLocationUnavailable() const { - t_assert(data != nullptr && _type == mtpc_fileLocationUnavailable); - return *(const MTPDfileLocationUnavailable*)data; - } - - MTPDfileLocation &_fileLocation() { - t_assert(data != nullptr && _type == mtpc_fileLocation); - split(); - return *(MTPDfileLocation*)data; - } - const MTPDfileLocation &c_fileLocation() const { - t_assert(data != nullptr && _type == mtpc_fileLocation); - return *(const MTPDfileLocation*)data; - } + const MTPDfileLocationUnavailable &c_fileLocationUnavailable() const; + const MTPDfileLocation &c_fileLocation() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3281,42 +2741,24 @@ public: private: explicit MTPfileLocation(mtpTypeId type); - explicit MTPfileLocation(MTPDfileLocationUnavailable *_data); - explicit MTPfileLocation(MTPDfileLocation *_data); + explicit MTPfileLocation(std::shared_ptr &&data); + explicit MTPfileLocation(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPFileLocation; class MTPuser : private mtpDataOwner { public: - MTPuser() : mtpDataOwner(0), _type(0) { + MTPuser() : mtpDataOwner(nullptr) { } - MTPuser(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPuser(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDuserEmpty &_userEmpty() { - t_assert(data != nullptr && _type == mtpc_userEmpty); - split(); - return *(MTPDuserEmpty*)data; - } - const MTPDuserEmpty &c_userEmpty() const { - t_assert(data != nullptr && _type == mtpc_userEmpty); - return *(const MTPDuserEmpty*)data; - } - - MTPDuser &_user() { - t_assert(data != nullptr && _type == mtpc_user); - split(); - return *(MTPDuser*)data; - } - const MTPDuser &c_user() const { - t_assert(data != nullptr && _type == mtpc_user); - return *(const MTPDuser*)data; - } + const MTPDuserEmpty &c_userEmpty() const; + const MTPDuser &c_user() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3327,32 +2769,23 @@ public: private: explicit MTPuser(mtpTypeId type); - explicit MTPuser(MTPDuserEmpty *_data); - explicit MTPuser(MTPDuser *_data); + explicit MTPuser(std::shared_ptr &&data); + explicit MTPuser(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPUser; class MTPuserProfilePhoto : private mtpDataOwner { public: - MTPuserProfilePhoto() : mtpDataOwner(0), _type(0) { + MTPuserProfilePhoto() : mtpDataOwner(nullptr) { } - MTPuserProfilePhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPuserProfilePhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDuserProfilePhoto &_userProfilePhoto() { - t_assert(data != nullptr && _type == mtpc_userProfilePhoto); - split(); - return *(MTPDuserProfilePhoto*)data; - } - const MTPDuserProfilePhoto &c_userProfilePhoto() const { - t_assert(data != nullptr && _type == mtpc_userProfilePhoto); - return *(const MTPDuserProfilePhoto*)data; - } + const MTPDuserProfilePhoto &c_userProfilePhoto() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3363,41 +2796,23 @@ public: private: explicit MTPuserProfilePhoto(mtpTypeId type); - explicit MTPuserProfilePhoto(MTPDuserProfilePhoto *_data); + explicit MTPuserProfilePhoto(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPUserProfilePhoto; class MTPuserStatus : private mtpDataOwner { public: - MTPuserStatus() : mtpDataOwner(0), _type(0) { + MTPuserStatus() : mtpDataOwner(nullptr) { } - MTPuserStatus(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPuserStatus(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDuserStatusOnline &_userStatusOnline() { - t_assert(data != nullptr && _type == mtpc_userStatusOnline); - split(); - return *(MTPDuserStatusOnline*)data; - } - const MTPDuserStatusOnline &c_userStatusOnline() const { - t_assert(data != nullptr && _type == mtpc_userStatusOnline); - return *(const MTPDuserStatusOnline*)data; - } - - MTPDuserStatusOffline &_userStatusOffline() { - t_assert(data != nullptr && _type == mtpc_userStatusOffline); - split(); - return *(MTPDuserStatusOffline*)data; - } - const MTPDuserStatusOffline &c_userStatusOffline() const { - t_assert(data != nullptr && _type == mtpc_userStatusOffline); - return *(const MTPDuserStatusOffline*)data; - } + const MTPDuserStatusOnline &c_userStatusOnline() const; + const MTPDuserStatusOffline &c_userStatusOffline() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3408,72 +2823,27 @@ public: private: explicit MTPuserStatus(mtpTypeId type); - explicit MTPuserStatus(MTPDuserStatusOnline *_data); - explicit MTPuserStatus(MTPDuserStatusOffline *_data); + explicit MTPuserStatus(std::shared_ptr &&data); + explicit MTPuserStatus(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPUserStatus; class MTPchat : private mtpDataOwner { public: - MTPchat() : mtpDataOwner(0), _type(0) { + MTPchat() : mtpDataOwner(nullptr) { } - MTPchat(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPchat(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDchatEmpty &_chatEmpty() { - t_assert(data != nullptr && _type == mtpc_chatEmpty); - split(); - return *(MTPDchatEmpty*)data; - } - const MTPDchatEmpty &c_chatEmpty() const { - t_assert(data != nullptr && _type == mtpc_chatEmpty); - return *(const MTPDchatEmpty*)data; - } - - MTPDchat &_chat() { - t_assert(data != nullptr && _type == mtpc_chat); - split(); - return *(MTPDchat*)data; - } - const MTPDchat &c_chat() const { - t_assert(data != nullptr && _type == mtpc_chat); - return *(const MTPDchat*)data; - } - - MTPDchatForbidden &_chatForbidden() { - t_assert(data != nullptr && _type == mtpc_chatForbidden); - split(); - return *(MTPDchatForbidden*)data; - } - const MTPDchatForbidden &c_chatForbidden() const { - t_assert(data != nullptr && _type == mtpc_chatForbidden); - return *(const MTPDchatForbidden*)data; - } - - MTPDchannel &_channel() { - t_assert(data != nullptr && _type == mtpc_channel); - split(); - return *(MTPDchannel*)data; - } - const MTPDchannel &c_channel() const { - t_assert(data != nullptr && _type == mtpc_channel); - return *(const MTPDchannel*)data; - } - - MTPDchannelForbidden &_channelForbidden() { - t_assert(data != nullptr && _type == mtpc_channelForbidden); - split(); - return *(MTPDchannelForbidden*)data; - } - const MTPDchannelForbidden &c_channelForbidden() const { - t_assert(data != nullptr && _type == mtpc_channelForbidden); - return *(const MTPDchannelForbidden*)data; - } + const MTPDchatEmpty &c_chatEmpty() const; + const MTPDchat &c_chat() const; + const MTPDchatForbidden &c_chatForbidden() const; + const MTPDchannel &c_channel() const; + const MTPDchannelForbidden &c_channelForbidden() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3484,45 +2854,27 @@ public: private: explicit MTPchat(mtpTypeId type); - explicit MTPchat(MTPDchatEmpty *_data); - explicit MTPchat(MTPDchat *_data); - explicit MTPchat(MTPDchatForbidden *_data); - explicit MTPchat(MTPDchannel *_data); - explicit MTPchat(MTPDchannelForbidden *_data); + explicit MTPchat(std::shared_ptr &&data); + explicit MTPchat(std::shared_ptr &&data); + explicit MTPchat(std::shared_ptr &&data); + explicit MTPchat(std::shared_ptr &&data); + explicit MTPchat(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPChat; class MTPchatFull : private mtpDataOwner { public: - MTPchatFull() : mtpDataOwner(0), _type(0) { + MTPchatFull() : mtpDataOwner(nullptr) { } - MTPchatFull(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPchatFull(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDchatFull &_chatFull() { - t_assert(data != nullptr && _type == mtpc_chatFull); - split(); - return *(MTPDchatFull*)data; - } - const MTPDchatFull &c_chatFull() const { - t_assert(data != nullptr && _type == mtpc_chatFull); - return *(const MTPDchatFull*)data; - } - - MTPDchannelFull &_channelFull() { - t_assert(data != nullptr && _type == mtpc_channelFull); - split(); - return *(MTPDchannelFull*)data; - } - const MTPDchannelFull &c_channelFull() const { - t_assert(data != nullptr && _type == mtpc_channelFull); - return *(const MTPDchannelFull*)data; - } + const MTPDchatFull &c_chatFull() const; + const MTPDchannelFull &c_channelFull() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3533,52 +2885,25 @@ public: private: explicit MTPchatFull(mtpTypeId type); - explicit MTPchatFull(MTPDchatFull *_data); - explicit MTPchatFull(MTPDchannelFull *_data); + explicit MTPchatFull(std::shared_ptr &&data); + explicit MTPchatFull(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPChatFull; class MTPchatParticipant : private mtpDataOwner { public: - MTPchatParticipant() : mtpDataOwner(0), _type(0) { + MTPchatParticipant() : mtpDataOwner(nullptr) { } - MTPchatParticipant(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPchatParticipant(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDchatParticipant &_chatParticipant() { - t_assert(data != nullptr && _type == mtpc_chatParticipant); - split(); - return *(MTPDchatParticipant*)data; - } - const MTPDchatParticipant &c_chatParticipant() const { - t_assert(data != nullptr && _type == mtpc_chatParticipant); - return *(const MTPDchatParticipant*)data; - } - - MTPDchatParticipantCreator &_chatParticipantCreator() { - t_assert(data != nullptr && _type == mtpc_chatParticipantCreator); - split(); - return *(MTPDchatParticipantCreator*)data; - } - const MTPDchatParticipantCreator &c_chatParticipantCreator() const { - t_assert(data != nullptr && _type == mtpc_chatParticipantCreator); - return *(const MTPDchatParticipantCreator*)data; - } - - MTPDchatParticipantAdmin &_chatParticipantAdmin() { - t_assert(data != nullptr && _type == mtpc_chatParticipantAdmin); - split(); - return *(MTPDchatParticipantAdmin*)data; - } - const MTPDchatParticipantAdmin &c_chatParticipantAdmin() const { - t_assert(data != nullptr && _type == mtpc_chatParticipantAdmin); - return *(const MTPDchatParticipantAdmin*)data; - } + const MTPDchatParticipant &c_chatParticipant() const; + const MTPDchatParticipantCreator &c_chatParticipantCreator() const; + const MTPDchatParticipantAdmin &c_chatParticipantAdmin() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3589,43 +2914,25 @@ public: private: explicit MTPchatParticipant(mtpTypeId type); - explicit MTPchatParticipant(MTPDchatParticipant *_data); - explicit MTPchatParticipant(MTPDchatParticipantCreator *_data); - explicit MTPchatParticipant(MTPDchatParticipantAdmin *_data); + explicit MTPchatParticipant(std::shared_ptr &&data); + explicit MTPchatParticipant(std::shared_ptr &&data); + explicit MTPchatParticipant(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPChatParticipant; class MTPchatParticipants : private mtpDataOwner { public: - MTPchatParticipants() : mtpDataOwner(0), _type(0) { + MTPchatParticipants() : mtpDataOwner(nullptr) { } - MTPchatParticipants(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPchatParticipants(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDchatParticipantsForbidden &_chatParticipantsForbidden() { - t_assert(data != nullptr && _type == mtpc_chatParticipantsForbidden); - split(); - return *(MTPDchatParticipantsForbidden*)data; - } - const MTPDchatParticipantsForbidden &c_chatParticipantsForbidden() const { - t_assert(data != nullptr && _type == mtpc_chatParticipantsForbidden); - return *(const MTPDchatParticipantsForbidden*)data; - } - - MTPDchatParticipants &_chatParticipants() { - t_assert(data != nullptr && _type == mtpc_chatParticipants); - split(); - return *(MTPDchatParticipants*)data; - } - const MTPDchatParticipants &c_chatParticipants() const { - t_assert(data != nullptr && _type == mtpc_chatParticipants); - return *(const MTPDchatParticipants*)data; - } + const MTPDchatParticipantsForbidden &c_chatParticipantsForbidden() const; + const MTPDchatParticipants &c_chatParticipants() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3636,32 +2943,23 @@ public: private: explicit MTPchatParticipants(mtpTypeId type); - explicit MTPchatParticipants(MTPDchatParticipantsForbidden *_data); - explicit MTPchatParticipants(MTPDchatParticipants *_data); + explicit MTPchatParticipants(std::shared_ptr &&data); + explicit MTPchatParticipants(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPChatParticipants; class MTPchatPhoto : private mtpDataOwner { public: - MTPchatPhoto() : mtpDataOwner(0), _type(0) { + MTPchatPhoto() : mtpDataOwner(nullptr) { } - MTPchatPhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPchatPhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDchatPhoto &_chatPhoto() { - t_assert(data != nullptr && _type == mtpc_chatPhoto); - split(); - return *(MTPDchatPhoto*)data; - } - const MTPDchatPhoto &c_chatPhoto() const { - t_assert(data != nullptr && _type == mtpc_chatPhoto); - return *(const MTPDchatPhoto*)data; - } + const MTPDchatPhoto &c_chatPhoto() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3672,51 +2970,24 @@ public: private: explicit MTPchatPhoto(mtpTypeId type); - explicit MTPchatPhoto(MTPDchatPhoto *_data); + explicit MTPchatPhoto(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPChatPhoto; class MTPmessage : private mtpDataOwner { public: - MTPmessage() : mtpDataOwner(0), _type(0) { + MTPmessage() : mtpDataOwner(nullptr) { } - MTPmessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessageEmpty &_messageEmpty() { - t_assert(data != nullptr && _type == mtpc_messageEmpty); - split(); - return *(MTPDmessageEmpty*)data; - } - const MTPDmessageEmpty &c_messageEmpty() const { - t_assert(data != nullptr && _type == mtpc_messageEmpty); - return *(const MTPDmessageEmpty*)data; - } - - MTPDmessage &_message() { - t_assert(data != nullptr && _type == mtpc_message); - split(); - return *(MTPDmessage*)data; - } - const MTPDmessage &c_message() const { - t_assert(data != nullptr && _type == mtpc_message); - return *(const MTPDmessage*)data; - } - - MTPDmessageService &_messageService() { - t_assert(data != nullptr && _type == mtpc_messageService); - split(); - return *(MTPDmessageService*)data; - } - const MTPDmessageService &c_messageService() const { - t_assert(data != nullptr && _type == mtpc_messageService); - return *(const MTPDmessageService*)data; - } + const MTPDmessageEmpty &c_messageEmpty() const; + const MTPDmessage &c_message() const; + const MTPDmessageService &c_messageService() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3727,93 +2998,30 @@ public: private: explicit MTPmessage(mtpTypeId type); - explicit MTPmessage(MTPDmessageEmpty *_data); - explicit MTPmessage(MTPDmessage *_data); - explicit MTPmessage(MTPDmessageService *_data); + explicit MTPmessage(std::shared_ptr &&data); + explicit MTPmessage(std::shared_ptr &&data); + explicit MTPmessage(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPMessage; class MTPmessageMedia : private mtpDataOwner { public: - MTPmessageMedia() : mtpDataOwner(0), _type(0) { + MTPmessageMedia() : mtpDataOwner(nullptr) { } - MTPmessageMedia(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessageMedia(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessageMediaPhoto &_messageMediaPhoto() { - t_assert(data != nullptr && _type == mtpc_messageMediaPhoto); - split(); - return *(MTPDmessageMediaPhoto*)data; - } - const MTPDmessageMediaPhoto &c_messageMediaPhoto() const { - t_assert(data != nullptr && _type == mtpc_messageMediaPhoto); - return *(const MTPDmessageMediaPhoto*)data; - } - - MTPDmessageMediaGeo &_messageMediaGeo() { - t_assert(data != nullptr && _type == mtpc_messageMediaGeo); - split(); - return *(MTPDmessageMediaGeo*)data; - } - const MTPDmessageMediaGeo &c_messageMediaGeo() const { - t_assert(data != nullptr && _type == mtpc_messageMediaGeo); - return *(const MTPDmessageMediaGeo*)data; - } - - MTPDmessageMediaContact &_messageMediaContact() { - t_assert(data != nullptr && _type == mtpc_messageMediaContact); - split(); - return *(MTPDmessageMediaContact*)data; - } - const MTPDmessageMediaContact &c_messageMediaContact() const { - t_assert(data != nullptr && _type == mtpc_messageMediaContact); - return *(const MTPDmessageMediaContact*)data; - } - - MTPDmessageMediaDocument &_messageMediaDocument() { - t_assert(data != nullptr && _type == mtpc_messageMediaDocument); - split(); - return *(MTPDmessageMediaDocument*)data; - } - const MTPDmessageMediaDocument &c_messageMediaDocument() const { - t_assert(data != nullptr && _type == mtpc_messageMediaDocument); - return *(const MTPDmessageMediaDocument*)data; - } - - MTPDmessageMediaWebPage &_messageMediaWebPage() { - t_assert(data != nullptr && _type == mtpc_messageMediaWebPage); - split(); - return *(MTPDmessageMediaWebPage*)data; - } - const MTPDmessageMediaWebPage &c_messageMediaWebPage() const { - t_assert(data != nullptr && _type == mtpc_messageMediaWebPage); - return *(const MTPDmessageMediaWebPage*)data; - } - - MTPDmessageMediaVenue &_messageMediaVenue() { - t_assert(data != nullptr && _type == mtpc_messageMediaVenue); - split(); - return *(MTPDmessageMediaVenue*)data; - } - const MTPDmessageMediaVenue &c_messageMediaVenue() const { - t_assert(data != nullptr && _type == mtpc_messageMediaVenue); - return *(const MTPDmessageMediaVenue*)data; - } - - MTPDmessageMediaGame &_messageMediaGame() { - t_assert(data != nullptr && _type == mtpc_messageMediaGame); - split(); - return *(MTPDmessageMediaGame*)data; - } - const MTPDmessageMediaGame &c_messageMediaGame() const { - t_assert(data != nullptr && _type == mtpc_messageMediaGame); - return *(const MTPDmessageMediaGame*)data; - } + const MTPDmessageMediaPhoto &c_messageMediaPhoto() const; + const MTPDmessageMediaGeo &c_messageMediaGeo() const; + const MTPDmessageMediaContact &c_messageMediaContact() const; + const MTPDmessageMediaDocument &c_messageMediaDocument() const; + const MTPDmessageMediaWebPage &c_messageMediaWebPage() const; + const MTPDmessageMediaVenue &c_messageMediaVenue() const; + const MTPDmessageMediaGame &c_messageMediaGame() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3824,137 +3032,38 @@ public: private: explicit MTPmessageMedia(mtpTypeId type); - explicit MTPmessageMedia(MTPDmessageMediaPhoto *_data); - explicit MTPmessageMedia(MTPDmessageMediaGeo *_data); - explicit MTPmessageMedia(MTPDmessageMediaContact *_data); - explicit MTPmessageMedia(MTPDmessageMediaDocument *_data); - explicit MTPmessageMedia(MTPDmessageMediaWebPage *_data); - explicit MTPmessageMedia(MTPDmessageMediaVenue *_data); - explicit MTPmessageMedia(MTPDmessageMediaGame *_data); + explicit MTPmessageMedia(std::shared_ptr &&data); + explicit MTPmessageMedia(std::shared_ptr &&data); + explicit MTPmessageMedia(std::shared_ptr &&data); + explicit MTPmessageMedia(std::shared_ptr &&data); + explicit MTPmessageMedia(std::shared_ptr &&data); + explicit MTPmessageMedia(std::shared_ptr &&data); + explicit MTPmessageMedia(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPMessageMedia; class MTPmessageAction : private mtpDataOwner { public: - MTPmessageAction() : mtpDataOwner(0), _type(0) { + MTPmessageAction() : mtpDataOwner(nullptr) { } - MTPmessageAction(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessageAction(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessageActionChatCreate &_messageActionChatCreate() { - t_assert(data != nullptr && _type == mtpc_messageActionChatCreate); - split(); - return *(MTPDmessageActionChatCreate*)data; - } - const MTPDmessageActionChatCreate &c_messageActionChatCreate() const { - t_assert(data != nullptr && _type == mtpc_messageActionChatCreate); - return *(const MTPDmessageActionChatCreate*)data; - } - - MTPDmessageActionChatEditTitle &_messageActionChatEditTitle() { - t_assert(data != nullptr && _type == mtpc_messageActionChatEditTitle); - split(); - return *(MTPDmessageActionChatEditTitle*)data; - } - const MTPDmessageActionChatEditTitle &c_messageActionChatEditTitle() const { - t_assert(data != nullptr && _type == mtpc_messageActionChatEditTitle); - return *(const MTPDmessageActionChatEditTitle*)data; - } - - MTPDmessageActionChatEditPhoto &_messageActionChatEditPhoto() { - t_assert(data != nullptr && _type == mtpc_messageActionChatEditPhoto); - split(); - return *(MTPDmessageActionChatEditPhoto*)data; - } - const MTPDmessageActionChatEditPhoto &c_messageActionChatEditPhoto() const { - t_assert(data != nullptr && _type == mtpc_messageActionChatEditPhoto); - return *(const MTPDmessageActionChatEditPhoto*)data; - } - - MTPDmessageActionChatAddUser &_messageActionChatAddUser() { - t_assert(data != nullptr && _type == mtpc_messageActionChatAddUser); - split(); - return *(MTPDmessageActionChatAddUser*)data; - } - const MTPDmessageActionChatAddUser &c_messageActionChatAddUser() const { - t_assert(data != nullptr && _type == mtpc_messageActionChatAddUser); - return *(const MTPDmessageActionChatAddUser*)data; - } - - MTPDmessageActionChatDeleteUser &_messageActionChatDeleteUser() { - t_assert(data != nullptr && _type == mtpc_messageActionChatDeleteUser); - split(); - return *(MTPDmessageActionChatDeleteUser*)data; - } - const MTPDmessageActionChatDeleteUser &c_messageActionChatDeleteUser() const { - t_assert(data != nullptr && _type == mtpc_messageActionChatDeleteUser); - return *(const MTPDmessageActionChatDeleteUser*)data; - } - - MTPDmessageActionChatJoinedByLink &_messageActionChatJoinedByLink() { - t_assert(data != nullptr && _type == mtpc_messageActionChatJoinedByLink); - split(); - return *(MTPDmessageActionChatJoinedByLink*)data; - } - const MTPDmessageActionChatJoinedByLink &c_messageActionChatJoinedByLink() const { - t_assert(data != nullptr && _type == mtpc_messageActionChatJoinedByLink); - return *(const MTPDmessageActionChatJoinedByLink*)data; - } - - MTPDmessageActionChannelCreate &_messageActionChannelCreate() { - t_assert(data != nullptr && _type == mtpc_messageActionChannelCreate); - split(); - return *(MTPDmessageActionChannelCreate*)data; - } - const MTPDmessageActionChannelCreate &c_messageActionChannelCreate() const { - t_assert(data != nullptr && _type == mtpc_messageActionChannelCreate); - return *(const MTPDmessageActionChannelCreate*)data; - } - - MTPDmessageActionChatMigrateTo &_messageActionChatMigrateTo() { - t_assert(data != nullptr && _type == mtpc_messageActionChatMigrateTo); - split(); - return *(MTPDmessageActionChatMigrateTo*)data; - } - const MTPDmessageActionChatMigrateTo &c_messageActionChatMigrateTo() const { - t_assert(data != nullptr && _type == mtpc_messageActionChatMigrateTo); - return *(const MTPDmessageActionChatMigrateTo*)data; - } - - MTPDmessageActionChannelMigrateFrom &_messageActionChannelMigrateFrom() { - t_assert(data != nullptr && _type == mtpc_messageActionChannelMigrateFrom); - split(); - return *(MTPDmessageActionChannelMigrateFrom*)data; - } - const MTPDmessageActionChannelMigrateFrom &c_messageActionChannelMigrateFrom() const { - t_assert(data != nullptr && _type == mtpc_messageActionChannelMigrateFrom); - return *(const MTPDmessageActionChannelMigrateFrom*)data; - } - - MTPDmessageActionGameScore &_messageActionGameScore() { - t_assert(data != nullptr && _type == mtpc_messageActionGameScore); - split(); - return *(MTPDmessageActionGameScore*)data; - } - const MTPDmessageActionGameScore &c_messageActionGameScore() const { - t_assert(data != nullptr && _type == mtpc_messageActionGameScore); - return *(const MTPDmessageActionGameScore*)data; - } - - MTPDmessageActionPhoneCall &_messageActionPhoneCall() { - t_assert(data != nullptr && _type == mtpc_messageActionPhoneCall); - split(); - return *(MTPDmessageActionPhoneCall*)data; - } - const MTPDmessageActionPhoneCall &c_messageActionPhoneCall() const { - t_assert(data != nullptr && _type == mtpc_messageActionPhoneCall); - return *(const MTPDmessageActionPhoneCall*)data; - } + const MTPDmessageActionChatCreate &c_messageActionChatCreate() const; + const MTPDmessageActionChatEditTitle &c_messageActionChatEditTitle() const; + const MTPDmessageActionChatEditPhoto &c_messageActionChatEditPhoto() const; + const MTPDmessageActionChatAddUser &c_messageActionChatAddUser() const; + const MTPDmessageActionChatDeleteUser &c_messageActionChatDeleteUser() const; + const MTPDmessageActionChatJoinedByLink &c_messageActionChatJoinedByLink() const; + const MTPDmessageActionChannelCreate &c_messageActionChannelCreate() const; + const MTPDmessageActionChatMigrateTo &c_messageActionChatMigrateTo() const; + const MTPDmessageActionChannelMigrateFrom &c_messageActionChannelMigrateFrom() const; + const MTPDmessageActionGameScore &c_messageActionGameScore() const; + const MTPDmessageActionPhoneCall &c_messageActionPhoneCall() const; uint32 innerLength() const; mtpTypeId type() const; @@ -3965,40 +3074,31 @@ public: private: explicit MTPmessageAction(mtpTypeId type); - explicit MTPmessageAction(MTPDmessageActionChatCreate *_data); - explicit MTPmessageAction(MTPDmessageActionChatEditTitle *_data); - explicit MTPmessageAction(MTPDmessageActionChatEditPhoto *_data); - explicit MTPmessageAction(MTPDmessageActionChatAddUser *_data); - explicit MTPmessageAction(MTPDmessageActionChatDeleteUser *_data); - explicit MTPmessageAction(MTPDmessageActionChatJoinedByLink *_data); - explicit MTPmessageAction(MTPDmessageActionChannelCreate *_data); - explicit MTPmessageAction(MTPDmessageActionChatMigrateTo *_data); - explicit MTPmessageAction(MTPDmessageActionChannelMigrateFrom *_data); - explicit MTPmessageAction(MTPDmessageActionGameScore *_data); - explicit MTPmessageAction(MTPDmessageActionPhoneCall *_data); + explicit MTPmessageAction(std::shared_ptr &&data); + explicit MTPmessageAction(std::shared_ptr &&data); + explicit MTPmessageAction(std::shared_ptr &&data); + explicit MTPmessageAction(std::shared_ptr &&data); + explicit MTPmessageAction(std::shared_ptr &&data); + explicit MTPmessageAction(std::shared_ptr &&data); + explicit MTPmessageAction(std::shared_ptr &&data); + explicit MTPmessageAction(std::shared_ptr &&data); + explicit MTPmessageAction(std::shared_ptr &&data); + explicit MTPmessageAction(std::shared_ptr &&data); + explicit MTPmessageAction(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPMessageAction; class MTPdialog : private mtpDataOwner { public: MTPdialog(); - MTPdialog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_dialog) : mtpDataOwner(0) { + MTPdialog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_dialog) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDdialog &_dialog() { - t_assert(data != nullptr); - split(); - return *(MTPDdialog*)data; - } - const MTPDdialog &c_dialog() const { - t_assert(data != nullptr); - return *(const MTPDdialog*)data; - } + const MTPDdialog &c_dialog() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4008,7 +3108,7 @@ public: typedef void ResponseType; private: - explicit MTPdialog(MTPDdialog *_data); + explicit MTPdialog(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4016,31 +3116,13 @@ typedef MTPBoxed MTPDialog; class MTPphoto : private mtpDataOwner { public: - MTPphoto() : mtpDataOwner(0), _type(0) { + MTPphoto() : mtpDataOwner(nullptr) { } - MTPphoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPphoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDphotoEmpty &_photoEmpty() { - t_assert(data != nullptr && _type == mtpc_photoEmpty); - split(); - return *(MTPDphotoEmpty*)data; - } - const MTPDphotoEmpty &c_photoEmpty() const { - t_assert(data != nullptr && _type == mtpc_photoEmpty); - return *(const MTPDphotoEmpty*)data; - } - - MTPDphoto &_photo() { - t_assert(data != nullptr && _type == mtpc_photo); - split(); - return *(MTPDphoto*)data; - } - const MTPDphoto &c_photo() const { - t_assert(data != nullptr && _type == mtpc_photo); - return *(const MTPDphoto*)data; - } + const MTPDphotoEmpty &c_photoEmpty() const; + const MTPDphoto &c_photo() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4051,52 +3133,25 @@ public: private: explicit MTPphoto(mtpTypeId type); - explicit MTPphoto(MTPDphotoEmpty *_data); - explicit MTPphoto(MTPDphoto *_data); + explicit MTPphoto(std::shared_ptr &&data); + explicit MTPphoto(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPPhoto; class MTPphotoSize : private mtpDataOwner { public: - MTPphotoSize() : mtpDataOwner(0), _type(0) { + MTPphotoSize() : mtpDataOwner(nullptr) { } - MTPphotoSize(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPphotoSize(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDphotoSizeEmpty &_photoSizeEmpty() { - t_assert(data != nullptr && _type == mtpc_photoSizeEmpty); - split(); - return *(MTPDphotoSizeEmpty*)data; - } - const MTPDphotoSizeEmpty &c_photoSizeEmpty() const { - t_assert(data != nullptr && _type == mtpc_photoSizeEmpty); - return *(const MTPDphotoSizeEmpty*)data; - } - - MTPDphotoSize &_photoSize() { - t_assert(data != nullptr && _type == mtpc_photoSize); - split(); - return *(MTPDphotoSize*)data; - } - const MTPDphotoSize &c_photoSize() const { - t_assert(data != nullptr && _type == mtpc_photoSize); - return *(const MTPDphotoSize*)data; - } - - MTPDphotoCachedSize &_photoCachedSize() { - t_assert(data != nullptr && _type == mtpc_photoCachedSize); - split(); - return *(MTPDphotoCachedSize*)data; - } - const MTPDphotoCachedSize &c_photoCachedSize() const { - t_assert(data != nullptr && _type == mtpc_photoCachedSize); - return *(const MTPDphotoCachedSize*)data; - } + const MTPDphotoSizeEmpty &c_photoSizeEmpty() const; + const MTPDphotoSize &c_photoSize() const; + const MTPDphotoCachedSize &c_photoCachedSize() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4107,33 +3162,24 @@ public: private: explicit MTPphotoSize(mtpTypeId type); - explicit MTPphotoSize(MTPDphotoSizeEmpty *_data); - explicit MTPphotoSize(MTPDphotoSize *_data); - explicit MTPphotoSize(MTPDphotoCachedSize *_data); + explicit MTPphotoSize(std::shared_ptr &&data); + explicit MTPphotoSize(std::shared_ptr &&data); + explicit MTPphotoSize(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPPhotoSize; class MTPgeoPoint : private mtpDataOwner { public: - MTPgeoPoint() : mtpDataOwner(0), _type(0) { + MTPgeoPoint() : mtpDataOwner(nullptr) { } - MTPgeoPoint(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPgeoPoint(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDgeoPoint &_geoPoint() { - t_assert(data != nullptr && _type == mtpc_geoPoint); - split(); - return *(MTPDgeoPoint*)data; - } - const MTPDgeoPoint &c_geoPoint() const { - t_assert(data != nullptr && _type == mtpc_geoPoint); - return *(const MTPDgeoPoint*)data; - } + const MTPDgeoPoint &c_geoPoint() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4144,30 +3190,21 @@ public: private: explicit MTPgeoPoint(mtpTypeId type); - explicit MTPgeoPoint(MTPDgeoPoint *_data); + explicit MTPgeoPoint(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPGeoPoint; class MTPauth_checkedPhone : private mtpDataOwner { public: MTPauth_checkedPhone(); - MTPauth_checkedPhone(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_checkedPhone) : mtpDataOwner(0) { + MTPauth_checkedPhone(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_checkedPhone) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDauth_checkedPhone &_auth_checkedPhone() { - t_assert(data != nullptr); - split(); - return *(MTPDauth_checkedPhone*)data; - } - const MTPDauth_checkedPhone &c_auth_checkedPhone() const { - t_assert(data != nullptr); - return *(const MTPDauth_checkedPhone*)data; - } + const MTPDauth_checkedPhone &c_auth_checkedPhone() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4177,7 +3214,7 @@ public: typedef void ResponseType; private: - explicit MTPauth_checkedPhone(MTPDauth_checkedPhone *_data); + explicit MTPauth_checkedPhone(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4186,19 +3223,10 @@ typedef MTPBoxed MTPauth_CheckedPhone; class MTPauth_sentCode : private mtpDataOwner { public: MTPauth_sentCode(); - MTPauth_sentCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sentCode) : mtpDataOwner(0) { + MTPauth_sentCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sentCode) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDauth_sentCode &_auth_sentCode() { - t_assert(data != nullptr); - split(); - return *(MTPDauth_sentCode*)data; - } - const MTPDauth_sentCode &c_auth_sentCode() const { - t_assert(data != nullptr); - return *(const MTPDauth_sentCode*)data; - } + const MTPDauth_sentCode &c_auth_sentCode() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4208,7 +3236,7 @@ public: typedef void ResponseType; private: - explicit MTPauth_sentCode(MTPDauth_sentCode *_data); + explicit MTPauth_sentCode(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4217,19 +3245,10 @@ typedef MTPBoxed MTPauth_SentCode; class MTPauth_authorization : private mtpDataOwner { public: MTPauth_authorization(); - MTPauth_authorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_authorization) : mtpDataOwner(0) { + MTPauth_authorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_authorization) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDauth_authorization &_auth_authorization() { - t_assert(data != nullptr); - split(); - return *(MTPDauth_authorization*)data; - } - const MTPDauth_authorization &c_auth_authorization() const { - t_assert(data != nullptr); - return *(const MTPDauth_authorization*)data; - } + const MTPDauth_authorization &c_auth_authorization() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4239,7 +3258,7 @@ public: typedef void ResponseType; private: - explicit MTPauth_authorization(MTPDauth_authorization *_data); + explicit MTPauth_authorization(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4248,19 +3267,10 @@ typedef MTPBoxed MTPauth_Authorization; class MTPauth_exportedAuthorization : private mtpDataOwner { public: MTPauth_exportedAuthorization(); - MTPauth_exportedAuthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_exportedAuthorization) : mtpDataOwner(0) { + MTPauth_exportedAuthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_exportedAuthorization) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDauth_exportedAuthorization &_auth_exportedAuthorization() { - t_assert(data != nullptr); - split(); - return *(MTPDauth_exportedAuthorization*)data; - } - const MTPDauth_exportedAuthorization &c_auth_exportedAuthorization() const { - t_assert(data != nullptr); - return *(const MTPDauth_exportedAuthorization*)data; - } + const MTPDauth_exportedAuthorization &c_auth_exportedAuthorization() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4270,7 +3280,7 @@ public: typedef void ResponseType; private: - explicit MTPauth_exportedAuthorization(MTPDauth_exportedAuthorization *_data); + explicit MTPauth_exportedAuthorization(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4278,21 +3288,12 @@ typedef MTPBoxed MTPauth_ExportedAuthorization; class MTPinputNotifyPeer : private mtpDataOwner { public: - MTPinputNotifyPeer() : mtpDataOwner(0), _type(0) { + MTPinputNotifyPeer() : mtpDataOwner(nullptr) { } - MTPinputNotifyPeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputNotifyPeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputNotifyPeer &_inputNotifyPeer() { - t_assert(data != nullptr && _type == mtpc_inputNotifyPeer); - split(); - return *(MTPDinputNotifyPeer*)data; - } - const MTPDinputNotifyPeer &c_inputNotifyPeer() const { - t_assert(data != nullptr && _type == mtpc_inputNotifyPeer); - return *(const MTPDinputNotifyPeer*)data; - } + const MTPDinputNotifyPeer &c_inputNotifyPeer() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4303,19 +3304,19 @@ public: private: explicit MTPinputNotifyPeer(mtpTypeId type); - explicit MTPinputNotifyPeer(MTPDinputNotifyPeer *_data); + explicit MTPinputNotifyPeer(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputNotifyPeer; class MTPinputPeerNotifyEvents { public: - MTPinputPeerNotifyEvents() : _type(0) { + MTPinputPeerNotifyEvents() { } - MTPinputPeerNotifyEvents(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPinputPeerNotifyEvents(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -4331,26 +3332,17 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputPeerNotifyEvents; class MTPinputPeerNotifySettings : private mtpDataOwner { public: MTPinputPeerNotifySettings(); - MTPinputPeerNotifySettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputPeerNotifySettings) : mtpDataOwner(0) { + MTPinputPeerNotifySettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputPeerNotifySettings) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputPeerNotifySettings &_inputPeerNotifySettings() { - t_assert(data != nullptr); - split(); - return *(MTPDinputPeerNotifySettings*)data; - } - const MTPDinputPeerNotifySettings &c_inputPeerNotifySettings() const { - t_assert(data != nullptr); - return *(const MTPDinputPeerNotifySettings*)data; - } + const MTPDinputPeerNotifySettings &c_inputPeerNotifySettings() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4360,7 +3352,7 @@ public: typedef void ResponseType; private: - explicit MTPinputPeerNotifySettings(MTPDinputPeerNotifySettings *_data); + explicit MTPinputPeerNotifySettings(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4368,9 +3360,9 @@ typedef MTPBoxed MTPInputPeerNotifySettings; class MTPpeerNotifyEvents { public: - MTPpeerNotifyEvents() : _type(0) { + MTPpeerNotifyEvents() { } - MTPpeerNotifyEvents(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPpeerNotifyEvents(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -4386,27 +3378,18 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPPeerNotifyEvents; class MTPpeerNotifySettings : private mtpDataOwner { public: - MTPpeerNotifySettings() : mtpDataOwner(0), _type(0) { + MTPpeerNotifySettings() : mtpDataOwner(nullptr) { } - MTPpeerNotifySettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPpeerNotifySettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDpeerNotifySettings &_peerNotifySettings() { - t_assert(data != nullptr && _type == mtpc_peerNotifySettings); - split(); - return *(MTPDpeerNotifySettings*)data; - } - const MTPDpeerNotifySettings &c_peerNotifySettings() const { - t_assert(data != nullptr && _type == mtpc_peerNotifySettings); - return *(const MTPDpeerNotifySettings*)data; - } + const MTPDpeerNotifySettings &c_peerNotifySettings() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4417,30 +3400,21 @@ public: private: explicit MTPpeerNotifySettings(mtpTypeId type); - explicit MTPpeerNotifySettings(MTPDpeerNotifySettings *_data); + explicit MTPpeerNotifySettings(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPPeerNotifySettings; class MTPpeerSettings : private mtpDataOwner { public: MTPpeerSettings(); - MTPpeerSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_peerSettings) : mtpDataOwner(0) { + MTPpeerSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_peerSettings) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDpeerSettings &_peerSettings() { - t_assert(data != nullptr); - split(); - return *(MTPDpeerSettings*)data; - } - const MTPDpeerSettings &c_peerSettings() const { - t_assert(data != nullptr); - return *(const MTPDpeerSettings*)data; - } + const MTPDpeerSettings &c_peerSettings() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4450,7 +3424,7 @@ public: typedef void ResponseType; private: - explicit MTPpeerSettings(MTPDpeerSettings *_data); + explicit MTPpeerSettings(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4458,31 +3432,13 @@ typedef MTPBoxed MTPPeerSettings; class MTPwallPaper : private mtpDataOwner { public: - MTPwallPaper() : mtpDataOwner(0), _type(0) { + MTPwallPaper() : mtpDataOwner(nullptr) { } - MTPwallPaper(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPwallPaper(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDwallPaper &_wallPaper() { - t_assert(data != nullptr && _type == mtpc_wallPaper); - split(); - return *(MTPDwallPaper*)data; - } - const MTPDwallPaper &c_wallPaper() const { - t_assert(data != nullptr && _type == mtpc_wallPaper); - return *(const MTPDwallPaper*)data; - } - - MTPDwallPaperSolid &_wallPaperSolid() { - t_assert(data != nullptr && _type == mtpc_wallPaperSolid); - split(); - return *(MTPDwallPaperSolid*)data; - } - const MTPDwallPaperSolid &c_wallPaperSolid() const { - t_assert(data != nullptr && _type == mtpc_wallPaperSolid); - return *(const MTPDwallPaperSolid*)data; - } + const MTPDwallPaper &c_wallPaper() const; + const MTPDwallPaperSolid &c_wallPaperSolid() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4493,32 +3449,23 @@ public: private: explicit MTPwallPaper(mtpTypeId type); - explicit MTPwallPaper(MTPDwallPaper *_data); - explicit MTPwallPaper(MTPDwallPaperSolid *_data); + explicit MTPwallPaper(std::shared_ptr &&data); + explicit MTPwallPaper(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPWallPaper; class MTPreportReason : private mtpDataOwner { public: - MTPreportReason() : mtpDataOwner(0), _type(0) { + MTPreportReason() : mtpDataOwner(nullptr) { } - MTPreportReason(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPreportReason(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputReportReasonOther &_inputReportReasonOther() { - t_assert(data != nullptr && _type == mtpc_inputReportReasonOther); - split(); - return *(MTPDinputReportReasonOther*)data; - } - const MTPDinputReportReasonOther &c_inputReportReasonOther() const { - t_assert(data != nullptr && _type == mtpc_inputReportReasonOther); - return *(const MTPDinputReportReasonOther*)data; - } + const MTPDinputReportReasonOther &c_inputReportReasonOther() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4529,30 +3476,21 @@ public: private: explicit MTPreportReason(mtpTypeId type); - explicit MTPreportReason(MTPDinputReportReasonOther *_data); + explicit MTPreportReason(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPReportReason; class MTPuserFull : private mtpDataOwner { public: MTPuserFull(); - MTPuserFull(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_userFull) : mtpDataOwner(0) { + MTPuserFull(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_userFull) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDuserFull &_userFull() { - t_assert(data != nullptr); - split(); - return *(MTPDuserFull*)data; - } - const MTPDuserFull &c_userFull() const { - t_assert(data != nullptr); - return *(const MTPDuserFull*)data; - } + const MTPDuserFull &c_userFull() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4562,7 +3500,7 @@ public: typedef void ResponseType; private: - explicit MTPuserFull(MTPDuserFull *_data); + explicit MTPuserFull(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4571,19 +3509,10 @@ typedef MTPBoxed MTPUserFull; class MTPcontact : private mtpDataOwner { public: MTPcontact(); - MTPcontact(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contact) : mtpDataOwner(0) { + MTPcontact(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contact) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDcontact &_contact() { - t_assert(data != nullptr); - split(); - return *(MTPDcontact*)data; - } - const MTPDcontact &c_contact() const { - t_assert(data != nullptr); - return *(const MTPDcontact*)data; - } + const MTPDcontact &c_contact() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4593,7 +3522,7 @@ public: typedef void ResponseType; private: - explicit MTPcontact(MTPDcontact *_data); + explicit MTPcontact(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4602,19 +3531,10 @@ typedef MTPBoxed MTPContact; class MTPimportedContact : private mtpDataOwner { public: MTPimportedContact(); - MTPimportedContact(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_importedContact) : mtpDataOwner(0) { + MTPimportedContact(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_importedContact) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDimportedContact &_importedContact() { - t_assert(data != nullptr); - split(); - return *(MTPDimportedContact*)data; - } - const MTPDimportedContact &c_importedContact() const { - t_assert(data != nullptr); - return *(const MTPDimportedContact*)data; - } + const MTPDimportedContact &c_importedContact() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4624,7 +3544,7 @@ public: typedef void ResponseType; private: - explicit MTPimportedContact(MTPDimportedContact *_data); + explicit MTPimportedContact(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4633,19 +3553,10 @@ typedef MTPBoxed MTPImportedContact; class MTPcontactBlocked : private mtpDataOwner { public: MTPcontactBlocked(); - MTPcontactBlocked(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contactBlocked) : mtpDataOwner(0) { + MTPcontactBlocked(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contactBlocked) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDcontactBlocked &_contactBlocked() { - t_assert(data != nullptr); - split(); - return *(MTPDcontactBlocked*)data; - } - const MTPDcontactBlocked &c_contactBlocked() const { - t_assert(data != nullptr); - return *(const MTPDcontactBlocked*)data; - } + const MTPDcontactBlocked &c_contactBlocked() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4655,7 +3566,7 @@ public: typedef void ResponseType; private: - explicit MTPcontactBlocked(MTPDcontactBlocked *_data); + explicit MTPcontactBlocked(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4664,19 +3575,10 @@ typedef MTPBoxed MTPContactBlocked; class MTPcontactStatus : private mtpDataOwner { public: MTPcontactStatus(); - MTPcontactStatus(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contactStatus) : mtpDataOwner(0) { + MTPcontactStatus(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contactStatus) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDcontactStatus &_contactStatus() { - t_assert(data != nullptr); - split(); - return *(MTPDcontactStatus*)data; - } - const MTPDcontactStatus &c_contactStatus() const { - t_assert(data != nullptr); - return *(const MTPDcontactStatus*)data; - } + const MTPDcontactStatus &c_contactStatus() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4686,7 +3588,7 @@ public: typedef void ResponseType; private: - explicit MTPcontactStatus(MTPDcontactStatus *_data); + explicit MTPcontactStatus(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4695,19 +3597,10 @@ typedef MTPBoxed MTPContactStatus; class MTPcontacts_link : private mtpDataOwner { public: MTPcontacts_link(); - MTPcontacts_link(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_link) : mtpDataOwner(0) { + MTPcontacts_link(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_link) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDcontacts_link &_contacts_link() { - t_assert(data != nullptr); - split(); - return *(MTPDcontacts_link*)data; - } - const MTPDcontacts_link &c_contacts_link() const { - t_assert(data != nullptr); - return *(const MTPDcontacts_link*)data; - } + const MTPDcontacts_link &c_contacts_link() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4717,7 +3610,7 @@ public: typedef void ResponseType; private: - explicit MTPcontacts_link(MTPDcontacts_link *_data); + explicit MTPcontacts_link(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4725,21 +3618,12 @@ typedef MTPBoxed MTPcontacts_Link; class MTPcontacts_contacts : private mtpDataOwner { public: - MTPcontacts_contacts() : mtpDataOwner(0), _type(0) { + MTPcontacts_contacts() : mtpDataOwner(nullptr) { } - MTPcontacts_contacts(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPcontacts_contacts(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDcontacts_contacts &_contacts_contacts() { - t_assert(data != nullptr && _type == mtpc_contacts_contacts); - split(); - return *(MTPDcontacts_contacts*)data; - } - const MTPDcontacts_contacts &c_contacts_contacts() const { - t_assert(data != nullptr && _type == mtpc_contacts_contacts); - return *(const MTPDcontacts_contacts*)data; - } + const MTPDcontacts_contacts &c_contacts_contacts() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4750,30 +3634,21 @@ public: private: explicit MTPcontacts_contacts(mtpTypeId type); - explicit MTPcontacts_contacts(MTPDcontacts_contacts *_data); + explicit MTPcontacts_contacts(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPcontacts_Contacts; class MTPcontacts_importedContacts : private mtpDataOwner { public: MTPcontacts_importedContacts(); - MTPcontacts_importedContacts(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_importedContacts) : mtpDataOwner(0) { + MTPcontacts_importedContacts(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_importedContacts) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDcontacts_importedContacts &_contacts_importedContacts() { - t_assert(data != nullptr); - split(); - return *(MTPDcontacts_importedContacts*)data; - } - const MTPDcontacts_importedContacts &c_contacts_importedContacts() const { - t_assert(data != nullptr); - return *(const MTPDcontacts_importedContacts*)data; - } + const MTPDcontacts_importedContacts &c_contacts_importedContacts() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4783,7 +3658,7 @@ public: typedef void ResponseType; private: - explicit MTPcontacts_importedContacts(MTPDcontacts_importedContacts *_data); + explicit MTPcontacts_importedContacts(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -4791,31 +3666,13 @@ typedef MTPBoxed MTPcontacts_ImportedContacts; class MTPcontacts_blocked : private mtpDataOwner { public: - MTPcontacts_blocked() : mtpDataOwner(0), _type(0) { + MTPcontacts_blocked() : mtpDataOwner(nullptr) { } - MTPcontacts_blocked(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPcontacts_blocked(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDcontacts_blocked &_contacts_blocked() { - t_assert(data != nullptr && _type == mtpc_contacts_blocked); - split(); - return *(MTPDcontacts_blocked*)data; - } - const MTPDcontacts_blocked &c_contacts_blocked() const { - t_assert(data != nullptr && _type == mtpc_contacts_blocked); - return *(const MTPDcontacts_blocked*)data; - } - - MTPDcontacts_blockedSlice &_contacts_blockedSlice() { - t_assert(data != nullptr && _type == mtpc_contacts_blockedSlice); - split(); - return *(MTPDcontacts_blockedSlice*)data; - } - const MTPDcontacts_blockedSlice &c_contacts_blockedSlice() const { - t_assert(data != nullptr && _type == mtpc_contacts_blockedSlice); - return *(const MTPDcontacts_blockedSlice*)data; - } + const MTPDcontacts_blocked &c_contacts_blocked() const; + const MTPDcontacts_blockedSlice &c_contacts_blockedSlice() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4826,42 +3683,24 @@ public: private: explicit MTPcontacts_blocked(mtpTypeId type); - explicit MTPcontacts_blocked(MTPDcontacts_blocked *_data); - explicit MTPcontacts_blocked(MTPDcontacts_blockedSlice *_data); + explicit MTPcontacts_blocked(std::shared_ptr &&data); + explicit MTPcontacts_blocked(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPcontacts_Blocked; class MTPmessages_dialogs : private mtpDataOwner { public: - MTPmessages_dialogs() : mtpDataOwner(0), _type(0) { + MTPmessages_dialogs() : mtpDataOwner(nullptr) { } - MTPmessages_dialogs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessages_dialogs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_dialogs &_messages_dialogs() { - t_assert(data != nullptr && _type == mtpc_messages_dialogs); - split(); - return *(MTPDmessages_dialogs*)data; - } - const MTPDmessages_dialogs &c_messages_dialogs() const { - t_assert(data != nullptr && _type == mtpc_messages_dialogs); - return *(const MTPDmessages_dialogs*)data; - } - - MTPDmessages_dialogsSlice &_messages_dialogsSlice() { - t_assert(data != nullptr && _type == mtpc_messages_dialogsSlice); - split(); - return *(MTPDmessages_dialogsSlice*)data; - } - const MTPDmessages_dialogsSlice &c_messages_dialogsSlice() const { - t_assert(data != nullptr && _type == mtpc_messages_dialogsSlice); - return *(const MTPDmessages_dialogsSlice*)data; - } + const MTPDmessages_dialogs &c_messages_dialogs() const; + const MTPDmessages_dialogsSlice &c_messages_dialogsSlice() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4872,52 +3711,25 @@ public: private: explicit MTPmessages_dialogs(mtpTypeId type); - explicit MTPmessages_dialogs(MTPDmessages_dialogs *_data); - explicit MTPmessages_dialogs(MTPDmessages_dialogsSlice *_data); + explicit MTPmessages_dialogs(std::shared_ptr &&data); + explicit MTPmessages_dialogs(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPmessages_Dialogs; class MTPmessages_messages : private mtpDataOwner { public: - MTPmessages_messages() : mtpDataOwner(0), _type(0) { + MTPmessages_messages() : mtpDataOwner(nullptr) { } - MTPmessages_messages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessages_messages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_messages &_messages_messages() { - t_assert(data != nullptr && _type == mtpc_messages_messages); - split(); - return *(MTPDmessages_messages*)data; - } - const MTPDmessages_messages &c_messages_messages() const { - t_assert(data != nullptr && _type == mtpc_messages_messages); - return *(const MTPDmessages_messages*)data; - } - - MTPDmessages_messagesSlice &_messages_messagesSlice() { - t_assert(data != nullptr && _type == mtpc_messages_messagesSlice); - split(); - return *(MTPDmessages_messagesSlice*)data; - } - const MTPDmessages_messagesSlice &c_messages_messagesSlice() const { - t_assert(data != nullptr && _type == mtpc_messages_messagesSlice); - return *(const MTPDmessages_messagesSlice*)data; - } - - MTPDmessages_channelMessages &_messages_channelMessages() { - t_assert(data != nullptr && _type == mtpc_messages_channelMessages); - split(); - return *(MTPDmessages_channelMessages*)data; - } - const MTPDmessages_channelMessages &c_messages_channelMessages() const { - t_assert(data != nullptr && _type == mtpc_messages_channelMessages); - return *(const MTPDmessages_channelMessages*)data; - } + const MTPDmessages_messages &c_messages_messages() const; + const MTPDmessages_messagesSlice &c_messages_messagesSlice() const; + const MTPDmessages_channelMessages &c_messages_channelMessages() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4928,43 +3740,25 @@ public: private: explicit MTPmessages_messages(mtpTypeId type); - explicit MTPmessages_messages(MTPDmessages_messages *_data); - explicit MTPmessages_messages(MTPDmessages_messagesSlice *_data); - explicit MTPmessages_messages(MTPDmessages_channelMessages *_data); + explicit MTPmessages_messages(std::shared_ptr &&data); + explicit MTPmessages_messages(std::shared_ptr &&data); + explicit MTPmessages_messages(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPmessages_Messages; class MTPmessages_chats : private mtpDataOwner { public: - MTPmessages_chats() : mtpDataOwner(0), _type(0) { + MTPmessages_chats() : mtpDataOwner(nullptr) { } - MTPmessages_chats(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessages_chats(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_chats &_messages_chats() { - t_assert(data != nullptr && _type == mtpc_messages_chats); - split(); - return *(MTPDmessages_chats*)data; - } - const MTPDmessages_chats &c_messages_chats() const { - t_assert(data != nullptr && _type == mtpc_messages_chats); - return *(const MTPDmessages_chats*)data; - } - - MTPDmessages_chatsSlice &_messages_chatsSlice() { - t_assert(data != nullptr && _type == mtpc_messages_chatsSlice); - split(); - return *(MTPDmessages_chatsSlice*)data; - } - const MTPDmessages_chatsSlice &c_messages_chatsSlice() const { - t_assert(data != nullptr && _type == mtpc_messages_chatsSlice); - return *(const MTPDmessages_chatsSlice*)data; - } + const MTPDmessages_chats &c_messages_chats() const; + const MTPDmessages_chatsSlice &c_messages_chatsSlice() const; uint32 innerLength() const; mtpTypeId type() const; @@ -4975,31 +3769,22 @@ public: private: explicit MTPmessages_chats(mtpTypeId type); - explicit MTPmessages_chats(MTPDmessages_chats *_data); - explicit MTPmessages_chats(MTPDmessages_chatsSlice *_data); + explicit MTPmessages_chats(std::shared_ptr &&data); + explicit MTPmessages_chats(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPmessages_Chats; class MTPmessages_chatFull : private mtpDataOwner { public: MTPmessages_chatFull(); - MTPmessages_chatFull(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_chatFull) : mtpDataOwner(0) { + MTPmessages_chatFull(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_chatFull) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_chatFull &_messages_chatFull() { - t_assert(data != nullptr); - split(); - return *(MTPDmessages_chatFull*)data; - } - const MTPDmessages_chatFull &c_messages_chatFull() const { - t_assert(data != nullptr); - return *(const MTPDmessages_chatFull*)data; - } + const MTPDmessages_chatFull &c_messages_chatFull() const; uint32 innerLength() const; mtpTypeId type() const; @@ -5009,7 +3794,7 @@ public: typedef void ResponseType; private: - explicit MTPmessages_chatFull(MTPDmessages_chatFull *_data); + explicit MTPmessages_chatFull(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -5018,19 +3803,10 @@ typedef MTPBoxed MTPmessages_ChatFull; class MTPmessages_affectedHistory : private mtpDataOwner { public: MTPmessages_affectedHistory(); - MTPmessages_affectedHistory(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_affectedHistory) : mtpDataOwner(0) { + MTPmessages_affectedHistory(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_affectedHistory) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_affectedHistory &_messages_affectedHistory() { - t_assert(data != nullptr); - split(); - return *(MTPDmessages_affectedHistory*)data; - } - const MTPDmessages_affectedHistory &c_messages_affectedHistory() const { - t_assert(data != nullptr); - return *(const MTPDmessages_affectedHistory*)data; - } + const MTPDmessages_affectedHistory &c_messages_affectedHistory() const; uint32 innerLength() const; mtpTypeId type() const; @@ -5040,7 +3816,7 @@ public: typedef void ResponseType; private: - explicit MTPmessages_affectedHistory(MTPDmessages_affectedHistory *_data); + explicit MTPmessages_affectedHistory(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -5048,21 +3824,12 @@ typedef MTPBoxed MTPmessages_AffectedHistory; class MTPmessagesFilter : private mtpDataOwner { public: - MTPmessagesFilter() : mtpDataOwner(0), _type(0) { + MTPmessagesFilter() : mtpDataOwner(nullptr) { } - MTPmessagesFilter(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessagesFilter(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputMessagesFilterPhoneCalls &_inputMessagesFilterPhoneCalls() { - t_assert(data != nullptr && _type == mtpc_inputMessagesFilterPhoneCalls); - split(); - return *(MTPDinputMessagesFilterPhoneCalls*)data; - } - const MTPDinputMessagesFilterPhoneCalls &c_inputMessagesFilterPhoneCalls() const { - t_assert(data != nullptr && _type == mtpc_inputMessagesFilterPhoneCalls); - return *(const MTPDinputMessagesFilterPhoneCalls*)data; - } + const MTPDinputMessagesFilterPhoneCalls &c_inputMessagesFilterPhoneCalls() const; uint32 innerLength() const; mtpTypeId type() const; @@ -5073,521 +3840,71 @@ public: private: explicit MTPmessagesFilter(mtpTypeId type); - explicit MTPmessagesFilter(MTPDinputMessagesFilterPhoneCalls *_data); + explicit MTPmessagesFilter(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPMessagesFilter; class MTPupdate : private mtpDataOwner { public: - MTPupdate() : mtpDataOwner(0), _type(0) { + MTPupdate() : mtpDataOwner(nullptr) { } - MTPupdate(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPupdate(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDupdateNewMessage &_updateNewMessage() { - t_assert(data != nullptr && _type == mtpc_updateNewMessage); - split(); - return *(MTPDupdateNewMessage*)data; - } - const MTPDupdateNewMessage &c_updateNewMessage() const { - t_assert(data != nullptr && _type == mtpc_updateNewMessage); - return *(const MTPDupdateNewMessage*)data; - } - - MTPDupdateMessageID &_updateMessageID() { - t_assert(data != nullptr && _type == mtpc_updateMessageID); - split(); - return *(MTPDupdateMessageID*)data; - } - const MTPDupdateMessageID &c_updateMessageID() const { - t_assert(data != nullptr && _type == mtpc_updateMessageID); - return *(const MTPDupdateMessageID*)data; - } - - MTPDupdateDeleteMessages &_updateDeleteMessages() { - t_assert(data != nullptr && _type == mtpc_updateDeleteMessages); - split(); - return *(MTPDupdateDeleteMessages*)data; - } - const MTPDupdateDeleteMessages &c_updateDeleteMessages() const { - t_assert(data != nullptr && _type == mtpc_updateDeleteMessages); - return *(const MTPDupdateDeleteMessages*)data; - } - - MTPDupdateUserTyping &_updateUserTyping() { - t_assert(data != nullptr && _type == mtpc_updateUserTyping); - split(); - return *(MTPDupdateUserTyping*)data; - } - const MTPDupdateUserTyping &c_updateUserTyping() const { - t_assert(data != nullptr && _type == mtpc_updateUserTyping); - return *(const MTPDupdateUserTyping*)data; - } - - MTPDupdateChatUserTyping &_updateChatUserTyping() { - t_assert(data != nullptr && _type == mtpc_updateChatUserTyping); - split(); - return *(MTPDupdateChatUserTyping*)data; - } - const MTPDupdateChatUserTyping &c_updateChatUserTyping() const { - t_assert(data != nullptr && _type == mtpc_updateChatUserTyping); - return *(const MTPDupdateChatUserTyping*)data; - } - - MTPDupdateChatParticipants &_updateChatParticipants() { - t_assert(data != nullptr && _type == mtpc_updateChatParticipants); - split(); - return *(MTPDupdateChatParticipants*)data; - } - const MTPDupdateChatParticipants &c_updateChatParticipants() const { - t_assert(data != nullptr && _type == mtpc_updateChatParticipants); - return *(const MTPDupdateChatParticipants*)data; - } - - MTPDupdateUserStatus &_updateUserStatus() { - t_assert(data != nullptr && _type == mtpc_updateUserStatus); - split(); - return *(MTPDupdateUserStatus*)data; - } - const MTPDupdateUserStatus &c_updateUserStatus() const { - t_assert(data != nullptr && _type == mtpc_updateUserStatus); - return *(const MTPDupdateUserStatus*)data; - } - - MTPDupdateUserName &_updateUserName() { - t_assert(data != nullptr && _type == mtpc_updateUserName); - split(); - return *(MTPDupdateUserName*)data; - } - const MTPDupdateUserName &c_updateUserName() const { - t_assert(data != nullptr && _type == mtpc_updateUserName); - return *(const MTPDupdateUserName*)data; - } - - MTPDupdateUserPhoto &_updateUserPhoto() { - t_assert(data != nullptr && _type == mtpc_updateUserPhoto); - split(); - return *(MTPDupdateUserPhoto*)data; - } - const MTPDupdateUserPhoto &c_updateUserPhoto() const { - t_assert(data != nullptr && _type == mtpc_updateUserPhoto); - return *(const MTPDupdateUserPhoto*)data; - } - - MTPDupdateContactRegistered &_updateContactRegistered() { - t_assert(data != nullptr && _type == mtpc_updateContactRegistered); - split(); - return *(MTPDupdateContactRegistered*)data; - } - const MTPDupdateContactRegistered &c_updateContactRegistered() const { - t_assert(data != nullptr && _type == mtpc_updateContactRegistered); - return *(const MTPDupdateContactRegistered*)data; - } - - MTPDupdateContactLink &_updateContactLink() { - t_assert(data != nullptr && _type == mtpc_updateContactLink); - split(); - return *(MTPDupdateContactLink*)data; - } - const MTPDupdateContactLink &c_updateContactLink() const { - t_assert(data != nullptr && _type == mtpc_updateContactLink); - return *(const MTPDupdateContactLink*)data; - } - - MTPDupdateNewEncryptedMessage &_updateNewEncryptedMessage() { - t_assert(data != nullptr && _type == mtpc_updateNewEncryptedMessage); - split(); - return *(MTPDupdateNewEncryptedMessage*)data; - } - const MTPDupdateNewEncryptedMessage &c_updateNewEncryptedMessage() const { - t_assert(data != nullptr && _type == mtpc_updateNewEncryptedMessage); - return *(const MTPDupdateNewEncryptedMessage*)data; - } - - MTPDupdateEncryptedChatTyping &_updateEncryptedChatTyping() { - t_assert(data != nullptr && _type == mtpc_updateEncryptedChatTyping); - split(); - return *(MTPDupdateEncryptedChatTyping*)data; - } - const MTPDupdateEncryptedChatTyping &c_updateEncryptedChatTyping() const { - t_assert(data != nullptr && _type == mtpc_updateEncryptedChatTyping); - return *(const MTPDupdateEncryptedChatTyping*)data; - } - - MTPDupdateEncryption &_updateEncryption() { - t_assert(data != nullptr && _type == mtpc_updateEncryption); - split(); - return *(MTPDupdateEncryption*)data; - } - const MTPDupdateEncryption &c_updateEncryption() const { - t_assert(data != nullptr && _type == mtpc_updateEncryption); - return *(const MTPDupdateEncryption*)data; - } - - MTPDupdateEncryptedMessagesRead &_updateEncryptedMessagesRead() { - t_assert(data != nullptr && _type == mtpc_updateEncryptedMessagesRead); - split(); - return *(MTPDupdateEncryptedMessagesRead*)data; - } - const MTPDupdateEncryptedMessagesRead &c_updateEncryptedMessagesRead() const { - t_assert(data != nullptr && _type == mtpc_updateEncryptedMessagesRead); - return *(const MTPDupdateEncryptedMessagesRead*)data; - } - - MTPDupdateChatParticipantAdd &_updateChatParticipantAdd() { - t_assert(data != nullptr && _type == mtpc_updateChatParticipantAdd); - split(); - return *(MTPDupdateChatParticipantAdd*)data; - } - const MTPDupdateChatParticipantAdd &c_updateChatParticipantAdd() const { - t_assert(data != nullptr && _type == mtpc_updateChatParticipantAdd); - return *(const MTPDupdateChatParticipantAdd*)data; - } - - MTPDupdateChatParticipantDelete &_updateChatParticipantDelete() { - t_assert(data != nullptr && _type == mtpc_updateChatParticipantDelete); - split(); - return *(MTPDupdateChatParticipantDelete*)data; - } - const MTPDupdateChatParticipantDelete &c_updateChatParticipantDelete() const { - t_assert(data != nullptr && _type == mtpc_updateChatParticipantDelete); - return *(const MTPDupdateChatParticipantDelete*)data; - } - - MTPDupdateDcOptions &_updateDcOptions() { - t_assert(data != nullptr && _type == mtpc_updateDcOptions); - split(); - return *(MTPDupdateDcOptions*)data; - } - const MTPDupdateDcOptions &c_updateDcOptions() const { - t_assert(data != nullptr && _type == mtpc_updateDcOptions); - return *(const MTPDupdateDcOptions*)data; - } - - MTPDupdateUserBlocked &_updateUserBlocked() { - t_assert(data != nullptr && _type == mtpc_updateUserBlocked); - split(); - return *(MTPDupdateUserBlocked*)data; - } - const MTPDupdateUserBlocked &c_updateUserBlocked() const { - t_assert(data != nullptr && _type == mtpc_updateUserBlocked); - return *(const MTPDupdateUserBlocked*)data; - } - - MTPDupdateNotifySettings &_updateNotifySettings() { - t_assert(data != nullptr && _type == mtpc_updateNotifySettings); - split(); - return *(MTPDupdateNotifySettings*)data; - } - const MTPDupdateNotifySettings &c_updateNotifySettings() const { - t_assert(data != nullptr && _type == mtpc_updateNotifySettings); - return *(const MTPDupdateNotifySettings*)data; - } - - MTPDupdateServiceNotification &_updateServiceNotification() { - t_assert(data != nullptr && _type == mtpc_updateServiceNotification); - split(); - return *(MTPDupdateServiceNotification*)data; - } - const MTPDupdateServiceNotification &c_updateServiceNotification() const { - t_assert(data != nullptr && _type == mtpc_updateServiceNotification); - return *(const MTPDupdateServiceNotification*)data; - } - - MTPDupdatePrivacy &_updatePrivacy() { - t_assert(data != nullptr && _type == mtpc_updatePrivacy); - split(); - return *(MTPDupdatePrivacy*)data; - } - const MTPDupdatePrivacy &c_updatePrivacy() const { - t_assert(data != nullptr && _type == mtpc_updatePrivacy); - return *(const MTPDupdatePrivacy*)data; - } - - MTPDupdateUserPhone &_updateUserPhone() { - t_assert(data != nullptr && _type == mtpc_updateUserPhone); - split(); - return *(MTPDupdateUserPhone*)data; - } - const MTPDupdateUserPhone &c_updateUserPhone() const { - t_assert(data != nullptr && _type == mtpc_updateUserPhone); - return *(const MTPDupdateUserPhone*)data; - } - - MTPDupdateReadHistoryInbox &_updateReadHistoryInbox() { - t_assert(data != nullptr && _type == mtpc_updateReadHistoryInbox); - split(); - return *(MTPDupdateReadHistoryInbox*)data; - } - const MTPDupdateReadHistoryInbox &c_updateReadHistoryInbox() const { - t_assert(data != nullptr && _type == mtpc_updateReadHistoryInbox); - return *(const MTPDupdateReadHistoryInbox*)data; - } - - MTPDupdateReadHistoryOutbox &_updateReadHistoryOutbox() { - t_assert(data != nullptr && _type == mtpc_updateReadHistoryOutbox); - split(); - return *(MTPDupdateReadHistoryOutbox*)data; - } - const MTPDupdateReadHistoryOutbox &c_updateReadHistoryOutbox() const { - t_assert(data != nullptr && _type == mtpc_updateReadHistoryOutbox); - return *(const MTPDupdateReadHistoryOutbox*)data; - } - - MTPDupdateWebPage &_updateWebPage() { - t_assert(data != nullptr && _type == mtpc_updateWebPage); - split(); - return *(MTPDupdateWebPage*)data; - } - const MTPDupdateWebPage &c_updateWebPage() const { - t_assert(data != nullptr && _type == mtpc_updateWebPage); - return *(const MTPDupdateWebPage*)data; - } - - MTPDupdateReadMessagesContents &_updateReadMessagesContents() { - t_assert(data != nullptr && _type == mtpc_updateReadMessagesContents); - split(); - return *(MTPDupdateReadMessagesContents*)data; - } - const MTPDupdateReadMessagesContents &c_updateReadMessagesContents() const { - t_assert(data != nullptr && _type == mtpc_updateReadMessagesContents); - return *(const MTPDupdateReadMessagesContents*)data; - } - - MTPDupdateChannelTooLong &_updateChannelTooLong() { - t_assert(data != nullptr && _type == mtpc_updateChannelTooLong); - split(); - return *(MTPDupdateChannelTooLong*)data; - } - const MTPDupdateChannelTooLong &c_updateChannelTooLong() const { - t_assert(data != nullptr && _type == mtpc_updateChannelTooLong); - return *(const MTPDupdateChannelTooLong*)data; - } - - MTPDupdateChannel &_updateChannel() { - t_assert(data != nullptr && _type == mtpc_updateChannel); - split(); - return *(MTPDupdateChannel*)data; - } - const MTPDupdateChannel &c_updateChannel() const { - t_assert(data != nullptr && _type == mtpc_updateChannel); - return *(const MTPDupdateChannel*)data; - } - - MTPDupdateNewChannelMessage &_updateNewChannelMessage() { - t_assert(data != nullptr && _type == mtpc_updateNewChannelMessage); - split(); - return *(MTPDupdateNewChannelMessage*)data; - } - const MTPDupdateNewChannelMessage &c_updateNewChannelMessage() const { - t_assert(data != nullptr && _type == mtpc_updateNewChannelMessage); - return *(const MTPDupdateNewChannelMessage*)data; - } - - MTPDupdateReadChannelInbox &_updateReadChannelInbox() { - t_assert(data != nullptr && _type == mtpc_updateReadChannelInbox); - split(); - return *(MTPDupdateReadChannelInbox*)data; - } - const MTPDupdateReadChannelInbox &c_updateReadChannelInbox() const { - t_assert(data != nullptr && _type == mtpc_updateReadChannelInbox); - return *(const MTPDupdateReadChannelInbox*)data; - } - - MTPDupdateDeleteChannelMessages &_updateDeleteChannelMessages() { - t_assert(data != nullptr && _type == mtpc_updateDeleteChannelMessages); - split(); - return *(MTPDupdateDeleteChannelMessages*)data; - } - const MTPDupdateDeleteChannelMessages &c_updateDeleteChannelMessages() const { - t_assert(data != nullptr && _type == mtpc_updateDeleteChannelMessages); - return *(const MTPDupdateDeleteChannelMessages*)data; - } - - MTPDupdateChannelMessageViews &_updateChannelMessageViews() { - t_assert(data != nullptr && _type == mtpc_updateChannelMessageViews); - split(); - return *(MTPDupdateChannelMessageViews*)data; - } - const MTPDupdateChannelMessageViews &c_updateChannelMessageViews() const { - t_assert(data != nullptr && _type == mtpc_updateChannelMessageViews); - return *(const MTPDupdateChannelMessageViews*)data; - } - - MTPDupdateChatAdmins &_updateChatAdmins() { - t_assert(data != nullptr && _type == mtpc_updateChatAdmins); - split(); - return *(MTPDupdateChatAdmins*)data; - } - const MTPDupdateChatAdmins &c_updateChatAdmins() const { - t_assert(data != nullptr && _type == mtpc_updateChatAdmins); - return *(const MTPDupdateChatAdmins*)data; - } - - MTPDupdateChatParticipantAdmin &_updateChatParticipantAdmin() { - t_assert(data != nullptr && _type == mtpc_updateChatParticipantAdmin); - split(); - return *(MTPDupdateChatParticipantAdmin*)data; - } - const MTPDupdateChatParticipantAdmin &c_updateChatParticipantAdmin() const { - t_assert(data != nullptr && _type == mtpc_updateChatParticipantAdmin); - return *(const MTPDupdateChatParticipantAdmin*)data; - } - - MTPDupdateNewStickerSet &_updateNewStickerSet() { - t_assert(data != nullptr && _type == mtpc_updateNewStickerSet); - split(); - return *(MTPDupdateNewStickerSet*)data; - } - const MTPDupdateNewStickerSet &c_updateNewStickerSet() const { - t_assert(data != nullptr && _type == mtpc_updateNewStickerSet); - return *(const MTPDupdateNewStickerSet*)data; - } - - MTPDupdateStickerSetsOrder &_updateStickerSetsOrder() { - t_assert(data != nullptr && _type == mtpc_updateStickerSetsOrder); - split(); - return *(MTPDupdateStickerSetsOrder*)data; - } - const MTPDupdateStickerSetsOrder &c_updateStickerSetsOrder() const { - t_assert(data != nullptr && _type == mtpc_updateStickerSetsOrder); - return *(const MTPDupdateStickerSetsOrder*)data; - } - - MTPDupdateBotInlineQuery &_updateBotInlineQuery() { - t_assert(data != nullptr && _type == mtpc_updateBotInlineQuery); - split(); - return *(MTPDupdateBotInlineQuery*)data; - } - const MTPDupdateBotInlineQuery &c_updateBotInlineQuery() const { - t_assert(data != nullptr && _type == mtpc_updateBotInlineQuery); - return *(const MTPDupdateBotInlineQuery*)data; - } - - MTPDupdateBotInlineSend &_updateBotInlineSend() { - t_assert(data != nullptr && _type == mtpc_updateBotInlineSend); - split(); - return *(MTPDupdateBotInlineSend*)data; - } - const MTPDupdateBotInlineSend &c_updateBotInlineSend() const { - t_assert(data != nullptr && _type == mtpc_updateBotInlineSend); - return *(const MTPDupdateBotInlineSend*)data; - } - - MTPDupdateEditChannelMessage &_updateEditChannelMessage() { - t_assert(data != nullptr && _type == mtpc_updateEditChannelMessage); - split(); - return *(MTPDupdateEditChannelMessage*)data; - } - const MTPDupdateEditChannelMessage &c_updateEditChannelMessage() const { - t_assert(data != nullptr && _type == mtpc_updateEditChannelMessage); - return *(const MTPDupdateEditChannelMessage*)data; - } - - MTPDupdateChannelPinnedMessage &_updateChannelPinnedMessage() { - t_assert(data != nullptr && _type == mtpc_updateChannelPinnedMessage); - split(); - return *(MTPDupdateChannelPinnedMessage*)data; - } - const MTPDupdateChannelPinnedMessage &c_updateChannelPinnedMessage() const { - t_assert(data != nullptr && _type == mtpc_updateChannelPinnedMessage); - return *(const MTPDupdateChannelPinnedMessage*)data; - } - - MTPDupdateBotCallbackQuery &_updateBotCallbackQuery() { - t_assert(data != nullptr && _type == mtpc_updateBotCallbackQuery); - split(); - return *(MTPDupdateBotCallbackQuery*)data; - } - const MTPDupdateBotCallbackQuery &c_updateBotCallbackQuery() const { - t_assert(data != nullptr && _type == mtpc_updateBotCallbackQuery); - return *(const MTPDupdateBotCallbackQuery*)data; - } - - MTPDupdateEditMessage &_updateEditMessage() { - t_assert(data != nullptr && _type == mtpc_updateEditMessage); - split(); - return *(MTPDupdateEditMessage*)data; - } - const MTPDupdateEditMessage &c_updateEditMessage() const { - t_assert(data != nullptr && _type == mtpc_updateEditMessage); - return *(const MTPDupdateEditMessage*)data; - } - - MTPDupdateInlineBotCallbackQuery &_updateInlineBotCallbackQuery() { - t_assert(data != nullptr && _type == mtpc_updateInlineBotCallbackQuery); - split(); - return *(MTPDupdateInlineBotCallbackQuery*)data; - } - const MTPDupdateInlineBotCallbackQuery &c_updateInlineBotCallbackQuery() const { - t_assert(data != nullptr && _type == mtpc_updateInlineBotCallbackQuery); - return *(const MTPDupdateInlineBotCallbackQuery*)data; - } - - MTPDupdateReadChannelOutbox &_updateReadChannelOutbox() { - t_assert(data != nullptr && _type == mtpc_updateReadChannelOutbox); - split(); - return *(MTPDupdateReadChannelOutbox*)data; - } - const MTPDupdateReadChannelOutbox &c_updateReadChannelOutbox() const { - t_assert(data != nullptr && _type == mtpc_updateReadChannelOutbox); - return *(const MTPDupdateReadChannelOutbox*)data; - } - - MTPDupdateDraftMessage &_updateDraftMessage() { - t_assert(data != nullptr && _type == mtpc_updateDraftMessage); - split(); - return *(MTPDupdateDraftMessage*)data; - } - const MTPDupdateDraftMessage &c_updateDraftMessage() const { - t_assert(data != nullptr && _type == mtpc_updateDraftMessage); - return *(const MTPDupdateDraftMessage*)data; - } - - MTPDupdateChannelWebPage &_updateChannelWebPage() { - t_assert(data != nullptr && _type == mtpc_updateChannelWebPage); - split(); - return *(MTPDupdateChannelWebPage*)data; - } - const MTPDupdateChannelWebPage &c_updateChannelWebPage() const { - t_assert(data != nullptr && _type == mtpc_updateChannelWebPage); - return *(const MTPDupdateChannelWebPage*)data; - } - - MTPDupdatePhoneCall &_updatePhoneCall() { - t_assert(data != nullptr && _type == mtpc_updatePhoneCall); - split(); - return *(MTPDupdatePhoneCall*)data; - } - const MTPDupdatePhoneCall &c_updatePhoneCall() const { - t_assert(data != nullptr && _type == mtpc_updatePhoneCall); - return *(const MTPDupdatePhoneCall*)data; - } - - MTPDupdateDialogPinned &_updateDialogPinned() { - t_assert(data != nullptr && _type == mtpc_updateDialogPinned); - split(); - return *(MTPDupdateDialogPinned*)data; - } - const MTPDupdateDialogPinned &c_updateDialogPinned() const { - t_assert(data != nullptr && _type == mtpc_updateDialogPinned); - return *(const MTPDupdateDialogPinned*)data; - } - - MTPDupdatePinnedDialogs &_updatePinnedDialogs() { - t_assert(data != nullptr && _type == mtpc_updatePinnedDialogs); - split(); - return *(MTPDupdatePinnedDialogs*)data; - } - const MTPDupdatePinnedDialogs &c_updatePinnedDialogs() const { - t_assert(data != nullptr && _type == mtpc_updatePinnedDialogs); - return *(const MTPDupdatePinnedDialogs*)data; - } + const MTPDupdateNewMessage &c_updateNewMessage() const; + const MTPDupdateMessageID &c_updateMessageID() const; + const MTPDupdateDeleteMessages &c_updateDeleteMessages() const; + const MTPDupdateUserTyping &c_updateUserTyping() const; + const MTPDupdateChatUserTyping &c_updateChatUserTyping() const; + const MTPDupdateChatParticipants &c_updateChatParticipants() const; + const MTPDupdateUserStatus &c_updateUserStatus() const; + const MTPDupdateUserName &c_updateUserName() const; + const MTPDupdateUserPhoto &c_updateUserPhoto() const; + const MTPDupdateContactRegistered &c_updateContactRegistered() const; + const MTPDupdateContactLink &c_updateContactLink() const; + const MTPDupdateNewEncryptedMessage &c_updateNewEncryptedMessage() const; + const MTPDupdateEncryptedChatTyping &c_updateEncryptedChatTyping() const; + const MTPDupdateEncryption &c_updateEncryption() const; + const MTPDupdateEncryptedMessagesRead &c_updateEncryptedMessagesRead() const; + const MTPDupdateChatParticipantAdd &c_updateChatParticipantAdd() const; + const MTPDupdateChatParticipantDelete &c_updateChatParticipantDelete() const; + const MTPDupdateDcOptions &c_updateDcOptions() const; + const MTPDupdateUserBlocked &c_updateUserBlocked() const; + const MTPDupdateNotifySettings &c_updateNotifySettings() const; + const MTPDupdateServiceNotification &c_updateServiceNotification() const; + const MTPDupdatePrivacy &c_updatePrivacy() const; + const MTPDupdateUserPhone &c_updateUserPhone() const; + const MTPDupdateReadHistoryInbox &c_updateReadHistoryInbox() const; + const MTPDupdateReadHistoryOutbox &c_updateReadHistoryOutbox() const; + const MTPDupdateWebPage &c_updateWebPage() const; + const MTPDupdateReadMessagesContents &c_updateReadMessagesContents() const; + const MTPDupdateChannelTooLong &c_updateChannelTooLong() const; + const MTPDupdateChannel &c_updateChannel() const; + const MTPDupdateNewChannelMessage &c_updateNewChannelMessage() const; + const MTPDupdateReadChannelInbox &c_updateReadChannelInbox() const; + const MTPDupdateDeleteChannelMessages &c_updateDeleteChannelMessages() const; + const MTPDupdateChannelMessageViews &c_updateChannelMessageViews() const; + const MTPDupdateChatAdmins &c_updateChatAdmins() const; + const MTPDupdateChatParticipantAdmin &c_updateChatParticipantAdmin() const; + const MTPDupdateNewStickerSet &c_updateNewStickerSet() const; + const MTPDupdateStickerSetsOrder &c_updateStickerSetsOrder() const; + const MTPDupdateBotInlineQuery &c_updateBotInlineQuery() const; + const MTPDupdateBotInlineSend &c_updateBotInlineSend() const; + const MTPDupdateEditChannelMessage &c_updateEditChannelMessage() const; + const MTPDupdateChannelPinnedMessage &c_updateChannelPinnedMessage() const; + const MTPDupdateBotCallbackQuery &c_updateBotCallbackQuery() const; + const MTPDupdateEditMessage &c_updateEditMessage() const; + const MTPDupdateInlineBotCallbackQuery &c_updateInlineBotCallbackQuery() const; + const MTPDupdateReadChannelOutbox &c_updateReadChannelOutbox() const; + const MTPDupdateDraftMessage &c_updateDraftMessage() const; + const MTPDupdateChannelWebPage &c_updateChannelWebPage() const; + const MTPDupdatePhoneCall &c_updatePhoneCall() const; + const MTPDupdateDialogPinned &c_updateDialogPinned() const; + const MTPDupdatePinnedDialogs &c_updatePinnedDialogs() const; uint32 innerLength() const; mtpTypeId type() const; @@ -5598,79 +3915,70 @@ public: private: explicit MTPupdate(mtpTypeId type); - explicit MTPupdate(MTPDupdateNewMessage *_data); - explicit MTPupdate(MTPDupdateMessageID *_data); - explicit MTPupdate(MTPDupdateDeleteMessages *_data); - explicit MTPupdate(MTPDupdateUserTyping *_data); - explicit MTPupdate(MTPDupdateChatUserTyping *_data); - explicit MTPupdate(MTPDupdateChatParticipants *_data); - explicit MTPupdate(MTPDupdateUserStatus *_data); - explicit MTPupdate(MTPDupdateUserName *_data); - explicit MTPupdate(MTPDupdateUserPhoto *_data); - explicit MTPupdate(MTPDupdateContactRegistered *_data); - explicit MTPupdate(MTPDupdateContactLink *_data); - explicit MTPupdate(MTPDupdateNewEncryptedMessage *_data); - explicit MTPupdate(MTPDupdateEncryptedChatTyping *_data); - explicit MTPupdate(MTPDupdateEncryption *_data); - explicit MTPupdate(MTPDupdateEncryptedMessagesRead *_data); - explicit MTPupdate(MTPDupdateChatParticipantAdd *_data); - explicit MTPupdate(MTPDupdateChatParticipantDelete *_data); - explicit MTPupdate(MTPDupdateDcOptions *_data); - explicit MTPupdate(MTPDupdateUserBlocked *_data); - explicit MTPupdate(MTPDupdateNotifySettings *_data); - explicit MTPupdate(MTPDupdateServiceNotification *_data); - explicit MTPupdate(MTPDupdatePrivacy *_data); - explicit MTPupdate(MTPDupdateUserPhone *_data); - explicit MTPupdate(MTPDupdateReadHistoryInbox *_data); - explicit MTPupdate(MTPDupdateReadHistoryOutbox *_data); - explicit MTPupdate(MTPDupdateWebPage *_data); - explicit MTPupdate(MTPDupdateReadMessagesContents *_data); - explicit MTPupdate(MTPDupdateChannelTooLong *_data); - explicit MTPupdate(MTPDupdateChannel *_data); - explicit MTPupdate(MTPDupdateNewChannelMessage *_data); - explicit MTPupdate(MTPDupdateReadChannelInbox *_data); - explicit MTPupdate(MTPDupdateDeleteChannelMessages *_data); - explicit MTPupdate(MTPDupdateChannelMessageViews *_data); - explicit MTPupdate(MTPDupdateChatAdmins *_data); - explicit MTPupdate(MTPDupdateChatParticipantAdmin *_data); - explicit MTPupdate(MTPDupdateNewStickerSet *_data); - explicit MTPupdate(MTPDupdateStickerSetsOrder *_data); - explicit MTPupdate(MTPDupdateBotInlineQuery *_data); - explicit MTPupdate(MTPDupdateBotInlineSend *_data); - explicit MTPupdate(MTPDupdateEditChannelMessage *_data); - explicit MTPupdate(MTPDupdateChannelPinnedMessage *_data); - explicit MTPupdate(MTPDupdateBotCallbackQuery *_data); - explicit MTPupdate(MTPDupdateEditMessage *_data); - explicit MTPupdate(MTPDupdateInlineBotCallbackQuery *_data); - explicit MTPupdate(MTPDupdateReadChannelOutbox *_data); - explicit MTPupdate(MTPDupdateDraftMessage *_data); - explicit MTPupdate(MTPDupdateChannelWebPage *_data); - explicit MTPupdate(MTPDupdatePhoneCall *_data); - explicit MTPupdate(MTPDupdateDialogPinned *_data); - explicit MTPupdate(MTPDupdatePinnedDialogs *_data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); + explicit MTPupdate(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPUpdate; class MTPupdates_state : private mtpDataOwner { public: MTPupdates_state(); - MTPupdates_state(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_state) : mtpDataOwner(0) { + MTPupdates_state(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_state) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDupdates_state &_updates_state() { - t_assert(data != nullptr); - split(); - return *(MTPDupdates_state*)data; - } - const MTPDupdates_state &c_updates_state() const { - t_assert(data != nullptr); - return *(const MTPDupdates_state*)data; - } + const MTPDupdates_state &c_updates_state() const; uint32 innerLength() const; mtpTypeId type() const; @@ -5680,7 +3988,7 @@ public: typedef void ResponseType; private: - explicit MTPupdates_state(MTPDupdates_state *_data); + explicit MTPupdates_state(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -5688,51 +3996,15 @@ typedef MTPBoxed MTPupdates_State; class MTPupdates_difference : private mtpDataOwner { public: - MTPupdates_difference() : mtpDataOwner(0), _type(0) { + MTPupdates_difference() : mtpDataOwner(nullptr) { } - MTPupdates_difference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPupdates_difference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDupdates_differenceEmpty &_updates_differenceEmpty() { - t_assert(data != nullptr && _type == mtpc_updates_differenceEmpty); - split(); - return *(MTPDupdates_differenceEmpty*)data; - } - const MTPDupdates_differenceEmpty &c_updates_differenceEmpty() const { - t_assert(data != nullptr && _type == mtpc_updates_differenceEmpty); - return *(const MTPDupdates_differenceEmpty*)data; - } - - MTPDupdates_difference &_updates_difference() { - t_assert(data != nullptr && _type == mtpc_updates_difference); - split(); - return *(MTPDupdates_difference*)data; - } - const MTPDupdates_difference &c_updates_difference() const { - t_assert(data != nullptr && _type == mtpc_updates_difference); - return *(const MTPDupdates_difference*)data; - } - - MTPDupdates_differenceSlice &_updates_differenceSlice() { - t_assert(data != nullptr && _type == mtpc_updates_differenceSlice); - split(); - return *(MTPDupdates_differenceSlice*)data; - } - const MTPDupdates_differenceSlice &c_updates_differenceSlice() const { - t_assert(data != nullptr && _type == mtpc_updates_differenceSlice); - return *(const MTPDupdates_differenceSlice*)data; - } - - MTPDupdates_differenceTooLong &_updates_differenceTooLong() { - t_assert(data != nullptr && _type == mtpc_updates_differenceTooLong); - split(); - return *(MTPDupdates_differenceTooLong*)data; - } - const MTPDupdates_differenceTooLong &c_updates_differenceTooLong() const { - t_assert(data != nullptr && _type == mtpc_updates_differenceTooLong); - return *(const MTPDupdates_differenceTooLong*)data; - } + const MTPDupdates_differenceEmpty &c_updates_differenceEmpty() const; + const MTPDupdates_difference &c_updates_difference() const; + const MTPDupdates_differenceSlice &c_updates_differenceSlice() const; + const MTPDupdates_differenceTooLong &c_updates_differenceTooLong() const; uint32 innerLength() const; mtpTypeId type() const; @@ -5743,84 +4015,30 @@ public: private: explicit MTPupdates_difference(mtpTypeId type); - explicit MTPupdates_difference(MTPDupdates_differenceEmpty *_data); - explicit MTPupdates_difference(MTPDupdates_difference *_data); - explicit MTPupdates_difference(MTPDupdates_differenceSlice *_data); - explicit MTPupdates_difference(MTPDupdates_differenceTooLong *_data); + explicit MTPupdates_difference(std::shared_ptr &&data); + explicit MTPupdates_difference(std::shared_ptr &&data); + explicit MTPupdates_difference(std::shared_ptr &&data); + explicit MTPupdates_difference(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPupdates_Difference; class MTPupdates : private mtpDataOwner { public: - MTPupdates() : mtpDataOwner(0), _type(0) { + MTPupdates() : mtpDataOwner(nullptr) { } - MTPupdates(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPupdates(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDupdateShortMessage &_updateShortMessage() { - t_assert(data != nullptr && _type == mtpc_updateShortMessage); - split(); - return *(MTPDupdateShortMessage*)data; - } - const MTPDupdateShortMessage &c_updateShortMessage() const { - t_assert(data != nullptr && _type == mtpc_updateShortMessage); - return *(const MTPDupdateShortMessage*)data; - } - - MTPDupdateShortChatMessage &_updateShortChatMessage() { - t_assert(data != nullptr && _type == mtpc_updateShortChatMessage); - split(); - return *(MTPDupdateShortChatMessage*)data; - } - const MTPDupdateShortChatMessage &c_updateShortChatMessage() const { - t_assert(data != nullptr && _type == mtpc_updateShortChatMessage); - return *(const MTPDupdateShortChatMessage*)data; - } - - MTPDupdateShort &_updateShort() { - t_assert(data != nullptr && _type == mtpc_updateShort); - split(); - return *(MTPDupdateShort*)data; - } - const MTPDupdateShort &c_updateShort() const { - t_assert(data != nullptr && _type == mtpc_updateShort); - return *(const MTPDupdateShort*)data; - } - - MTPDupdatesCombined &_updatesCombined() { - t_assert(data != nullptr && _type == mtpc_updatesCombined); - split(); - return *(MTPDupdatesCombined*)data; - } - const MTPDupdatesCombined &c_updatesCombined() const { - t_assert(data != nullptr && _type == mtpc_updatesCombined); - return *(const MTPDupdatesCombined*)data; - } - - MTPDupdates &_updates() { - t_assert(data != nullptr && _type == mtpc_updates); - split(); - return *(MTPDupdates*)data; - } - const MTPDupdates &c_updates() const { - t_assert(data != nullptr && _type == mtpc_updates); - return *(const MTPDupdates*)data; - } - - MTPDupdateShortSentMessage &_updateShortSentMessage() { - t_assert(data != nullptr && _type == mtpc_updateShortSentMessage); - split(); - return *(MTPDupdateShortSentMessage*)data; - } - const MTPDupdateShortSentMessage &c_updateShortSentMessage() const { - t_assert(data != nullptr && _type == mtpc_updateShortSentMessage); - return *(const MTPDupdateShortSentMessage*)data; - } + const MTPDupdateShortMessage &c_updateShortMessage() const; + const MTPDupdateShortChatMessage &c_updateShortChatMessage() const; + const MTPDupdateShort &c_updateShort() const; + const MTPDupdatesCombined &c_updatesCombined() const; + const MTPDupdates &c_updates() const; + const MTPDupdateShortSentMessage &c_updateShortSentMessage() const; uint32 innerLength() const; mtpTypeId type() const; @@ -5831,46 +4049,28 @@ public: private: explicit MTPupdates(mtpTypeId type); - explicit MTPupdates(MTPDupdateShortMessage *_data); - explicit MTPupdates(MTPDupdateShortChatMessage *_data); - explicit MTPupdates(MTPDupdateShort *_data); - explicit MTPupdates(MTPDupdatesCombined *_data); - explicit MTPupdates(MTPDupdates *_data); - explicit MTPupdates(MTPDupdateShortSentMessage *_data); + explicit MTPupdates(std::shared_ptr &&data); + explicit MTPupdates(std::shared_ptr &&data); + explicit MTPupdates(std::shared_ptr &&data); + explicit MTPupdates(std::shared_ptr &&data); + explicit MTPupdates(std::shared_ptr &&data); + explicit MTPupdates(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPUpdates; class MTPphotos_photos : private mtpDataOwner { public: - MTPphotos_photos() : mtpDataOwner(0), _type(0) { + MTPphotos_photos() : mtpDataOwner(nullptr) { } - MTPphotos_photos(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPphotos_photos(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDphotos_photos &_photos_photos() { - t_assert(data != nullptr && _type == mtpc_photos_photos); - split(); - return *(MTPDphotos_photos*)data; - } - const MTPDphotos_photos &c_photos_photos() const { - t_assert(data != nullptr && _type == mtpc_photos_photos); - return *(const MTPDphotos_photos*)data; - } - - MTPDphotos_photosSlice &_photos_photosSlice() { - t_assert(data != nullptr && _type == mtpc_photos_photosSlice); - split(); - return *(MTPDphotos_photosSlice*)data; - } - const MTPDphotos_photosSlice &c_photos_photosSlice() const { - t_assert(data != nullptr && _type == mtpc_photos_photosSlice); - return *(const MTPDphotos_photosSlice*)data; - } + const MTPDphotos_photos &c_photos_photos() const; + const MTPDphotos_photosSlice &c_photos_photosSlice() const; uint32 innerLength() const; mtpTypeId type() const; @@ -5881,31 +4081,22 @@ public: private: explicit MTPphotos_photos(mtpTypeId type); - explicit MTPphotos_photos(MTPDphotos_photos *_data); - explicit MTPphotos_photos(MTPDphotos_photosSlice *_data); + explicit MTPphotos_photos(std::shared_ptr &&data); + explicit MTPphotos_photos(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPphotos_Photos; class MTPphotos_photo : private mtpDataOwner { public: MTPphotos_photo(); - MTPphotos_photo(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_photo) : mtpDataOwner(0) { + MTPphotos_photo(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_photo) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDphotos_photo &_photos_photo() { - t_assert(data != nullptr); - split(); - return *(MTPDphotos_photo*)data; - } - const MTPDphotos_photo &c_photos_photo() const { - t_assert(data != nullptr); - return *(const MTPDphotos_photo*)data; - } + const MTPDphotos_photo &c_photos_photo() const; uint32 innerLength() const; mtpTypeId type() const; @@ -5915,7 +4106,7 @@ public: typedef void ResponseType; private: - explicit MTPphotos_photo(MTPDphotos_photo *_data); + explicit MTPphotos_photo(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -5924,19 +4115,10 @@ typedef MTPBoxed MTPphotos_Photo; class MTPupload_file : private mtpDataOwner { public: MTPupload_file(); - MTPupload_file(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_file) : mtpDataOwner(0) { + MTPupload_file(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_file) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDupload_file &_upload_file() { - t_assert(data != nullptr); - split(); - return *(MTPDupload_file*)data; - } - const MTPDupload_file &c_upload_file() const { - t_assert(data != nullptr); - return *(const MTPDupload_file*)data; - } + const MTPDupload_file &c_upload_file() const; uint32 innerLength() const; mtpTypeId type() const; @@ -5946,7 +4128,7 @@ public: typedef void ResponseType; private: - explicit MTPupload_file(MTPDupload_file *_data); + explicit MTPupload_file(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -5955,19 +4137,10 @@ typedef MTPBoxed MTPupload_File; class MTPdcOption : private mtpDataOwner { public: MTPdcOption(); - MTPdcOption(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_dcOption) : mtpDataOwner(0) { + MTPdcOption(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_dcOption) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDdcOption &_dcOption() { - t_assert(data != nullptr); - split(); - return *(MTPDdcOption*)data; - } - const MTPDdcOption &c_dcOption() const { - t_assert(data != nullptr); - return *(const MTPDdcOption*)data; - } + const MTPDdcOption &c_dcOption() const; uint32 innerLength() const; mtpTypeId type() const; @@ -5977,7 +4150,7 @@ public: typedef void ResponseType; private: - explicit MTPdcOption(MTPDdcOption *_data); + explicit MTPdcOption(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -5986,19 +4159,10 @@ typedef MTPBoxed MTPDcOption; class MTPconfig : private mtpDataOwner { public: MTPconfig(); - MTPconfig(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_config) : mtpDataOwner(0) { + MTPconfig(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_config) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDconfig &_config() { - t_assert(data != nullptr); - split(); - return *(MTPDconfig*)data; - } - const MTPDconfig &c_config() const { - t_assert(data != nullptr); - return *(const MTPDconfig*)data; - } + const MTPDconfig &c_config() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6008,7 +4172,7 @@ public: typedef void ResponseType; private: - explicit MTPconfig(MTPDconfig *_data); + explicit MTPconfig(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -6017,19 +4181,10 @@ typedef MTPBoxed MTPConfig; class MTPnearestDc : private mtpDataOwner { public: MTPnearestDc(); - MTPnearestDc(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_nearestDc) : mtpDataOwner(0) { + MTPnearestDc(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_nearestDc) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDnearestDc &_nearestDc() { - t_assert(data != nullptr); - split(); - return *(MTPDnearestDc*)data; - } - const MTPDnearestDc &c_nearestDc() const { - t_assert(data != nullptr); - return *(const MTPDnearestDc*)data; - } + const MTPDnearestDc &c_nearestDc() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6039,7 +4194,7 @@ public: typedef void ResponseType; private: - explicit MTPnearestDc(MTPDnearestDc *_data); + explicit MTPnearestDc(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -6047,21 +4202,12 @@ typedef MTPBoxed MTPNearestDc; class MTPhelp_appUpdate : private mtpDataOwner { public: - MTPhelp_appUpdate() : mtpDataOwner(0), _type(0) { + MTPhelp_appUpdate() : mtpDataOwner(nullptr) { } - MTPhelp_appUpdate(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPhelp_appUpdate(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDhelp_appUpdate &_help_appUpdate() { - t_assert(data != nullptr && _type == mtpc_help_appUpdate); - split(); - return *(MTPDhelp_appUpdate*)data; - } - const MTPDhelp_appUpdate &c_help_appUpdate() const { - t_assert(data != nullptr && _type == mtpc_help_appUpdate); - return *(const MTPDhelp_appUpdate*)data; - } + const MTPDhelp_appUpdate &c_help_appUpdate() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6072,30 +4218,21 @@ public: private: explicit MTPhelp_appUpdate(mtpTypeId type); - explicit MTPhelp_appUpdate(MTPDhelp_appUpdate *_data); + explicit MTPhelp_appUpdate(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPhelp_AppUpdate; class MTPhelp_inviteText : private mtpDataOwner { public: MTPhelp_inviteText(); - MTPhelp_inviteText(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_inviteText) : mtpDataOwner(0) { + MTPhelp_inviteText(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_inviteText) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDhelp_inviteText &_help_inviteText() { - t_assert(data != nullptr); - split(); - return *(MTPDhelp_inviteText*)data; - } - const MTPDhelp_inviteText &c_help_inviteText() const { - t_assert(data != nullptr); - return *(const MTPDhelp_inviteText*)data; - } + const MTPDhelp_inviteText &c_help_inviteText() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6105,7 +4242,7 @@ public: typedef void ResponseType; private: - explicit MTPhelp_inviteText(MTPDhelp_inviteText *_data); + explicit MTPhelp_inviteText(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -6113,61 +4250,16 @@ typedef MTPBoxed MTPhelp_InviteText; class MTPencryptedChat : private mtpDataOwner { public: - MTPencryptedChat() : mtpDataOwner(0), _type(0) { + MTPencryptedChat() : mtpDataOwner(nullptr) { } - MTPencryptedChat(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPencryptedChat(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDencryptedChatEmpty &_encryptedChatEmpty() { - t_assert(data != nullptr && _type == mtpc_encryptedChatEmpty); - split(); - return *(MTPDencryptedChatEmpty*)data; - } - const MTPDencryptedChatEmpty &c_encryptedChatEmpty() const { - t_assert(data != nullptr && _type == mtpc_encryptedChatEmpty); - return *(const MTPDencryptedChatEmpty*)data; - } - - MTPDencryptedChatWaiting &_encryptedChatWaiting() { - t_assert(data != nullptr && _type == mtpc_encryptedChatWaiting); - split(); - return *(MTPDencryptedChatWaiting*)data; - } - const MTPDencryptedChatWaiting &c_encryptedChatWaiting() const { - t_assert(data != nullptr && _type == mtpc_encryptedChatWaiting); - return *(const MTPDencryptedChatWaiting*)data; - } - - MTPDencryptedChatRequested &_encryptedChatRequested() { - t_assert(data != nullptr && _type == mtpc_encryptedChatRequested); - split(); - return *(MTPDencryptedChatRequested*)data; - } - const MTPDencryptedChatRequested &c_encryptedChatRequested() const { - t_assert(data != nullptr && _type == mtpc_encryptedChatRequested); - return *(const MTPDencryptedChatRequested*)data; - } - - MTPDencryptedChat &_encryptedChat() { - t_assert(data != nullptr && _type == mtpc_encryptedChat); - split(); - return *(MTPDencryptedChat*)data; - } - const MTPDencryptedChat &c_encryptedChat() const { - t_assert(data != nullptr && _type == mtpc_encryptedChat); - return *(const MTPDencryptedChat*)data; - } - - MTPDencryptedChatDiscarded &_encryptedChatDiscarded() { - t_assert(data != nullptr && _type == mtpc_encryptedChatDiscarded); - split(); - return *(MTPDencryptedChatDiscarded*)data; - } - const MTPDencryptedChatDiscarded &c_encryptedChatDiscarded() const { - t_assert(data != nullptr && _type == mtpc_encryptedChatDiscarded); - return *(const MTPDencryptedChatDiscarded*)data; - } + const MTPDencryptedChatEmpty &c_encryptedChatEmpty() const; + const MTPDencryptedChatWaiting &c_encryptedChatWaiting() const; + const MTPDencryptedChatRequested &c_encryptedChatRequested() const; + const MTPDencryptedChat &c_encryptedChat() const; + const MTPDencryptedChatDiscarded &c_encryptedChatDiscarded() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6178,34 +4270,25 @@ public: private: explicit MTPencryptedChat(mtpTypeId type); - explicit MTPencryptedChat(MTPDencryptedChatEmpty *_data); - explicit MTPencryptedChat(MTPDencryptedChatWaiting *_data); - explicit MTPencryptedChat(MTPDencryptedChatRequested *_data); - explicit MTPencryptedChat(MTPDencryptedChat *_data); - explicit MTPencryptedChat(MTPDencryptedChatDiscarded *_data); + explicit MTPencryptedChat(std::shared_ptr &&data); + explicit MTPencryptedChat(std::shared_ptr &&data); + explicit MTPencryptedChat(std::shared_ptr &&data); + explicit MTPencryptedChat(std::shared_ptr &&data); + explicit MTPencryptedChat(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPEncryptedChat; class MTPinputEncryptedChat : private mtpDataOwner { public: MTPinputEncryptedChat(); - MTPinputEncryptedChat(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputEncryptedChat) : mtpDataOwner(0) { + MTPinputEncryptedChat(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputEncryptedChat) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputEncryptedChat &_inputEncryptedChat() { - t_assert(data != nullptr); - split(); - return *(MTPDinputEncryptedChat*)data; - } - const MTPDinputEncryptedChat &c_inputEncryptedChat() const { - t_assert(data != nullptr); - return *(const MTPDinputEncryptedChat*)data; - } + const MTPDinputEncryptedChat &c_inputEncryptedChat() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6215,7 +4298,7 @@ public: typedef void ResponseType; private: - explicit MTPinputEncryptedChat(MTPDinputEncryptedChat *_data); + explicit MTPinputEncryptedChat(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -6223,21 +4306,12 @@ typedef MTPBoxed MTPInputEncryptedChat; class MTPencryptedFile : private mtpDataOwner { public: - MTPencryptedFile() : mtpDataOwner(0), _type(0) { + MTPencryptedFile() : mtpDataOwner(nullptr) { } - MTPencryptedFile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPencryptedFile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDencryptedFile &_encryptedFile() { - t_assert(data != nullptr && _type == mtpc_encryptedFile); - split(); - return *(MTPDencryptedFile*)data; - } - const MTPDencryptedFile &c_encryptedFile() const { - t_assert(data != nullptr && _type == mtpc_encryptedFile); - return *(const MTPDencryptedFile*)data; - } + const MTPDencryptedFile &c_encryptedFile() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6248,51 +4322,24 @@ public: private: explicit MTPencryptedFile(mtpTypeId type); - explicit MTPencryptedFile(MTPDencryptedFile *_data); + explicit MTPencryptedFile(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPEncryptedFile; class MTPinputEncryptedFile : private mtpDataOwner { public: - MTPinputEncryptedFile() : mtpDataOwner(0), _type(0) { + MTPinputEncryptedFile() : mtpDataOwner(nullptr) { } - MTPinputEncryptedFile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputEncryptedFile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputEncryptedFileUploaded &_inputEncryptedFileUploaded() { - t_assert(data != nullptr && _type == mtpc_inputEncryptedFileUploaded); - split(); - return *(MTPDinputEncryptedFileUploaded*)data; - } - const MTPDinputEncryptedFileUploaded &c_inputEncryptedFileUploaded() const { - t_assert(data != nullptr && _type == mtpc_inputEncryptedFileUploaded); - return *(const MTPDinputEncryptedFileUploaded*)data; - } - - MTPDinputEncryptedFile &_inputEncryptedFile() { - t_assert(data != nullptr && _type == mtpc_inputEncryptedFile); - split(); - return *(MTPDinputEncryptedFile*)data; - } - const MTPDinputEncryptedFile &c_inputEncryptedFile() const { - t_assert(data != nullptr && _type == mtpc_inputEncryptedFile); - return *(const MTPDinputEncryptedFile*)data; - } - - MTPDinputEncryptedFileBigUploaded &_inputEncryptedFileBigUploaded() { - t_assert(data != nullptr && _type == mtpc_inputEncryptedFileBigUploaded); - split(); - return *(MTPDinputEncryptedFileBigUploaded*)data; - } - const MTPDinputEncryptedFileBigUploaded &c_inputEncryptedFileBigUploaded() const { - t_assert(data != nullptr && _type == mtpc_inputEncryptedFileBigUploaded); - return *(const MTPDinputEncryptedFileBigUploaded*)data; - } + const MTPDinputEncryptedFileUploaded &c_inputEncryptedFileUploaded() const; + const MTPDinputEncryptedFile &c_inputEncryptedFile() const; + const MTPDinputEncryptedFileBigUploaded &c_inputEncryptedFileBigUploaded() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6303,43 +4350,25 @@ public: private: explicit MTPinputEncryptedFile(mtpTypeId type); - explicit MTPinputEncryptedFile(MTPDinputEncryptedFileUploaded *_data); - explicit MTPinputEncryptedFile(MTPDinputEncryptedFile *_data); - explicit MTPinputEncryptedFile(MTPDinputEncryptedFileBigUploaded *_data); + explicit MTPinputEncryptedFile(std::shared_ptr &&data); + explicit MTPinputEncryptedFile(std::shared_ptr &&data); + explicit MTPinputEncryptedFile(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputEncryptedFile; class MTPencryptedMessage : private mtpDataOwner { public: - MTPencryptedMessage() : mtpDataOwner(0), _type(0) { + MTPencryptedMessage() : mtpDataOwner(nullptr) { } - MTPencryptedMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPencryptedMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDencryptedMessage &_encryptedMessage() { - t_assert(data != nullptr && _type == mtpc_encryptedMessage); - split(); - return *(MTPDencryptedMessage*)data; - } - const MTPDencryptedMessage &c_encryptedMessage() const { - t_assert(data != nullptr && _type == mtpc_encryptedMessage); - return *(const MTPDencryptedMessage*)data; - } - - MTPDencryptedMessageService &_encryptedMessageService() { - t_assert(data != nullptr && _type == mtpc_encryptedMessageService); - split(); - return *(MTPDencryptedMessageService*)data; - } - const MTPDencryptedMessageService &c_encryptedMessageService() const { - t_assert(data != nullptr && _type == mtpc_encryptedMessageService); - return *(const MTPDencryptedMessageService*)data; - } + const MTPDencryptedMessage &c_encryptedMessage() const; + const MTPDencryptedMessageService &c_encryptedMessageService() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6350,42 +4379,24 @@ public: private: explicit MTPencryptedMessage(mtpTypeId type); - explicit MTPencryptedMessage(MTPDencryptedMessage *_data); - explicit MTPencryptedMessage(MTPDencryptedMessageService *_data); + explicit MTPencryptedMessage(std::shared_ptr &&data); + explicit MTPencryptedMessage(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPEncryptedMessage; class MTPmessages_dhConfig : private mtpDataOwner { public: - MTPmessages_dhConfig() : mtpDataOwner(0), _type(0) { + MTPmessages_dhConfig() : mtpDataOwner(nullptr) { } - MTPmessages_dhConfig(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessages_dhConfig(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_dhConfigNotModified &_messages_dhConfigNotModified() { - t_assert(data != nullptr && _type == mtpc_messages_dhConfigNotModified); - split(); - return *(MTPDmessages_dhConfigNotModified*)data; - } - const MTPDmessages_dhConfigNotModified &c_messages_dhConfigNotModified() const { - t_assert(data != nullptr && _type == mtpc_messages_dhConfigNotModified); - return *(const MTPDmessages_dhConfigNotModified*)data; - } - - MTPDmessages_dhConfig &_messages_dhConfig() { - t_assert(data != nullptr && _type == mtpc_messages_dhConfig); - split(); - return *(MTPDmessages_dhConfig*)data; - } - const MTPDmessages_dhConfig &c_messages_dhConfig() const { - t_assert(data != nullptr && _type == mtpc_messages_dhConfig); - return *(const MTPDmessages_dhConfig*)data; - } + const MTPDmessages_dhConfigNotModified &c_messages_dhConfigNotModified() const; + const MTPDmessages_dhConfig &c_messages_dhConfig() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6396,42 +4407,24 @@ public: private: explicit MTPmessages_dhConfig(mtpTypeId type); - explicit MTPmessages_dhConfig(MTPDmessages_dhConfigNotModified *_data); - explicit MTPmessages_dhConfig(MTPDmessages_dhConfig *_data); + explicit MTPmessages_dhConfig(std::shared_ptr &&data); + explicit MTPmessages_dhConfig(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPmessages_DhConfig; class MTPmessages_sentEncryptedMessage : private mtpDataOwner { public: - MTPmessages_sentEncryptedMessage() : mtpDataOwner(0), _type(0) { + MTPmessages_sentEncryptedMessage() : mtpDataOwner(nullptr) { } - MTPmessages_sentEncryptedMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessages_sentEncryptedMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_sentEncryptedMessage &_messages_sentEncryptedMessage() { - t_assert(data != nullptr && _type == mtpc_messages_sentEncryptedMessage); - split(); - return *(MTPDmessages_sentEncryptedMessage*)data; - } - const MTPDmessages_sentEncryptedMessage &c_messages_sentEncryptedMessage() const { - t_assert(data != nullptr && _type == mtpc_messages_sentEncryptedMessage); - return *(const MTPDmessages_sentEncryptedMessage*)data; - } - - MTPDmessages_sentEncryptedFile &_messages_sentEncryptedFile() { - t_assert(data != nullptr && _type == mtpc_messages_sentEncryptedFile); - split(); - return *(MTPDmessages_sentEncryptedFile*)data; - } - const MTPDmessages_sentEncryptedFile &c_messages_sentEncryptedFile() const { - t_assert(data != nullptr && _type == mtpc_messages_sentEncryptedFile); - return *(const MTPDmessages_sentEncryptedFile*)data; - } + const MTPDmessages_sentEncryptedMessage &c_messages_sentEncryptedMessage() const; + const MTPDmessages_sentEncryptedFile &c_messages_sentEncryptedFile() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6442,32 +4435,23 @@ public: private: explicit MTPmessages_sentEncryptedMessage(mtpTypeId type); - explicit MTPmessages_sentEncryptedMessage(MTPDmessages_sentEncryptedMessage *_data); - explicit MTPmessages_sentEncryptedMessage(MTPDmessages_sentEncryptedFile *_data); + explicit MTPmessages_sentEncryptedMessage(std::shared_ptr &&data); + explicit MTPmessages_sentEncryptedMessage(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPmessages_SentEncryptedMessage; class MTPinputDocument : private mtpDataOwner { public: - MTPinputDocument() : mtpDataOwner(0), _type(0) { + MTPinputDocument() : mtpDataOwner(nullptr) { } - MTPinputDocument(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputDocument(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputDocument &_inputDocument() { - t_assert(data != nullptr && _type == mtpc_inputDocument); - split(); - return *(MTPDinputDocument*)data; - } - const MTPDinputDocument &c_inputDocument() const { - t_assert(data != nullptr && _type == mtpc_inputDocument); - return *(const MTPDinputDocument*)data; - } + const MTPDinputDocument &c_inputDocument() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6478,41 +4462,23 @@ public: private: explicit MTPinputDocument(mtpTypeId type); - explicit MTPinputDocument(MTPDinputDocument *_data); + explicit MTPinputDocument(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputDocument; class MTPdocument : private mtpDataOwner { public: - MTPdocument() : mtpDataOwner(0), _type(0) { + MTPdocument() : mtpDataOwner(nullptr) { } - MTPdocument(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPdocument(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDdocumentEmpty &_documentEmpty() { - t_assert(data != nullptr && _type == mtpc_documentEmpty); - split(); - return *(MTPDdocumentEmpty*)data; - } - const MTPDdocumentEmpty &c_documentEmpty() const { - t_assert(data != nullptr && _type == mtpc_documentEmpty); - return *(const MTPDdocumentEmpty*)data; - } - - MTPDdocument &_document() { - t_assert(data != nullptr && _type == mtpc_document); - split(); - return *(MTPDdocument*)data; - } - const MTPDdocument &c_document() const { - t_assert(data != nullptr && _type == mtpc_document); - return *(const MTPDdocument*)data; - } + const MTPDdocumentEmpty &c_documentEmpty() const; + const MTPDdocument &c_document() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6523,31 +4489,22 @@ public: private: explicit MTPdocument(mtpTypeId type); - explicit MTPdocument(MTPDdocumentEmpty *_data); - explicit MTPdocument(MTPDdocument *_data); + explicit MTPdocument(std::shared_ptr &&data); + explicit MTPdocument(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPDocument; class MTPhelp_support : private mtpDataOwner { public: MTPhelp_support(); - MTPhelp_support(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_support) : mtpDataOwner(0) { + MTPhelp_support(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_support) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDhelp_support &_help_support() { - t_assert(data != nullptr); - split(); - return *(MTPDhelp_support*)data; - } - const MTPDhelp_support &c_help_support() const { - t_assert(data != nullptr); - return *(const MTPDhelp_support*)data; - } + const MTPDhelp_support &c_help_support() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6557,7 +4514,7 @@ public: typedef void ResponseType; private: - explicit MTPhelp_support(MTPDhelp_support *_data); + explicit MTPhelp_support(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -6565,21 +4522,12 @@ typedef MTPBoxed MTPhelp_Support; class MTPnotifyPeer : private mtpDataOwner { public: - MTPnotifyPeer() : mtpDataOwner(0), _type(0) { + MTPnotifyPeer() : mtpDataOwner(nullptr) { } - MTPnotifyPeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPnotifyPeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDnotifyPeer &_notifyPeer() { - t_assert(data != nullptr && _type == mtpc_notifyPeer); - split(); - return *(MTPDnotifyPeer*)data; - } - const MTPDnotifyPeer &c_notifyPeer() const { - t_assert(data != nullptr && _type == mtpc_notifyPeer); - return *(const MTPDnotifyPeer*)data; - } + const MTPDnotifyPeer &c_notifyPeer() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6590,61 +4538,25 @@ public: private: explicit MTPnotifyPeer(mtpTypeId type); - explicit MTPnotifyPeer(MTPDnotifyPeer *_data); + explicit MTPnotifyPeer(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPNotifyPeer; class MTPsendMessageAction : private mtpDataOwner { public: - MTPsendMessageAction() : mtpDataOwner(0), _type(0) { + MTPsendMessageAction() : mtpDataOwner(nullptr) { } - MTPsendMessageAction(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPsendMessageAction(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDsendMessageUploadVideoAction &_sendMessageUploadVideoAction() { - t_assert(data != nullptr && _type == mtpc_sendMessageUploadVideoAction); - split(); - return *(MTPDsendMessageUploadVideoAction*)data; - } - const MTPDsendMessageUploadVideoAction &c_sendMessageUploadVideoAction() const { - t_assert(data != nullptr && _type == mtpc_sendMessageUploadVideoAction); - return *(const MTPDsendMessageUploadVideoAction*)data; - } - - MTPDsendMessageUploadAudioAction &_sendMessageUploadAudioAction() { - t_assert(data != nullptr && _type == mtpc_sendMessageUploadAudioAction); - split(); - return *(MTPDsendMessageUploadAudioAction*)data; - } - const MTPDsendMessageUploadAudioAction &c_sendMessageUploadAudioAction() const { - t_assert(data != nullptr && _type == mtpc_sendMessageUploadAudioAction); - return *(const MTPDsendMessageUploadAudioAction*)data; - } - - MTPDsendMessageUploadPhotoAction &_sendMessageUploadPhotoAction() { - t_assert(data != nullptr && _type == mtpc_sendMessageUploadPhotoAction); - split(); - return *(MTPDsendMessageUploadPhotoAction*)data; - } - const MTPDsendMessageUploadPhotoAction &c_sendMessageUploadPhotoAction() const { - t_assert(data != nullptr && _type == mtpc_sendMessageUploadPhotoAction); - return *(const MTPDsendMessageUploadPhotoAction*)data; - } - - MTPDsendMessageUploadDocumentAction &_sendMessageUploadDocumentAction() { - t_assert(data != nullptr && _type == mtpc_sendMessageUploadDocumentAction); - split(); - return *(MTPDsendMessageUploadDocumentAction*)data; - } - const MTPDsendMessageUploadDocumentAction &c_sendMessageUploadDocumentAction() const { - t_assert(data != nullptr && _type == mtpc_sendMessageUploadDocumentAction); - return *(const MTPDsendMessageUploadDocumentAction*)data; - } + const MTPDsendMessageUploadVideoAction &c_sendMessageUploadVideoAction() const; + const MTPDsendMessageUploadAudioAction &c_sendMessageUploadAudioAction() const; + const MTPDsendMessageUploadPhotoAction &c_sendMessageUploadPhotoAction() const; + const MTPDsendMessageUploadDocumentAction &c_sendMessageUploadDocumentAction() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6655,33 +4567,24 @@ public: private: explicit MTPsendMessageAction(mtpTypeId type); - explicit MTPsendMessageAction(MTPDsendMessageUploadVideoAction *_data); - explicit MTPsendMessageAction(MTPDsendMessageUploadAudioAction *_data); - explicit MTPsendMessageAction(MTPDsendMessageUploadPhotoAction *_data); - explicit MTPsendMessageAction(MTPDsendMessageUploadDocumentAction *_data); + explicit MTPsendMessageAction(std::shared_ptr &&data); + explicit MTPsendMessageAction(std::shared_ptr &&data); + explicit MTPsendMessageAction(std::shared_ptr &&data); + explicit MTPsendMessageAction(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPSendMessageAction; class MTPcontacts_found : private mtpDataOwner { public: MTPcontacts_found(); - MTPcontacts_found(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_found) : mtpDataOwner(0) { + MTPcontacts_found(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_found) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDcontacts_found &_contacts_found() { - t_assert(data != nullptr); - split(); - return *(MTPDcontacts_found*)data; - } - const MTPDcontacts_found &c_contacts_found() const { - t_assert(data != nullptr); - return *(const MTPDcontacts_found*)data; - } + const MTPDcontacts_found &c_contacts_found() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6691,7 +4594,7 @@ public: typedef void ResponseType; private: - explicit MTPcontacts_found(MTPDcontacts_found *_data); + explicit MTPcontacts_found(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -6699,9 +4602,9 @@ typedef MTPBoxed MTPcontacts_Found; class MTPinputPrivacyKey { public: - MTPinputPrivacyKey() : _type(0) { + MTPinputPrivacyKey() { } - MTPinputPrivacyKey(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPinputPrivacyKey(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -6717,15 +4620,15 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputPrivacyKey; class MTPprivacyKey { public: - MTPprivacyKey() : _type(0) { + MTPprivacyKey() { } - MTPprivacyKey(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPprivacyKey(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -6741,37 +4644,19 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPPrivacyKey; class MTPinputPrivacyRule : private mtpDataOwner { public: - MTPinputPrivacyRule() : mtpDataOwner(0), _type(0) { + MTPinputPrivacyRule() : mtpDataOwner(nullptr) { } - MTPinputPrivacyRule(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputPrivacyRule(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputPrivacyValueAllowUsers &_inputPrivacyValueAllowUsers() { - t_assert(data != nullptr && _type == mtpc_inputPrivacyValueAllowUsers); - split(); - return *(MTPDinputPrivacyValueAllowUsers*)data; - } - const MTPDinputPrivacyValueAllowUsers &c_inputPrivacyValueAllowUsers() const { - t_assert(data != nullptr && _type == mtpc_inputPrivacyValueAllowUsers); - return *(const MTPDinputPrivacyValueAllowUsers*)data; - } - - MTPDinputPrivacyValueDisallowUsers &_inputPrivacyValueDisallowUsers() { - t_assert(data != nullptr && _type == mtpc_inputPrivacyValueDisallowUsers); - split(); - return *(MTPDinputPrivacyValueDisallowUsers*)data; - } - const MTPDinputPrivacyValueDisallowUsers &c_inputPrivacyValueDisallowUsers() const { - t_assert(data != nullptr && _type == mtpc_inputPrivacyValueDisallowUsers); - return *(const MTPDinputPrivacyValueDisallowUsers*)data; - } + const MTPDinputPrivacyValueAllowUsers &c_inputPrivacyValueAllowUsers() const; + const MTPDinputPrivacyValueDisallowUsers &c_inputPrivacyValueDisallowUsers() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6782,42 +4667,24 @@ public: private: explicit MTPinputPrivacyRule(mtpTypeId type); - explicit MTPinputPrivacyRule(MTPDinputPrivacyValueAllowUsers *_data); - explicit MTPinputPrivacyRule(MTPDinputPrivacyValueDisallowUsers *_data); + explicit MTPinputPrivacyRule(std::shared_ptr &&data); + explicit MTPinputPrivacyRule(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputPrivacyRule; class MTPprivacyRule : private mtpDataOwner { public: - MTPprivacyRule() : mtpDataOwner(0), _type(0) { + MTPprivacyRule() : mtpDataOwner(nullptr) { } - MTPprivacyRule(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPprivacyRule(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDprivacyValueAllowUsers &_privacyValueAllowUsers() { - t_assert(data != nullptr && _type == mtpc_privacyValueAllowUsers); - split(); - return *(MTPDprivacyValueAllowUsers*)data; - } - const MTPDprivacyValueAllowUsers &c_privacyValueAllowUsers() const { - t_assert(data != nullptr && _type == mtpc_privacyValueAllowUsers); - return *(const MTPDprivacyValueAllowUsers*)data; - } - - MTPDprivacyValueDisallowUsers &_privacyValueDisallowUsers() { - t_assert(data != nullptr && _type == mtpc_privacyValueDisallowUsers); - split(); - return *(MTPDprivacyValueDisallowUsers*)data; - } - const MTPDprivacyValueDisallowUsers &c_privacyValueDisallowUsers() const { - t_assert(data != nullptr && _type == mtpc_privacyValueDisallowUsers); - return *(const MTPDprivacyValueDisallowUsers*)data; - } + const MTPDprivacyValueAllowUsers &c_privacyValueAllowUsers() const; + const MTPDprivacyValueDisallowUsers &c_privacyValueDisallowUsers() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6828,31 +4695,22 @@ public: private: explicit MTPprivacyRule(mtpTypeId type); - explicit MTPprivacyRule(MTPDprivacyValueAllowUsers *_data); - explicit MTPprivacyRule(MTPDprivacyValueDisallowUsers *_data); + explicit MTPprivacyRule(std::shared_ptr &&data); + explicit MTPprivacyRule(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPPrivacyRule; class MTPaccount_privacyRules : private mtpDataOwner { public: MTPaccount_privacyRules(); - MTPaccount_privacyRules(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_privacyRules) : mtpDataOwner(0) { + MTPaccount_privacyRules(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_privacyRules) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDaccount_privacyRules &_account_privacyRules() { - t_assert(data != nullptr); - split(); - return *(MTPDaccount_privacyRules*)data; - } - const MTPDaccount_privacyRules &c_account_privacyRules() const { - t_assert(data != nullptr); - return *(const MTPDaccount_privacyRules*)data; - } + const MTPDaccount_privacyRules &c_account_privacyRules() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6862,7 +4720,7 @@ public: typedef void ResponseType; private: - explicit MTPaccount_privacyRules(MTPDaccount_privacyRules *_data); + explicit MTPaccount_privacyRules(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -6871,19 +4729,10 @@ typedef MTPBoxed MTPaccount_PrivacyRules; class MTPaccountDaysTTL : private mtpDataOwner { public: MTPaccountDaysTTL(); - MTPaccountDaysTTL(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_accountDaysTTL) : mtpDataOwner(0) { + MTPaccountDaysTTL(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_accountDaysTTL) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDaccountDaysTTL &_accountDaysTTL() { - t_assert(data != nullptr); - split(); - return *(MTPDaccountDaysTTL*)data; - } - const MTPDaccountDaysTTL &c_accountDaysTTL() const { - t_assert(data != nullptr); - return *(const MTPDaccountDaysTTL*)data; - } + const MTPDaccountDaysTTL &c_accountDaysTTL() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6893,7 +4742,7 @@ public: typedef void ResponseType; private: - explicit MTPaccountDaysTTL(MTPDaccountDaysTTL *_data); + explicit MTPaccountDaysTTL(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -6901,61 +4750,16 @@ typedef MTPBoxed MTPAccountDaysTTL; class MTPdocumentAttribute : private mtpDataOwner { public: - MTPdocumentAttribute() : mtpDataOwner(0), _type(0) { + MTPdocumentAttribute() : mtpDataOwner(nullptr) { } - MTPdocumentAttribute(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPdocumentAttribute(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDdocumentAttributeImageSize &_documentAttributeImageSize() { - t_assert(data != nullptr && _type == mtpc_documentAttributeImageSize); - split(); - return *(MTPDdocumentAttributeImageSize*)data; - } - const MTPDdocumentAttributeImageSize &c_documentAttributeImageSize() const { - t_assert(data != nullptr && _type == mtpc_documentAttributeImageSize); - return *(const MTPDdocumentAttributeImageSize*)data; - } - - MTPDdocumentAttributeSticker &_documentAttributeSticker() { - t_assert(data != nullptr && _type == mtpc_documentAttributeSticker); - split(); - return *(MTPDdocumentAttributeSticker*)data; - } - const MTPDdocumentAttributeSticker &c_documentAttributeSticker() const { - t_assert(data != nullptr && _type == mtpc_documentAttributeSticker); - return *(const MTPDdocumentAttributeSticker*)data; - } - - MTPDdocumentAttributeVideo &_documentAttributeVideo() { - t_assert(data != nullptr && _type == mtpc_documentAttributeVideo); - split(); - return *(MTPDdocumentAttributeVideo*)data; - } - const MTPDdocumentAttributeVideo &c_documentAttributeVideo() const { - t_assert(data != nullptr && _type == mtpc_documentAttributeVideo); - return *(const MTPDdocumentAttributeVideo*)data; - } - - MTPDdocumentAttributeAudio &_documentAttributeAudio() { - t_assert(data != nullptr && _type == mtpc_documentAttributeAudio); - split(); - return *(MTPDdocumentAttributeAudio*)data; - } - const MTPDdocumentAttributeAudio &c_documentAttributeAudio() const { - t_assert(data != nullptr && _type == mtpc_documentAttributeAudio); - return *(const MTPDdocumentAttributeAudio*)data; - } - - MTPDdocumentAttributeFilename &_documentAttributeFilename() { - t_assert(data != nullptr && _type == mtpc_documentAttributeFilename); - split(); - return *(MTPDdocumentAttributeFilename*)data; - } - const MTPDdocumentAttributeFilename &c_documentAttributeFilename() const { - t_assert(data != nullptr && _type == mtpc_documentAttributeFilename); - return *(const MTPDdocumentAttributeFilename*)data; - } + const MTPDdocumentAttributeImageSize &c_documentAttributeImageSize() const; + const MTPDdocumentAttributeSticker &c_documentAttributeSticker() const; + const MTPDdocumentAttributeVideo &c_documentAttributeVideo() const; + const MTPDdocumentAttributeAudio &c_documentAttributeAudio() const; + const MTPDdocumentAttributeFilename &c_documentAttributeFilename() const; uint32 innerLength() const; mtpTypeId type() const; @@ -6966,35 +4770,26 @@ public: private: explicit MTPdocumentAttribute(mtpTypeId type); - explicit MTPdocumentAttribute(MTPDdocumentAttributeImageSize *_data); - explicit MTPdocumentAttribute(MTPDdocumentAttributeSticker *_data); - explicit MTPdocumentAttribute(MTPDdocumentAttributeVideo *_data); - explicit MTPdocumentAttribute(MTPDdocumentAttributeAudio *_data); - explicit MTPdocumentAttribute(MTPDdocumentAttributeFilename *_data); + explicit MTPdocumentAttribute(std::shared_ptr &&data); + explicit MTPdocumentAttribute(std::shared_ptr &&data); + explicit MTPdocumentAttribute(std::shared_ptr &&data); + explicit MTPdocumentAttribute(std::shared_ptr &&data); + explicit MTPdocumentAttribute(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPDocumentAttribute; class MTPmessages_stickers : private mtpDataOwner { public: - MTPmessages_stickers() : mtpDataOwner(0), _type(0) { + MTPmessages_stickers() : mtpDataOwner(nullptr) { } - MTPmessages_stickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessages_stickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_stickers &_messages_stickers() { - t_assert(data != nullptr && _type == mtpc_messages_stickers); - split(); - return *(MTPDmessages_stickers*)data; - } - const MTPDmessages_stickers &c_messages_stickers() const { - t_assert(data != nullptr && _type == mtpc_messages_stickers); - return *(const MTPDmessages_stickers*)data; - } + const MTPDmessages_stickers &c_messages_stickers() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7005,30 +4800,21 @@ public: private: explicit MTPmessages_stickers(mtpTypeId type); - explicit MTPmessages_stickers(MTPDmessages_stickers *_data); + explicit MTPmessages_stickers(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPmessages_Stickers; class MTPstickerPack : private mtpDataOwner { public: MTPstickerPack(); - MTPstickerPack(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_stickerPack) : mtpDataOwner(0) { + MTPstickerPack(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_stickerPack) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDstickerPack &_stickerPack() { - t_assert(data != nullptr); - split(); - return *(MTPDstickerPack*)data; - } - const MTPDstickerPack &c_stickerPack() const { - t_assert(data != nullptr); - return *(const MTPDstickerPack*)data; - } + const MTPDstickerPack &c_stickerPack() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7038,7 +4824,7 @@ public: typedef void ResponseType; private: - explicit MTPstickerPack(MTPDstickerPack *_data); + explicit MTPstickerPack(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7046,21 +4832,12 @@ typedef MTPBoxed MTPStickerPack; class MTPmessages_allStickers : private mtpDataOwner { public: - MTPmessages_allStickers() : mtpDataOwner(0), _type(0) { + MTPmessages_allStickers() : mtpDataOwner(nullptr) { } - MTPmessages_allStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessages_allStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_allStickers &_messages_allStickers() { - t_assert(data != nullptr && _type == mtpc_messages_allStickers); - split(); - return *(MTPDmessages_allStickers*)data; - } - const MTPDmessages_allStickers &c_messages_allStickers() const { - t_assert(data != nullptr && _type == mtpc_messages_allStickers); - return *(const MTPDmessages_allStickers*)data; - } + const MTPDmessages_allStickers &c_messages_allStickers() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7071,30 +4848,21 @@ public: private: explicit MTPmessages_allStickers(mtpTypeId type); - explicit MTPmessages_allStickers(MTPDmessages_allStickers *_data); + explicit MTPmessages_allStickers(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPmessages_AllStickers; class MTPdisabledFeature : private mtpDataOwner { public: MTPdisabledFeature(); - MTPdisabledFeature(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_disabledFeature) : mtpDataOwner(0) { + MTPdisabledFeature(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_disabledFeature) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDdisabledFeature &_disabledFeature() { - t_assert(data != nullptr); - split(); - return *(MTPDdisabledFeature*)data; - } - const MTPDdisabledFeature &c_disabledFeature() const { - t_assert(data != nullptr); - return *(const MTPDdisabledFeature*)data; - } + const MTPDdisabledFeature &c_disabledFeature() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7104,7 +4872,7 @@ public: typedef void ResponseType; private: - explicit MTPdisabledFeature(MTPDdisabledFeature *_data); + explicit MTPdisabledFeature(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7113,19 +4881,10 @@ typedef MTPBoxed MTPDisabledFeature; class MTPmessages_affectedMessages : private mtpDataOwner { public: MTPmessages_affectedMessages(); - MTPmessages_affectedMessages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_affectedMessages) : mtpDataOwner(0) { + MTPmessages_affectedMessages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_affectedMessages) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_affectedMessages &_messages_affectedMessages() { - t_assert(data != nullptr); - split(); - return *(MTPDmessages_affectedMessages*)data; - } - const MTPDmessages_affectedMessages &c_messages_affectedMessages() const { - t_assert(data != nullptr); - return *(const MTPDmessages_affectedMessages*)data; - } + const MTPDmessages_affectedMessages &c_messages_affectedMessages() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7135,7 +4894,7 @@ public: typedef void ResponseType; private: - explicit MTPmessages_affectedMessages(MTPDmessages_affectedMessages *_data); + explicit MTPmessages_affectedMessages(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7143,9 +4902,9 @@ typedef MTPBoxed MTPmessages_AffectedMessages; class MTPcontactLink { public: - MTPcontactLink() : _type(0) { + MTPcontactLink() { } - MTPcontactLink(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPcontactLink(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -7161,47 +4920,20 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPContactLink; class MTPwebPage : private mtpDataOwner { public: - MTPwebPage() : mtpDataOwner(0), _type(0) { + MTPwebPage() : mtpDataOwner(nullptr) { } - MTPwebPage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPwebPage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDwebPageEmpty &_webPageEmpty() { - t_assert(data != nullptr && _type == mtpc_webPageEmpty); - split(); - return *(MTPDwebPageEmpty*)data; - } - const MTPDwebPageEmpty &c_webPageEmpty() const { - t_assert(data != nullptr && _type == mtpc_webPageEmpty); - return *(const MTPDwebPageEmpty*)data; - } - - MTPDwebPagePending &_webPagePending() { - t_assert(data != nullptr && _type == mtpc_webPagePending); - split(); - return *(MTPDwebPagePending*)data; - } - const MTPDwebPagePending &c_webPagePending() const { - t_assert(data != nullptr && _type == mtpc_webPagePending); - return *(const MTPDwebPagePending*)data; - } - - MTPDwebPage &_webPage() { - t_assert(data != nullptr && _type == mtpc_webPage); - split(); - return *(MTPDwebPage*)data; - } - const MTPDwebPage &c_webPage() const { - t_assert(data != nullptr && _type == mtpc_webPage); - return *(const MTPDwebPage*)data; - } + const MTPDwebPageEmpty &c_webPageEmpty() const; + const MTPDwebPagePending &c_webPagePending() const; + const MTPDwebPage &c_webPage() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7212,32 +4944,23 @@ public: private: explicit MTPwebPage(mtpTypeId type); - explicit MTPwebPage(MTPDwebPageEmpty *_data); - explicit MTPwebPage(MTPDwebPagePending *_data); - explicit MTPwebPage(MTPDwebPage *_data); + explicit MTPwebPage(std::shared_ptr &&data); + explicit MTPwebPage(std::shared_ptr &&data); + explicit MTPwebPage(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPWebPage; class MTPauthorization : private mtpDataOwner { public: MTPauthorization(); - MTPauthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_authorization) : mtpDataOwner(0) { + MTPauthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_authorization) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDauthorization &_authorization() { - t_assert(data != nullptr); - split(); - return *(MTPDauthorization*)data; - } - const MTPDauthorization &c_authorization() const { - t_assert(data != nullptr); - return *(const MTPDauthorization*)data; - } + const MTPDauthorization &c_authorization() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7247,7 +4970,7 @@ public: typedef void ResponseType; private: - explicit MTPauthorization(MTPDauthorization *_data); + explicit MTPauthorization(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7256,19 +4979,10 @@ typedef MTPBoxed MTPAuthorization; class MTPaccount_authorizations : private mtpDataOwner { public: MTPaccount_authorizations(); - MTPaccount_authorizations(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_authorizations) : mtpDataOwner(0) { + MTPaccount_authorizations(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_authorizations) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDaccount_authorizations &_account_authorizations() { - t_assert(data != nullptr); - split(); - return *(MTPDaccount_authorizations*)data; - } - const MTPDaccount_authorizations &c_account_authorizations() const { - t_assert(data != nullptr); - return *(const MTPDaccount_authorizations*)data; - } + const MTPDaccount_authorizations &c_account_authorizations() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7278,7 +4992,7 @@ public: typedef void ResponseType; private: - explicit MTPaccount_authorizations(MTPDaccount_authorizations *_data); + explicit MTPaccount_authorizations(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7286,31 +5000,13 @@ typedef MTPBoxed MTPaccount_Authorizations; class MTPaccount_password : private mtpDataOwner { public: - MTPaccount_password() : mtpDataOwner(0), _type(0) { + MTPaccount_password() : mtpDataOwner(nullptr) { } - MTPaccount_password(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPaccount_password(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDaccount_noPassword &_account_noPassword() { - t_assert(data != nullptr && _type == mtpc_account_noPassword); - split(); - return *(MTPDaccount_noPassword*)data; - } - const MTPDaccount_noPassword &c_account_noPassword() const { - t_assert(data != nullptr && _type == mtpc_account_noPassword); - return *(const MTPDaccount_noPassword*)data; - } - - MTPDaccount_password &_account_password() { - t_assert(data != nullptr && _type == mtpc_account_password); - split(); - return *(MTPDaccount_password*)data; - } - const MTPDaccount_password &c_account_password() const { - t_assert(data != nullptr && _type == mtpc_account_password); - return *(const MTPDaccount_password*)data; - } + const MTPDaccount_noPassword &c_account_noPassword() const; + const MTPDaccount_password &c_account_password() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7321,31 +5017,22 @@ public: private: explicit MTPaccount_password(mtpTypeId type); - explicit MTPaccount_password(MTPDaccount_noPassword *_data); - explicit MTPaccount_password(MTPDaccount_password *_data); + explicit MTPaccount_password(std::shared_ptr &&data); + explicit MTPaccount_password(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPaccount_Password; class MTPaccount_passwordSettings : private mtpDataOwner { public: MTPaccount_passwordSettings(); - MTPaccount_passwordSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_passwordSettings) : mtpDataOwner(0) { + MTPaccount_passwordSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_passwordSettings) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDaccount_passwordSettings &_account_passwordSettings() { - t_assert(data != nullptr); - split(); - return *(MTPDaccount_passwordSettings*)data; - } - const MTPDaccount_passwordSettings &c_account_passwordSettings() const { - t_assert(data != nullptr); - return *(const MTPDaccount_passwordSettings*)data; - } + const MTPDaccount_passwordSettings &c_account_passwordSettings() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7355,7 +5042,7 @@ public: typedef void ResponseType; private: - explicit MTPaccount_passwordSettings(MTPDaccount_passwordSettings *_data); + explicit MTPaccount_passwordSettings(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7364,19 +5051,10 @@ typedef MTPBoxed MTPaccount_PasswordSettings; class MTPaccount_passwordInputSettings : private mtpDataOwner { public: MTPaccount_passwordInputSettings(); - MTPaccount_passwordInputSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_passwordInputSettings) : mtpDataOwner(0) { + MTPaccount_passwordInputSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_passwordInputSettings) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDaccount_passwordInputSettings &_account_passwordInputSettings() { - t_assert(data != nullptr); - split(); - return *(MTPDaccount_passwordInputSettings*)data; - } - const MTPDaccount_passwordInputSettings &c_account_passwordInputSettings() const { - t_assert(data != nullptr); - return *(const MTPDaccount_passwordInputSettings*)data; - } + const MTPDaccount_passwordInputSettings &c_account_passwordInputSettings() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7386,7 +5064,7 @@ public: typedef void ResponseType; private: - explicit MTPaccount_passwordInputSettings(MTPDaccount_passwordInputSettings *_data); + explicit MTPaccount_passwordInputSettings(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7395,19 +5073,10 @@ typedef MTPBoxed MTPaccount_PasswordInputSetti class MTPauth_passwordRecovery : private mtpDataOwner { public: MTPauth_passwordRecovery(); - MTPauth_passwordRecovery(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_passwordRecovery) : mtpDataOwner(0) { + MTPauth_passwordRecovery(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_passwordRecovery) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDauth_passwordRecovery &_auth_passwordRecovery() { - t_assert(data != nullptr); - split(); - return *(MTPDauth_passwordRecovery*)data; - } - const MTPDauth_passwordRecovery &c_auth_passwordRecovery() const { - t_assert(data != nullptr); - return *(const MTPDauth_passwordRecovery*)data; - } + const MTPDauth_passwordRecovery &c_auth_passwordRecovery() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7417,7 +5086,7 @@ public: typedef void ResponseType; private: - explicit MTPauth_passwordRecovery(MTPDauth_passwordRecovery *_data); + explicit MTPauth_passwordRecovery(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7426,19 +5095,10 @@ typedef MTPBoxed MTPauth_PasswordRecovery; class MTPreceivedNotifyMessage : private mtpDataOwner { public: MTPreceivedNotifyMessage(); - MTPreceivedNotifyMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_receivedNotifyMessage) : mtpDataOwner(0) { + MTPreceivedNotifyMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_receivedNotifyMessage) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDreceivedNotifyMessage &_receivedNotifyMessage() { - t_assert(data != nullptr); - split(); - return *(MTPDreceivedNotifyMessage*)data; - } - const MTPDreceivedNotifyMessage &c_receivedNotifyMessage() const { - t_assert(data != nullptr); - return *(const MTPDreceivedNotifyMessage*)data; - } + const MTPDreceivedNotifyMessage &c_receivedNotifyMessage() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7448,7 +5108,7 @@ public: typedef void ResponseType; private: - explicit MTPreceivedNotifyMessage(MTPDreceivedNotifyMessage *_data); + explicit MTPreceivedNotifyMessage(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7456,21 +5116,12 @@ typedef MTPBoxed MTPReceivedNotifyMessage; class MTPexportedChatInvite : private mtpDataOwner { public: - MTPexportedChatInvite() : mtpDataOwner(0), _type(0) { + MTPexportedChatInvite() : mtpDataOwner(nullptr) { } - MTPexportedChatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPexportedChatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDchatInviteExported &_chatInviteExported() { - t_assert(data != nullptr && _type == mtpc_chatInviteExported); - split(); - return *(MTPDchatInviteExported*)data; - } - const MTPDchatInviteExported &c_chatInviteExported() const { - t_assert(data != nullptr && _type == mtpc_chatInviteExported); - return *(const MTPDchatInviteExported*)data; - } + const MTPDchatInviteExported &c_chatInviteExported() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7481,41 +5132,23 @@ public: private: explicit MTPexportedChatInvite(mtpTypeId type); - explicit MTPexportedChatInvite(MTPDchatInviteExported *_data); + explicit MTPexportedChatInvite(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPExportedChatInvite; class MTPchatInvite : private mtpDataOwner { public: - MTPchatInvite() : mtpDataOwner(0), _type(0) { + MTPchatInvite() : mtpDataOwner(nullptr) { } - MTPchatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPchatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDchatInviteAlready &_chatInviteAlready() { - t_assert(data != nullptr && _type == mtpc_chatInviteAlready); - split(); - return *(MTPDchatInviteAlready*)data; - } - const MTPDchatInviteAlready &c_chatInviteAlready() const { - t_assert(data != nullptr && _type == mtpc_chatInviteAlready); - return *(const MTPDchatInviteAlready*)data; - } - - MTPDchatInvite &_chatInvite() { - t_assert(data != nullptr && _type == mtpc_chatInvite); - split(); - return *(MTPDchatInvite*)data; - } - const MTPDchatInvite &c_chatInvite() const { - t_assert(data != nullptr && _type == mtpc_chatInvite); - return *(const MTPDchatInvite*)data; - } + const MTPDchatInviteAlready &c_chatInviteAlready() const; + const MTPDchatInvite &c_chatInvite() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7526,42 +5159,24 @@ public: private: explicit MTPchatInvite(mtpTypeId type); - explicit MTPchatInvite(MTPDchatInviteAlready *_data); - explicit MTPchatInvite(MTPDchatInvite *_data); + explicit MTPchatInvite(std::shared_ptr &&data); + explicit MTPchatInvite(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPChatInvite; class MTPinputStickerSet : private mtpDataOwner { public: - MTPinputStickerSet() : mtpDataOwner(0), _type(0) { + MTPinputStickerSet() : mtpDataOwner(nullptr) { } - MTPinputStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputStickerSetID &_inputStickerSetID() { - t_assert(data != nullptr && _type == mtpc_inputStickerSetID); - split(); - return *(MTPDinputStickerSetID*)data; - } - const MTPDinputStickerSetID &c_inputStickerSetID() const { - t_assert(data != nullptr && _type == mtpc_inputStickerSetID); - return *(const MTPDinputStickerSetID*)data; - } - - MTPDinputStickerSetShortName &_inputStickerSetShortName() { - t_assert(data != nullptr && _type == mtpc_inputStickerSetShortName); - split(); - return *(MTPDinputStickerSetShortName*)data; - } - const MTPDinputStickerSetShortName &c_inputStickerSetShortName() const { - t_assert(data != nullptr && _type == mtpc_inputStickerSetShortName); - return *(const MTPDinputStickerSetShortName*)data; - } + const MTPDinputStickerSetID &c_inputStickerSetID() const; + const MTPDinputStickerSetShortName &c_inputStickerSetShortName() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7572,31 +5187,22 @@ public: private: explicit MTPinputStickerSet(mtpTypeId type); - explicit MTPinputStickerSet(MTPDinputStickerSetID *_data); - explicit MTPinputStickerSet(MTPDinputStickerSetShortName *_data); + explicit MTPinputStickerSet(std::shared_ptr &&data); + explicit MTPinputStickerSet(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputStickerSet; class MTPstickerSet : private mtpDataOwner { public: MTPstickerSet(); - MTPstickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_stickerSet) : mtpDataOwner(0) { + MTPstickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_stickerSet) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDstickerSet &_stickerSet() { - t_assert(data != nullptr); - split(); - return *(MTPDstickerSet*)data; - } - const MTPDstickerSet &c_stickerSet() const { - t_assert(data != nullptr); - return *(const MTPDstickerSet*)data; - } + const MTPDstickerSet &c_stickerSet() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7606,7 +5212,7 @@ public: typedef void ResponseType; private: - explicit MTPstickerSet(MTPDstickerSet *_data); + explicit MTPstickerSet(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7615,19 +5221,10 @@ typedef MTPBoxed MTPStickerSet; class MTPmessages_stickerSet : private mtpDataOwner { public: MTPmessages_stickerSet(); - MTPmessages_stickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_stickerSet) : mtpDataOwner(0) { + MTPmessages_stickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_stickerSet) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_stickerSet &_messages_stickerSet() { - t_assert(data != nullptr); - split(); - return *(MTPDmessages_stickerSet*)data; - } - const MTPDmessages_stickerSet &c_messages_stickerSet() const { - t_assert(data != nullptr); - return *(const MTPDmessages_stickerSet*)data; - } + const MTPDmessages_stickerSet &c_messages_stickerSet() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7637,7 +5234,7 @@ public: typedef void ResponseType; private: - explicit MTPmessages_stickerSet(MTPDmessages_stickerSet *_data); + explicit MTPmessages_stickerSet(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7646,19 +5243,10 @@ typedef MTPBoxed MTPmessages_StickerSet; class MTPbotCommand : private mtpDataOwner { public: MTPbotCommand(); - MTPbotCommand(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_botCommand) : mtpDataOwner(0) { + MTPbotCommand(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_botCommand) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDbotCommand &_botCommand() { - t_assert(data != nullptr); - split(); - return *(MTPDbotCommand*)data; - } - const MTPDbotCommand &c_botCommand() const { - t_assert(data != nullptr); - return *(const MTPDbotCommand*)data; - } + const MTPDbotCommand &c_botCommand() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7668,7 +5256,7 @@ public: typedef void ResponseType; private: - explicit MTPbotCommand(MTPDbotCommand *_data); + explicit MTPbotCommand(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7677,19 +5265,10 @@ typedef MTPBoxed MTPBotCommand; class MTPbotInfo : private mtpDataOwner { public: MTPbotInfo(); - MTPbotInfo(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_botInfo) : mtpDataOwner(0) { + MTPbotInfo(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_botInfo) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDbotInfo &_botInfo() { - t_assert(data != nullptr); - split(); - return *(MTPDbotInfo*)data; - } - const MTPDbotInfo &c_botInfo() const { - t_assert(data != nullptr); - return *(const MTPDbotInfo*)data; - } + const MTPDbotInfo &c_botInfo() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7699,7 +5278,7 @@ public: typedef void ResponseType; private: - explicit MTPbotInfo(MTPDbotInfo *_data); + explicit MTPbotInfo(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7707,81 +5286,18 @@ typedef MTPBoxed MTPBotInfo; class MTPkeyboardButton : private mtpDataOwner { public: - MTPkeyboardButton() : mtpDataOwner(0), _type(0) { + MTPkeyboardButton() : mtpDataOwner(nullptr) { } - MTPkeyboardButton(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPkeyboardButton(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDkeyboardButton &_keyboardButton() { - t_assert(data != nullptr && _type == mtpc_keyboardButton); - split(); - return *(MTPDkeyboardButton*)data; - } - const MTPDkeyboardButton &c_keyboardButton() const { - t_assert(data != nullptr && _type == mtpc_keyboardButton); - return *(const MTPDkeyboardButton*)data; - } - - MTPDkeyboardButtonUrl &_keyboardButtonUrl() { - t_assert(data != nullptr && _type == mtpc_keyboardButtonUrl); - split(); - return *(MTPDkeyboardButtonUrl*)data; - } - const MTPDkeyboardButtonUrl &c_keyboardButtonUrl() const { - t_assert(data != nullptr && _type == mtpc_keyboardButtonUrl); - return *(const MTPDkeyboardButtonUrl*)data; - } - - MTPDkeyboardButtonCallback &_keyboardButtonCallback() { - t_assert(data != nullptr && _type == mtpc_keyboardButtonCallback); - split(); - return *(MTPDkeyboardButtonCallback*)data; - } - const MTPDkeyboardButtonCallback &c_keyboardButtonCallback() const { - t_assert(data != nullptr && _type == mtpc_keyboardButtonCallback); - return *(const MTPDkeyboardButtonCallback*)data; - } - - MTPDkeyboardButtonRequestPhone &_keyboardButtonRequestPhone() { - t_assert(data != nullptr && _type == mtpc_keyboardButtonRequestPhone); - split(); - return *(MTPDkeyboardButtonRequestPhone*)data; - } - const MTPDkeyboardButtonRequestPhone &c_keyboardButtonRequestPhone() const { - t_assert(data != nullptr && _type == mtpc_keyboardButtonRequestPhone); - return *(const MTPDkeyboardButtonRequestPhone*)data; - } - - MTPDkeyboardButtonRequestGeoLocation &_keyboardButtonRequestGeoLocation() { - t_assert(data != nullptr && _type == mtpc_keyboardButtonRequestGeoLocation); - split(); - return *(MTPDkeyboardButtonRequestGeoLocation*)data; - } - const MTPDkeyboardButtonRequestGeoLocation &c_keyboardButtonRequestGeoLocation() const { - t_assert(data != nullptr && _type == mtpc_keyboardButtonRequestGeoLocation); - return *(const MTPDkeyboardButtonRequestGeoLocation*)data; - } - - MTPDkeyboardButtonSwitchInline &_keyboardButtonSwitchInline() { - t_assert(data != nullptr && _type == mtpc_keyboardButtonSwitchInline); - split(); - return *(MTPDkeyboardButtonSwitchInline*)data; - } - const MTPDkeyboardButtonSwitchInline &c_keyboardButtonSwitchInline() const { - t_assert(data != nullptr && _type == mtpc_keyboardButtonSwitchInline); - return *(const MTPDkeyboardButtonSwitchInline*)data; - } - - MTPDkeyboardButtonGame &_keyboardButtonGame() { - t_assert(data != nullptr && _type == mtpc_keyboardButtonGame); - split(); - return *(MTPDkeyboardButtonGame*)data; - } - const MTPDkeyboardButtonGame &c_keyboardButtonGame() const { - t_assert(data != nullptr && _type == mtpc_keyboardButtonGame); - return *(const MTPDkeyboardButtonGame*)data; - } + const MTPDkeyboardButton &c_keyboardButton() const; + const MTPDkeyboardButtonUrl &c_keyboardButtonUrl() const; + const MTPDkeyboardButtonCallback &c_keyboardButtonCallback() const; + const MTPDkeyboardButtonRequestPhone &c_keyboardButtonRequestPhone() const; + const MTPDkeyboardButtonRequestGeoLocation &c_keyboardButtonRequestGeoLocation() const; + const MTPDkeyboardButtonSwitchInline &c_keyboardButtonSwitchInline() const; + const MTPDkeyboardButtonGame &c_keyboardButtonGame() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7792,36 +5308,27 @@ public: private: explicit MTPkeyboardButton(mtpTypeId type); - explicit MTPkeyboardButton(MTPDkeyboardButton *_data); - explicit MTPkeyboardButton(MTPDkeyboardButtonUrl *_data); - explicit MTPkeyboardButton(MTPDkeyboardButtonCallback *_data); - explicit MTPkeyboardButton(MTPDkeyboardButtonRequestPhone *_data); - explicit MTPkeyboardButton(MTPDkeyboardButtonRequestGeoLocation *_data); - explicit MTPkeyboardButton(MTPDkeyboardButtonSwitchInline *_data); - explicit MTPkeyboardButton(MTPDkeyboardButtonGame *_data); + explicit MTPkeyboardButton(std::shared_ptr &&data); + explicit MTPkeyboardButton(std::shared_ptr &&data); + explicit MTPkeyboardButton(std::shared_ptr &&data); + explicit MTPkeyboardButton(std::shared_ptr &&data); + explicit MTPkeyboardButton(std::shared_ptr &&data); + explicit MTPkeyboardButton(std::shared_ptr &&data); + explicit MTPkeyboardButton(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPKeyboardButton; class MTPkeyboardButtonRow : private mtpDataOwner { public: MTPkeyboardButtonRow(); - MTPkeyboardButtonRow(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_keyboardButtonRow) : mtpDataOwner(0) { + MTPkeyboardButtonRow(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_keyboardButtonRow) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDkeyboardButtonRow &_keyboardButtonRow() { - t_assert(data != nullptr); - split(); - return *(MTPDkeyboardButtonRow*)data; - } - const MTPDkeyboardButtonRow &c_keyboardButtonRow() const { - t_assert(data != nullptr); - return *(const MTPDkeyboardButtonRow*)data; - } + const MTPDkeyboardButtonRow &c_keyboardButtonRow() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7831,7 +5338,7 @@ public: typedef void ResponseType; private: - explicit MTPkeyboardButtonRow(MTPDkeyboardButtonRow *_data); + explicit MTPkeyboardButtonRow(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -7839,51 +5346,15 @@ typedef MTPBoxed MTPKeyboardButtonRow; class MTPreplyMarkup : private mtpDataOwner { public: - MTPreplyMarkup() : mtpDataOwner(0), _type(0) { + MTPreplyMarkup() : mtpDataOwner(nullptr) { } - MTPreplyMarkup(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPreplyMarkup(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDreplyKeyboardHide &_replyKeyboardHide() { - t_assert(data != nullptr && _type == mtpc_replyKeyboardHide); - split(); - return *(MTPDreplyKeyboardHide*)data; - } - const MTPDreplyKeyboardHide &c_replyKeyboardHide() const { - t_assert(data != nullptr && _type == mtpc_replyKeyboardHide); - return *(const MTPDreplyKeyboardHide*)data; - } - - MTPDreplyKeyboardForceReply &_replyKeyboardForceReply() { - t_assert(data != nullptr && _type == mtpc_replyKeyboardForceReply); - split(); - return *(MTPDreplyKeyboardForceReply*)data; - } - const MTPDreplyKeyboardForceReply &c_replyKeyboardForceReply() const { - t_assert(data != nullptr && _type == mtpc_replyKeyboardForceReply); - return *(const MTPDreplyKeyboardForceReply*)data; - } - - MTPDreplyKeyboardMarkup &_replyKeyboardMarkup() { - t_assert(data != nullptr && _type == mtpc_replyKeyboardMarkup); - split(); - return *(MTPDreplyKeyboardMarkup*)data; - } - const MTPDreplyKeyboardMarkup &c_replyKeyboardMarkup() const { - t_assert(data != nullptr && _type == mtpc_replyKeyboardMarkup); - return *(const MTPDreplyKeyboardMarkup*)data; - } - - MTPDreplyInlineMarkup &_replyInlineMarkup() { - t_assert(data != nullptr && _type == mtpc_replyInlineMarkup); - split(); - return *(MTPDreplyInlineMarkup*)data; - } - const MTPDreplyInlineMarkup &c_replyInlineMarkup() const { - t_assert(data != nullptr && _type == mtpc_replyInlineMarkup); - return *(const MTPDreplyInlineMarkup*)data; - } + const MTPDreplyKeyboardHide &c_replyKeyboardHide() const; + const MTPDreplyKeyboardForceReply &c_replyKeyboardForceReply() const; + const MTPDreplyKeyboardMarkup &c_replyKeyboardMarkup() const; + const MTPDreplyInlineMarkup &c_replyInlineMarkup() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7894,34 +5365,25 @@ public: private: explicit MTPreplyMarkup(mtpTypeId type); - explicit MTPreplyMarkup(MTPDreplyKeyboardHide *_data); - explicit MTPreplyMarkup(MTPDreplyKeyboardForceReply *_data); - explicit MTPreplyMarkup(MTPDreplyKeyboardMarkup *_data); - explicit MTPreplyMarkup(MTPDreplyInlineMarkup *_data); + explicit MTPreplyMarkup(std::shared_ptr &&data); + explicit MTPreplyMarkup(std::shared_ptr &&data); + explicit MTPreplyMarkup(std::shared_ptr &&data); + explicit MTPreplyMarkup(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPReplyMarkup; class MTPhelp_appChangelog : private mtpDataOwner { public: - MTPhelp_appChangelog() : mtpDataOwner(0), _type(0) { + MTPhelp_appChangelog() : mtpDataOwner(nullptr) { } - MTPhelp_appChangelog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPhelp_appChangelog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDhelp_appChangelog &_help_appChangelog() { - t_assert(data != nullptr && _type == mtpc_help_appChangelog); - split(); - return *(MTPDhelp_appChangelog*)data; - } - const MTPDhelp_appChangelog &c_help_appChangelog() const { - t_assert(data != nullptr && _type == mtpc_help_appChangelog); - return *(const MTPDhelp_appChangelog*)data; - } + const MTPDhelp_appChangelog &c_help_appChangelog() const; uint32 innerLength() const; mtpTypeId type() const; @@ -7932,151 +5394,34 @@ public: private: explicit MTPhelp_appChangelog(mtpTypeId type); - explicit MTPhelp_appChangelog(MTPDhelp_appChangelog *_data); + explicit MTPhelp_appChangelog(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPhelp_AppChangelog; class MTPmessageEntity : private mtpDataOwner { public: - MTPmessageEntity() : mtpDataOwner(0), _type(0) { + MTPmessageEntity() : mtpDataOwner(nullptr) { } - MTPmessageEntity(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessageEntity(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessageEntityUnknown &_messageEntityUnknown() { - t_assert(data != nullptr && _type == mtpc_messageEntityUnknown); - split(); - return *(MTPDmessageEntityUnknown*)data; - } - const MTPDmessageEntityUnknown &c_messageEntityUnknown() const { - t_assert(data != nullptr && _type == mtpc_messageEntityUnknown); - return *(const MTPDmessageEntityUnknown*)data; - } - - MTPDmessageEntityMention &_messageEntityMention() { - t_assert(data != nullptr && _type == mtpc_messageEntityMention); - split(); - return *(MTPDmessageEntityMention*)data; - } - const MTPDmessageEntityMention &c_messageEntityMention() const { - t_assert(data != nullptr && _type == mtpc_messageEntityMention); - return *(const MTPDmessageEntityMention*)data; - } - - MTPDmessageEntityHashtag &_messageEntityHashtag() { - t_assert(data != nullptr && _type == mtpc_messageEntityHashtag); - split(); - return *(MTPDmessageEntityHashtag*)data; - } - const MTPDmessageEntityHashtag &c_messageEntityHashtag() const { - t_assert(data != nullptr && _type == mtpc_messageEntityHashtag); - return *(const MTPDmessageEntityHashtag*)data; - } - - MTPDmessageEntityBotCommand &_messageEntityBotCommand() { - t_assert(data != nullptr && _type == mtpc_messageEntityBotCommand); - split(); - return *(MTPDmessageEntityBotCommand*)data; - } - const MTPDmessageEntityBotCommand &c_messageEntityBotCommand() const { - t_assert(data != nullptr && _type == mtpc_messageEntityBotCommand); - return *(const MTPDmessageEntityBotCommand*)data; - } - - MTPDmessageEntityUrl &_messageEntityUrl() { - t_assert(data != nullptr && _type == mtpc_messageEntityUrl); - split(); - return *(MTPDmessageEntityUrl*)data; - } - const MTPDmessageEntityUrl &c_messageEntityUrl() const { - t_assert(data != nullptr && _type == mtpc_messageEntityUrl); - return *(const MTPDmessageEntityUrl*)data; - } - - MTPDmessageEntityEmail &_messageEntityEmail() { - t_assert(data != nullptr && _type == mtpc_messageEntityEmail); - split(); - return *(MTPDmessageEntityEmail*)data; - } - const MTPDmessageEntityEmail &c_messageEntityEmail() const { - t_assert(data != nullptr && _type == mtpc_messageEntityEmail); - return *(const MTPDmessageEntityEmail*)data; - } - - MTPDmessageEntityBold &_messageEntityBold() { - t_assert(data != nullptr && _type == mtpc_messageEntityBold); - split(); - return *(MTPDmessageEntityBold*)data; - } - const MTPDmessageEntityBold &c_messageEntityBold() const { - t_assert(data != nullptr && _type == mtpc_messageEntityBold); - return *(const MTPDmessageEntityBold*)data; - } - - MTPDmessageEntityItalic &_messageEntityItalic() { - t_assert(data != nullptr && _type == mtpc_messageEntityItalic); - split(); - return *(MTPDmessageEntityItalic*)data; - } - const MTPDmessageEntityItalic &c_messageEntityItalic() const { - t_assert(data != nullptr && _type == mtpc_messageEntityItalic); - return *(const MTPDmessageEntityItalic*)data; - } - - MTPDmessageEntityCode &_messageEntityCode() { - t_assert(data != nullptr && _type == mtpc_messageEntityCode); - split(); - return *(MTPDmessageEntityCode*)data; - } - const MTPDmessageEntityCode &c_messageEntityCode() const { - t_assert(data != nullptr && _type == mtpc_messageEntityCode); - return *(const MTPDmessageEntityCode*)data; - } - - MTPDmessageEntityPre &_messageEntityPre() { - t_assert(data != nullptr && _type == mtpc_messageEntityPre); - split(); - return *(MTPDmessageEntityPre*)data; - } - const MTPDmessageEntityPre &c_messageEntityPre() const { - t_assert(data != nullptr && _type == mtpc_messageEntityPre); - return *(const MTPDmessageEntityPre*)data; - } - - MTPDmessageEntityTextUrl &_messageEntityTextUrl() { - t_assert(data != nullptr && _type == mtpc_messageEntityTextUrl); - split(); - return *(MTPDmessageEntityTextUrl*)data; - } - const MTPDmessageEntityTextUrl &c_messageEntityTextUrl() const { - t_assert(data != nullptr && _type == mtpc_messageEntityTextUrl); - return *(const MTPDmessageEntityTextUrl*)data; - } - - MTPDmessageEntityMentionName &_messageEntityMentionName() { - t_assert(data != nullptr && _type == mtpc_messageEntityMentionName); - split(); - return *(MTPDmessageEntityMentionName*)data; - } - const MTPDmessageEntityMentionName &c_messageEntityMentionName() const { - t_assert(data != nullptr && _type == mtpc_messageEntityMentionName); - return *(const MTPDmessageEntityMentionName*)data; - } - - MTPDinputMessageEntityMentionName &_inputMessageEntityMentionName() { - t_assert(data != nullptr && _type == mtpc_inputMessageEntityMentionName); - split(); - return *(MTPDinputMessageEntityMentionName*)data; - } - const MTPDinputMessageEntityMentionName &c_inputMessageEntityMentionName() const { - t_assert(data != nullptr && _type == mtpc_inputMessageEntityMentionName); - return *(const MTPDinputMessageEntityMentionName*)data; - } + const MTPDmessageEntityUnknown &c_messageEntityUnknown() const; + const MTPDmessageEntityMention &c_messageEntityMention() const; + const MTPDmessageEntityHashtag &c_messageEntityHashtag() const; + const MTPDmessageEntityBotCommand &c_messageEntityBotCommand() const; + const MTPDmessageEntityUrl &c_messageEntityUrl() const; + const MTPDmessageEntityEmail &c_messageEntityEmail() const; + const MTPDmessageEntityBold &c_messageEntityBold() const; + const MTPDmessageEntityItalic &c_messageEntityItalic() const; + const MTPDmessageEntityCode &c_messageEntityCode() const; + const MTPDmessageEntityPre &c_messageEntityPre() const; + const MTPDmessageEntityTextUrl &c_messageEntityTextUrl() const; + const MTPDmessageEntityMentionName &c_messageEntityMentionName() const; + const MTPDinputMessageEntityMentionName &c_inputMessageEntityMentionName() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8087,43 +5432,34 @@ public: private: explicit MTPmessageEntity(mtpTypeId type); - explicit MTPmessageEntity(MTPDmessageEntityUnknown *_data); - explicit MTPmessageEntity(MTPDmessageEntityMention *_data); - explicit MTPmessageEntity(MTPDmessageEntityHashtag *_data); - explicit MTPmessageEntity(MTPDmessageEntityBotCommand *_data); - explicit MTPmessageEntity(MTPDmessageEntityUrl *_data); - explicit MTPmessageEntity(MTPDmessageEntityEmail *_data); - explicit MTPmessageEntity(MTPDmessageEntityBold *_data); - explicit MTPmessageEntity(MTPDmessageEntityItalic *_data); - explicit MTPmessageEntity(MTPDmessageEntityCode *_data); - explicit MTPmessageEntity(MTPDmessageEntityPre *_data); - explicit MTPmessageEntity(MTPDmessageEntityTextUrl *_data); - explicit MTPmessageEntity(MTPDmessageEntityMentionName *_data); - explicit MTPmessageEntity(MTPDinputMessageEntityMentionName *_data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); + explicit MTPmessageEntity(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPMessageEntity; class MTPinputChannel : private mtpDataOwner { public: - MTPinputChannel() : mtpDataOwner(0), _type(0) { + MTPinputChannel() : mtpDataOwner(nullptr) { } - MTPinputChannel(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputChannel(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputChannel &_inputChannel() { - t_assert(data != nullptr && _type == mtpc_inputChannel); - split(); - return *(MTPDinputChannel*)data; - } - const MTPDinputChannel &c_inputChannel() const { - t_assert(data != nullptr && _type == mtpc_inputChannel); - return *(const MTPDinputChannel*)data; - } + const MTPDinputChannel &c_inputChannel() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8134,30 +5470,21 @@ public: private: explicit MTPinputChannel(mtpTypeId type); - explicit MTPinputChannel(MTPDinputChannel *_data); + explicit MTPinputChannel(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputChannel; class MTPcontacts_resolvedPeer : private mtpDataOwner { public: MTPcontacts_resolvedPeer(); - MTPcontacts_resolvedPeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_resolvedPeer) : mtpDataOwner(0) { + MTPcontacts_resolvedPeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_resolvedPeer) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDcontacts_resolvedPeer &_contacts_resolvedPeer() { - t_assert(data != nullptr); - split(); - return *(MTPDcontacts_resolvedPeer*)data; - } - const MTPDcontacts_resolvedPeer &c_contacts_resolvedPeer() const { - t_assert(data != nullptr); - return *(const MTPDcontacts_resolvedPeer*)data; - } + const MTPDcontacts_resolvedPeer &c_contacts_resolvedPeer() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8167,7 +5494,7 @@ public: typedef void ResponseType; private: - explicit MTPcontacts_resolvedPeer(MTPDcontacts_resolvedPeer *_data); + explicit MTPcontacts_resolvedPeer(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -8176,19 +5503,10 @@ typedef MTPBoxed MTPcontacts_ResolvedPeer; class MTPmessageRange : private mtpDataOwner { public: MTPmessageRange(); - MTPmessageRange(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messageRange) : mtpDataOwner(0) { + MTPmessageRange(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messageRange) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessageRange &_messageRange() { - t_assert(data != nullptr); - split(); - return *(MTPDmessageRange*)data; - } - const MTPDmessageRange &c_messageRange() const { - t_assert(data != nullptr); - return *(const MTPDmessageRange*)data; - } + const MTPDmessageRange &c_messageRange() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8198,7 +5516,7 @@ public: typedef void ResponseType; private: - explicit MTPmessageRange(MTPDmessageRange *_data); + explicit MTPmessageRange(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -8206,41 +5524,14 @@ typedef MTPBoxed MTPMessageRange; class MTPupdates_channelDifference : private mtpDataOwner { public: - MTPupdates_channelDifference() : mtpDataOwner(0), _type(0) { + MTPupdates_channelDifference() : mtpDataOwner(nullptr) { } - MTPupdates_channelDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPupdates_channelDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDupdates_channelDifferenceEmpty &_updates_channelDifferenceEmpty() { - t_assert(data != nullptr && _type == mtpc_updates_channelDifferenceEmpty); - split(); - return *(MTPDupdates_channelDifferenceEmpty*)data; - } - const MTPDupdates_channelDifferenceEmpty &c_updates_channelDifferenceEmpty() const { - t_assert(data != nullptr && _type == mtpc_updates_channelDifferenceEmpty); - return *(const MTPDupdates_channelDifferenceEmpty*)data; - } - - MTPDupdates_channelDifferenceTooLong &_updates_channelDifferenceTooLong() { - t_assert(data != nullptr && _type == mtpc_updates_channelDifferenceTooLong); - split(); - return *(MTPDupdates_channelDifferenceTooLong*)data; - } - const MTPDupdates_channelDifferenceTooLong &c_updates_channelDifferenceTooLong() const { - t_assert(data != nullptr && _type == mtpc_updates_channelDifferenceTooLong); - return *(const MTPDupdates_channelDifferenceTooLong*)data; - } - - MTPDupdates_channelDifference &_updates_channelDifference() { - t_assert(data != nullptr && _type == mtpc_updates_channelDifference); - split(); - return *(MTPDupdates_channelDifference*)data; - } - const MTPDupdates_channelDifference &c_updates_channelDifference() const { - t_assert(data != nullptr && _type == mtpc_updates_channelDifference); - return *(const MTPDupdates_channelDifference*)data; - } + const MTPDupdates_channelDifferenceEmpty &c_updates_channelDifferenceEmpty() const; + const MTPDupdates_channelDifferenceTooLong &c_updates_channelDifferenceTooLong() const; + const MTPDupdates_channelDifference &c_updates_channelDifference() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8251,33 +5542,24 @@ public: private: explicit MTPupdates_channelDifference(mtpTypeId type); - explicit MTPupdates_channelDifference(MTPDupdates_channelDifferenceEmpty *_data); - explicit MTPupdates_channelDifference(MTPDupdates_channelDifferenceTooLong *_data); - explicit MTPupdates_channelDifference(MTPDupdates_channelDifference *_data); + explicit MTPupdates_channelDifference(std::shared_ptr &&data); + explicit MTPupdates_channelDifference(std::shared_ptr &&data); + explicit MTPupdates_channelDifference(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPupdates_ChannelDifference; class MTPchannelMessagesFilter : private mtpDataOwner { public: - MTPchannelMessagesFilter() : mtpDataOwner(0), _type(0) { + MTPchannelMessagesFilter() : mtpDataOwner(nullptr) { } - MTPchannelMessagesFilter(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPchannelMessagesFilter(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDchannelMessagesFilter &_channelMessagesFilter() { - t_assert(data != nullptr && _type == mtpc_channelMessagesFilter); - split(); - return *(MTPDchannelMessagesFilter*)data; - } - const MTPDchannelMessagesFilter &c_channelMessagesFilter() const { - t_assert(data != nullptr && _type == mtpc_channelMessagesFilter); - return *(const MTPDchannelMessagesFilter*)data; - } + const MTPDchannelMessagesFilter &c_channelMessagesFilter() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8288,81 +5570,27 @@ public: private: explicit MTPchannelMessagesFilter(mtpTypeId type); - explicit MTPchannelMessagesFilter(MTPDchannelMessagesFilter *_data); + explicit MTPchannelMessagesFilter(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPChannelMessagesFilter; class MTPchannelParticipant : private mtpDataOwner { public: - MTPchannelParticipant() : mtpDataOwner(0), _type(0) { + MTPchannelParticipant() : mtpDataOwner(nullptr) { } - MTPchannelParticipant(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPchannelParticipant(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDchannelParticipant &_channelParticipant() { - t_assert(data != nullptr && _type == mtpc_channelParticipant); - split(); - return *(MTPDchannelParticipant*)data; - } - const MTPDchannelParticipant &c_channelParticipant() const { - t_assert(data != nullptr && _type == mtpc_channelParticipant); - return *(const MTPDchannelParticipant*)data; - } - - MTPDchannelParticipantSelf &_channelParticipantSelf() { - t_assert(data != nullptr && _type == mtpc_channelParticipantSelf); - split(); - return *(MTPDchannelParticipantSelf*)data; - } - const MTPDchannelParticipantSelf &c_channelParticipantSelf() const { - t_assert(data != nullptr && _type == mtpc_channelParticipantSelf); - return *(const MTPDchannelParticipantSelf*)data; - } - - MTPDchannelParticipantModerator &_channelParticipantModerator() { - t_assert(data != nullptr && _type == mtpc_channelParticipantModerator); - split(); - return *(MTPDchannelParticipantModerator*)data; - } - const MTPDchannelParticipantModerator &c_channelParticipantModerator() const { - t_assert(data != nullptr && _type == mtpc_channelParticipantModerator); - return *(const MTPDchannelParticipantModerator*)data; - } - - MTPDchannelParticipantEditor &_channelParticipantEditor() { - t_assert(data != nullptr && _type == mtpc_channelParticipantEditor); - split(); - return *(MTPDchannelParticipantEditor*)data; - } - const MTPDchannelParticipantEditor &c_channelParticipantEditor() const { - t_assert(data != nullptr && _type == mtpc_channelParticipantEditor); - return *(const MTPDchannelParticipantEditor*)data; - } - - MTPDchannelParticipantKicked &_channelParticipantKicked() { - t_assert(data != nullptr && _type == mtpc_channelParticipantKicked); - split(); - return *(MTPDchannelParticipantKicked*)data; - } - const MTPDchannelParticipantKicked &c_channelParticipantKicked() const { - t_assert(data != nullptr && _type == mtpc_channelParticipantKicked); - return *(const MTPDchannelParticipantKicked*)data; - } - - MTPDchannelParticipantCreator &_channelParticipantCreator() { - t_assert(data != nullptr && _type == mtpc_channelParticipantCreator); - split(); - return *(MTPDchannelParticipantCreator*)data; - } - const MTPDchannelParticipantCreator &c_channelParticipantCreator() const { - t_assert(data != nullptr && _type == mtpc_channelParticipantCreator); - return *(const MTPDchannelParticipantCreator*)data; - } + const MTPDchannelParticipant &c_channelParticipant() const; + const MTPDchannelParticipantSelf &c_channelParticipantSelf() const; + const MTPDchannelParticipantModerator &c_channelParticipantModerator() const; + const MTPDchannelParticipantEditor &c_channelParticipantEditor() const; + const MTPDchannelParticipantKicked &c_channelParticipantKicked() const; + const MTPDchannelParticipantCreator &c_channelParticipantCreator() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8373,24 +5601,24 @@ public: private: explicit MTPchannelParticipant(mtpTypeId type); - explicit MTPchannelParticipant(MTPDchannelParticipant *_data); - explicit MTPchannelParticipant(MTPDchannelParticipantSelf *_data); - explicit MTPchannelParticipant(MTPDchannelParticipantModerator *_data); - explicit MTPchannelParticipant(MTPDchannelParticipantEditor *_data); - explicit MTPchannelParticipant(MTPDchannelParticipantKicked *_data); - explicit MTPchannelParticipant(MTPDchannelParticipantCreator *_data); + explicit MTPchannelParticipant(std::shared_ptr &&data); + explicit MTPchannelParticipant(std::shared_ptr &&data); + explicit MTPchannelParticipant(std::shared_ptr &&data); + explicit MTPchannelParticipant(std::shared_ptr &&data); + explicit MTPchannelParticipant(std::shared_ptr &&data); + explicit MTPchannelParticipant(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPChannelParticipant; class MTPchannelParticipantsFilter { public: - MTPchannelParticipantsFilter() : _type(0) { + MTPchannelParticipantsFilter() { } - MTPchannelParticipantsFilter(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPchannelParticipantsFilter(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -8406,15 +5634,15 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPChannelParticipantsFilter; class MTPchannelParticipantRole { public: - MTPchannelParticipantRole() : _type(0) { + MTPchannelParticipantRole() { } - MTPchannelParticipantRole(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPchannelParticipantRole(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -8430,26 +5658,17 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPChannelParticipantRole; class MTPchannels_channelParticipants : private mtpDataOwner { public: MTPchannels_channelParticipants(); - MTPchannels_channelParticipants(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_channels_channelParticipants) : mtpDataOwner(0) { + MTPchannels_channelParticipants(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_channels_channelParticipants) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDchannels_channelParticipants &_channels_channelParticipants() { - t_assert(data != nullptr); - split(); - return *(MTPDchannels_channelParticipants*)data; - } - const MTPDchannels_channelParticipants &c_channels_channelParticipants() const { - t_assert(data != nullptr); - return *(const MTPDchannels_channelParticipants*)data; - } + const MTPDchannels_channelParticipants &c_channels_channelParticipants() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8459,7 +5678,7 @@ public: typedef void ResponseType; private: - explicit MTPchannels_channelParticipants(MTPDchannels_channelParticipants *_data); + explicit MTPchannels_channelParticipants(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -8468,19 +5687,10 @@ typedef MTPBoxed MTPchannels_ChannelParticipant class MTPchannels_channelParticipant : private mtpDataOwner { public: MTPchannels_channelParticipant(); - MTPchannels_channelParticipant(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_channels_channelParticipant) : mtpDataOwner(0) { + MTPchannels_channelParticipant(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_channels_channelParticipant) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDchannels_channelParticipant &_channels_channelParticipant() { - t_assert(data != nullptr); - split(); - return *(MTPDchannels_channelParticipant*)data; - } - const MTPDchannels_channelParticipant &c_channels_channelParticipant() const { - t_assert(data != nullptr); - return *(const MTPDchannels_channelParticipant*)data; - } + const MTPDchannels_channelParticipant &c_channels_channelParticipant() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8490,7 +5700,7 @@ public: typedef void ResponseType; private: - explicit MTPchannels_channelParticipant(MTPDchannels_channelParticipant *_data); + explicit MTPchannels_channelParticipant(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -8499,19 +5709,10 @@ typedef MTPBoxed MTPchannels_ChannelParticipant; class MTPhelp_termsOfService : private mtpDataOwner { public: MTPhelp_termsOfService(); - MTPhelp_termsOfService(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_termsOfService) : mtpDataOwner(0) { + MTPhelp_termsOfService(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_termsOfService) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDhelp_termsOfService &_help_termsOfService() { - t_assert(data != nullptr); - split(); - return *(MTPDhelp_termsOfService*)data; - } - const MTPDhelp_termsOfService &c_help_termsOfService() const { - t_assert(data != nullptr); - return *(const MTPDhelp_termsOfService*)data; - } + const MTPDhelp_termsOfService &c_help_termsOfService() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8521,7 +5722,7 @@ public: typedef void ResponseType; private: - explicit MTPhelp_termsOfService(MTPDhelp_termsOfService *_data); + explicit MTPhelp_termsOfService(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -8529,31 +5730,13 @@ typedef MTPBoxed MTPhelp_TermsOfService; class MTPfoundGif : private mtpDataOwner { public: - MTPfoundGif() : mtpDataOwner(0), _type(0) { + MTPfoundGif() : mtpDataOwner(nullptr) { } - MTPfoundGif(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPfoundGif(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDfoundGif &_foundGif() { - t_assert(data != nullptr && _type == mtpc_foundGif); - split(); - return *(MTPDfoundGif*)data; - } - const MTPDfoundGif &c_foundGif() const { - t_assert(data != nullptr && _type == mtpc_foundGif); - return *(const MTPDfoundGif*)data; - } - - MTPDfoundGifCached &_foundGifCached() { - t_assert(data != nullptr && _type == mtpc_foundGifCached); - split(); - return *(MTPDfoundGifCached*)data; - } - const MTPDfoundGifCached &c_foundGifCached() const { - t_assert(data != nullptr && _type == mtpc_foundGifCached); - return *(const MTPDfoundGifCached*)data; - } + const MTPDfoundGif &c_foundGif() const; + const MTPDfoundGifCached &c_foundGifCached() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8564,31 +5747,22 @@ public: private: explicit MTPfoundGif(mtpTypeId type); - explicit MTPfoundGif(MTPDfoundGif *_data); - explicit MTPfoundGif(MTPDfoundGifCached *_data); + explicit MTPfoundGif(std::shared_ptr &&data); + explicit MTPfoundGif(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPFoundGif; class MTPmessages_foundGifs : private mtpDataOwner { public: MTPmessages_foundGifs(); - MTPmessages_foundGifs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_foundGifs) : mtpDataOwner(0) { + MTPmessages_foundGifs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_foundGifs) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_foundGifs &_messages_foundGifs() { - t_assert(data != nullptr); - split(); - return *(MTPDmessages_foundGifs*)data; - } - const MTPDmessages_foundGifs &c_messages_foundGifs() const { - t_assert(data != nullptr); - return *(const MTPDmessages_foundGifs*)data; - } + const MTPDmessages_foundGifs &c_messages_foundGifs() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8598,7 +5772,7 @@ public: typedef void ResponseType; private: - explicit MTPmessages_foundGifs(MTPDmessages_foundGifs *_data); + explicit MTPmessages_foundGifs(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -8606,21 +5780,12 @@ typedef MTPBoxed MTPmessages_FoundGifs; class MTPmessages_savedGifs : private mtpDataOwner { public: - MTPmessages_savedGifs() : mtpDataOwner(0), _type(0) { + MTPmessages_savedGifs() : mtpDataOwner(nullptr) { } - MTPmessages_savedGifs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessages_savedGifs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_savedGifs &_messages_savedGifs() { - t_assert(data != nullptr && _type == mtpc_messages_savedGifs); - split(); - return *(MTPDmessages_savedGifs*)data; - } - const MTPDmessages_savedGifs &c_messages_savedGifs() const { - t_assert(data != nullptr && _type == mtpc_messages_savedGifs); - return *(const MTPDmessages_savedGifs*)data; - } + const MTPDmessages_savedGifs &c_messages_savedGifs() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8631,81 +5796,27 @@ public: private: explicit MTPmessages_savedGifs(mtpTypeId type); - explicit MTPmessages_savedGifs(MTPDmessages_savedGifs *_data); + explicit MTPmessages_savedGifs(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPmessages_SavedGifs; class MTPinputBotInlineMessage : private mtpDataOwner { public: - MTPinputBotInlineMessage() : mtpDataOwner(0), _type(0) { + MTPinputBotInlineMessage() : mtpDataOwner(nullptr) { } - MTPinputBotInlineMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputBotInlineMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputBotInlineMessageMediaAuto &_inputBotInlineMessageMediaAuto() { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaAuto); - split(); - return *(MTPDinputBotInlineMessageMediaAuto*)data; - } - const MTPDinputBotInlineMessageMediaAuto &c_inputBotInlineMessageMediaAuto() const { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaAuto); - return *(const MTPDinputBotInlineMessageMediaAuto*)data; - } - - MTPDinputBotInlineMessageText &_inputBotInlineMessageText() { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageText); - split(); - return *(MTPDinputBotInlineMessageText*)data; - } - const MTPDinputBotInlineMessageText &c_inputBotInlineMessageText() const { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageText); - return *(const MTPDinputBotInlineMessageText*)data; - } - - MTPDinputBotInlineMessageMediaGeo &_inputBotInlineMessageMediaGeo() { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaGeo); - split(); - return *(MTPDinputBotInlineMessageMediaGeo*)data; - } - const MTPDinputBotInlineMessageMediaGeo &c_inputBotInlineMessageMediaGeo() const { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaGeo); - return *(const MTPDinputBotInlineMessageMediaGeo*)data; - } - - MTPDinputBotInlineMessageMediaVenue &_inputBotInlineMessageMediaVenue() { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaVenue); - split(); - return *(MTPDinputBotInlineMessageMediaVenue*)data; - } - const MTPDinputBotInlineMessageMediaVenue &c_inputBotInlineMessageMediaVenue() const { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaVenue); - return *(const MTPDinputBotInlineMessageMediaVenue*)data; - } - - MTPDinputBotInlineMessageMediaContact &_inputBotInlineMessageMediaContact() { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaContact); - split(); - return *(MTPDinputBotInlineMessageMediaContact*)data; - } - const MTPDinputBotInlineMessageMediaContact &c_inputBotInlineMessageMediaContact() const { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaContact); - return *(const MTPDinputBotInlineMessageMediaContact*)data; - } - - MTPDinputBotInlineMessageGame &_inputBotInlineMessageGame() { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageGame); - split(); - return *(MTPDinputBotInlineMessageGame*)data; - } - const MTPDinputBotInlineMessageGame &c_inputBotInlineMessageGame() const { - t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageGame); - return *(const MTPDinputBotInlineMessageGame*)data; - } + const MTPDinputBotInlineMessageMediaAuto &c_inputBotInlineMessageMediaAuto() const; + const MTPDinputBotInlineMessageText &c_inputBotInlineMessageText() const; + const MTPDinputBotInlineMessageMediaGeo &c_inputBotInlineMessageMediaGeo() const; + const MTPDinputBotInlineMessageMediaVenue &c_inputBotInlineMessageMediaVenue() const; + const MTPDinputBotInlineMessageMediaContact &c_inputBotInlineMessageMediaContact() const; + const MTPDinputBotInlineMessageGame &c_inputBotInlineMessageGame() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8716,66 +5827,30 @@ public: private: explicit MTPinputBotInlineMessage(mtpTypeId type); - explicit MTPinputBotInlineMessage(MTPDinputBotInlineMessageMediaAuto *_data); - explicit MTPinputBotInlineMessage(MTPDinputBotInlineMessageText *_data); - explicit MTPinputBotInlineMessage(MTPDinputBotInlineMessageMediaGeo *_data); - explicit MTPinputBotInlineMessage(MTPDinputBotInlineMessageMediaVenue *_data); - explicit MTPinputBotInlineMessage(MTPDinputBotInlineMessageMediaContact *_data); - explicit MTPinputBotInlineMessage(MTPDinputBotInlineMessageGame *_data); + explicit MTPinputBotInlineMessage(std::shared_ptr &&data); + explicit MTPinputBotInlineMessage(std::shared_ptr &&data); + explicit MTPinputBotInlineMessage(std::shared_ptr &&data); + explicit MTPinputBotInlineMessage(std::shared_ptr &&data); + explicit MTPinputBotInlineMessage(std::shared_ptr &&data); + explicit MTPinputBotInlineMessage(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputBotInlineMessage; class MTPinputBotInlineResult : private mtpDataOwner { public: - MTPinputBotInlineResult() : mtpDataOwner(0), _type(0) { + MTPinputBotInlineResult() : mtpDataOwner(nullptr) { } - MTPinputBotInlineResult(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputBotInlineResult(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputBotInlineResult &_inputBotInlineResult() { - t_assert(data != nullptr && _type == mtpc_inputBotInlineResult); - split(); - return *(MTPDinputBotInlineResult*)data; - } - const MTPDinputBotInlineResult &c_inputBotInlineResult() const { - t_assert(data != nullptr && _type == mtpc_inputBotInlineResult); - return *(const MTPDinputBotInlineResult*)data; - } - - MTPDinputBotInlineResultPhoto &_inputBotInlineResultPhoto() { - t_assert(data != nullptr && _type == mtpc_inputBotInlineResultPhoto); - split(); - return *(MTPDinputBotInlineResultPhoto*)data; - } - const MTPDinputBotInlineResultPhoto &c_inputBotInlineResultPhoto() const { - t_assert(data != nullptr && _type == mtpc_inputBotInlineResultPhoto); - return *(const MTPDinputBotInlineResultPhoto*)data; - } - - MTPDinputBotInlineResultDocument &_inputBotInlineResultDocument() { - t_assert(data != nullptr && _type == mtpc_inputBotInlineResultDocument); - split(); - return *(MTPDinputBotInlineResultDocument*)data; - } - const MTPDinputBotInlineResultDocument &c_inputBotInlineResultDocument() const { - t_assert(data != nullptr && _type == mtpc_inputBotInlineResultDocument); - return *(const MTPDinputBotInlineResultDocument*)data; - } - - MTPDinputBotInlineResultGame &_inputBotInlineResultGame() { - t_assert(data != nullptr && _type == mtpc_inputBotInlineResultGame); - split(); - return *(MTPDinputBotInlineResultGame*)data; - } - const MTPDinputBotInlineResultGame &c_inputBotInlineResultGame() const { - t_assert(data != nullptr && _type == mtpc_inputBotInlineResultGame); - return *(const MTPDinputBotInlineResultGame*)data; - } + const MTPDinputBotInlineResult &c_inputBotInlineResult() const; + const MTPDinputBotInlineResultPhoto &c_inputBotInlineResultPhoto() const; + const MTPDinputBotInlineResultDocument &c_inputBotInlineResultDocument() const; + const MTPDinputBotInlineResultGame &c_inputBotInlineResultGame() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8786,74 +5861,29 @@ public: private: explicit MTPinputBotInlineResult(mtpTypeId type); - explicit MTPinputBotInlineResult(MTPDinputBotInlineResult *_data); - explicit MTPinputBotInlineResult(MTPDinputBotInlineResultPhoto *_data); - explicit MTPinputBotInlineResult(MTPDinputBotInlineResultDocument *_data); - explicit MTPinputBotInlineResult(MTPDinputBotInlineResultGame *_data); + explicit MTPinputBotInlineResult(std::shared_ptr &&data); + explicit MTPinputBotInlineResult(std::shared_ptr &&data); + explicit MTPinputBotInlineResult(std::shared_ptr &&data); + explicit MTPinputBotInlineResult(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputBotInlineResult; class MTPbotInlineMessage : private mtpDataOwner { public: - MTPbotInlineMessage() : mtpDataOwner(0), _type(0) { + MTPbotInlineMessage() : mtpDataOwner(nullptr) { } - MTPbotInlineMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPbotInlineMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDbotInlineMessageMediaAuto &_botInlineMessageMediaAuto() { - t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaAuto); - split(); - return *(MTPDbotInlineMessageMediaAuto*)data; - } - const MTPDbotInlineMessageMediaAuto &c_botInlineMessageMediaAuto() const { - t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaAuto); - return *(const MTPDbotInlineMessageMediaAuto*)data; - } - - MTPDbotInlineMessageText &_botInlineMessageText() { - t_assert(data != nullptr && _type == mtpc_botInlineMessageText); - split(); - return *(MTPDbotInlineMessageText*)data; - } - const MTPDbotInlineMessageText &c_botInlineMessageText() const { - t_assert(data != nullptr && _type == mtpc_botInlineMessageText); - return *(const MTPDbotInlineMessageText*)data; - } - - MTPDbotInlineMessageMediaGeo &_botInlineMessageMediaGeo() { - t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaGeo); - split(); - return *(MTPDbotInlineMessageMediaGeo*)data; - } - const MTPDbotInlineMessageMediaGeo &c_botInlineMessageMediaGeo() const { - t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaGeo); - return *(const MTPDbotInlineMessageMediaGeo*)data; - } - - MTPDbotInlineMessageMediaVenue &_botInlineMessageMediaVenue() { - t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaVenue); - split(); - return *(MTPDbotInlineMessageMediaVenue*)data; - } - const MTPDbotInlineMessageMediaVenue &c_botInlineMessageMediaVenue() const { - t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaVenue); - return *(const MTPDbotInlineMessageMediaVenue*)data; - } - - MTPDbotInlineMessageMediaContact &_botInlineMessageMediaContact() { - t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaContact); - split(); - return *(MTPDbotInlineMessageMediaContact*)data; - } - const MTPDbotInlineMessageMediaContact &c_botInlineMessageMediaContact() const { - t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaContact); - return *(const MTPDbotInlineMessageMediaContact*)data; - } + const MTPDbotInlineMessageMediaAuto &c_botInlineMessageMediaAuto() const; + const MTPDbotInlineMessageText &c_botInlineMessageText() const; + const MTPDbotInlineMessageMediaGeo &c_botInlineMessageMediaGeo() const; + const MTPDbotInlineMessageMediaVenue &c_botInlineMessageMediaVenue() const; + const MTPDbotInlineMessageMediaContact &c_botInlineMessageMediaContact() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8864,45 +5894,27 @@ public: private: explicit MTPbotInlineMessage(mtpTypeId type); - explicit MTPbotInlineMessage(MTPDbotInlineMessageMediaAuto *_data); - explicit MTPbotInlineMessage(MTPDbotInlineMessageText *_data); - explicit MTPbotInlineMessage(MTPDbotInlineMessageMediaGeo *_data); - explicit MTPbotInlineMessage(MTPDbotInlineMessageMediaVenue *_data); - explicit MTPbotInlineMessage(MTPDbotInlineMessageMediaContact *_data); + explicit MTPbotInlineMessage(std::shared_ptr &&data); + explicit MTPbotInlineMessage(std::shared_ptr &&data); + explicit MTPbotInlineMessage(std::shared_ptr &&data); + explicit MTPbotInlineMessage(std::shared_ptr &&data); + explicit MTPbotInlineMessage(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPBotInlineMessage; class MTPbotInlineResult : private mtpDataOwner { public: - MTPbotInlineResult() : mtpDataOwner(0), _type(0) { + MTPbotInlineResult() : mtpDataOwner(nullptr) { } - MTPbotInlineResult(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPbotInlineResult(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDbotInlineResult &_botInlineResult() { - t_assert(data != nullptr && _type == mtpc_botInlineResult); - split(); - return *(MTPDbotInlineResult*)data; - } - const MTPDbotInlineResult &c_botInlineResult() const { - t_assert(data != nullptr && _type == mtpc_botInlineResult); - return *(const MTPDbotInlineResult*)data; - } - - MTPDbotInlineMediaResult &_botInlineMediaResult() { - t_assert(data != nullptr && _type == mtpc_botInlineMediaResult); - split(); - return *(MTPDbotInlineMediaResult*)data; - } - const MTPDbotInlineMediaResult &c_botInlineMediaResult() const { - t_assert(data != nullptr && _type == mtpc_botInlineMediaResult); - return *(const MTPDbotInlineMediaResult*)data; - } + const MTPDbotInlineResult &c_botInlineResult() const; + const MTPDbotInlineMediaResult &c_botInlineMediaResult() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8913,31 +5925,22 @@ public: private: explicit MTPbotInlineResult(mtpTypeId type); - explicit MTPbotInlineResult(MTPDbotInlineResult *_data); - explicit MTPbotInlineResult(MTPDbotInlineMediaResult *_data); + explicit MTPbotInlineResult(std::shared_ptr &&data); + explicit MTPbotInlineResult(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPBotInlineResult; class MTPmessages_botResults : private mtpDataOwner { public: MTPmessages_botResults(); - MTPmessages_botResults(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_botResults) : mtpDataOwner(0) { + MTPmessages_botResults(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_botResults) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_botResults &_messages_botResults() { - t_assert(data != nullptr); - split(); - return *(MTPDmessages_botResults*)data; - } - const MTPDmessages_botResults &c_messages_botResults() const { - t_assert(data != nullptr); - return *(const MTPDmessages_botResults*)data; - } + const MTPDmessages_botResults &c_messages_botResults() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8947,7 +5950,7 @@ public: typedef void ResponseType; private: - explicit MTPmessages_botResults(MTPDmessages_botResults *_data); + explicit MTPmessages_botResults(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -8956,19 +5959,10 @@ typedef MTPBoxed MTPmessages_BotResults; class MTPexportedMessageLink : private mtpDataOwner { public: MTPexportedMessageLink(); - MTPexportedMessageLink(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_exportedMessageLink) : mtpDataOwner(0) { + MTPexportedMessageLink(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_exportedMessageLink) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDexportedMessageLink &_exportedMessageLink() { - t_assert(data != nullptr); - split(); - return *(MTPDexportedMessageLink*)data; - } - const MTPDexportedMessageLink &c_exportedMessageLink() const { - t_assert(data != nullptr); - return *(const MTPDexportedMessageLink*)data; - } + const MTPDexportedMessageLink &c_exportedMessageLink() const; uint32 innerLength() const; mtpTypeId type() const; @@ -8978,7 +5972,7 @@ public: typedef void ResponseType; private: - explicit MTPexportedMessageLink(MTPDexportedMessageLink *_data); + explicit MTPexportedMessageLink(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -8987,19 +5981,10 @@ typedef MTPBoxed MTPExportedMessageLink; class MTPmessageFwdHeader : private mtpDataOwner { public: MTPmessageFwdHeader(); - MTPmessageFwdHeader(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messageFwdHeader) : mtpDataOwner(0) { + MTPmessageFwdHeader(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messageFwdHeader) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessageFwdHeader &_messageFwdHeader() { - t_assert(data != nullptr); - split(); - return *(MTPDmessageFwdHeader*)data; - } - const MTPDmessageFwdHeader &c_messageFwdHeader() const { - t_assert(data != nullptr); - return *(const MTPDmessageFwdHeader*)data; - } + const MTPDmessageFwdHeader &c_messageFwdHeader() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9009,7 +5994,7 @@ public: typedef void ResponseType; private: - explicit MTPmessageFwdHeader(MTPDmessageFwdHeader *_data); + explicit MTPmessageFwdHeader(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9017,9 +6002,9 @@ typedef MTPBoxed MTPMessageFwdHeader; class MTPauth_codeType { public: - MTPauth_codeType() : _type(0) { + MTPauth_codeType() { } - MTPauth_codeType(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPauth_codeType(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -9035,57 +6020,21 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPauth_CodeType; class MTPauth_sentCodeType : private mtpDataOwner { public: - MTPauth_sentCodeType() : mtpDataOwner(0), _type(0) { + MTPauth_sentCodeType() : mtpDataOwner(nullptr) { } - MTPauth_sentCodeType(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPauth_sentCodeType(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDauth_sentCodeTypeApp &_auth_sentCodeTypeApp() { - t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeApp); - split(); - return *(MTPDauth_sentCodeTypeApp*)data; - } - const MTPDauth_sentCodeTypeApp &c_auth_sentCodeTypeApp() const { - t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeApp); - return *(const MTPDauth_sentCodeTypeApp*)data; - } - - MTPDauth_sentCodeTypeSms &_auth_sentCodeTypeSms() { - t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeSms); - split(); - return *(MTPDauth_sentCodeTypeSms*)data; - } - const MTPDauth_sentCodeTypeSms &c_auth_sentCodeTypeSms() const { - t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeSms); - return *(const MTPDauth_sentCodeTypeSms*)data; - } - - MTPDauth_sentCodeTypeCall &_auth_sentCodeTypeCall() { - t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeCall); - split(); - return *(MTPDauth_sentCodeTypeCall*)data; - } - const MTPDauth_sentCodeTypeCall &c_auth_sentCodeTypeCall() const { - t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeCall); - return *(const MTPDauth_sentCodeTypeCall*)data; - } - - MTPDauth_sentCodeTypeFlashCall &_auth_sentCodeTypeFlashCall() { - t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeFlashCall); - split(); - return *(MTPDauth_sentCodeTypeFlashCall*)data; - } - const MTPDauth_sentCodeTypeFlashCall &c_auth_sentCodeTypeFlashCall() const { - t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeFlashCall); - return *(const MTPDauth_sentCodeTypeFlashCall*)data; - } + const MTPDauth_sentCodeTypeApp &c_auth_sentCodeTypeApp() const; + const MTPDauth_sentCodeTypeSms &c_auth_sentCodeTypeSms() const; + const MTPDauth_sentCodeTypeCall &c_auth_sentCodeTypeCall() const; + const MTPDauth_sentCodeTypeFlashCall &c_auth_sentCodeTypeFlashCall() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9096,33 +6045,24 @@ public: private: explicit MTPauth_sentCodeType(mtpTypeId type); - explicit MTPauth_sentCodeType(MTPDauth_sentCodeTypeApp *_data); - explicit MTPauth_sentCodeType(MTPDauth_sentCodeTypeSms *_data); - explicit MTPauth_sentCodeType(MTPDauth_sentCodeTypeCall *_data); - explicit MTPauth_sentCodeType(MTPDauth_sentCodeTypeFlashCall *_data); + explicit MTPauth_sentCodeType(std::shared_ptr &&data); + explicit MTPauth_sentCodeType(std::shared_ptr &&data); + explicit MTPauth_sentCodeType(std::shared_ptr &&data); + explicit MTPauth_sentCodeType(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPauth_SentCodeType; class MTPmessages_botCallbackAnswer : private mtpDataOwner { public: MTPmessages_botCallbackAnswer(); - MTPmessages_botCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_botCallbackAnswer) : mtpDataOwner(0) { + MTPmessages_botCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_botCallbackAnswer) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_botCallbackAnswer &_messages_botCallbackAnswer() { - t_assert(data != nullptr); - split(); - return *(MTPDmessages_botCallbackAnswer*)data; - } - const MTPDmessages_botCallbackAnswer &c_messages_botCallbackAnswer() const { - t_assert(data != nullptr); - return *(const MTPDmessages_botCallbackAnswer*)data; - } + const MTPDmessages_botCallbackAnswer &c_messages_botCallbackAnswer() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9132,7 +6072,7 @@ public: typedef void ResponseType; private: - explicit MTPmessages_botCallbackAnswer(MTPDmessages_botCallbackAnswer *_data); + explicit MTPmessages_botCallbackAnswer(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9141,19 +6081,10 @@ typedef MTPBoxed MTPmessages_BotCallbackAnswer; class MTPmessages_messageEditData : private mtpDataOwner { public: MTPmessages_messageEditData(); - MTPmessages_messageEditData(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_messageEditData) : mtpDataOwner(0) { + MTPmessages_messageEditData(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_messageEditData) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_messageEditData &_messages_messageEditData() { - t_assert(data != nullptr); - split(); - return *(MTPDmessages_messageEditData*)data; - } - const MTPDmessages_messageEditData &c_messages_messageEditData() const { - t_assert(data != nullptr); - return *(const MTPDmessages_messageEditData*)data; - } + const MTPDmessages_messageEditData &c_messages_messageEditData() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9163,7 +6094,7 @@ public: typedef void ResponseType; private: - explicit MTPmessages_messageEditData(MTPDmessages_messageEditData *_data); + explicit MTPmessages_messageEditData(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9172,19 +6103,10 @@ typedef MTPBoxed MTPmessages_MessageEditData; class MTPinputBotInlineMessageID : private mtpDataOwner { public: MTPinputBotInlineMessageID(); - MTPinputBotInlineMessageID(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputBotInlineMessageID) : mtpDataOwner(0) { + MTPinputBotInlineMessageID(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputBotInlineMessageID) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputBotInlineMessageID &_inputBotInlineMessageID() { - t_assert(data != nullptr); - split(); - return *(MTPDinputBotInlineMessageID*)data; - } - const MTPDinputBotInlineMessageID &c_inputBotInlineMessageID() const { - t_assert(data != nullptr); - return *(const MTPDinputBotInlineMessageID*)data; - } + const MTPDinputBotInlineMessageID &c_inputBotInlineMessageID() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9194,7 +6116,7 @@ public: typedef void ResponseType; private: - explicit MTPinputBotInlineMessageID(MTPDinputBotInlineMessageID *_data); + explicit MTPinputBotInlineMessageID(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9203,19 +6125,10 @@ typedef MTPBoxed MTPInputBotInlineMessageID; class MTPinlineBotSwitchPM : private mtpDataOwner { public: MTPinlineBotSwitchPM(); - MTPinlineBotSwitchPM(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inlineBotSwitchPM) : mtpDataOwner(0) { + MTPinlineBotSwitchPM(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inlineBotSwitchPM) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinlineBotSwitchPM &_inlineBotSwitchPM() { - t_assert(data != nullptr); - split(); - return *(MTPDinlineBotSwitchPM*)data; - } - const MTPDinlineBotSwitchPM &c_inlineBotSwitchPM() const { - t_assert(data != nullptr); - return *(const MTPDinlineBotSwitchPM*)data; - } + const MTPDinlineBotSwitchPM &c_inlineBotSwitchPM() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9225,7 +6138,7 @@ public: typedef void ResponseType; private: - explicit MTPinlineBotSwitchPM(MTPDinlineBotSwitchPM *_data); + explicit MTPinlineBotSwitchPM(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9234,19 +6147,10 @@ typedef MTPBoxed MTPInlineBotSwitchPM; class MTPmessages_peerDialogs : private mtpDataOwner { public: MTPmessages_peerDialogs(); - MTPmessages_peerDialogs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_peerDialogs) : mtpDataOwner(0) { + MTPmessages_peerDialogs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_peerDialogs) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_peerDialogs &_messages_peerDialogs() { - t_assert(data != nullptr); - split(); - return *(MTPDmessages_peerDialogs*)data; - } - const MTPDmessages_peerDialogs &c_messages_peerDialogs() const { - t_assert(data != nullptr); - return *(const MTPDmessages_peerDialogs*)data; - } + const MTPDmessages_peerDialogs &c_messages_peerDialogs() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9256,7 +6160,7 @@ public: typedef void ResponseType; private: - explicit MTPmessages_peerDialogs(MTPDmessages_peerDialogs *_data); + explicit MTPmessages_peerDialogs(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9265,19 +6169,10 @@ typedef MTPBoxed MTPmessages_PeerDialogs; class MTPtopPeer : private mtpDataOwner { public: MTPtopPeer(); - MTPtopPeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_topPeer) : mtpDataOwner(0) { + MTPtopPeer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_topPeer) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDtopPeer &_topPeer() { - t_assert(data != nullptr); - split(); - return *(MTPDtopPeer*)data; - } - const MTPDtopPeer &c_topPeer() const { - t_assert(data != nullptr); - return *(const MTPDtopPeer*)data; - } + const MTPDtopPeer &c_topPeer() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9287,7 +6182,7 @@ public: typedef void ResponseType; private: - explicit MTPtopPeer(MTPDtopPeer *_data); + explicit MTPtopPeer(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9295,9 +6190,9 @@ typedef MTPBoxed MTPTopPeer; class MTPtopPeerCategory { public: - MTPtopPeerCategory() : _type(0) { + MTPtopPeerCategory() { } - MTPtopPeerCategory(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPtopPeerCategory(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -9313,26 +6208,17 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPTopPeerCategory; class MTPtopPeerCategoryPeers : private mtpDataOwner { public: MTPtopPeerCategoryPeers(); - MTPtopPeerCategoryPeers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_topPeerCategoryPeers) : mtpDataOwner(0) { + MTPtopPeerCategoryPeers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_topPeerCategoryPeers) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDtopPeerCategoryPeers &_topPeerCategoryPeers() { - t_assert(data != nullptr); - split(); - return *(MTPDtopPeerCategoryPeers*)data; - } - const MTPDtopPeerCategoryPeers &c_topPeerCategoryPeers() const { - t_assert(data != nullptr); - return *(const MTPDtopPeerCategoryPeers*)data; - } + const MTPDtopPeerCategoryPeers &c_topPeerCategoryPeers() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9342,7 +6228,7 @@ public: typedef void ResponseType; private: - explicit MTPtopPeerCategoryPeers(MTPDtopPeerCategoryPeers *_data); + explicit MTPtopPeerCategoryPeers(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9350,21 +6236,12 @@ typedef MTPBoxed MTPTopPeerCategoryPeers; class MTPcontacts_topPeers : private mtpDataOwner { public: - MTPcontacts_topPeers() : mtpDataOwner(0), _type(0) { + MTPcontacts_topPeers() : mtpDataOwner(nullptr) { } - MTPcontacts_topPeers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPcontacts_topPeers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDcontacts_topPeers &_contacts_topPeers() { - t_assert(data != nullptr && _type == mtpc_contacts_topPeers); - split(); - return *(MTPDcontacts_topPeers*)data; - } - const MTPDcontacts_topPeers &c_contacts_topPeers() const { - t_assert(data != nullptr && _type == mtpc_contacts_topPeers); - return *(const MTPDcontacts_topPeers*)data; - } + const MTPDcontacts_topPeers &c_contacts_topPeers() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9375,31 +6252,22 @@ public: private: explicit MTPcontacts_topPeers(mtpTypeId type); - explicit MTPcontacts_topPeers(MTPDcontacts_topPeers *_data); + explicit MTPcontacts_topPeers(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPcontacts_TopPeers; class MTPdraftMessage : private mtpDataOwner { public: - MTPdraftMessage() : mtpDataOwner(0), _type(0) { + MTPdraftMessage() : mtpDataOwner(nullptr) { } - MTPdraftMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPdraftMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDdraftMessage &_draftMessage() { - t_assert(data != nullptr && _type == mtpc_draftMessage); - split(); - return *(MTPDdraftMessage*)data; - } - const MTPDdraftMessage &c_draftMessage() const { - t_assert(data != nullptr && _type == mtpc_draftMessage); - return *(const MTPDdraftMessage*)data; - } + const MTPDdraftMessage &c_draftMessage() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9410,31 +6278,22 @@ public: private: explicit MTPdraftMessage(mtpTypeId type); - explicit MTPdraftMessage(MTPDdraftMessage *_data); + explicit MTPdraftMessage(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPDraftMessage; class MTPmessages_featuredStickers : private mtpDataOwner { public: - MTPmessages_featuredStickers() : mtpDataOwner(0), _type(0) { + MTPmessages_featuredStickers() : mtpDataOwner(nullptr) { } - MTPmessages_featuredStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessages_featuredStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_featuredStickers &_messages_featuredStickers() { - t_assert(data != nullptr && _type == mtpc_messages_featuredStickers); - split(); - return *(MTPDmessages_featuredStickers*)data; - } - const MTPDmessages_featuredStickers &c_messages_featuredStickers() const { - t_assert(data != nullptr && _type == mtpc_messages_featuredStickers); - return *(const MTPDmessages_featuredStickers*)data; - } + const MTPDmessages_featuredStickers &c_messages_featuredStickers() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9445,31 +6304,22 @@ public: private: explicit MTPmessages_featuredStickers(mtpTypeId type); - explicit MTPmessages_featuredStickers(MTPDmessages_featuredStickers *_data); + explicit MTPmessages_featuredStickers(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPmessages_FeaturedStickers; class MTPmessages_recentStickers : private mtpDataOwner { public: - MTPmessages_recentStickers() : mtpDataOwner(0), _type(0) { + MTPmessages_recentStickers() : mtpDataOwner(nullptr) { } - MTPmessages_recentStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessages_recentStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_recentStickers &_messages_recentStickers() { - t_assert(data != nullptr && _type == mtpc_messages_recentStickers); - split(); - return *(MTPDmessages_recentStickers*)data; - } - const MTPDmessages_recentStickers &c_messages_recentStickers() const { - t_assert(data != nullptr && _type == mtpc_messages_recentStickers); - return *(const MTPDmessages_recentStickers*)data; - } + const MTPDmessages_recentStickers &c_messages_recentStickers() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9480,30 +6330,21 @@ public: private: explicit MTPmessages_recentStickers(mtpTypeId type); - explicit MTPmessages_recentStickers(MTPDmessages_recentStickers *_data); + explicit MTPmessages_recentStickers(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPmessages_RecentStickers; class MTPmessages_archivedStickers : private mtpDataOwner { public: MTPmessages_archivedStickers(); - MTPmessages_archivedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_archivedStickers) : mtpDataOwner(0) { + MTPmessages_archivedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_archivedStickers) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_archivedStickers &_messages_archivedStickers() { - t_assert(data != nullptr); - split(); - return *(MTPDmessages_archivedStickers*)data; - } - const MTPDmessages_archivedStickers &c_messages_archivedStickers() const { - t_assert(data != nullptr); - return *(const MTPDmessages_archivedStickers*)data; - } + const MTPDmessages_archivedStickers &c_messages_archivedStickers() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9513,7 +6354,7 @@ public: typedef void ResponseType; private: - explicit MTPmessages_archivedStickers(MTPDmessages_archivedStickers *_data); + explicit MTPmessages_archivedStickers(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9521,21 +6362,12 @@ typedef MTPBoxed MTPmessages_ArchivedStickers; class MTPmessages_stickerSetInstallResult : private mtpDataOwner { public: - MTPmessages_stickerSetInstallResult() : mtpDataOwner(0), _type(0) { + MTPmessages_stickerSetInstallResult() : mtpDataOwner(nullptr) { } - MTPmessages_stickerSetInstallResult(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPmessages_stickerSetInstallResult(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_stickerSetInstallResultArchive &_messages_stickerSetInstallResultArchive() { - t_assert(data != nullptr && _type == mtpc_messages_stickerSetInstallResultArchive); - split(); - return *(MTPDmessages_stickerSetInstallResultArchive*)data; - } - const MTPDmessages_stickerSetInstallResultArchive &c_messages_stickerSetInstallResultArchive() const { - t_assert(data != nullptr && _type == mtpc_messages_stickerSetInstallResultArchive); - return *(const MTPDmessages_stickerSetInstallResultArchive*)data; - } + const MTPDmessages_stickerSetInstallResultArchive &c_messages_stickerSetInstallResultArchive() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9546,41 +6378,23 @@ public: private: explicit MTPmessages_stickerSetInstallResult(mtpTypeId type); - explicit MTPmessages_stickerSetInstallResult(MTPDmessages_stickerSetInstallResultArchive *_data); + explicit MTPmessages_stickerSetInstallResult(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPmessages_StickerSetInstallResult; class MTPstickerSetCovered : private mtpDataOwner { public: - MTPstickerSetCovered() : mtpDataOwner(0), _type(0) { + MTPstickerSetCovered() : mtpDataOwner(nullptr) { } - MTPstickerSetCovered(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPstickerSetCovered(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDstickerSetCovered &_stickerSetCovered() { - t_assert(data != nullptr && _type == mtpc_stickerSetCovered); - split(); - return *(MTPDstickerSetCovered*)data; - } - const MTPDstickerSetCovered &c_stickerSetCovered() const { - t_assert(data != nullptr && _type == mtpc_stickerSetCovered); - return *(const MTPDstickerSetCovered*)data; - } - - MTPDstickerSetMultiCovered &_stickerSetMultiCovered() { - t_assert(data != nullptr && _type == mtpc_stickerSetMultiCovered); - split(); - return *(MTPDstickerSetMultiCovered*)data; - } - const MTPDstickerSetMultiCovered &c_stickerSetMultiCovered() const { - t_assert(data != nullptr && _type == mtpc_stickerSetMultiCovered); - return *(const MTPDstickerSetMultiCovered*)data; - } + const MTPDstickerSetCovered &c_stickerSetCovered() const; + const MTPDstickerSetMultiCovered &c_stickerSetMultiCovered() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9591,31 +6405,22 @@ public: private: explicit MTPstickerSetCovered(mtpTypeId type); - explicit MTPstickerSetCovered(MTPDstickerSetCovered *_data); - explicit MTPstickerSetCovered(MTPDstickerSetMultiCovered *_data); + explicit MTPstickerSetCovered(std::shared_ptr &&data); + explicit MTPstickerSetCovered(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPStickerSetCovered; class MTPmaskCoords : private mtpDataOwner { public: MTPmaskCoords(); - MTPmaskCoords(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_maskCoords) : mtpDataOwner(0) { + MTPmaskCoords(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_maskCoords) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmaskCoords &_maskCoords() { - t_assert(data != nullptr); - split(); - return *(MTPDmaskCoords*)data; - } - const MTPDmaskCoords &c_maskCoords() const { - t_assert(data != nullptr); - return *(const MTPDmaskCoords*)data; - } + const MTPDmaskCoords &c_maskCoords() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9625,7 +6430,7 @@ public: typedef void ResponseType; private: - explicit MTPmaskCoords(MTPDmaskCoords *_data); + explicit MTPmaskCoords(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9633,31 +6438,13 @@ typedef MTPBoxed MTPMaskCoords; class MTPinputStickeredMedia : private mtpDataOwner { public: - MTPinputStickeredMedia() : mtpDataOwner(0), _type(0) { + MTPinputStickeredMedia() : mtpDataOwner(nullptr) { } - MTPinputStickeredMedia(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputStickeredMedia(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputStickeredMediaPhoto &_inputStickeredMediaPhoto() { - t_assert(data != nullptr && _type == mtpc_inputStickeredMediaPhoto); - split(); - return *(MTPDinputStickeredMediaPhoto*)data; - } - const MTPDinputStickeredMediaPhoto &c_inputStickeredMediaPhoto() const { - t_assert(data != nullptr && _type == mtpc_inputStickeredMediaPhoto); - return *(const MTPDinputStickeredMediaPhoto*)data; - } - - MTPDinputStickeredMediaDocument &_inputStickeredMediaDocument() { - t_assert(data != nullptr && _type == mtpc_inputStickeredMediaDocument); - split(); - return *(MTPDinputStickeredMediaDocument*)data; - } - const MTPDinputStickeredMediaDocument &c_inputStickeredMediaDocument() const { - t_assert(data != nullptr && _type == mtpc_inputStickeredMediaDocument); - return *(const MTPDinputStickeredMediaDocument*)data; - } + const MTPDinputStickeredMediaPhoto &c_inputStickeredMediaPhoto() const; + const MTPDinputStickeredMediaDocument &c_inputStickeredMediaDocument() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9668,31 +6455,22 @@ public: private: explicit MTPinputStickeredMedia(mtpTypeId type); - explicit MTPinputStickeredMedia(MTPDinputStickeredMediaPhoto *_data); - explicit MTPinputStickeredMedia(MTPDinputStickeredMediaDocument *_data); + explicit MTPinputStickeredMedia(std::shared_ptr &&data); + explicit MTPinputStickeredMedia(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputStickeredMedia; class MTPgame : private mtpDataOwner { public: MTPgame(); - MTPgame(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_game) : mtpDataOwner(0) { + MTPgame(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_game) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDgame &_game() { - t_assert(data != nullptr); - split(); - return *(MTPDgame*)data; - } - const MTPDgame &c_game() const { - t_assert(data != nullptr); - return *(const MTPDgame*)data; - } + const MTPDgame &c_game() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9702,7 +6480,7 @@ public: typedef void ResponseType; private: - explicit MTPgame(MTPDgame *_data); + explicit MTPgame(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9710,31 +6488,13 @@ typedef MTPBoxed MTPGame; class MTPinputGame : private mtpDataOwner { public: - MTPinputGame() : mtpDataOwner(0), _type(0) { + MTPinputGame() : mtpDataOwner(nullptr) { } - MTPinputGame(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPinputGame(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputGameID &_inputGameID() { - t_assert(data != nullptr && _type == mtpc_inputGameID); - split(); - return *(MTPDinputGameID*)data; - } - const MTPDinputGameID &c_inputGameID() const { - t_assert(data != nullptr && _type == mtpc_inputGameID); - return *(const MTPDinputGameID*)data; - } - - MTPDinputGameShortName &_inputGameShortName() { - t_assert(data != nullptr && _type == mtpc_inputGameShortName); - split(); - return *(MTPDinputGameShortName*)data; - } - const MTPDinputGameShortName &c_inputGameShortName() const { - t_assert(data != nullptr && _type == mtpc_inputGameShortName); - return *(const MTPDinputGameShortName*)data; - } + const MTPDinputGameID &c_inputGameID() const; + const MTPDinputGameShortName &c_inputGameShortName() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9745,31 +6505,22 @@ public: private: explicit MTPinputGame(mtpTypeId type); - explicit MTPinputGame(MTPDinputGameID *_data); - explicit MTPinputGame(MTPDinputGameShortName *_data); + explicit MTPinputGame(std::shared_ptr &&data); + explicit MTPinputGame(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPInputGame; class MTPhighScore : private mtpDataOwner { public: MTPhighScore(); - MTPhighScore(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_highScore) : mtpDataOwner(0) { + MTPhighScore(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_highScore) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDhighScore &_highScore() { - t_assert(data != nullptr); - split(); - return *(MTPDhighScore*)data; - } - const MTPDhighScore &c_highScore() const { - t_assert(data != nullptr); - return *(const MTPDhighScore*)data; - } + const MTPDhighScore &c_highScore() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9779,7 +6530,7 @@ public: typedef void ResponseType; private: - explicit MTPhighScore(MTPDhighScore *_data); + explicit MTPhighScore(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9788,19 +6539,10 @@ typedef MTPBoxed MTPHighScore; class MTPmessages_highScores : private mtpDataOwner { public: MTPmessages_highScores(); - MTPmessages_highScores(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_highScores) : mtpDataOwner(0) { + MTPmessages_highScores(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_highScores) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDmessages_highScores &_messages_highScores() { - t_assert(data != nullptr); - split(); - return *(MTPDmessages_highScores*)data; - } - const MTPDmessages_highScores &c_messages_highScores() const { - t_assert(data != nullptr); - return *(const MTPDmessages_highScores*)data; - } + const MTPDmessages_highScores &c_messages_highScores() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9810,7 +6552,7 @@ public: typedef void ResponseType; private: - explicit MTPmessages_highScores(MTPDmessages_highScores *_data); + explicit MTPmessages_highScores(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -9818,101 +6560,20 @@ typedef MTPBoxed MTPmessages_HighScores; class MTPrichText : private mtpDataOwner { public: - MTPrichText() : mtpDataOwner(0), _type(0) { + MTPrichText() : mtpDataOwner(nullptr) { } - MTPrichText(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPrichText(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDtextPlain &_textPlain() { - t_assert(data != nullptr && _type == mtpc_textPlain); - split(); - return *(MTPDtextPlain*)data; - } - const MTPDtextPlain &c_textPlain() const { - t_assert(data != nullptr && _type == mtpc_textPlain); - return *(const MTPDtextPlain*)data; - } - - MTPDtextBold &_textBold() { - t_assert(data != nullptr && _type == mtpc_textBold); - split(); - return *(MTPDtextBold*)data; - } - const MTPDtextBold &c_textBold() const { - t_assert(data != nullptr && _type == mtpc_textBold); - return *(const MTPDtextBold*)data; - } - - MTPDtextItalic &_textItalic() { - t_assert(data != nullptr && _type == mtpc_textItalic); - split(); - return *(MTPDtextItalic*)data; - } - const MTPDtextItalic &c_textItalic() const { - t_assert(data != nullptr && _type == mtpc_textItalic); - return *(const MTPDtextItalic*)data; - } - - MTPDtextUnderline &_textUnderline() { - t_assert(data != nullptr && _type == mtpc_textUnderline); - split(); - return *(MTPDtextUnderline*)data; - } - const MTPDtextUnderline &c_textUnderline() const { - t_assert(data != nullptr && _type == mtpc_textUnderline); - return *(const MTPDtextUnderline*)data; - } - - MTPDtextStrike &_textStrike() { - t_assert(data != nullptr && _type == mtpc_textStrike); - split(); - return *(MTPDtextStrike*)data; - } - const MTPDtextStrike &c_textStrike() const { - t_assert(data != nullptr && _type == mtpc_textStrike); - return *(const MTPDtextStrike*)data; - } - - MTPDtextFixed &_textFixed() { - t_assert(data != nullptr && _type == mtpc_textFixed); - split(); - return *(MTPDtextFixed*)data; - } - const MTPDtextFixed &c_textFixed() const { - t_assert(data != nullptr && _type == mtpc_textFixed); - return *(const MTPDtextFixed*)data; - } - - MTPDtextUrl &_textUrl() { - t_assert(data != nullptr && _type == mtpc_textUrl); - split(); - return *(MTPDtextUrl*)data; - } - const MTPDtextUrl &c_textUrl() const { - t_assert(data != nullptr && _type == mtpc_textUrl); - return *(const MTPDtextUrl*)data; - } - - MTPDtextEmail &_textEmail() { - t_assert(data != nullptr && _type == mtpc_textEmail); - split(); - return *(MTPDtextEmail*)data; - } - const MTPDtextEmail &c_textEmail() const { - t_assert(data != nullptr && _type == mtpc_textEmail); - return *(const MTPDtextEmail*)data; - } - - MTPDtextConcat &_textConcat() { - t_assert(data != nullptr && _type == mtpc_textConcat); - split(); - return *(MTPDtextConcat*)data; - } - const MTPDtextConcat &c_textConcat() const { - t_assert(data != nullptr && _type == mtpc_textConcat); - return *(const MTPDtextConcat*)data; - } + const MTPDtextPlain &c_textPlain() const; + const MTPDtextBold &c_textBold() const; + const MTPDtextItalic &c_textItalic() const; + const MTPDtextUnderline &c_textUnderline() const; + const MTPDtextStrike &c_textStrike() const; + const MTPDtextFixed &c_textFixed() const; + const MTPDtextUrl &c_textUrl() const; + const MTPDtextEmail &c_textEmail() const; + const MTPDtextConcat &c_textConcat() const; uint32 innerLength() const; mtpTypeId type() const; @@ -9923,219 +6584,48 @@ public: private: explicit MTPrichText(mtpTypeId type); - explicit MTPrichText(MTPDtextPlain *_data); - explicit MTPrichText(MTPDtextBold *_data); - explicit MTPrichText(MTPDtextItalic *_data); - explicit MTPrichText(MTPDtextUnderline *_data); - explicit MTPrichText(MTPDtextStrike *_data); - explicit MTPrichText(MTPDtextFixed *_data); - explicit MTPrichText(MTPDtextUrl *_data); - explicit MTPrichText(MTPDtextEmail *_data); - explicit MTPrichText(MTPDtextConcat *_data); + explicit MTPrichText(std::shared_ptr &&data); + explicit MTPrichText(std::shared_ptr &&data); + explicit MTPrichText(std::shared_ptr &&data); + explicit MTPrichText(std::shared_ptr &&data); + explicit MTPrichText(std::shared_ptr &&data); + explicit MTPrichText(std::shared_ptr &&data); + explicit MTPrichText(std::shared_ptr &&data); + explicit MTPrichText(std::shared_ptr &&data); + explicit MTPrichText(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPRichText; class MTPpageBlock : private mtpDataOwner { public: - MTPpageBlock() : mtpDataOwner(0), _type(0) { + MTPpageBlock() : mtpDataOwner(nullptr) { } - MTPpageBlock(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPpageBlock(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDpageBlockTitle &_pageBlockTitle() { - t_assert(data != nullptr && _type == mtpc_pageBlockTitle); - split(); - return *(MTPDpageBlockTitle*)data; - } - const MTPDpageBlockTitle &c_pageBlockTitle() const { - t_assert(data != nullptr && _type == mtpc_pageBlockTitle); - return *(const MTPDpageBlockTitle*)data; - } - - MTPDpageBlockSubtitle &_pageBlockSubtitle() { - t_assert(data != nullptr && _type == mtpc_pageBlockSubtitle); - split(); - return *(MTPDpageBlockSubtitle*)data; - } - const MTPDpageBlockSubtitle &c_pageBlockSubtitle() const { - t_assert(data != nullptr && _type == mtpc_pageBlockSubtitle); - return *(const MTPDpageBlockSubtitle*)data; - } - - MTPDpageBlockAuthorDate &_pageBlockAuthorDate() { - t_assert(data != nullptr && _type == mtpc_pageBlockAuthorDate); - split(); - return *(MTPDpageBlockAuthorDate*)data; - } - const MTPDpageBlockAuthorDate &c_pageBlockAuthorDate() const { - t_assert(data != nullptr && _type == mtpc_pageBlockAuthorDate); - return *(const MTPDpageBlockAuthorDate*)data; - } - - MTPDpageBlockHeader &_pageBlockHeader() { - t_assert(data != nullptr && _type == mtpc_pageBlockHeader); - split(); - return *(MTPDpageBlockHeader*)data; - } - const MTPDpageBlockHeader &c_pageBlockHeader() const { - t_assert(data != nullptr && _type == mtpc_pageBlockHeader); - return *(const MTPDpageBlockHeader*)data; - } - - MTPDpageBlockSubheader &_pageBlockSubheader() { - t_assert(data != nullptr && _type == mtpc_pageBlockSubheader); - split(); - return *(MTPDpageBlockSubheader*)data; - } - const MTPDpageBlockSubheader &c_pageBlockSubheader() const { - t_assert(data != nullptr && _type == mtpc_pageBlockSubheader); - return *(const MTPDpageBlockSubheader*)data; - } - - MTPDpageBlockParagraph &_pageBlockParagraph() { - t_assert(data != nullptr && _type == mtpc_pageBlockParagraph); - split(); - return *(MTPDpageBlockParagraph*)data; - } - const MTPDpageBlockParagraph &c_pageBlockParagraph() const { - t_assert(data != nullptr && _type == mtpc_pageBlockParagraph); - return *(const MTPDpageBlockParagraph*)data; - } - - MTPDpageBlockPreformatted &_pageBlockPreformatted() { - t_assert(data != nullptr && _type == mtpc_pageBlockPreformatted); - split(); - return *(MTPDpageBlockPreformatted*)data; - } - const MTPDpageBlockPreformatted &c_pageBlockPreformatted() const { - t_assert(data != nullptr && _type == mtpc_pageBlockPreformatted); - return *(const MTPDpageBlockPreformatted*)data; - } - - MTPDpageBlockFooter &_pageBlockFooter() { - t_assert(data != nullptr && _type == mtpc_pageBlockFooter); - split(); - return *(MTPDpageBlockFooter*)data; - } - const MTPDpageBlockFooter &c_pageBlockFooter() const { - t_assert(data != nullptr && _type == mtpc_pageBlockFooter); - return *(const MTPDpageBlockFooter*)data; - } - - MTPDpageBlockAnchor &_pageBlockAnchor() { - t_assert(data != nullptr && _type == mtpc_pageBlockAnchor); - split(); - return *(MTPDpageBlockAnchor*)data; - } - const MTPDpageBlockAnchor &c_pageBlockAnchor() const { - t_assert(data != nullptr && _type == mtpc_pageBlockAnchor); - return *(const MTPDpageBlockAnchor*)data; - } - - MTPDpageBlockList &_pageBlockList() { - t_assert(data != nullptr && _type == mtpc_pageBlockList); - split(); - return *(MTPDpageBlockList*)data; - } - const MTPDpageBlockList &c_pageBlockList() const { - t_assert(data != nullptr && _type == mtpc_pageBlockList); - return *(const MTPDpageBlockList*)data; - } - - MTPDpageBlockBlockquote &_pageBlockBlockquote() { - t_assert(data != nullptr && _type == mtpc_pageBlockBlockquote); - split(); - return *(MTPDpageBlockBlockquote*)data; - } - const MTPDpageBlockBlockquote &c_pageBlockBlockquote() const { - t_assert(data != nullptr && _type == mtpc_pageBlockBlockquote); - return *(const MTPDpageBlockBlockquote*)data; - } - - MTPDpageBlockPullquote &_pageBlockPullquote() { - t_assert(data != nullptr && _type == mtpc_pageBlockPullquote); - split(); - return *(MTPDpageBlockPullquote*)data; - } - const MTPDpageBlockPullquote &c_pageBlockPullquote() const { - t_assert(data != nullptr && _type == mtpc_pageBlockPullquote); - return *(const MTPDpageBlockPullquote*)data; - } - - MTPDpageBlockPhoto &_pageBlockPhoto() { - t_assert(data != nullptr && _type == mtpc_pageBlockPhoto); - split(); - return *(MTPDpageBlockPhoto*)data; - } - const MTPDpageBlockPhoto &c_pageBlockPhoto() const { - t_assert(data != nullptr && _type == mtpc_pageBlockPhoto); - return *(const MTPDpageBlockPhoto*)data; - } - - MTPDpageBlockVideo &_pageBlockVideo() { - t_assert(data != nullptr && _type == mtpc_pageBlockVideo); - split(); - return *(MTPDpageBlockVideo*)data; - } - const MTPDpageBlockVideo &c_pageBlockVideo() const { - t_assert(data != nullptr && _type == mtpc_pageBlockVideo); - return *(const MTPDpageBlockVideo*)data; - } - - MTPDpageBlockCover &_pageBlockCover() { - t_assert(data != nullptr && _type == mtpc_pageBlockCover); - split(); - return *(MTPDpageBlockCover*)data; - } - const MTPDpageBlockCover &c_pageBlockCover() const { - t_assert(data != nullptr && _type == mtpc_pageBlockCover); - return *(const MTPDpageBlockCover*)data; - } - - MTPDpageBlockEmbed &_pageBlockEmbed() { - t_assert(data != nullptr && _type == mtpc_pageBlockEmbed); - split(); - return *(MTPDpageBlockEmbed*)data; - } - const MTPDpageBlockEmbed &c_pageBlockEmbed() const { - t_assert(data != nullptr && _type == mtpc_pageBlockEmbed); - return *(const MTPDpageBlockEmbed*)data; - } - - MTPDpageBlockEmbedPost &_pageBlockEmbedPost() { - t_assert(data != nullptr && _type == mtpc_pageBlockEmbedPost); - split(); - return *(MTPDpageBlockEmbedPost*)data; - } - const MTPDpageBlockEmbedPost &c_pageBlockEmbedPost() const { - t_assert(data != nullptr && _type == mtpc_pageBlockEmbedPost); - return *(const MTPDpageBlockEmbedPost*)data; - } - - MTPDpageBlockCollage &_pageBlockCollage() { - t_assert(data != nullptr && _type == mtpc_pageBlockCollage); - split(); - return *(MTPDpageBlockCollage*)data; - } - const MTPDpageBlockCollage &c_pageBlockCollage() const { - t_assert(data != nullptr && _type == mtpc_pageBlockCollage); - return *(const MTPDpageBlockCollage*)data; - } - - MTPDpageBlockSlideshow &_pageBlockSlideshow() { - t_assert(data != nullptr && _type == mtpc_pageBlockSlideshow); - split(); - return *(MTPDpageBlockSlideshow*)data; - } - const MTPDpageBlockSlideshow &c_pageBlockSlideshow() const { - t_assert(data != nullptr && _type == mtpc_pageBlockSlideshow); - return *(const MTPDpageBlockSlideshow*)data; - } + const MTPDpageBlockTitle &c_pageBlockTitle() const; + const MTPDpageBlockSubtitle &c_pageBlockSubtitle() const; + const MTPDpageBlockAuthorDate &c_pageBlockAuthorDate() const; + const MTPDpageBlockHeader &c_pageBlockHeader() const; + const MTPDpageBlockSubheader &c_pageBlockSubheader() const; + const MTPDpageBlockParagraph &c_pageBlockParagraph() const; + const MTPDpageBlockPreformatted &c_pageBlockPreformatted() const; + const MTPDpageBlockFooter &c_pageBlockFooter() const; + const MTPDpageBlockAnchor &c_pageBlockAnchor() const; + const MTPDpageBlockList &c_pageBlockList() const; + const MTPDpageBlockBlockquote &c_pageBlockBlockquote() const; + const MTPDpageBlockPullquote &c_pageBlockPullquote() const; + const MTPDpageBlockPhoto &c_pageBlockPhoto() const; + const MTPDpageBlockVideo &c_pageBlockVideo() const; + const MTPDpageBlockCover &c_pageBlockCover() const; + const MTPDpageBlockEmbed &c_pageBlockEmbed() const; + const MTPDpageBlockEmbedPost &c_pageBlockEmbedPost() const; + const MTPDpageBlockCollage &c_pageBlockCollage() const; + const MTPDpageBlockSlideshow &c_pageBlockSlideshow() const; uint32 innerLength() const; mtpTypeId type() const; @@ -10146,59 +6636,41 @@ public: private: explicit MTPpageBlock(mtpTypeId type); - explicit MTPpageBlock(MTPDpageBlockTitle *_data); - explicit MTPpageBlock(MTPDpageBlockSubtitle *_data); - explicit MTPpageBlock(MTPDpageBlockAuthorDate *_data); - explicit MTPpageBlock(MTPDpageBlockHeader *_data); - explicit MTPpageBlock(MTPDpageBlockSubheader *_data); - explicit MTPpageBlock(MTPDpageBlockParagraph *_data); - explicit MTPpageBlock(MTPDpageBlockPreformatted *_data); - explicit MTPpageBlock(MTPDpageBlockFooter *_data); - explicit MTPpageBlock(MTPDpageBlockAnchor *_data); - explicit MTPpageBlock(MTPDpageBlockList *_data); - explicit MTPpageBlock(MTPDpageBlockBlockquote *_data); - explicit MTPpageBlock(MTPDpageBlockPullquote *_data); - explicit MTPpageBlock(MTPDpageBlockPhoto *_data); - explicit MTPpageBlock(MTPDpageBlockVideo *_data); - explicit MTPpageBlock(MTPDpageBlockCover *_data); - explicit MTPpageBlock(MTPDpageBlockEmbed *_data); - explicit MTPpageBlock(MTPDpageBlockEmbedPost *_data); - explicit MTPpageBlock(MTPDpageBlockCollage *_data); - explicit MTPpageBlock(MTPDpageBlockSlideshow *_data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); + explicit MTPpageBlock(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPPageBlock; class MTPpage : private mtpDataOwner { public: - MTPpage() : mtpDataOwner(0), _type(0) { + MTPpage() : mtpDataOwner(nullptr) { } - MTPpage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPpage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDpagePart &_pagePart() { - t_assert(data != nullptr && _type == mtpc_pagePart); - split(); - return *(MTPDpagePart*)data; - } - const MTPDpagePart &c_pagePart() const { - t_assert(data != nullptr && _type == mtpc_pagePart); - return *(const MTPDpagePart*)data; - } - - MTPDpageFull &_pageFull() { - t_assert(data != nullptr && _type == mtpc_pageFull); - split(); - return *(MTPDpageFull*)data; - } - const MTPDpageFull &c_pageFull() const { - t_assert(data != nullptr && _type == mtpc_pageFull); - return *(const MTPDpageFull*)data; - } + const MTPDpagePart &c_pagePart() const; + const MTPDpageFull &c_pageFull() const; uint32 innerLength() const; mtpTypeId type() const; @@ -10209,31 +6681,22 @@ public: private: explicit MTPpage(mtpTypeId type); - explicit MTPpage(MTPDpagePart *_data); - explicit MTPpage(MTPDpageFull *_data); + explicit MTPpage(std::shared_ptr &&data); + explicit MTPpage(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPPage; class MTPinputPhoneCall : private mtpDataOwner { public: MTPinputPhoneCall(); - MTPinputPhoneCall(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputPhoneCall) : mtpDataOwner(0) { + MTPinputPhoneCall(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inputPhoneCall) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDinputPhoneCall &_inputPhoneCall() { - t_assert(data != nullptr); - split(); - return *(MTPDinputPhoneCall*)data; - } - const MTPDinputPhoneCall &c_inputPhoneCall() const { - t_assert(data != nullptr); - return *(const MTPDinputPhoneCall*)data; - } + const MTPDinputPhoneCall &c_inputPhoneCall() const; uint32 innerLength() const; mtpTypeId type() const; @@ -10243,7 +6706,7 @@ public: typedef void ResponseType; private: - explicit MTPinputPhoneCall(MTPDinputPhoneCall *_data); + explicit MTPinputPhoneCall(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -10251,61 +6714,16 @@ typedef MTPBoxed MTPInputPhoneCall; class MTPphoneCall : private mtpDataOwner { public: - MTPphoneCall() : mtpDataOwner(0), _type(0) { + MTPphoneCall() : mtpDataOwner(nullptr) { } - MTPphoneCall(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPphoneCall(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDphoneCallEmpty &_phoneCallEmpty() { - t_assert(data != nullptr && _type == mtpc_phoneCallEmpty); - split(); - return *(MTPDphoneCallEmpty*)data; - } - const MTPDphoneCallEmpty &c_phoneCallEmpty() const { - t_assert(data != nullptr && _type == mtpc_phoneCallEmpty); - return *(const MTPDphoneCallEmpty*)data; - } - - MTPDphoneCallWaiting &_phoneCallWaiting() { - t_assert(data != nullptr && _type == mtpc_phoneCallWaiting); - split(); - return *(MTPDphoneCallWaiting*)data; - } - const MTPDphoneCallWaiting &c_phoneCallWaiting() const { - t_assert(data != nullptr && _type == mtpc_phoneCallWaiting); - return *(const MTPDphoneCallWaiting*)data; - } - - MTPDphoneCallRequested &_phoneCallRequested() { - t_assert(data != nullptr && _type == mtpc_phoneCallRequested); - split(); - return *(MTPDphoneCallRequested*)data; - } - const MTPDphoneCallRequested &c_phoneCallRequested() const { - t_assert(data != nullptr && _type == mtpc_phoneCallRequested); - return *(const MTPDphoneCallRequested*)data; - } - - MTPDphoneCall &_phoneCall() { - t_assert(data != nullptr && _type == mtpc_phoneCall); - split(); - return *(MTPDphoneCall*)data; - } - const MTPDphoneCall &c_phoneCall() const { - t_assert(data != nullptr && _type == mtpc_phoneCall); - return *(const MTPDphoneCall*)data; - } - - MTPDphoneCallDiscarded &_phoneCallDiscarded() { - t_assert(data != nullptr && _type == mtpc_phoneCallDiscarded); - split(); - return *(MTPDphoneCallDiscarded*)data; - } - const MTPDphoneCallDiscarded &c_phoneCallDiscarded() const { - t_assert(data != nullptr && _type == mtpc_phoneCallDiscarded); - return *(const MTPDphoneCallDiscarded*)data; - } + const MTPDphoneCallEmpty &c_phoneCallEmpty() const; + const MTPDphoneCallWaiting &c_phoneCallWaiting() const; + const MTPDphoneCallRequested &c_phoneCallRequested() const; + const MTPDphoneCall &c_phoneCall() const; + const MTPDphoneCallDiscarded &c_phoneCallDiscarded() const; uint32 innerLength() const; mtpTypeId type() const; @@ -10316,34 +6734,25 @@ public: private: explicit MTPphoneCall(mtpTypeId type); - explicit MTPphoneCall(MTPDphoneCallEmpty *_data); - explicit MTPphoneCall(MTPDphoneCallWaiting *_data); - explicit MTPphoneCall(MTPDphoneCallRequested *_data); - explicit MTPphoneCall(MTPDphoneCall *_data); - explicit MTPphoneCall(MTPDphoneCallDiscarded *_data); + explicit MTPphoneCall(std::shared_ptr &&data); + explicit MTPphoneCall(std::shared_ptr &&data); + explicit MTPphoneCall(std::shared_ptr &&data); + explicit MTPphoneCall(std::shared_ptr &&data); + explicit MTPphoneCall(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPPhoneCall; class MTPphoneConnection : private mtpDataOwner { public: MTPphoneConnection(); - MTPphoneConnection(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_phoneConnection) : mtpDataOwner(0) { + MTPphoneConnection(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_phoneConnection) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDphoneConnection &_phoneConnection() { - t_assert(data != nullptr); - split(); - return *(MTPDphoneConnection*)data; - } - const MTPDphoneConnection &c_phoneConnection() const { - t_assert(data != nullptr); - return *(const MTPDphoneConnection*)data; - } + const MTPDphoneConnection &c_phoneConnection() const; uint32 innerLength() const; mtpTypeId type() const; @@ -10353,7 +6762,7 @@ public: typedef void ResponseType; private: - explicit MTPphoneConnection(MTPDphoneConnection *_data); + explicit MTPphoneConnection(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -10362,19 +6771,10 @@ typedef MTPBoxed MTPPhoneConnection; class MTPphoneCallProtocol : private mtpDataOwner { public: MTPphoneCallProtocol(); - MTPphoneCallProtocol(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_phoneCallProtocol) : mtpDataOwner(0) { + MTPphoneCallProtocol(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_phoneCallProtocol) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDphoneCallProtocol &_phoneCallProtocol() { - t_assert(data != nullptr); - split(); - return *(MTPDphoneCallProtocol*)data; - } - const MTPDphoneCallProtocol &c_phoneCallProtocol() const { - t_assert(data != nullptr); - return *(const MTPDphoneCallProtocol*)data; - } + const MTPDphoneCallProtocol &c_phoneCallProtocol() const; uint32 innerLength() const; mtpTypeId type() const; @@ -10384,7 +6784,7 @@ public: typedef void ResponseType; private: - explicit MTPphoneCallProtocol(MTPDphoneCallProtocol *_data); + explicit MTPphoneCallProtocol(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -10393,19 +6793,10 @@ typedef MTPBoxed MTPPhoneCallProtocol; class MTPphone_phoneCall : private mtpDataOwner { public: MTPphone_phoneCall(); - MTPphone_phoneCall(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_phone_phoneCall) : mtpDataOwner(0) { + MTPphone_phoneCall(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_phone_phoneCall) : mtpDataOwner(nullptr) { read(from, end, cons); } - - MTPDphone_phoneCall &_phone_phoneCall() { - t_assert(data != nullptr); - split(); - return *(MTPDphone_phoneCall*)data; - } - const MTPDphone_phoneCall &c_phone_phoneCall() const { - t_assert(data != nullptr); - return *(const MTPDphone_phoneCall*)data; - } + const MTPDphone_phoneCall &c_phone_phoneCall() const; uint32 innerLength() const; mtpTypeId type() const; @@ -10415,7 +6806,7 @@ public: typedef void ResponseType; private: - explicit MTPphone_phoneCall(MTPDphone_phoneCall *_data); + explicit MTPphone_phoneCall(std::shared_ptr &&data); friend class MTP::internal::TypeCreator; }; @@ -10423,9 +6814,9 @@ typedef MTPBoxed MTPphone_PhoneCall; class MTPphoneCallDiscardReason { public: - MTPphoneCallDiscardReason() : _type(0) { + MTPphoneCallDiscardReason() { } - MTPphoneCallDiscardReason(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPphoneCallDiscardReason(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { read(from, end, cons); } @@ -10441,13 +6832,13 @@ private: friend class MTP::internal::TypeCreator; - mtpTypeId _type; + mtpTypeId _type = 0; }; typedef MTPBoxed MTPPhoneCallDiscardReason; // Type constructors with data -class MTPDresPQ : public mtpDataImpl { +class MTPDresPQ : public mtpData { public: MTPDresPQ() { } @@ -10460,7 +6851,7 @@ public: MTPVector vserver_public_key_fingerprints; }; -class MTPDp_q_inner_data : public mtpDataImpl { +class MTPDp_q_inner_data : public mtpData { public: MTPDp_q_inner_data() { } @@ -10475,7 +6866,7 @@ public: MTPint256 vnew_nonce; }; -class MTPDserver_DH_params_fail : public mtpDataImpl { +class MTPDserver_DH_params_fail : public mtpData { public: MTPDserver_DH_params_fail() { } @@ -10487,7 +6878,7 @@ public: MTPint128 vnew_nonce_hash; }; -class MTPDserver_DH_params_ok : public mtpDataImpl { +class MTPDserver_DH_params_ok : public mtpData { public: MTPDserver_DH_params_ok() { } @@ -10499,7 +6890,7 @@ public: MTPstring vencrypted_answer; }; -class MTPDserver_DH_inner_data : public mtpDataImpl { +class MTPDserver_DH_inner_data : public mtpData { public: MTPDserver_DH_inner_data() { } @@ -10514,7 +6905,7 @@ public: MTPint vserver_time; }; -class MTPDclient_DH_inner_data : public mtpDataImpl { +class MTPDclient_DH_inner_data : public mtpData { public: MTPDclient_DH_inner_data() { } @@ -10527,7 +6918,7 @@ public: MTPstring vg_b; }; -class MTPDdh_gen_ok : public mtpDataImpl { +class MTPDdh_gen_ok : public mtpData { public: MTPDdh_gen_ok() { } @@ -10539,7 +6930,7 @@ public: MTPint128 vnew_nonce_hash1; }; -class MTPDdh_gen_retry : public mtpDataImpl { +class MTPDdh_gen_retry : public mtpData { public: MTPDdh_gen_retry() { } @@ -10551,7 +6942,7 @@ public: MTPint128 vnew_nonce_hash2; }; -class MTPDdh_gen_fail : public mtpDataImpl { +class MTPDdh_gen_fail : public mtpData { public: MTPDdh_gen_fail() { } @@ -10563,7 +6954,7 @@ public: MTPint128 vnew_nonce_hash3; }; -class MTPDmsgs_ack : public mtpDataImpl { +class MTPDmsgs_ack : public mtpData { public: MTPDmsgs_ack() { } @@ -10573,7 +6964,7 @@ public: MTPVector vmsg_ids; }; -class MTPDbad_msg_notification : public mtpDataImpl { +class MTPDbad_msg_notification : public mtpData { public: MTPDbad_msg_notification() { } @@ -10585,7 +6976,7 @@ public: MTPint verror_code; }; -class MTPDbad_server_salt : public mtpDataImpl { +class MTPDbad_server_salt : public mtpData { public: MTPDbad_server_salt() { } @@ -10598,7 +6989,7 @@ public: MTPlong vnew_server_salt; }; -class MTPDmsgs_state_req : public mtpDataImpl { +class MTPDmsgs_state_req : public mtpData { public: MTPDmsgs_state_req() { } @@ -10608,7 +6999,7 @@ public: MTPVector vmsg_ids; }; -class MTPDmsgs_state_info : public mtpDataImpl { +class MTPDmsgs_state_info : public mtpData { public: MTPDmsgs_state_info() { } @@ -10619,7 +7010,7 @@ public: MTPstring vinfo; }; -class MTPDmsgs_all_info : public mtpDataImpl { +class MTPDmsgs_all_info : public mtpData { public: MTPDmsgs_all_info() { } @@ -10630,7 +7021,7 @@ public: MTPstring vinfo; }; -class MTPDmsg_detailed_info : public mtpDataImpl { +class MTPDmsg_detailed_info : public mtpData { public: MTPDmsg_detailed_info() { } @@ -10643,7 +7034,7 @@ public: MTPint vstatus; }; -class MTPDmsg_new_detailed_info : public mtpDataImpl { +class MTPDmsg_new_detailed_info : public mtpData { public: MTPDmsg_new_detailed_info() { } @@ -10655,7 +7046,7 @@ public: MTPint vstatus; }; -class MTPDmsg_resend_req : public mtpDataImpl { +class MTPDmsg_resend_req : public mtpData { public: MTPDmsg_resend_req() { } @@ -10665,7 +7056,7 @@ public: MTPVector vmsg_ids; }; -class MTPDrpc_error : public mtpDataImpl { +class MTPDrpc_error : public mtpData { public: MTPDrpc_error() { } @@ -10676,7 +7067,7 @@ public: MTPstring verror_message; }; -class MTPDrpc_answer_dropped : public mtpDataImpl { +class MTPDrpc_answer_dropped : public mtpData { public: MTPDrpc_answer_dropped() { } @@ -10688,7 +7079,7 @@ public: MTPint vbytes; }; -class MTPDfuture_salt : public mtpDataImpl { +class MTPDfuture_salt : public mtpData { public: MTPDfuture_salt() { } @@ -10700,7 +7091,7 @@ public: MTPlong vsalt; }; -class MTPDfuture_salts : public mtpDataImpl { +class MTPDfuture_salts : public mtpData { public: MTPDfuture_salts() { } @@ -10712,7 +7103,7 @@ public: MTPvector vsalts; }; -class MTPDpong : public mtpDataImpl { +class MTPDpong : public mtpData { public: MTPDpong() { } @@ -10723,7 +7114,7 @@ public: MTPlong vping_id; }; -class MTPDdestroy_session_ok : public mtpDataImpl { +class MTPDdestroy_session_ok : public mtpData { public: MTPDdestroy_session_ok() { } @@ -10733,7 +7124,7 @@ public: MTPlong vsession_id; }; -class MTPDdestroy_session_none : public mtpDataImpl { +class MTPDdestroy_session_none : public mtpData { public: MTPDdestroy_session_none() { } @@ -10743,7 +7134,7 @@ public: MTPlong vsession_id; }; -class MTPDnew_session_created : public mtpDataImpl { +class MTPDnew_session_created : public mtpData { public: MTPDnew_session_created() { } @@ -10755,7 +7146,7 @@ public: MTPlong vserver_salt; }; -class MTPDhttp_wait : public mtpDataImpl { +class MTPDhttp_wait : public mtpData { public: MTPDhttp_wait() { } @@ -10767,7 +7158,7 @@ public: MTPint vmax_wait; }; -class MTPDerror : public mtpDataImpl { +class MTPDerror : public mtpData { public: MTPDerror() { } @@ -10778,7 +7169,7 @@ public: MTPstring vtext; }; -class MTPDinputPeerChat : public mtpDataImpl { +class MTPDinputPeerChat : public mtpData { public: MTPDinputPeerChat() { } @@ -10788,7 +7179,7 @@ public: MTPint vchat_id; }; -class MTPDinputPeerUser : public mtpDataImpl { +class MTPDinputPeerUser : public mtpData { public: MTPDinputPeerUser() { } @@ -10799,7 +7190,7 @@ public: MTPlong vaccess_hash; }; -class MTPDinputPeerChannel : public mtpDataImpl { +class MTPDinputPeerChannel : public mtpData { public: MTPDinputPeerChannel() { } @@ -10810,7 +7201,7 @@ public: MTPlong vaccess_hash; }; -class MTPDinputUser : public mtpDataImpl { +class MTPDinputUser : public mtpData { public: MTPDinputUser() { } @@ -10821,7 +7212,7 @@ public: MTPlong vaccess_hash; }; -class MTPDinputPhoneContact : public mtpDataImpl { +class MTPDinputPhoneContact : public mtpData { public: MTPDinputPhoneContact() { } @@ -10834,7 +7225,7 @@ public: MTPstring vlast_name; }; -class MTPDinputFile : public mtpDataImpl { +class MTPDinputFile : public mtpData { public: MTPDinputFile() { } @@ -10847,7 +7238,7 @@ public: MTPstring vmd5_checksum; }; -class MTPDinputFileBig : public mtpDataImpl { +class MTPDinputFileBig : public mtpData { public: MTPDinputFileBig() { } @@ -10859,7 +7250,7 @@ public: MTPstring vname; }; -class MTPDinputMediaUploadedPhoto : public mtpDataImpl { +class MTPDinputMediaUploadedPhoto : public mtpData { public: enum class Flag : int32 { f_stickers = (1 << 0), @@ -10881,7 +7272,7 @@ public: MTPVector vstickers; }; -class MTPDinputMediaPhoto : public mtpDataImpl { +class MTPDinputMediaPhoto : public mtpData { public: MTPDinputMediaPhoto() { } @@ -10892,7 +7283,7 @@ public: MTPstring vcaption; }; -class MTPDinputMediaGeoPoint : public mtpDataImpl { +class MTPDinputMediaGeoPoint : public mtpData { public: MTPDinputMediaGeoPoint() { } @@ -10902,7 +7293,7 @@ public: MTPInputGeoPoint vgeo_point; }; -class MTPDinputMediaContact : public mtpDataImpl { +class MTPDinputMediaContact : public mtpData { public: MTPDinputMediaContact() { } @@ -10914,7 +7305,7 @@ public: MTPstring vlast_name; }; -class MTPDinputMediaUploadedDocument : public mtpDataImpl { +class MTPDinputMediaUploadedDocument : public mtpData { public: enum class Flag : int32 { f_stickers = (1 << 0), @@ -10938,7 +7329,7 @@ public: MTPVector vstickers; }; -class MTPDinputMediaUploadedThumbDocument : public mtpDataImpl { +class MTPDinputMediaUploadedThumbDocument : public mtpData { public: enum class Flag : int32 { f_stickers = (1 << 0), @@ -10963,7 +7354,7 @@ public: MTPVector vstickers; }; -class MTPDinputMediaDocument : public mtpDataImpl { +class MTPDinputMediaDocument : public mtpData { public: MTPDinputMediaDocument() { } @@ -10974,7 +7365,7 @@ public: MTPstring vcaption; }; -class MTPDinputMediaVenue : public mtpDataImpl { +class MTPDinputMediaVenue : public mtpData { public: MTPDinputMediaVenue() { } @@ -10988,7 +7379,7 @@ public: MTPstring vvenue_id; }; -class MTPDinputMediaGifExternal : public mtpDataImpl { +class MTPDinputMediaGifExternal : public mtpData { public: MTPDinputMediaGifExternal() { } @@ -10999,7 +7390,7 @@ public: MTPstring vq; }; -class MTPDinputMediaPhotoExternal : public mtpDataImpl { +class MTPDinputMediaPhotoExternal : public mtpData { public: MTPDinputMediaPhotoExternal() { } @@ -11010,7 +7401,7 @@ public: MTPstring vcaption; }; -class MTPDinputMediaDocumentExternal : public mtpDataImpl { +class MTPDinputMediaDocumentExternal : public mtpData { public: MTPDinputMediaDocumentExternal() { } @@ -11021,7 +7412,7 @@ public: MTPstring vcaption; }; -class MTPDinputMediaGame : public mtpDataImpl { +class MTPDinputMediaGame : public mtpData { public: MTPDinputMediaGame() { } @@ -11031,7 +7422,7 @@ public: MTPInputGame vid; }; -class MTPDinputChatUploadedPhoto : public mtpDataImpl { +class MTPDinputChatUploadedPhoto : public mtpData { public: MTPDinputChatUploadedPhoto() { } @@ -11041,7 +7432,7 @@ public: MTPInputFile vfile; }; -class MTPDinputChatPhoto : public mtpDataImpl { +class MTPDinputChatPhoto : public mtpData { public: MTPDinputChatPhoto() { } @@ -11051,7 +7442,7 @@ public: MTPInputPhoto vid; }; -class MTPDinputGeoPoint : public mtpDataImpl { +class MTPDinputGeoPoint : public mtpData { public: MTPDinputGeoPoint() { } @@ -11062,7 +7453,7 @@ public: MTPdouble vlong; }; -class MTPDinputPhoto : public mtpDataImpl { +class MTPDinputPhoto : public mtpData { public: MTPDinputPhoto() { } @@ -11073,7 +7464,7 @@ public: MTPlong vaccess_hash; }; -class MTPDinputFileLocation : public mtpDataImpl { +class MTPDinputFileLocation : public mtpData { public: MTPDinputFileLocation() { } @@ -11085,7 +7476,7 @@ public: MTPlong vsecret; }; -class MTPDinputEncryptedFileLocation : public mtpDataImpl { +class MTPDinputEncryptedFileLocation : public mtpData { public: MTPDinputEncryptedFileLocation() { } @@ -11096,7 +7487,7 @@ public: MTPlong vaccess_hash; }; -class MTPDinputDocumentFileLocation : public mtpDataImpl { +class MTPDinputDocumentFileLocation : public mtpData { public: MTPDinputDocumentFileLocation() { } @@ -11108,7 +7499,7 @@ public: MTPint vversion; }; -class MTPDinputAppEvent : public mtpDataImpl { +class MTPDinputAppEvent : public mtpData { public: MTPDinputAppEvent() { } @@ -11121,7 +7512,7 @@ public: MTPstring vdata; }; -class MTPDpeerUser : public mtpDataImpl { +class MTPDpeerUser : public mtpData { public: MTPDpeerUser() { } @@ -11131,7 +7522,7 @@ public: MTPint vuser_id; }; -class MTPDpeerChat : public mtpDataImpl { +class MTPDpeerChat : public mtpData { public: MTPDpeerChat() { } @@ -11141,7 +7532,7 @@ public: MTPint vchat_id; }; -class MTPDpeerChannel : public mtpDataImpl { +class MTPDpeerChannel : public mtpData { public: MTPDpeerChannel() { } @@ -11151,7 +7542,7 @@ public: MTPint vchannel_id; }; -class MTPDfileLocationUnavailable : public mtpDataImpl { +class MTPDfileLocationUnavailable : public mtpData { public: MTPDfileLocationUnavailable() { } @@ -11163,7 +7554,7 @@ public: MTPlong vsecret; }; -class MTPDfileLocation : public mtpDataImpl { +class MTPDfileLocation : public mtpData { public: MTPDfileLocation() { } @@ -11176,7 +7567,7 @@ public: MTPlong vsecret; }; -class MTPDuserEmpty : public mtpDataImpl { +class MTPDuserEmpty : public mtpData { public: MTPDuserEmpty() { } @@ -11186,7 +7577,7 @@ public: MTPint vid; }; -class MTPDuser : public mtpDataImpl { +class MTPDuser : public mtpData { public: enum class Flag : int32 { f_self = (1 << 10), @@ -11257,7 +7648,7 @@ public: MTPstring vbot_inline_placeholder; }; -class MTPDuserProfilePhoto : public mtpDataImpl { +class MTPDuserProfilePhoto : public mtpData { public: MTPDuserProfilePhoto() { } @@ -11269,7 +7660,7 @@ public: MTPFileLocation vphoto_big; }; -class MTPDuserStatusOnline : public mtpDataImpl { +class MTPDuserStatusOnline : public mtpData { public: MTPDuserStatusOnline() { } @@ -11279,7 +7670,7 @@ public: MTPint vexpires; }; -class MTPDuserStatusOffline : public mtpDataImpl { +class MTPDuserStatusOffline : public mtpData { public: MTPDuserStatusOffline() { } @@ -11289,7 +7680,7 @@ public: MTPint vwas_online; }; -class MTPDchatEmpty : public mtpDataImpl { +class MTPDchatEmpty : public mtpData { public: MTPDchatEmpty() { } @@ -11299,7 +7690,7 @@ public: MTPint vid; }; -class MTPDchat : public mtpDataImpl { +class MTPDchat : public mtpData { public: enum class Flag : int32 { f_creator = (1 << 0), @@ -11338,7 +7729,7 @@ public: MTPInputChannel vmigrated_to; }; -class MTPDchatForbidden : public mtpDataImpl { +class MTPDchatForbidden : public mtpData { public: MTPDchatForbidden() { } @@ -11349,7 +7740,7 @@ public: MTPstring vtitle; }; -class MTPDchannel : public mtpDataImpl { +class MTPDchannel : public mtpData { public: enum class Flag : int32 { f_creator = (1 << 0), @@ -11405,7 +7796,7 @@ public: MTPstring vrestriction_reason; }; -class MTPDchannelForbidden : public mtpDataImpl { +class MTPDchannelForbidden : public mtpData { public: enum class Flag : int32 { f_broadcast = (1 << 5), @@ -11430,7 +7821,7 @@ public: MTPstring vtitle; }; -class MTPDchatFull : public mtpDataImpl { +class MTPDchatFull : public mtpData { public: MTPDchatFull() { } @@ -11445,7 +7836,7 @@ public: MTPVector vbot_info; }; -class MTPDchannelFull : public mtpDataImpl { +class MTPDchannelFull : public mtpData { public: enum class Flag : int32 { f_can_view_participants = (1 << 3), @@ -11494,7 +7885,7 @@ public: MTPint vpinned_msg_id; }; -class MTPDchatParticipant : public mtpDataImpl { +class MTPDchatParticipant : public mtpData { public: MTPDchatParticipant() { } @@ -11506,7 +7897,7 @@ public: MTPint vdate; }; -class MTPDchatParticipantCreator : public mtpDataImpl { +class MTPDchatParticipantCreator : public mtpData { public: MTPDchatParticipantCreator() { } @@ -11516,7 +7907,7 @@ public: MTPint vuser_id; }; -class MTPDchatParticipantAdmin : public mtpDataImpl { +class MTPDchatParticipantAdmin : public mtpData { public: MTPDchatParticipantAdmin() { } @@ -11528,7 +7919,7 @@ public: MTPint vdate; }; -class MTPDchatParticipantsForbidden : public mtpDataImpl { +class MTPDchatParticipantsForbidden : public mtpData { public: enum class Flag : int32 { f_self_participant = (1 << 0), @@ -11549,7 +7940,7 @@ public: MTPChatParticipant vself_participant; }; -class MTPDchatParticipants : public mtpDataImpl { +class MTPDchatParticipants : public mtpData { public: MTPDchatParticipants() { } @@ -11561,7 +7952,7 @@ public: MTPint vversion; }; -class MTPDchatPhoto : public mtpDataImpl { +class MTPDchatPhoto : public mtpData { public: MTPDchatPhoto() { } @@ -11572,7 +7963,7 @@ public: MTPFileLocation vphoto_big; }; -class MTPDmessageEmpty : public mtpDataImpl { +class MTPDmessageEmpty : public mtpData { public: MTPDmessageEmpty() { } @@ -11582,7 +7973,7 @@ public: MTPint vid; }; -class MTPDmessage : public mtpDataImpl { +class MTPDmessage : public mtpData { public: enum class Flag : int32 { f_out = (1 << 1), @@ -11641,7 +8032,7 @@ public: MTPint vedit_date; }; -class MTPDmessageService : public mtpDataImpl { +class MTPDmessageService : public mtpData { public: enum class Flag : int32 { f_out = (1 << 1), @@ -11679,7 +8070,7 @@ public: MTPMessageAction vaction; }; -class MTPDmessageMediaPhoto : public mtpDataImpl { +class MTPDmessageMediaPhoto : public mtpData { public: MTPDmessageMediaPhoto() { } @@ -11690,7 +8081,7 @@ public: MTPstring vcaption; }; -class MTPDmessageMediaGeo : public mtpDataImpl { +class MTPDmessageMediaGeo : public mtpData { public: MTPDmessageMediaGeo() { } @@ -11700,7 +8091,7 @@ public: MTPGeoPoint vgeo; }; -class MTPDmessageMediaContact : public mtpDataImpl { +class MTPDmessageMediaContact : public mtpData { public: MTPDmessageMediaContact() { } @@ -11713,7 +8104,7 @@ public: MTPint vuser_id; }; -class MTPDmessageMediaDocument : public mtpDataImpl { +class MTPDmessageMediaDocument : public mtpData { public: MTPDmessageMediaDocument() { } @@ -11724,7 +8115,7 @@ public: MTPstring vcaption; }; -class MTPDmessageMediaWebPage : public mtpDataImpl { +class MTPDmessageMediaWebPage : public mtpData { public: MTPDmessageMediaWebPage() { } @@ -11734,7 +8125,7 @@ public: MTPWebPage vwebpage; }; -class MTPDmessageMediaVenue : public mtpDataImpl { +class MTPDmessageMediaVenue : public mtpData { public: MTPDmessageMediaVenue() { } @@ -11748,7 +8139,7 @@ public: MTPstring vvenue_id; }; -class MTPDmessageMediaGame : public mtpDataImpl { +class MTPDmessageMediaGame : public mtpData { public: MTPDmessageMediaGame() { } @@ -11758,7 +8149,7 @@ public: MTPGame vgame; }; -class MTPDmessageActionChatCreate : public mtpDataImpl { +class MTPDmessageActionChatCreate : public mtpData { public: MTPDmessageActionChatCreate() { } @@ -11769,7 +8160,7 @@ public: MTPVector vusers; }; -class MTPDmessageActionChatEditTitle : public mtpDataImpl { +class MTPDmessageActionChatEditTitle : public mtpData { public: MTPDmessageActionChatEditTitle() { } @@ -11779,7 +8170,7 @@ public: MTPstring vtitle; }; -class MTPDmessageActionChatEditPhoto : public mtpDataImpl { +class MTPDmessageActionChatEditPhoto : public mtpData { public: MTPDmessageActionChatEditPhoto() { } @@ -11789,7 +8180,7 @@ public: MTPPhoto vphoto; }; -class MTPDmessageActionChatAddUser : public mtpDataImpl { +class MTPDmessageActionChatAddUser : public mtpData { public: MTPDmessageActionChatAddUser() { } @@ -11799,7 +8190,7 @@ public: MTPVector vusers; }; -class MTPDmessageActionChatDeleteUser : public mtpDataImpl { +class MTPDmessageActionChatDeleteUser : public mtpData { public: MTPDmessageActionChatDeleteUser() { } @@ -11809,7 +8200,7 @@ public: MTPint vuser_id; }; -class MTPDmessageActionChatJoinedByLink : public mtpDataImpl { +class MTPDmessageActionChatJoinedByLink : public mtpData { public: MTPDmessageActionChatJoinedByLink() { } @@ -11819,7 +8210,7 @@ public: MTPint vinviter_id; }; -class MTPDmessageActionChannelCreate : public mtpDataImpl { +class MTPDmessageActionChannelCreate : public mtpData { public: MTPDmessageActionChannelCreate() { } @@ -11829,7 +8220,7 @@ public: MTPstring vtitle; }; -class MTPDmessageActionChatMigrateTo : public mtpDataImpl { +class MTPDmessageActionChatMigrateTo : public mtpData { public: MTPDmessageActionChatMigrateTo() { } @@ -11839,7 +8230,7 @@ public: MTPint vchannel_id; }; -class MTPDmessageActionChannelMigrateFrom : public mtpDataImpl { +class MTPDmessageActionChannelMigrateFrom : public mtpData { public: MTPDmessageActionChannelMigrateFrom() { } @@ -11850,7 +8241,7 @@ public: MTPint vchat_id; }; -class MTPDmessageActionGameScore : public mtpDataImpl { +class MTPDmessageActionGameScore : public mtpData { public: MTPDmessageActionGameScore() { } @@ -11861,7 +8252,7 @@ public: MTPint vscore; }; -class MTPDmessageActionPhoneCall : public mtpDataImpl { +class MTPDmessageActionPhoneCall : public mtpData { public: enum class Flag : int32 { f_reason = (1 << 0), @@ -11886,7 +8277,7 @@ public: MTPint vduration; }; -class MTPDdialog : public mtpDataImpl { +class MTPDdialog : public mtpData { public: enum class Flag : int32 { f_pinned = (1 << 2), @@ -11918,7 +8309,7 @@ public: MTPDraftMessage vdraft; }; -class MTPDphotoEmpty : public mtpDataImpl { +class MTPDphotoEmpty : public mtpData { public: MTPDphotoEmpty() { } @@ -11928,7 +8319,7 @@ public: MTPlong vid; }; -class MTPDphoto : public mtpDataImpl { +class MTPDphoto : public mtpData { public: enum class Flag : int32 { f_has_stickers = (1 << 0), @@ -11951,7 +8342,7 @@ public: MTPVector vsizes; }; -class MTPDphotoSizeEmpty : public mtpDataImpl { +class MTPDphotoSizeEmpty : public mtpData { public: MTPDphotoSizeEmpty() { } @@ -11961,7 +8352,7 @@ public: MTPstring vtype; }; -class MTPDphotoSize : public mtpDataImpl { +class MTPDphotoSize : public mtpData { public: MTPDphotoSize() { } @@ -11975,7 +8366,7 @@ public: MTPint vsize; }; -class MTPDphotoCachedSize : public mtpDataImpl { +class MTPDphotoCachedSize : public mtpData { public: MTPDphotoCachedSize() { } @@ -11989,7 +8380,7 @@ public: MTPbytes vbytes; }; -class MTPDgeoPoint : public mtpDataImpl { +class MTPDgeoPoint : public mtpData { public: MTPDgeoPoint() { } @@ -12000,7 +8391,7 @@ public: MTPdouble vlat; }; -class MTPDauth_checkedPhone : public mtpDataImpl { +class MTPDauth_checkedPhone : public mtpData { public: MTPDauth_checkedPhone() { } @@ -12010,7 +8401,7 @@ public: MTPBool vphone_registered; }; -class MTPDauth_sentCode : public mtpDataImpl { +class MTPDauth_sentCode : public mtpData { public: enum class Flag : int32 { f_phone_registered = (1 << 0), @@ -12038,7 +8429,7 @@ public: MTPint vtimeout; }; -class MTPDauth_authorization : public mtpDataImpl { +class MTPDauth_authorization : public mtpData { public: enum class Flag : int32 { f_tmp_sessions = (1 << 0), @@ -12059,7 +8450,7 @@ public: MTPUser vuser; }; -class MTPDauth_exportedAuthorization : public mtpDataImpl { +class MTPDauth_exportedAuthorization : public mtpData { public: MTPDauth_exportedAuthorization() { } @@ -12070,7 +8461,7 @@ public: MTPbytes vbytes; }; -class MTPDinputNotifyPeer : public mtpDataImpl { +class MTPDinputNotifyPeer : public mtpData { public: MTPDinputNotifyPeer() { } @@ -12080,7 +8471,7 @@ public: MTPInputPeer vpeer; }; -class MTPDinputPeerNotifySettings : public mtpDataImpl { +class MTPDinputPeerNotifySettings : public mtpData { public: enum class Flag : int32 { f_show_previews = (1 << 0), @@ -12104,7 +8495,7 @@ public: MTPstring vsound; }; -class MTPDpeerNotifySettings : public mtpDataImpl { +class MTPDpeerNotifySettings : public mtpData { public: enum class Flag : int32 { f_show_previews = (1 << 0), @@ -12128,7 +8519,7 @@ public: MTPstring vsound; }; -class MTPDpeerSettings : public mtpDataImpl { +class MTPDpeerSettings : public mtpData { public: enum class Flag : int32 { f_report_spam = (1 << 0), @@ -12147,7 +8538,7 @@ public: MTPflags vflags; }; -class MTPDwallPaper : public mtpDataImpl { +class MTPDwallPaper : public mtpData { public: MTPDwallPaper() { } @@ -12160,7 +8551,7 @@ public: MTPint vcolor; }; -class MTPDwallPaperSolid : public mtpDataImpl { +class MTPDwallPaperSolid : public mtpData { public: MTPDwallPaperSolid() { } @@ -12173,7 +8564,7 @@ public: MTPint vcolor; }; -class MTPDinputReportReasonOther : public mtpDataImpl { +class MTPDinputReportReasonOther : public mtpData { public: MTPDinputReportReasonOther() { } @@ -12183,7 +8574,7 @@ public: MTPstring vtext; }; -class MTPDuserFull : public mtpDataImpl { +class MTPDuserFull : public mtpData { public: enum class Flag : int32 { f_blocked = (1 << 0), @@ -12218,7 +8609,7 @@ public: MTPint vcommon_chats_count; }; -class MTPDcontact : public mtpDataImpl { +class MTPDcontact : public mtpData { public: MTPDcontact() { } @@ -12229,7 +8620,7 @@ public: MTPBool vmutual; }; -class MTPDimportedContact : public mtpDataImpl { +class MTPDimportedContact : public mtpData { public: MTPDimportedContact() { } @@ -12240,7 +8631,7 @@ public: MTPlong vclient_id; }; -class MTPDcontactBlocked : public mtpDataImpl { +class MTPDcontactBlocked : public mtpData { public: MTPDcontactBlocked() { } @@ -12251,7 +8642,7 @@ public: MTPint vdate; }; -class MTPDcontactStatus : public mtpDataImpl { +class MTPDcontactStatus : public mtpData { public: MTPDcontactStatus() { } @@ -12262,7 +8653,7 @@ public: MTPUserStatus vstatus; }; -class MTPDcontacts_link : public mtpDataImpl { +class MTPDcontacts_link : public mtpData { public: MTPDcontacts_link() { } @@ -12274,7 +8665,7 @@ public: MTPUser vuser; }; -class MTPDcontacts_contacts : public mtpDataImpl { +class MTPDcontacts_contacts : public mtpData { public: MTPDcontacts_contacts() { } @@ -12285,7 +8676,7 @@ public: MTPVector vusers; }; -class MTPDcontacts_importedContacts : public mtpDataImpl { +class MTPDcontacts_importedContacts : public mtpData { public: MTPDcontacts_importedContacts() { } @@ -12297,7 +8688,7 @@ public: MTPVector vusers; }; -class MTPDcontacts_blocked : public mtpDataImpl { +class MTPDcontacts_blocked : public mtpData { public: MTPDcontacts_blocked() { } @@ -12308,7 +8699,7 @@ public: MTPVector vusers; }; -class MTPDcontacts_blockedSlice : public mtpDataImpl { +class MTPDcontacts_blockedSlice : public mtpData { public: MTPDcontacts_blockedSlice() { } @@ -12320,7 +8711,7 @@ public: MTPVector vusers; }; -class MTPDmessages_dialogs : public mtpDataImpl { +class MTPDmessages_dialogs : public mtpData { public: MTPDmessages_dialogs() { } @@ -12333,7 +8724,7 @@ public: MTPVector vusers; }; -class MTPDmessages_dialogsSlice : public mtpDataImpl { +class MTPDmessages_dialogsSlice : public mtpData { public: MTPDmessages_dialogsSlice() { } @@ -12347,7 +8738,7 @@ public: MTPVector vusers; }; -class MTPDmessages_messages : public mtpDataImpl { +class MTPDmessages_messages : public mtpData { public: MTPDmessages_messages() { } @@ -12359,7 +8750,7 @@ public: MTPVector vusers; }; -class MTPDmessages_messagesSlice : public mtpDataImpl { +class MTPDmessages_messagesSlice : public mtpData { public: MTPDmessages_messagesSlice() { } @@ -12372,7 +8763,7 @@ public: MTPVector vusers; }; -class MTPDmessages_channelMessages : public mtpDataImpl { +class MTPDmessages_channelMessages : public mtpData { public: enum class Flag : int32 { MAX_FIELD = (1 << 0), @@ -12393,7 +8784,7 @@ public: MTPVector vusers; }; -class MTPDmessages_chats : public mtpDataImpl { +class MTPDmessages_chats : public mtpData { public: MTPDmessages_chats() { } @@ -12403,7 +8794,7 @@ public: MTPVector vchats; }; -class MTPDmessages_chatsSlice : public mtpDataImpl { +class MTPDmessages_chatsSlice : public mtpData { public: MTPDmessages_chatsSlice() { } @@ -12414,7 +8805,7 @@ public: MTPVector vchats; }; -class MTPDmessages_chatFull : public mtpDataImpl { +class MTPDmessages_chatFull : public mtpData { public: MTPDmessages_chatFull() { } @@ -12426,7 +8817,7 @@ public: MTPVector vusers; }; -class MTPDmessages_affectedHistory : public mtpDataImpl { +class MTPDmessages_affectedHistory : public mtpData { public: MTPDmessages_affectedHistory() { } @@ -12438,7 +8829,7 @@ public: MTPint voffset; }; -class MTPDinputMessagesFilterPhoneCalls : public mtpDataImpl { +class MTPDinputMessagesFilterPhoneCalls : public mtpData { public: enum class Flag : int32 { f_missed = (1 << 0), @@ -12457,7 +8848,7 @@ public: MTPflags vflags; }; -class MTPDupdateNewMessage : public mtpDataImpl { +class MTPDupdateNewMessage : public mtpData { public: MTPDupdateNewMessage() { } @@ -12469,7 +8860,7 @@ public: MTPint vpts_count; }; -class MTPDupdateMessageID : public mtpDataImpl { +class MTPDupdateMessageID : public mtpData { public: MTPDupdateMessageID() { } @@ -12480,7 +8871,7 @@ public: MTPlong vrandom_id; }; -class MTPDupdateDeleteMessages : public mtpDataImpl { +class MTPDupdateDeleteMessages : public mtpData { public: MTPDupdateDeleteMessages() { } @@ -12492,7 +8883,7 @@ public: MTPint vpts_count; }; -class MTPDupdateUserTyping : public mtpDataImpl { +class MTPDupdateUserTyping : public mtpData { public: MTPDupdateUserTyping() { } @@ -12503,7 +8894,7 @@ public: MTPSendMessageAction vaction; }; -class MTPDupdateChatUserTyping : public mtpDataImpl { +class MTPDupdateChatUserTyping : public mtpData { public: MTPDupdateChatUserTyping() { } @@ -12515,7 +8906,7 @@ public: MTPSendMessageAction vaction; }; -class MTPDupdateChatParticipants : public mtpDataImpl { +class MTPDupdateChatParticipants : public mtpData { public: MTPDupdateChatParticipants() { } @@ -12525,7 +8916,7 @@ public: MTPChatParticipants vparticipants; }; -class MTPDupdateUserStatus : public mtpDataImpl { +class MTPDupdateUserStatus : public mtpData { public: MTPDupdateUserStatus() { } @@ -12536,7 +8927,7 @@ public: MTPUserStatus vstatus; }; -class MTPDupdateUserName : public mtpDataImpl { +class MTPDupdateUserName : public mtpData { public: MTPDupdateUserName() { } @@ -12549,7 +8940,7 @@ public: MTPstring vusername; }; -class MTPDupdateUserPhoto : public mtpDataImpl { +class MTPDupdateUserPhoto : public mtpData { public: MTPDupdateUserPhoto() { } @@ -12562,7 +8953,7 @@ public: MTPBool vprevious; }; -class MTPDupdateContactRegistered : public mtpDataImpl { +class MTPDupdateContactRegistered : public mtpData { public: MTPDupdateContactRegistered() { } @@ -12573,7 +8964,7 @@ public: MTPint vdate; }; -class MTPDupdateContactLink : public mtpDataImpl { +class MTPDupdateContactLink : public mtpData { public: MTPDupdateContactLink() { } @@ -12585,7 +8976,7 @@ public: MTPContactLink vforeign_link; }; -class MTPDupdateNewEncryptedMessage : public mtpDataImpl { +class MTPDupdateNewEncryptedMessage : public mtpData { public: MTPDupdateNewEncryptedMessage() { } @@ -12596,7 +8987,7 @@ public: MTPint vqts; }; -class MTPDupdateEncryptedChatTyping : public mtpDataImpl { +class MTPDupdateEncryptedChatTyping : public mtpData { public: MTPDupdateEncryptedChatTyping() { } @@ -12606,7 +8997,7 @@ public: MTPint vchat_id; }; -class MTPDupdateEncryption : public mtpDataImpl { +class MTPDupdateEncryption : public mtpData { public: MTPDupdateEncryption() { } @@ -12617,7 +9008,7 @@ public: MTPint vdate; }; -class MTPDupdateEncryptedMessagesRead : public mtpDataImpl { +class MTPDupdateEncryptedMessagesRead : public mtpData { public: MTPDupdateEncryptedMessagesRead() { } @@ -12629,7 +9020,7 @@ public: MTPint vdate; }; -class MTPDupdateChatParticipantAdd : public mtpDataImpl { +class MTPDupdateChatParticipantAdd : public mtpData { public: MTPDupdateChatParticipantAdd() { } @@ -12643,7 +9034,7 @@ public: MTPint vversion; }; -class MTPDupdateChatParticipantDelete : public mtpDataImpl { +class MTPDupdateChatParticipantDelete : public mtpData { public: MTPDupdateChatParticipantDelete() { } @@ -12655,7 +9046,7 @@ public: MTPint vversion; }; -class MTPDupdateDcOptions : public mtpDataImpl { +class MTPDupdateDcOptions : public mtpData { public: MTPDupdateDcOptions() { } @@ -12665,7 +9056,7 @@ public: MTPVector vdc_options; }; -class MTPDupdateUserBlocked : public mtpDataImpl { +class MTPDupdateUserBlocked : public mtpData { public: MTPDupdateUserBlocked() { } @@ -12676,7 +9067,7 @@ public: MTPBool vblocked; }; -class MTPDupdateNotifySettings : public mtpDataImpl { +class MTPDupdateNotifySettings : public mtpData { public: MTPDupdateNotifySettings() { } @@ -12687,7 +9078,7 @@ public: MTPPeerNotifySettings vnotify_settings; }; -class MTPDupdateServiceNotification : public mtpDataImpl { +class MTPDupdateServiceNotification : public mtpData { public: enum class Flag : int32 { f_popup = (1 << 0), @@ -12714,7 +9105,7 @@ public: MTPVector ventities; }; -class MTPDupdatePrivacy : public mtpDataImpl { +class MTPDupdatePrivacy : public mtpData { public: MTPDupdatePrivacy() { } @@ -12725,7 +9116,7 @@ public: MTPVector vrules; }; -class MTPDupdateUserPhone : public mtpDataImpl { +class MTPDupdateUserPhone : public mtpData { public: MTPDupdateUserPhone() { } @@ -12736,7 +9127,7 @@ public: MTPstring vphone; }; -class MTPDupdateReadHistoryInbox : public mtpDataImpl { +class MTPDupdateReadHistoryInbox : public mtpData { public: MTPDupdateReadHistoryInbox() { } @@ -12749,7 +9140,7 @@ public: MTPint vpts_count; }; -class MTPDupdateReadHistoryOutbox : public mtpDataImpl { +class MTPDupdateReadHistoryOutbox : public mtpData { public: MTPDupdateReadHistoryOutbox() { } @@ -12762,7 +9153,7 @@ public: MTPint vpts_count; }; -class MTPDupdateWebPage : public mtpDataImpl { +class MTPDupdateWebPage : public mtpData { public: MTPDupdateWebPage() { } @@ -12774,7 +9165,7 @@ public: MTPint vpts_count; }; -class MTPDupdateReadMessagesContents : public mtpDataImpl { +class MTPDupdateReadMessagesContents : public mtpData { public: MTPDupdateReadMessagesContents() { } @@ -12786,7 +9177,7 @@ public: MTPint vpts_count; }; -class MTPDupdateChannelTooLong : public mtpDataImpl { +class MTPDupdateChannelTooLong : public mtpData { public: enum class Flag : int32 { f_pts = (1 << 0), @@ -12807,7 +9198,7 @@ public: MTPint vpts; }; -class MTPDupdateChannel : public mtpDataImpl { +class MTPDupdateChannel : public mtpData { public: MTPDupdateChannel() { } @@ -12817,7 +9208,7 @@ public: MTPint vchannel_id; }; -class MTPDupdateNewChannelMessage : public mtpDataImpl { +class MTPDupdateNewChannelMessage : public mtpData { public: MTPDupdateNewChannelMessage() { } @@ -12829,7 +9220,7 @@ public: MTPint vpts_count; }; -class MTPDupdateReadChannelInbox : public mtpDataImpl { +class MTPDupdateReadChannelInbox : public mtpData { public: MTPDupdateReadChannelInbox() { } @@ -12840,7 +9231,7 @@ public: MTPint vmax_id; }; -class MTPDupdateDeleteChannelMessages : public mtpDataImpl { +class MTPDupdateDeleteChannelMessages : public mtpData { public: MTPDupdateDeleteChannelMessages() { } @@ -12853,7 +9244,7 @@ public: MTPint vpts_count; }; -class MTPDupdateChannelMessageViews : public mtpDataImpl { +class MTPDupdateChannelMessageViews : public mtpData { public: MTPDupdateChannelMessageViews() { } @@ -12865,7 +9256,7 @@ public: MTPint vviews; }; -class MTPDupdateChatAdmins : public mtpDataImpl { +class MTPDupdateChatAdmins : public mtpData { public: MTPDupdateChatAdmins() { } @@ -12877,7 +9268,7 @@ public: MTPint vversion; }; -class MTPDupdateChatParticipantAdmin : public mtpDataImpl { +class MTPDupdateChatParticipantAdmin : public mtpData { public: MTPDupdateChatParticipantAdmin() { } @@ -12890,7 +9281,7 @@ public: MTPint vversion; }; -class MTPDupdateNewStickerSet : public mtpDataImpl { +class MTPDupdateNewStickerSet : public mtpData { public: MTPDupdateNewStickerSet() { } @@ -12900,7 +9291,7 @@ public: MTPmessages_StickerSet vstickerset; }; -class MTPDupdateStickerSetsOrder : public mtpDataImpl { +class MTPDupdateStickerSetsOrder : public mtpData { public: enum class Flag : int32 { f_masks = (1 << 0), @@ -12920,7 +9311,7 @@ public: MTPVector vorder; }; -class MTPDupdateBotInlineQuery : public mtpDataImpl { +class MTPDupdateBotInlineQuery : public mtpData { public: enum class Flag : int32 { f_geo = (1 << 0), @@ -12944,7 +9335,7 @@ public: MTPstring voffset; }; -class MTPDupdateBotInlineSend : public mtpDataImpl { +class MTPDupdateBotInlineSend : public mtpData { public: enum class Flag : int32 { f_geo = (1 << 0), @@ -12971,7 +9362,7 @@ public: MTPInputBotInlineMessageID vmsg_id; }; -class MTPDupdateEditChannelMessage : public mtpDataImpl { +class MTPDupdateEditChannelMessage : public mtpData { public: MTPDupdateEditChannelMessage() { } @@ -12983,7 +9374,7 @@ public: MTPint vpts_count; }; -class MTPDupdateChannelPinnedMessage : public mtpDataImpl { +class MTPDupdateChannelPinnedMessage : public mtpData { public: MTPDupdateChannelPinnedMessage() { } @@ -12994,7 +9385,7 @@ public: MTPint vid; }; -class MTPDupdateBotCallbackQuery : public mtpDataImpl { +class MTPDupdateBotCallbackQuery : public mtpData { public: enum class Flag : int32 { f_data = (1 << 0), @@ -13023,7 +9414,7 @@ public: MTPstring vgame_short_name; }; -class MTPDupdateEditMessage : public mtpDataImpl { +class MTPDupdateEditMessage : public mtpData { public: MTPDupdateEditMessage() { } @@ -13035,7 +9426,7 @@ public: MTPint vpts_count; }; -class MTPDupdateInlineBotCallbackQuery : public mtpDataImpl { +class MTPDupdateInlineBotCallbackQuery : public mtpData { public: enum class Flag : int32 { f_data = (1 << 0), @@ -13063,7 +9454,7 @@ public: MTPstring vgame_short_name; }; -class MTPDupdateReadChannelOutbox : public mtpDataImpl { +class MTPDupdateReadChannelOutbox : public mtpData { public: MTPDupdateReadChannelOutbox() { } @@ -13074,7 +9465,7 @@ public: MTPint vmax_id; }; -class MTPDupdateDraftMessage : public mtpDataImpl { +class MTPDupdateDraftMessage : public mtpData { public: MTPDupdateDraftMessage() { } @@ -13085,7 +9476,7 @@ public: MTPDraftMessage vdraft; }; -class MTPDupdateChannelWebPage : public mtpDataImpl { +class MTPDupdateChannelWebPage : public mtpData { public: MTPDupdateChannelWebPage() { } @@ -13098,7 +9489,7 @@ public: MTPint vpts_count; }; -class MTPDupdatePhoneCall : public mtpDataImpl { +class MTPDupdatePhoneCall : public mtpData { public: MTPDupdatePhoneCall() { } @@ -13108,7 +9499,7 @@ public: MTPPhoneCall vphone_call; }; -class MTPDupdateDialogPinned : public mtpDataImpl { +class MTPDupdateDialogPinned : public mtpData { public: enum class Flag : int32 { f_pinned = (1 << 0), @@ -13128,7 +9519,7 @@ public: MTPPeer vpeer; }; -class MTPDupdatePinnedDialogs : public mtpDataImpl { +class MTPDupdatePinnedDialogs : public mtpData { public: enum class Flag : int32 { f_order = (1 << 0), @@ -13148,7 +9539,7 @@ public: MTPVector vorder; }; -class MTPDupdates_state : public mtpDataImpl { +class MTPDupdates_state : public mtpData { public: MTPDupdates_state() { } @@ -13162,7 +9553,7 @@ public: MTPint vunread_count; }; -class MTPDupdates_differenceEmpty : public mtpDataImpl { +class MTPDupdates_differenceEmpty : public mtpData { public: MTPDupdates_differenceEmpty() { } @@ -13173,7 +9564,7 @@ public: MTPint vseq; }; -class MTPDupdates_difference : public mtpDataImpl { +class MTPDupdates_difference : public mtpData { public: MTPDupdates_difference() { } @@ -13188,7 +9579,7 @@ public: MTPupdates_State vstate; }; -class MTPDupdates_differenceSlice : public mtpDataImpl { +class MTPDupdates_differenceSlice : public mtpData { public: MTPDupdates_differenceSlice() { } @@ -13203,7 +9594,7 @@ public: MTPupdates_State vintermediate_state; }; -class MTPDupdates_differenceTooLong : public mtpDataImpl { +class MTPDupdates_differenceTooLong : public mtpData { public: MTPDupdates_differenceTooLong() { } @@ -13213,7 +9604,7 @@ public: MTPint vpts; }; -class MTPDupdateShortMessage : public mtpDataImpl { +class MTPDupdateShortMessage : public mtpData { public: enum class Flag : int32 { f_out = (1 << 1), @@ -13257,7 +9648,7 @@ public: MTPVector ventities; }; -class MTPDupdateShortChatMessage : public mtpDataImpl { +class MTPDupdateShortChatMessage : public mtpData { public: enum class Flag : int32 { f_out = (1 << 1), @@ -13302,7 +9693,7 @@ public: MTPVector ventities; }; -class MTPDupdateShort : public mtpDataImpl { +class MTPDupdateShort : public mtpData { public: MTPDupdateShort() { } @@ -13313,7 +9704,7 @@ public: MTPint vdate; }; -class MTPDupdatesCombined : public mtpDataImpl { +class MTPDupdatesCombined : public mtpData { public: MTPDupdatesCombined() { } @@ -13328,7 +9719,7 @@ public: MTPint vseq; }; -class MTPDupdates : public mtpDataImpl { +class MTPDupdates : public mtpData { public: MTPDupdates() { } @@ -13342,7 +9733,7 @@ public: MTPint vseq; }; -class MTPDupdateShortSentMessage : public mtpDataImpl { +class MTPDupdateShortSentMessage : public mtpData { public: enum class Flag : int32 { f_out = (1 << 1), @@ -13372,7 +9763,7 @@ public: MTPVector ventities; }; -class MTPDphotos_photos : public mtpDataImpl { +class MTPDphotos_photos : public mtpData { public: MTPDphotos_photos() { } @@ -13383,7 +9774,7 @@ public: MTPVector vusers; }; -class MTPDphotos_photosSlice : public mtpDataImpl { +class MTPDphotos_photosSlice : public mtpData { public: MTPDphotos_photosSlice() { } @@ -13395,7 +9786,7 @@ public: MTPVector vusers; }; -class MTPDphotos_photo : public mtpDataImpl { +class MTPDphotos_photo : public mtpData { public: MTPDphotos_photo() { } @@ -13406,7 +9797,7 @@ public: MTPVector vusers; }; -class MTPDupload_file : public mtpDataImpl { +class MTPDupload_file : public mtpData { public: MTPDupload_file() { } @@ -13418,7 +9809,7 @@ public: MTPbytes vbytes; }; -class MTPDdcOption : public mtpDataImpl { +class MTPDdcOption : public mtpData { public: enum class Flag : int32 { f_ipv6 = (1 << 0), @@ -13445,7 +9836,7 @@ public: MTPint vport; }; -class MTPDconfig : public mtpDataImpl { +class MTPDconfig : public mtpData { public: enum class Flag : int32 { f_phonecalls_enabled = (1 << 1), @@ -13495,7 +9886,7 @@ public: MTPVector vdisabled_features; }; -class MTPDnearestDc : public mtpDataImpl { +class MTPDnearestDc : public mtpData { public: MTPDnearestDc() { } @@ -13507,7 +9898,7 @@ public: MTPint vnearest_dc; }; -class MTPDhelp_appUpdate : public mtpDataImpl { +class MTPDhelp_appUpdate : public mtpData { public: MTPDhelp_appUpdate() { } @@ -13520,7 +9911,7 @@ public: MTPstring vtext; }; -class MTPDhelp_inviteText : public mtpDataImpl { +class MTPDhelp_inviteText : public mtpData { public: MTPDhelp_inviteText() { } @@ -13530,7 +9921,7 @@ public: MTPstring vmessage; }; -class MTPDencryptedChatEmpty : public mtpDataImpl { +class MTPDencryptedChatEmpty : public mtpData { public: MTPDencryptedChatEmpty() { } @@ -13540,7 +9931,7 @@ public: MTPint vid; }; -class MTPDencryptedChatWaiting : public mtpDataImpl { +class MTPDencryptedChatWaiting : public mtpData { public: MTPDencryptedChatWaiting() { } @@ -13554,7 +9945,7 @@ public: MTPint vparticipant_id; }; -class MTPDencryptedChatRequested : public mtpDataImpl { +class MTPDencryptedChatRequested : public mtpData { public: MTPDencryptedChatRequested() { } @@ -13569,7 +9960,7 @@ public: MTPbytes vg_a; }; -class MTPDencryptedChat : public mtpDataImpl { +class MTPDencryptedChat : public mtpData { public: MTPDencryptedChat() { } @@ -13585,7 +9976,7 @@ public: MTPlong vkey_fingerprint; }; -class MTPDencryptedChatDiscarded : public mtpDataImpl { +class MTPDencryptedChatDiscarded : public mtpData { public: MTPDencryptedChatDiscarded() { } @@ -13595,7 +9986,7 @@ public: MTPint vid; }; -class MTPDinputEncryptedChat : public mtpDataImpl { +class MTPDinputEncryptedChat : public mtpData { public: MTPDinputEncryptedChat() { } @@ -13606,7 +9997,7 @@ public: MTPlong vaccess_hash; }; -class MTPDencryptedFile : public mtpDataImpl { +class MTPDencryptedFile : public mtpData { public: MTPDencryptedFile() { } @@ -13620,7 +10011,7 @@ public: MTPint vkey_fingerprint; }; -class MTPDinputEncryptedFileUploaded : public mtpDataImpl { +class MTPDinputEncryptedFileUploaded : public mtpData { public: MTPDinputEncryptedFileUploaded() { } @@ -13633,7 +10024,7 @@ public: MTPint vkey_fingerprint; }; -class MTPDinputEncryptedFile : public mtpDataImpl { +class MTPDinputEncryptedFile : public mtpData { public: MTPDinputEncryptedFile() { } @@ -13644,7 +10035,7 @@ public: MTPlong vaccess_hash; }; -class MTPDinputEncryptedFileBigUploaded : public mtpDataImpl { +class MTPDinputEncryptedFileBigUploaded : public mtpData { public: MTPDinputEncryptedFileBigUploaded() { } @@ -13656,7 +10047,7 @@ public: MTPint vkey_fingerprint; }; -class MTPDencryptedMessage : public mtpDataImpl { +class MTPDencryptedMessage : public mtpData { public: MTPDencryptedMessage() { } @@ -13670,7 +10061,7 @@ public: MTPEncryptedFile vfile; }; -class MTPDencryptedMessageService : public mtpDataImpl { +class MTPDencryptedMessageService : public mtpData { public: MTPDencryptedMessageService() { } @@ -13683,7 +10074,7 @@ public: MTPbytes vbytes; }; -class MTPDmessages_dhConfigNotModified : public mtpDataImpl { +class MTPDmessages_dhConfigNotModified : public mtpData { public: MTPDmessages_dhConfigNotModified() { } @@ -13693,7 +10084,7 @@ public: MTPbytes vrandom; }; -class MTPDmessages_dhConfig : public mtpDataImpl { +class MTPDmessages_dhConfig : public mtpData { public: MTPDmessages_dhConfig() { } @@ -13706,7 +10097,7 @@ public: MTPbytes vrandom; }; -class MTPDmessages_sentEncryptedMessage : public mtpDataImpl { +class MTPDmessages_sentEncryptedMessage : public mtpData { public: MTPDmessages_sentEncryptedMessage() { } @@ -13716,7 +10107,7 @@ public: MTPint vdate; }; -class MTPDmessages_sentEncryptedFile : public mtpDataImpl { +class MTPDmessages_sentEncryptedFile : public mtpData { public: MTPDmessages_sentEncryptedFile() { } @@ -13727,7 +10118,7 @@ public: MTPEncryptedFile vfile; }; -class MTPDinputDocument : public mtpDataImpl { +class MTPDinputDocument : public mtpData { public: MTPDinputDocument() { } @@ -13738,7 +10129,7 @@ public: MTPlong vaccess_hash; }; -class MTPDdocumentEmpty : public mtpDataImpl { +class MTPDdocumentEmpty : public mtpData { public: MTPDdocumentEmpty() { } @@ -13748,7 +10139,7 @@ public: MTPlong vid; }; -class MTPDdocument : public mtpDataImpl { +class MTPDdocument : public mtpData { public: MTPDdocument() { } @@ -13766,7 +10157,7 @@ public: MTPVector vattributes; }; -class MTPDhelp_support : public mtpDataImpl { +class MTPDhelp_support : public mtpData { public: MTPDhelp_support() { } @@ -13777,7 +10168,7 @@ public: MTPUser vuser; }; -class MTPDnotifyPeer : public mtpDataImpl { +class MTPDnotifyPeer : public mtpData { public: MTPDnotifyPeer() { } @@ -13787,7 +10178,7 @@ public: MTPPeer vpeer; }; -class MTPDsendMessageUploadVideoAction : public mtpDataImpl { +class MTPDsendMessageUploadVideoAction : public mtpData { public: MTPDsendMessageUploadVideoAction() { } @@ -13797,7 +10188,7 @@ public: MTPint vprogress; }; -class MTPDsendMessageUploadAudioAction : public mtpDataImpl { +class MTPDsendMessageUploadAudioAction : public mtpData { public: MTPDsendMessageUploadAudioAction() { } @@ -13807,7 +10198,7 @@ public: MTPint vprogress; }; -class MTPDsendMessageUploadPhotoAction : public mtpDataImpl { +class MTPDsendMessageUploadPhotoAction : public mtpData { public: MTPDsendMessageUploadPhotoAction() { } @@ -13817,7 +10208,7 @@ public: MTPint vprogress; }; -class MTPDsendMessageUploadDocumentAction : public mtpDataImpl { +class MTPDsendMessageUploadDocumentAction : public mtpData { public: MTPDsendMessageUploadDocumentAction() { } @@ -13827,7 +10218,7 @@ public: MTPint vprogress; }; -class MTPDcontacts_found : public mtpDataImpl { +class MTPDcontacts_found : public mtpData { public: MTPDcontacts_found() { } @@ -13839,7 +10230,7 @@ public: MTPVector vusers; }; -class MTPDinputPrivacyValueAllowUsers : public mtpDataImpl { +class MTPDinputPrivacyValueAllowUsers : public mtpData { public: MTPDinputPrivacyValueAllowUsers() { } @@ -13849,7 +10240,7 @@ public: MTPVector vusers; }; -class MTPDinputPrivacyValueDisallowUsers : public mtpDataImpl { +class MTPDinputPrivacyValueDisallowUsers : public mtpData { public: MTPDinputPrivacyValueDisallowUsers() { } @@ -13859,7 +10250,7 @@ public: MTPVector vusers; }; -class MTPDprivacyValueAllowUsers : public mtpDataImpl { +class MTPDprivacyValueAllowUsers : public mtpData { public: MTPDprivacyValueAllowUsers() { } @@ -13869,7 +10260,7 @@ public: MTPVector vusers; }; -class MTPDprivacyValueDisallowUsers : public mtpDataImpl { +class MTPDprivacyValueDisallowUsers : public mtpData { public: MTPDprivacyValueDisallowUsers() { } @@ -13879,7 +10270,7 @@ public: MTPVector vusers; }; -class MTPDaccount_privacyRules : public mtpDataImpl { +class MTPDaccount_privacyRules : public mtpData { public: MTPDaccount_privacyRules() { } @@ -13890,7 +10281,7 @@ public: MTPVector vusers; }; -class MTPDaccountDaysTTL : public mtpDataImpl { +class MTPDaccountDaysTTL : public mtpData { public: MTPDaccountDaysTTL() { } @@ -13900,7 +10291,7 @@ public: MTPint vdays; }; -class MTPDdocumentAttributeImageSize : public mtpDataImpl { +class MTPDdocumentAttributeImageSize : public mtpData { public: MTPDdocumentAttributeImageSize() { } @@ -13911,7 +10302,7 @@ public: MTPint vh; }; -class MTPDdocumentAttributeSticker : public mtpDataImpl { +class MTPDdocumentAttributeSticker : public mtpData { public: enum class Flag : int32 { f_mask = (1 << 1), @@ -13936,7 +10327,7 @@ public: MTPMaskCoords vmask_coords; }; -class MTPDdocumentAttributeVideo : public mtpDataImpl { +class MTPDdocumentAttributeVideo : public mtpData { public: MTPDdocumentAttributeVideo() { } @@ -13948,7 +10339,7 @@ public: MTPint vh; }; -class MTPDdocumentAttributeAudio : public mtpDataImpl { +class MTPDdocumentAttributeAudio : public mtpData { public: enum class Flag : int32 { f_voice = (1 << 10), @@ -13978,7 +10369,7 @@ public: MTPbytes vwaveform; }; -class MTPDdocumentAttributeFilename : public mtpDataImpl { +class MTPDdocumentAttributeFilename : public mtpData { public: MTPDdocumentAttributeFilename() { } @@ -13988,7 +10379,7 @@ public: MTPstring vfile_name; }; -class MTPDmessages_stickers : public mtpDataImpl { +class MTPDmessages_stickers : public mtpData { public: MTPDmessages_stickers() { } @@ -13999,7 +10390,7 @@ public: MTPVector vstickers; }; -class MTPDstickerPack : public mtpDataImpl { +class MTPDstickerPack : public mtpData { public: MTPDstickerPack() { } @@ -14010,7 +10401,7 @@ public: MTPVector vdocuments; }; -class MTPDmessages_allStickers : public mtpDataImpl { +class MTPDmessages_allStickers : public mtpData { public: MTPDmessages_allStickers() { } @@ -14021,7 +10412,7 @@ public: MTPVector vsets; }; -class MTPDdisabledFeature : public mtpDataImpl { +class MTPDdisabledFeature : public mtpData { public: MTPDdisabledFeature() { } @@ -14032,7 +10423,7 @@ public: MTPstring vdescription; }; -class MTPDmessages_affectedMessages : public mtpDataImpl { +class MTPDmessages_affectedMessages : public mtpData { public: MTPDmessages_affectedMessages() { } @@ -14043,7 +10434,7 @@ public: MTPint vpts_count; }; -class MTPDwebPageEmpty : public mtpDataImpl { +class MTPDwebPageEmpty : public mtpData { public: MTPDwebPageEmpty() { } @@ -14053,7 +10444,7 @@ public: MTPlong vid; }; -class MTPDwebPagePending : public mtpDataImpl { +class MTPDwebPagePending : public mtpData { public: MTPDwebPagePending() { } @@ -14064,7 +10455,7 @@ public: MTPint vdate; }; -class MTPDwebPage : public mtpDataImpl { +class MTPDwebPage : public mtpData { public: enum class Flag : int32 { f_type = (1 << 0), @@ -14125,7 +10516,7 @@ public: MTPPage vcached_page; }; -class MTPDauthorization : public mtpDataImpl { +class MTPDauthorization : public mtpData { public: MTPDauthorization() { } @@ -14147,7 +10538,7 @@ public: MTPstring vregion; }; -class MTPDaccount_authorizations : public mtpDataImpl { +class MTPDaccount_authorizations : public mtpData { public: MTPDaccount_authorizations() { } @@ -14157,7 +10548,7 @@ public: MTPVector vauthorizations; }; -class MTPDaccount_noPassword : public mtpDataImpl { +class MTPDaccount_noPassword : public mtpData { public: MTPDaccount_noPassword() { } @@ -14168,7 +10559,7 @@ public: MTPstring vemail_unconfirmed_pattern; }; -class MTPDaccount_password : public mtpDataImpl { +class MTPDaccount_password : public mtpData { public: MTPDaccount_password() { } @@ -14182,7 +10573,7 @@ public: MTPstring vemail_unconfirmed_pattern; }; -class MTPDaccount_passwordSettings : public mtpDataImpl { +class MTPDaccount_passwordSettings : public mtpData { public: MTPDaccount_passwordSettings() { } @@ -14192,7 +10583,7 @@ public: MTPstring vemail; }; -class MTPDaccount_passwordInputSettings : public mtpDataImpl { +class MTPDaccount_passwordInputSettings : public mtpData { public: enum class Flag : int32 { f_new_salt = (1 << 0), @@ -14222,7 +10613,7 @@ public: MTPstring vemail; }; -class MTPDauth_passwordRecovery : public mtpDataImpl { +class MTPDauth_passwordRecovery : public mtpData { public: MTPDauth_passwordRecovery() { } @@ -14232,7 +10623,7 @@ public: MTPstring vemail_pattern; }; -class MTPDreceivedNotifyMessage : public mtpDataImpl { +class MTPDreceivedNotifyMessage : public mtpData { public: MTPDreceivedNotifyMessage() { } @@ -14243,7 +10634,7 @@ public: MTPint vflags; }; -class MTPDchatInviteExported : public mtpDataImpl { +class MTPDchatInviteExported : public mtpData { public: MTPDchatInviteExported() { } @@ -14253,7 +10644,7 @@ public: MTPstring vlink; }; -class MTPDchatInviteAlready : public mtpDataImpl { +class MTPDchatInviteAlready : public mtpData { public: MTPDchatInviteAlready() { } @@ -14263,7 +10654,7 @@ public: MTPChat vchat; }; -class MTPDchatInvite : public mtpDataImpl { +class MTPDchatInvite : public mtpData { public: enum class Flag : int32 { f_channel = (1 << 0), @@ -14295,7 +10686,7 @@ public: MTPVector vparticipants; }; -class MTPDinputStickerSetID : public mtpDataImpl { +class MTPDinputStickerSetID : public mtpData { public: MTPDinputStickerSetID() { } @@ -14306,7 +10697,7 @@ public: MTPlong vaccess_hash; }; -class MTPDinputStickerSetShortName : public mtpDataImpl { +class MTPDinputStickerSetShortName : public mtpData { public: MTPDinputStickerSetShortName() { } @@ -14316,7 +10707,7 @@ public: MTPstring vshort_name; }; -class MTPDstickerSet : public mtpDataImpl { +class MTPDstickerSet : public mtpData { public: enum class Flag : int32 { f_installed = (1 << 0), @@ -14348,7 +10739,7 @@ public: MTPint vhash; }; -class MTPDmessages_stickerSet : public mtpDataImpl { +class MTPDmessages_stickerSet : public mtpData { public: MTPDmessages_stickerSet() { } @@ -14360,7 +10751,7 @@ public: MTPVector vdocuments; }; -class MTPDbotCommand : public mtpDataImpl { +class MTPDbotCommand : public mtpData { public: MTPDbotCommand() { } @@ -14371,7 +10762,7 @@ public: MTPstring vdescription; }; -class MTPDbotInfo : public mtpDataImpl { +class MTPDbotInfo : public mtpData { public: MTPDbotInfo() { } @@ -14383,7 +10774,7 @@ public: MTPVector vcommands; }; -class MTPDkeyboardButton : public mtpDataImpl { +class MTPDkeyboardButton : public mtpData { public: MTPDkeyboardButton() { } @@ -14393,7 +10784,7 @@ public: MTPstring vtext; }; -class MTPDkeyboardButtonUrl : public mtpDataImpl { +class MTPDkeyboardButtonUrl : public mtpData { public: MTPDkeyboardButtonUrl() { } @@ -14404,7 +10795,7 @@ public: MTPstring vurl; }; -class MTPDkeyboardButtonCallback : public mtpDataImpl { +class MTPDkeyboardButtonCallback : public mtpData { public: MTPDkeyboardButtonCallback() { } @@ -14415,7 +10806,7 @@ public: MTPbytes vdata; }; -class MTPDkeyboardButtonRequestPhone : public mtpDataImpl { +class MTPDkeyboardButtonRequestPhone : public mtpData { public: MTPDkeyboardButtonRequestPhone() { } @@ -14425,7 +10816,7 @@ public: MTPstring vtext; }; -class MTPDkeyboardButtonRequestGeoLocation : public mtpDataImpl { +class MTPDkeyboardButtonRequestGeoLocation : public mtpData { public: MTPDkeyboardButtonRequestGeoLocation() { } @@ -14435,7 +10826,7 @@ public: MTPstring vtext; }; -class MTPDkeyboardButtonSwitchInline : public mtpDataImpl { +class MTPDkeyboardButtonSwitchInline : public mtpData { public: enum class Flag : int32 { f_same_peer = (1 << 0), @@ -14456,7 +10847,7 @@ public: MTPstring vquery; }; -class MTPDkeyboardButtonGame : public mtpDataImpl { +class MTPDkeyboardButtonGame : public mtpData { public: MTPDkeyboardButtonGame() { } @@ -14466,7 +10857,7 @@ public: MTPstring vtext; }; -class MTPDkeyboardButtonRow : public mtpDataImpl { +class MTPDkeyboardButtonRow : public mtpData { public: MTPDkeyboardButtonRow() { } @@ -14476,7 +10867,7 @@ public: MTPVector vbuttons; }; -class MTPDreplyKeyboardHide : public mtpDataImpl { +class MTPDreplyKeyboardHide : public mtpData { public: enum class Flag : int32 { f_selective = (1 << 2), @@ -14496,7 +10887,7 @@ public: MTPflags vflags; }; -class MTPDreplyKeyboardForceReply : public mtpDataImpl { +class MTPDreplyKeyboardForceReply : public mtpData { public: enum class Flag : int32 { f_single_use = (1 << 1), @@ -14518,7 +10909,7 @@ public: MTPflags vflags; }; -class MTPDreplyKeyboardMarkup : public mtpDataImpl { +class MTPDreplyKeyboardMarkup : public mtpData { public: enum class Flag : int32 { f_resize = (1 << 0), @@ -14543,7 +10934,7 @@ public: MTPVector vrows; }; -class MTPDreplyInlineMarkup : public mtpDataImpl { +class MTPDreplyInlineMarkup : public mtpData { public: MTPDreplyInlineMarkup() { } @@ -14553,7 +10944,7 @@ public: MTPVector vrows; }; -class MTPDhelp_appChangelog : public mtpDataImpl { +class MTPDhelp_appChangelog : public mtpData { public: MTPDhelp_appChangelog() { } @@ -14565,7 +10956,7 @@ public: MTPVector ventities; }; -class MTPDmessageEntityUnknown : public mtpDataImpl { +class MTPDmessageEntityUnknown : public mtpData { public: MTPDmessageEntityUnknown() { } @@ -14576,7 +10967,7 @@ public: MTPint vlength; }; -class MTPDmessageEntityMention : public mtpDataImpl { +class MTPDmessageEntityMention : public mtpData { public: MTPDmessageEntityMention() { } @@ -14587,7 +10978,7 @@ public: MTPint vlength; }; -class MTPDmessageEntityHashtag : public mtpDataImpl { +class MTPDmessageEntityHashtag : public mtpData { public: MTPDmessageEntityHashtag() { } @@ -14598,7 +10989,7 @@ public: MTPint vlength; }; -class MTPDmessageEntityBotCommand : public mtpDataImpl { +class MTPDmessageEntityBotCommand : public mtpData { public: MTPDmessageEntityBotCommand() { } @@ -14609,7 +11000,7 @@ public: MTPint vlength; }; -class MTPDmessageEntityUrl : public mtpDataImpl { +class MTPDmessageEntityUrl : public mtpData { public: MTPDmessageEntityUrl() { } @@ -14620,7 +11011,7 @@ public: MTPint vlength; }; -class MTPDmessageEntityEmail : public mtpDataImpl { +class MTPDmessageEntityEmail : public mtpData { public: MTPDmessageEntityEmail() { } @@ -14631,7 +11022,7 @@ public: MTPint vlength; }; -class MTPDmessageEntityBold : public mtpDataImpl { +class MTPDmessageEntityBold : public mtpData { public: MTPDmessageEntityBold() { } @@ -14642,7 +11033,7 @@ public: MTPint vlength; }; -class MTPDmessageEntityItalic : public mtpDataImpl { +class MTPDmessageEntityItalic : public mtpData { public: MTPDmessageEntityItalic() { } @@ -14653,7 +11044,7 @@ public: MTPint vlength; }; -class MTPDmessageEntityCode : public mtpDataImpl { +class MTPDmessageEntityCode : public mtpData { public: MTPDmessageEntityCode() { } @@ -14664,7 +11055,7 @@ public: MTPint vlength; }; -class MTPDmessageEntityPre : public mtpDataImpl { +class MTPDmessageEntityPre : public mtpData { public: MTPDmessageEntityPre() { } @@ -14676,7 +11067,7 @@ public: MTPstring vlanguage; }; -class MTPDmessageEntityTextUrl : public mtpDataImpl { +class MTPDmessageEntityTextUrl : public mtpData { public: MTPDmessageEntityTextUrl() { } @@ -14688,7 +11079,7 @@ public: MTPstring vurl; }; -class MTPDmessageEntityMentionName : public mtpDataImpl { +class MTPDmessageEntityMentionName : public mtpData { public: MTPDmessageEntityMentionName() { } @@ -14700,7 +11091,7 @@ public: MTPint vuser_id; }; -class MTPDinputMessageEntityMentionName : public mtpDataImpl { +class MTPDinputMessageEntityMentionName : public mtpData { public: MTPDinputMessageEntityMentionName() { } @@ -14712,7 +11103,7 @@ public: MTPInputUser vuser_id; }; -class MTPDinputChannel : public mtpDataImpl { +class MTPDinputChannel : public mtpData { public: MTPDinputChannel() { } @@ -14723,7 +11114,7 @@ public: MTPlong vaccess_hash; }; -class MTPDcontacts_resolvedPeer : public mtpDataImpl { +class MTPDcontacts_resolvedPeer : public mtpData { public: MTPDcontacts_resolvedPeer() { } @@ -14735,7 +11126,7 @@ public: MTPVector vusers; }; -class MTPDmessageRange : public mtpDataImpl { +class MTPDmessageRange : public mtpData { public: MTPDmessageRange() { } @@ -14746,7 +11137,7 @@ public: MTPint vmax_id; }; -class MTPDupdates_channelDifferenceEmpty : public mtpDataImpl { +class MTPDupdates_channelDifferenceEmpty : public mtpData { public: enum class Flag : int32 { f_final = (1 << 0), @@ -14770,7 +11161,7 @@ public: MTPint vtimeout; }; -class MTPDupdates_channelDifferenceTooLong : public mtpDataImpl { +class MTPDupdates_channelDifferenceTooLong : public mtpData { public: enum class Flag : int32 { f_final = (1 << 0), @@ -14801,7 +11192,7 @@ public: MTPVector vusers; }; -class MTPDupdates_channelDifference : public mtpDataImpl { +class MTPDupdates_channelDifference : public mtpData { public: enum class Flag : int32 { f_final = (1 << 0), @@ -14829,7 +11220,7 @@ public: MTPVector vusers; }; -class MTPDchannelMessagesFilter : public mtpDataImpl { +class MTPDchannelMessagesFilter : public mtpData { public: enum class Flag : int32 { f_exclude_new_messages = (1 << 1), @@ -14850,7 +11241,7 @@ public: MTPVector vranges; }; -class MTPDchannelParticipant : public mtpDataImpl { +class MTPDchannelParticipant : public mtpData { public: MTPDchannelParticipant() { } @@ -14861,7 +11252,7 @@ public: MTPint vdate; }; -class MTPDchannelParticipantSelf : public mtpDataImpl { +class MTPDchannelParticipantSelf : public mtpData { public: MTPDchannelParticipantSelf() { } @@ -14873,7 +11264,7 @@ public: MTPint vdate; }; -class MTPDchannelParticipantModerator : public mtpDataImpl { +class MTPDchannelParticipantModerator : public mtpData { public: MTPDchannelParticipantModerator() { } @@ -14885,7 +11276,7 @@ public: MTPint vdate; }; -class MTPDchannelParticipantEditor : public mtpDataImpl { +class MTPDchannelParticipantEditor : public mtpData { public: MTPDchannelParticipantEditor() { } @@ -14897,7 +11288,7 @@ public: MTPint vdate; }; -class MTPDchannelParticipantKicked : public mtpDataImpl { +class MTPDchannelParticipantKicked : public mtpData { public: MTPDchannelParticipantKicked() { } @@ -14909,7 +11300,7 @@ public: MTPint vdate; }; -class MTPDchannelParticipantCreator : public mtpDataImpl { +class MTPDchannelParticipantCreator : public mtpData { public: MTPDchannelParticipantCreator() { } @@ -14919,7 +11310,7 @@ public: MTPint vuser_id; }; -class MTPDchannels_channelParticipants : public mtpDataImpl { +class MTPDchannels_channelParticipants : public mtpData { public: MTPDchannels_channelParticipants() { } @@ -14931,7 +11322,7 @@ public: MTPVector vusers; }; -class MTPDchannels_channelParticipant : public mtpDataImpl { +class MTPDchannels_channelParticipant : public mtpData { public: MTPDchannels_channelParticipant() { } @@ -14942,7 +11333,7 @@ public: MTPVector vusers; }; -class MTPDhelp_termsOfService : public mtpDataImpl { +class MTPDhelp_termsOfService : public mtpData { public: MTPDhelp_termsOfService() { } @@ -14952,7 +11343,7 @@ public: MTPstring vtext; }; -class MTPDfoundGif : public mtpDataImpl { +class MTPDfoundGif : public mtpData { public: MTPDfoundGif() { } @@ -14967,7 +11358,7 @@ public: MTPint vh; }; -class MTPDfoundGifCached : public mtpDataImpl { +class MTPDfoundGifCached : public mtpData { public: MTPDfoundGifCached() { } @@ -14979,7 +11370,7 @@ public: MTPDocument vdocument; }; -class MTPDmessages_foundGifs : public mtpDataImpl { +class MTPDmessages_foundGifs : public mtpData { public: MTPDmessages_foundGifs() { } @@ -14990,7 +11381,7 @@ public: MTPVector vresults; }; -class MTPDmessages_savedGifs : public mtpDataImpl { +class MTPDmessages_savedGifs : public mtpData { public: MTPDmessages_savedGifs() { } @@ -15001,7 +11392,7 @@ public: MTPVector vgifs; }; -class MTPDinputBotInlineMessageMediaAuto : public mtpDataImpl { +class MTPDinputBotInlineMessageMediaAuto : public mtpData { public: enum class Flag : int32 { f_reply_markup = (1 << 2), @@ -15023,7 +11414,7 @@ public: MTPReplyMarkup vreply_markup; }; -class MTPDinputBotInlineMessageText : public mtpDataImpl { +class MTPDinputBotInlineMessageText : public mtpData { public: enum class Flag : int32 { f_no_webpage = (1 << 0), @@ -15050,7 +11441,7 @@ public: MTPReplyMarkup vreply_markup; }; -class MTPDinputBotInlineMessageMediaGeo : public mtpDataImpl { +class MTPDinputBotInlineMessageMediaGeo : public mtpData { public: enum class Flag : int32 { f_reply_markup = (1 << 2), @@ -15072,7 +11463,7 @@ public: MTPReplyMarkup vreply_markup; }; -class MTPDinputBotInlineMessageMediaVenue : public mtpDataImpl { +class MTPDinputBotInlineMessageMediaVenue : public mtpData { public: enum class Flag : int32 { f_reply_markup = (1 << 2), @@ -15098,7 +11489,7 @@ public: MTPReplyMarkup vreply_markup; }; -class MTPDinputBotInlineMessageMediaContact : public mtpDataImpl { +class MTPDinputBotInlineMessageMediaContact : public mtpData { public: enum class Flag : int32 { f_reply_markup = (1 << 2), @@ -15122,7 +11513,7 @@ public: MTPReplyMarkup vreply_markup; }; -class MTPDinputBotInlineMessageGame : public mtpDataImpl { +class MTPDinputBotInlineMessageGame : public mtpData { public: enum class Flag : int32 { f_reply_markup = (1 << 2), @@ -15143,7 +11534,7 @@ public: MTPReplyMarkup vreply_markup; }; -class MTPDinputBotInlineResult : public mtpDataImpl { +class MTPDinputBotInlineResult : public mtpData { public: enum class Flag : int32 { f_title = (1 << 1), @@ -15191,7 +11582,7 @@ public: MTPInputBotInlineMessage vsend_message; }; -class MTPDinputBotInlineResultPhoto : public mtpDataImpl { +class MTPDinputBotInlineResultPhoto : public mtpData { public: MTPDinputBotInlineResultPhoto() { } @@ -15204,7 +11595,7 @@ public: MTPInputBotInlineMessage vsend_message; }; -class MTPDinputBotInlineResultDocument : public mtpDataImpl { +class MTPDinputBotInlineResultDocument : public mtpData { public: enum class Flag : int32 { f_title = (1 << 1), @@ -15232,7 +11623,7 @@ public: MTPInputBotInlineMessage vsend_message; }; -class MTPDinputBotInlineResultGame : public mtpDataImpl { +class MTPDinputBotInlineResultGame : public mtpData { public: MTPDinputBotInlineResultGame() { } @@ -15244,7 +11635,7 @@ public: MTPInputBotInlineMessage vsend_message; }; -class MTPDbotInlineMessageMediaAuto : public mtpDataImpl { +class MTPDbotInlineMessageMediaAuto : public mtpData { public: enum class Flag : int32 { f_reply_markup = (1 << 2), @@ -15266,7 +11657,7 @@ public: MTPReplyMarkup vreply_markup; }; -class MTPDbotInlineMessageText : public mtpDataImpl { +class MTPDbotInlineMessageText : public mtpData { public: enum class Flag : int32 { f_no_webpage = (1 << 0), @@ -15293,7 +11684,7 @@ public: MTPReplyMarkup vreply_markup; }; -class MTPDbotInlineMessageMediaGeo : public mtpDataImpl { +class MTPDbotInlineMessageMediaGeo : public mtpData { public: enum class Flag : int32 { f_reply_markup = (1 << 2), @@ -15315,7 +11706,7 @@ public: MTPReplyMarkup vreply_markup; }; -class MTPDbotInlineMessageMediaVenue : public mtpDataImpl { +class MTPDbotInlineMessageMediaVenue : public mtpData { public: enum class Flag : int32 { f_reply_markup = (1 << 2), @@ -15341,7 +11732,7 @@ public: MTPReplyMarkup vreply_markup; }; -class MTPDbotInlineMessageMediaContact : public mtpDataImpl { +class MTPDbotInlineMessageMediaContact : public mtpData { public: enum class Flag : int32 { f_reply_markup = (1 << 2), @@ -15365,7 +11756,7 @@ public: MTPReplyMarkup vreply_markup; }; -class MTPDbotInlineResult : public mtpDataImpl { +class MTPDbotInlineResult : public mtpData { public: enum class Flag : int32 { f_title = (1 << 1), @@ -15413,7 +11804,7 @@ public: MTPBotInlineMessage vsend_message; }; -class MTPDbotInlineMediaResult : public mtpDataImpl { +class MTPDbotInlineMediaResult : public mtpData { public: enum class Flag : int32 { f_photo = (1 << 0), @@ -15446,7 +11837,7 @@ public: MTPBotInlineMessage vsend_message; }; -class MTPDmessages_botResults : public mtpDataImpl { +class MTPDmessages_botResults : public mtpData { public: enum class Flag : int32 { f_gallery = (1 << 0), @@ -15475,7 +11866,7 @@ public: MTPint vcache_time; }; -class MTPDexportedMessageLink : public mtpDataImpl { +class MTPDexportedMessageLink : public mtpData { public: MTPDexportedMessageLink() { } @@ -15485,7 +11876,7 @@ public: MTPstring vlink; }; -class MTPDmessageFwdHeader : public mtpDataImpl { +class MTPDmessageFwdHeader : public mtpData { public: enum class Flag : int32 { f_from_id = (1 << 0), @@ -15513,7 +11904,7 @@ public: MTPint vchannel_post; }; -class MTPDauth_sentCodeTypeApp : public mtpDataImpl { +class MTPDauth_sentCodeTypeApp : public mtpData { public: MTPDauth_sentCodeTypeApp() { } @@ -15523,7 +11914,7 @@ public: MTPint vlength; }; -class MTPDauth_sentCodeTypeSms : public mtpDataImpl { +class MTPDauth_sentCodeTypeSms : public mtpData { public: MTPDauth_sentCodeTypeSms() { } @@ -15533,7 +11924,7 @@ public: MTPint vlength; }; -class MTPDauth_sentCodeTypeCall : public mtpDataImpl { +class MTPDauth_sentCodeTypeCall : public mtpData { public: MTPDauth_sentCodeTypeCall() { } @@ -15543,7 +11934,7 @@ public: MTPint vlength; }; -class MTPDauth_sentCodeTypeFlashCall : public mtpDataImpl { +class MTPDauth_sentCodeTypeFlashCall : public mtpData { public: MTPDauth_sentCodeTypeFlashCall() { } @@ -15553,7 +11944,7 @@ public: MTPstring vpattern; }; -class MTPDmessages_botCallbackAnswer : public mtpDataImpl { +class MTPDmessages_botCallbackAnswer : public mtpData { public: enum class Flag : int32 { f_alert = (1 << 1), @@ -15582,7 +11973,7 @@ public: MTPint vcache_time; }; -class MTPDmessages_messageEditData : public mtpDataImpl { +class MTPDmessages_messageEditData : public mtpData { public: enum class Flag : int32 { f_caption = (1 << 0), @@ -15601,7 +11992,7 @@ public: MTPflags vflags; }; -class MTPDinputBotInlineMessageID : public mtpDataImpl { +class MTPDinputBotInlineMessageID : public mtpData { public: MTPDinputBotInlineMessageID() { } @@ -15613,7 +12004,7 @@ public: MTPlong vaccess_hash; }; -class MTPDinlineBotSwitchPM : public mtpDataImpl { +class MTPDinlineBotSwitchPM : public mtpData { public: MTPDinlineBotSwitchPM() { } @@ -15624,7 +12015,7 @@ public: MTPstring vstart_param; }; -class MTPDmessages_peerDialogs : public mtpDataImpl { +class MTPDmessages_peerDialogs : public mtpData { public: MTPDmessages_peerDialogs() { } @@ -15638,7 +12029,7 @@ public: MTPupdates_State vstate; }; -class MTPDtopPeer : public mtpDataImpl { +class MTPDtopPeer : public mtpData { public: MTPDtopPeer() { } @@ -15649,7 +12040,7 @@ public: MTPdouble vrating; }; -class MTPDtopPeerCategoryPeers : public mtpDataImpl { +class MTPDtopPeerCategoryPeers : public mtpData { public: MTPDtopPeerCategoryPeers() { } @@ -15661,7 +12052,7 @@ public: MTPVector vpeers; }; -class MTPDcontacts_topPeers : public mtpDataImpl { +class MTPDcontacts_topPeers : public mtpData { public: MTPDcontacts_topPeers() { } @@ -15673,7 +12064,7 @@ public: MTPVector vusers; }; -class MTPDdraftMessage : public mtpDataImpl { +class MTPDdraftMessage : public mtpData { public: enum class Flag : int32 { f_no_webpage = (1 << 1), @@ -15701,7 +12092,7 @@ public: MTPint vdate; }; -class MTPDmessages_featuredStickers : public mtpDataImpl { +class MTPDmessages_featuredStickers : public mtpData { public: MTPDmessages_featuredStickers() { } @@ -15713,7 +12104,7 @@ public: MTPVector vunread; }; -class MTPDmessages_recentStickers : public mtpDataImpl { +class MTPDmessages_recentStickers : public mtpData { public: MTPDmessages_recentStickers() { } @@ -15724,7 +12115,7 @@ public: MTPVector vstickers; }; -class MTPDmessages_archivedStickers : public mtpDataImpl { +class MTPDmessages_archivedStickers : public mtpData { public: MTPDmessages_archivedStickers() { } @@ -15735,7 +12126,7 @@ public: MTPVector vsets; }; -class MTPDmessages_stickerSetInstallResultArchive : public mtpDataImpl { +class MTPDmessages_stickerSetInstallResultArchive : public mtpData { public: MTPDmessages_stickerSetInstallResultArchive() { } @@ -15745,7 +12136,7 @@ public: MTPVector vsets; }; -class MTPDstickerSetCovered : public mtpDataImpl { +class MTPDstickerSetCovered : public mtpData { public: MTPDstickerSetCovered() { } @@ -15756,7 +12147,7 @@ public: MTPDocument vcover; }; -class MTPDstickerSetMultiCovered : public mtpDataImpl { +class MTPDstickerSetMultiCovered : public mtpData { public: MTPDstickerSetMultiCovered() { } @@ -15767,7 +12158,7 @@ public: MTPVector vcovers; }; -class MTPDmaskCoords : public mtpDataImpl { +class MTPDmaskCoords : public mtpData { public: MTPDmaskCoords() { } @@ -15780,7 +12171,7 @@ public: MTPdouble vzoom; }; -class MTPDinputStickeredMediaPhoto : public mtpDataImpl { +class MTPDinputStickeredMediaPhoto : public mtpData { public: MTPDinputStickeredMediaPhoto() { } @@ -15790,7 +12181,7 @@ public: MTPInputPhoto vid; }; -class MTPDinputStickeredMediaDocument : public mtpDataImpl { +class MTPDinputStickeredMediaDocument : public mtpData { public: MTPDinputStickeredMediaDocument() { } @@ -15800,7 +12191,7 @@ public: MTPInputDocument vid; }; -class MTPDgame : public mtpDataImpl { +class MTPDgame : public mtpData { public: enum class Flag : int32 { f_document = (1 << 0), @@ -15826,7 +12217,7 @@ public: MTPDocument vdocument; }; -class MTPDinputGameID : public mtpDataImpl { +class MTPDinputGameID : public mtpData { public: MTPDinputGameID() { } @@ -15837,7 +12228,7 @@ public: MTPlong vaccess_hash; }; -class MTPDinputGameShortName : public mtpDataImpl { +class MTPDinputGameShortName : public mtpData { public: MTPDinputGameShortName() { } @@ -15848,7 +12239,7 @@ public: MTPstring vshort_name; }; -class MTPDhighScore : public mtpDataImpl { +class MTPDhighScore : public mtpData { public: MTPDhighScore() { } @@ -15860,7 +12251,7 @@ public: MTPint vscore; }; -class MTPDmessages_highScores : public mtpDataImpl { +class MTPDmessages_highScores : public mtpData { public: MTPDmessages_highScores() { } @@ -15871,7 +12262,7 @@ public: MTPVector vusers; }; -class MTPDtextPlain : public mtpDataImpl { +class MTPDtextPlain : public mtpData { public: MTPDtextPlain() { } @@ -15881,7 +12272,7 @@ public: MTPstring vtext; }; -class MTPDtextBold : public mtpDataImpl { +class MTPDtextBold : public mtpData { public: MTPDtextBold() { } @@ -15891,7 +12282,7 @@ public: MTPRichText vtext; }; -class MTPDtextItalic : public mtpDataImpl { +class MTPDtextItalic : public mtpData { public: MTPDtextItalic() { } @@ -15901,7 +12292,7 @@ public: MTPRichText vtext; }; -class MTPDtextUnderline : public mtpDataImpl { +class MTPDtextUnderline : public mtpData { public: MTPDtextUnderline() { } @@ -15911,7 +12302,7 @@ public: MTPRichText vtext; }; -class MTPDtextStrike : public mtpDataImpl { +class MTPDtextStrike : public mtpData { public: MTPDtextStrike() { } @@ -15921,7 +12312,7 @@ public: MTPRichText vtext; }; -class MTPDtextFixed : public mtpDataImpl { +class MTPDtextFixed : public mtpData { public: MTPDtextFixed() { } @@ -15931,7 +12322,7 @@ public: MTPRichText vtext; }; -class MTPDtextUrl : public mtpDataImpl { +class MTPDtextUrl : public mtpData { public: MTPDtextUrl() { } @@ -15943,7 +12334,7 @@ public: MTPlong vwebpage_id; }; -class MTPDtextEmail : public mtpDataImpl { +class MTPDtextEmail : public mtpData { public: MTPDtextEmail() { } @@ -15954,7 +12345,7 @@ public: MTPstring vemail; }; -class MTPDtextConcat : public mtpDataImpl { +class MTPDtextConcat : public mtpData { public: MTPDtextConcat() { } @@ -15964,7 +12355,7 @@ public: MTPVector vtexts; }; -class MTPDpageBlockTitle : public mtpDataImpl { +class MTPDpageBlockTitle : public mtpData { public: MTPDpageBlockTitle() { } @@ -15974,7 +12365,7 @@ public: MTPRichText vtext; }; -class MTPDpageBlockSubtitle : public mtpDataImpl { +class MTPDpageBlockSubtitle : public mtpData { public: MTPDpageBlockSubtitle() { } @@ -15984,7 +12375,7 @@ public: MTPRichText vtext; }; -class MTPDpageBlockAuthorDate : public mtpDataImpl { +class MTPDpageBlockAuthorDate : public mtpData { public: MTPDpageBlockAuthorDate() { } @@ -15995,7 +12386,7 @@ public: MTPint vpublished_date; }; -class MTPDpageBlockHeader : public mtpDataImpl { +class MTPDpageBlockHeader : public mtpData { public: MTPDpageBlockHeader() { } @@ -16005,7 +12396,7 @@ public: MTPRichText vtext; }; -class MTPDpageBlockSubheader : public mtpDataImpl { +class MTPDpageBlockSubheader : public mtpData { public: MTPDpageBlockSubheader() { } @@ -16015,7 +12406,7 @@ public: MTPRichText vtext; }; -class MTPDpageBlockParagraph : public mtpDataImpl { +class MTPDpageBlockParagraph : public mtpData { public: MTPDpageBlockParagraph() { } @@ -16025,7 +12416,7 @@ public: MTPRichText vtext; }; -class MTPDpageBlockPreformatted : public mtpDataImpl { +class MTPDpageBlockPreformatted : public mtpData { public: MTPDpageBlockPreformatted() { } @@ -16036,7 +12427,7 @@ public: MTPstring vlanguage; }; -class MTPDpageBlockFooter : public mtpDataImpl { +class MTPDpageBlockFooter : public mtpData { public: MTPDpageBlockFooter() { } @@ -16046,7 +12437,7 @@ public: MTPRichText vtext; }; -class MTPDpageBlockAnchor : public mtpDataImpl { +class MTPDpageBlockAnchor : public mtpData { public: MTPDpageBlockAnchor() { } @@ -16056,7 +12447,7 @@ public: MTPstring vname; }; -class MTPDpageBlockList : public mtpDataImpl { +class MTPDpageBlockList : public mtpData { public: MTPDpageBlockList() { } @@ -16067,7 +12458,7 @@ public: MTPVector vitems; }; -class MTPDpageBlockBlockquote : public mtpDataImpl { +class MTPDpageBlockBlockquote : public mtpData { public: MTPDpageBlockBlockquote() { } @@ -16078,7 +12469,7 @@ public: MTPRichText vcaption; }; -class MTPDpageBlockPullquote : public mtpDataImpl { +class MTPDpageBlockPullquote : public mtpData { public: MTPDpageBlockPullquote() { } @@ -16089,7 +12480,7 @@ public: MTPRichText vcaption; }; -class MTPDpageBlockPhoto : public mtpDataImpl { +class MTPDpageBlockPhoto : public mtpData { public: MTPDpageBlockPhoto() { } @@ -16100,7 +12491,7 @@ public: MTPRichText vcaption; }; -class MTPDpageBlockVideo : public mtpDataImpl { +class MTPDpageBlockVideo : public mtpData { public: enum class Flag : int32 { f_autoplay = (1 << 0), @@ -16124,7 +12515,7 @@ public: MTPRichText vcaption; }; -class MTPDpageBlockCover : public mtpDataImpl { +class MTPDpageBlockCover : public mtpData { public: MTPDpageBlockCover() { } @@ -16134,7 +12525,7 @@ public: MTPPageBlock vcover; }; -class MTPDpageBlockEmbed : public mtpDataImpl { +class MTPDpageBlockEmbed : public mtpData { public: enum class Flag : int32 { f_full_width = (1 << 0), @@ -16168,7 +12559,7 @@ public: MTPRichText vcaption; }; -class MTPDpageBlockEmbedPost : public mtpDataImpl { +class MTPDpageBlockEmbedPost : public mtpData { public: MTPDpageBlockEmbedPost() { } @@ -16184,7 +12575,7 @@ public: MTPRichText vcaption; }; -class MTPDpageBlockCollage : public mtpDataImpl { +class MTPDpageBlockCollage : public mtpData { public: MTPDpageBlockCollage() { } @@ -16195,7 +12586,7 @@ public: MTPRichText vcaption; }; -class MTPDpageBlockSlideshow : public mtpDataImpl { +class MTPDpageBlockSlideshow : public mtpData { public: MTPDpageBlockSlideshow() { } @@ -16206,7 +12597,7 @@ public: MTPRichText vcaption; }; -class MTPDpagePart : public mtpDataImpl { +class MTPDpagePart : public mtpData { public: MTPDpagePart() { } @@ -16218,7 +12609,7 @@ public: MTPVector vvideos; }; -class MTPDpageFull : public mtpDataImpl { +class MTPDpageFull : public mtpData { public: MTPDpageFull() { } @@ -16230,7 +12621,7 @@ public: MTPVector vvideos; }; -class MTPDinputPhoneCall : public mtpDataImpl { +class MTPDinputPhoneCall : public mtpData { public: MTPDinputPhoneCall() { } @@ -16241,7 +12632,7 @@ public: MTPlong vaccess_hash; }; -class MTPDphoneCallEmpty : public mtpDataImpl { +class MTPDphoneCallEmpty : public mtpData { public: MTPDphoneCallEmpty() { } @@ -16251,7 +12642,7 @@ public: MTPlong vid; }; -class MTPDphoneCallWaiting : public mtpDataImpl { +class MTPDphoneCallWaiting : public mtpData { public: enum class Flag : int32 { f_receive_date = (1 << 0), @@ -16277,7 +12668,7 @@ public: MTPint vreceive_date; }; -class MTPDphoneCallRequested : public mtpDataImpl { +class MTPDphoneCallRequested : public mtpData { public: MTPDphoneCallRequested() { } @@ -16293,7 +12684,7 @@ public: MTPPhoneCallProtocol vprotocol; }; -class MTPDphoneCall : public mtpDataImpl { +class MTPDphoneCall : public mtpData { public: MTPDphoneCall() { } @@ -16313,7 +12704,7 @@ public: MTPint vstart_date; }; -class MTPDphoneCallDiscarded : public mtpDataImpl { +class MTPDphoneCallDiscarded : public mtpData { public: enum class Flag : int32 { f_reason = (1 << 0), @@ -16338,7 +12729,7 @@ public: MTPint vduration; }; -class MTPDphoneConnection : public mtpDataImpl { +class MTPDphoneConnection : public mtpData { public: MTPDphoneConnection() { } @@ -16352,7 +12743,7 @@ public: MTPbytes vpeer_tag; }; -class MTPDphoneCallProtocol : public mtpDataImpl { +class MTPDphoneCallProtocol : public mtpData { public: enum class Flag : int32 { f_udp_p2p = (1 << 0), @@ -16376,7 +12767,7 @@ public: MTPint vmax_layer; }; -class MTPDphone_phoneCall : public mtpDataImpl { +class MTPDphone_phoneCall : public mtpData { public: MTPDphone_phoneCall() { } @@ -25504,31 +21895,31 @@ namespace internal { class TypeCreator { public: inline static MTPresPQ new_resPQ(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPstring &_pq, const MTPVector &_server_public_key_fingerprints) { - return MTPresPQ(new MTPDresPQ(_nonce, _server_nonce, _pq, _server_public_key_fingerprints)); + return MTPresPQ(std::make_shared(_nonce, _server_nonce, _pq, _server_public_key_fingerprints)); } inline static MTPp_Q_inner_data new_p_q_inner_data(const MTPstring &_pq, const MTPstring &_p, const MTPstring &_q, const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint256 &_new_nonce) { - return MTPp_Q_inner_data(new MTPDp_q_inner_data(_pq, _p, _q, _nonce, _server_nonce, _new_nonce)); + return MTPp_Q_inner_data(std::make_shared(_pq, _p, _q, _nonce, _server_nonce, _new_nonce)); } inline static MTPserver_DH_Params new_server_DH_params_fail(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash) { - return MTPserver_DH_Params(new MTPDserver_DH_params_fail(_nonce, _server_nonce, _new_nonce_hash)); + return MTPserver_DH_Params(std::make_shared(_nonce, _server_nonce, _new_nonce_hash)); } inline static MTPserver_DH_Params new_server_DH_params_ok(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPstring &_encrypted_answer) { - return MTPserver_DH_Params(new MTPDserver_DH_params_ok(_nonce, _server_nonce, _encrypted_answer)); + return MTPserver_DH_Params(std::make_shared(_nonce, _server_nonce, _encrypted_answer)); } inline static MTPserver_DH_inner_data new_server_DH_inner_data(const MTPint128 &_nonce, const MTPint128 &_server_nonce, MTPint _g, const MTPstring &_dh_prime, const MTPstring &_g_a, MTPint _server_time) { - return MTPserver_DH_inner_data(new MTPDserver_DH_inner_data(_nonce, _server_nonce, _g, _dh_prime, _g_a, _server_time)); + return MTPserver_DH_inner_data(std::make_shared(_nonce, _server_nonce, _g, _dh_prime, _g_a, _server_time)); } inline static MTPclient_DH_Inner_Data new_client_DH_inner_data(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPlong &_retry_id, const MTPstring &_g_b) { - return MTPclient_DH_Inner_Data(new MTPDclient_DH_inner_data(_nonce, _server_nonce, _retry_id, _g_b)); + return MTPclient_DH_Inner_Data(std::make_shared(_nonce, _server_nonce, _retry_id, _g_b)); } inline static MTPset_client_DH_params_answer new_dh_gen_ok(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash1) { - return MTPset_client_DH_params_answer(new MTPDdh_gen_ok(_nonce, _server_nonce, _new_nonce_hash1)); + return MTPset_client_DH_params_answer(std::make_shared(_nonce, _server_nonce, _new_nonce_hash1)); } inline static MTPset_client_DH_params_answer new_dh_gen_retry(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash2) { - return MTPset_client_DH_params_answer(new MTPDdh_gen_retry(_nonce, _server_nonce, _new_nonce_hash2)); + return MTPset_client_DH_params_answer(std::make_shared(_nonce, _server_nonce, _new_nonce_hash2)); } inline static MTPset_client_DH_params_answer new_dh_gen_fail(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash3) { - return MTPset_client_DH_params_answer(new MTPDdh_gen_fail(_nonce, _server_nonce, _new_nonce_hash3)); + return MTPset_client_DH_params_answer(std::make_shared(_nonce, _server_nonce, _new_nonce_hash3)); } inline static MTPdestroyAuthKeyRes new_destroy_auth_key_ok() { return MTPdestroyAuthKeyRes(mtpc_destroy_auth_key_ok); @@ -25540,34 +21931,34 @@ public: return MTPdestroyAuthKeyRes(mtpc_destroy_auth_key_fail); } inline static MTPmsgsAck new_msgs_ack(const MTPVector &_msg_ids) { - return MTPmsgsAck(new MTPDmsgs_ack(_msg_ids)); + return MTPmsgsAck(std::make_shared(_msg_ids)); } inline static MTPbadMsgNotification new_bad_msg_notification(const MTPlong &_bad_msg_id, MTPint _bad_msg_seqno, MTPint _error_code) { - return MTPbadMsgNotification(new MTPDbad_msg_notification(_bad_msg_id, _bad_msg_seqno, _error_code)); + return MTPbadMsgNotification(std::make_shared(_bad_msg_id, _bad_msg_seqno, _error_code)); } inline static MTPbadMsgNotification new_bad_server_salt(const MTPlong &_bad_msg_id, MTPint _bad_msg_seqno, MTPint _error_code, const MTPlong &_new_server_salt) { - return MTPbadMsgNotification(new MTPDbad_server_salt(_bad_msg_id, _bad_msg_seqno, _error_code, _new_server_salt)); + return MTPbadMsgNotification(std::make_shared(_bad_msg_id, _bad_msg_seqno, _error_code, _new_server_salt)); } inline static MTPmsgsStateReq new_msgs_state_req(const MTPVector &_msg_ids) { - return MTPmsgsStateReq(new MTPDmsgs_state_req(_msg_ids)); + return MTPmsgsStateReq(std::make_shared(_msg_ids)); } inline static MTPmsgsStateInfo new_msgs_state_info(const MTPlong &_req_msg_id, const MTPstring &_info) { - return MTPmsgsStateInfo(new MTPDmsgs_state_info(_req_msg_id, _info)); + return MTPmsgsStateInfo(std::make_shared(_req_msg_id, _info)); } inline static MTPmsgsAllInfo new_msgs_all_info(const MTPVector &_msg_ids, const MTPstring &_info) { - return MTPmsgsAllInfo(new MTPDmsgs_all_info(_msg_ids, _info)); + return MTPmsgsAllInfo(std::make_shared(_msg_ids, _info)); } inline static MTPmsgDetailedInfo new_msg_detailed_info(const MTPlong &_msg_id, const MTPlong &_answer_msg_id, MTPint _bytes, MTPint _status) { - return MTPmsgDetailedInfo(new MTPDmsg_detailed_info(_msg_id, _answer_msg_id, _bytes, _status)); + return MTPmsgDetailedInfo(std::make_shared(_msg_id, _answer_msg_id, _bytes, _status)); } inline static MTPmsgDetailedInfo new_msg_new_detailed_info(const MTPlong &_answer_msg_id, MTPint _bytes, MTPint _status) { - return MTPmsgDetailedInfo(new MTPDmsg_new_detailed_info(_answer_msg_id, _bytes, _status)); + return MTPmsgDetailedInfo(std::make_shared(_answer_msg_id, _bytes, _status)); } inline static MTPmsgResendReq new_msg_resend_req(const MTPVector &_msg_ids) { - return MTPmsgResendReq(new MTPDmsg_resend_req(_msg_ids)); + return MTPmsgResendReq(std::make_shared(_msg_ids)); } inline static MTPrpcError new_rpc_error(MTPint _error_code, const MTPstring &_error_message) { - return MTPrpcError(new MTPDrpc_error(_error_code, _error_message)); + return MTPrpcError(std::make_shared(_error_code, _error_message)); } inline static MTPrpcDropAnswer new_rpc_answer_unknown() { return MTPrpcDropAnswer(mtpc_rpc_answer_unknown); @@ -25576,28 +21967,28 @@ public: return MTPrpcDropAnswer(mtpc_rpc_answer_dropped_running); } inline static MTPrpcDropAnswer new_rpc_answer_dropped(const MTPlong &_msg_id, MTPint _seq_no, MTPint _bytes) { - return MTPrpcDropAnswer(new MTPDrpc_answer_dropped(_msg_id, _seq_no, _bytes)); + return MTPrpcDropAnswer(std::make_shared(_msg_id, _seq_no, _bytes)); } inline static MTPfutureSalt new_future_salt(MTPint _valid_since, MTPint _valid_until, const MTPlong &_salt) { - return MTPfutureSalt(new MTPDfuture_salt(_valid_since, _valid_until, _salt)); + return MTPfutureSalt(std::make_shared(_valid_since, _valid_until, _salt)); } inline static MTPfutureSalts new_future_salts(const MTPlong &_req_msg_id, MTPint _now, const MTPvector &_salts) { - return MTPfutureSalts(new MTPDfuture_salts(_req_msg_id, _now, _salts)); + return MTPfutureSalts(std::make_shared(_req_msg_id, _now, _salts)); } inline static MTPpong new_pong(const MTPlong &_msg_id, const MTPlong &_ping_id) { - return MTPpong(new MTPDpong(_msg_id, _ping_id)); + return MTPpong(std::make_shared(_msg_id, _ping_id)); } inline static MTPdestroySessionRes new_destroy_session_ok(const MTPlong &_session_id) { - return MTPdestroySessionRes(new MTPDdestroy_session_ok(_session_id)); + return MTPdestroySessionRes(std::make_shared(_session_id)); } inline static MTPdestroySessionRes new_destroy_session_none(const MTPlong &_session_id) { - return MTPdestroySessionRes(new MTPDdestroy_session_none(_session_id)); + return MTPdestroySessionRes(std::make_shared(_session_id)); } inline static MTPnewSession new_new_session_created(const MTPlong &_first_msg_id, const MTPlong &_unique_id, const MTPlong &_server_salt) { - return MTPnewSession(new MTPDnew_session_created(_first_msg_id, _unique_id, _server_salt)); + return MTPnewSession(std::make_shared(_first_msg_id, _unique_id, _server_salt)); } inline static MTPhttpWait new_http_wait(MTPint _max_delay, MTPint _wait_after, MTPint _max_wait) { - return MTPhttpWait(new MTPDhttp_wait(_max_delay, _wait_after, _max_wait)); + return MTPhttpWait(std::make_shared(_max_delay, _wait_after, _max_wait)); } inline static MTPbool new_boolFalse() { return MTPbool(mtpc_boolFalse); @@ -25609,7 +22000,7 @@ public: return MTPtrue(); } inline static MTPerror new_error(MTPint _code, const MTPstring &_text) { - return MTPerror(new MTPDerror(_code, _text)); + return MTPerror(std::make_shared(_code, _text)); } inline static MTPnull new_null() { return MTPnull(); @@ -25621,13 +22012,13 @@ public: return MTPinputPeer(mtpc_inputPeerSelf); } inline static MTPinputPeer new_inputPeerChat(MTPint _chat_id) { - return MTPinputPeer(new MTPDinputPeerChat(_chat_id)); + return MTPinputPeer(std::make_shared(_chat_id)); } inline static MTPinputPeer new_inputPeerUser(MTPint _user_id, const MTPlong &_access_hash) { - return MTPinputPeer(new MTPDinputPeerUser(_user_id, _access_hash)); + return MTPinputPeer(std::make_shared(_user_id, _access_hash)); } inline static MTPinputPeer new_inputPeerChannel(MTPint _channel_id, const MTPlong &_access_hash) { - return MTPinputPeer(new MTPDinputPeerChannel(_channel_id, _access_hash)); + return MTPinputPeer(std::make_shared(_channel_id, _access_hash)); } inline static MTPinputUser new_inputUserEmpty() { return MTPinputUser(mtpc_inputUserEmpty); @@ -25636,97 +22027,97 @@ public: return MTPinputUser(mtpc_inputUserSelf); } inline static MTPinputUser new_inputUser(MTPint _user_id, const MTPlong &_access_hash) { - return MTPinputUser(new MTPDinputUser(_user_id, _access_hash)); + return MTPinputUser(std::make_shared(_user_id, _access_hash)); } inline static MTPinputContact new_inputPhoneContact(const MTPlong &_client_id, const MTPstring &_phone, const MTPstring &_first_name, const MTPstring &_last_name) { - return MTPinputContact(new MTPDinputPhoneContact(_client_id, _phone, _first_name, _last_name)); + return MTPinputContact(std::make_shared(_client_id, _phone, _first_name, _last_name)); } inline static MTPinputFile new_inputFile(const MTPlong &_id, MTPint _parts, const MTPstring &_name, const MTPstring &_md5_checksum) { - return MTPinputFile(new MTPDinputFile(_id, _parts, _name, _md5_checksum)); + return MTPinputFile(std::make_shared(_id, _parts, _name, _md5_checksum)); } inline static MTPinputFile new_inputFileBig(const MTPlong &_id, MTPint _parts, const MTPstring &_name) { - return MTPinputFile(new MTPDinputFileBig(_id, _parts, _name)); + return MTPinputFile(std::make_shared(_id, _parts, _name)); } inline static MTPinputMedia new_inputMediaEmpty() { return MTPinputMedia(mtpc_inputMediaEmpty); } inline static MTPinputMedia new_inputMediaUploadedPhoto(const MTPflags &_flags, const MTPInputFile &_file, const MTPstring &_caption, const MTPVector &_stickers) { - return MTPinputMedia(new MTPDinputMediaUploadedPhoto(_flags, _file, _caption, _stickers)); + return MTPinputMedia(std::make_shared(_flags, _file, _caption, _stickers)); } inline static MTPinputMedia new_inputMediaPhoto(const MTPInputPhoto &_id, const MTPstring &_caption) { - return MTPinputMedia(new MTPDinputMediaPhoto(_id, _caption)); + return MTPinputMedia(std::make_shared(_id, _caption)); } inline static MTPinputMedia new_inputMediaGeoPoint(const MTPInputGeoPoint &_geo_point) { - return MTPinputMedia(new MTPDinputMediaGeoPoint(_geo_point)); + return MTPinputMedia(std::make_shared(_geo_point)); } inline static MTPinputMedia new_inputMediaContact(const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name) { - return MTPinputMedia(new MTPDinputMediaContact(_phone_number, _first_name, _last_name)); + return MTPinputMedia(std::make_shared(_phone_number, _first_name, _last_name)); } inline static MTPinputMedia new_inputMediaUploadedDocument(const MTPflags &_flags, const MTPInputFile &_file, const MTPstring &_mime_type, const MTPVector &_attributes, const MTPstring &_caption, const MTPVector &_stickers) { - return MTPinputMedia(new MTPDinputMediaUploadedDocument(_flags, _file, _mime_type, _attributes, _caption, _stickers)); + return MTPinputMedia(std::make_shared(_flags, _file, _mime_type, _attributes, _caption, _stickers)); } inline static MTPinputMedia new_inputMediaUploadedThumbDocument(const MTPflags &_flags, const MTPInputFile &_file, const MTPInputFile &_thumb, const MTPstring &_mime_type, const MTPVector &_attributes, const MTPstring &_caption, const MTPVector &_stickers) { - return MTPinputMedia(new MTPDinputMediaUploadedThumbDocument(_flags, _file, _thumb, _mime_type, _attributes, _caption, _stickers)); + return MTPinputMedia(std::make_shared(_flags, _file, _thumb, _mime_type, _attributes, _caption, _stickers)); } inline static MTPinputMedia new_inputMediaDocument(const MTPInputDocument &_id, const MTPstring &_caption) { - return MTPinputMedia(new MTPDinputMediaDocument(_id, _caption)); + return MTPinputMedia(std::make_shared(_id, _caption)); } inline static MTPinputMedia new_inputMediaVenue(const MTPInputGeoPoint &_geo_point, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id) { - return MTPinputMedia(new MTPDinputMediaVenue(_geo_point, _title, _address, _provider, _venue_id)); + return MTPinputMedia(std::make_shared(_geo_point, _title, _address, _provider, _venue_id)); } inline static MTPinputMedia new_inputMediaGifExternal(const MTPstring &_url, const MTPstring &_q) { - return MTPinputMedia(new MTPDinputMediaGifExternal(_url, _q)); + return MTPinputMedia(std::make_shared(_url, _q)); } inline static MTPinputMedia new_inputMediaPhotoExternal(const MTPstring &_url, const MTPstring &_caption) { - return MTPinputMedia(new MTPDinputMediaPhotoExternal(_url, _caption)); + return MTPinputMedia(std::make_shared(_url, _caption)); } inline static MTPinputMedia new_inputMediaDocumentExternal(const MTPstring &_url, const MTPstring &_caption) { - return MTPinputMedia(new MTPDinputMediaDocumentExternal(_url, _caption)); + return MTPinputMedia(std::make_shared(_url, _caption)); } inline static MTPinputMedia new_inputMediaGame(const MTPInputGame &_id) { - return MTPinputMedia(new MTPDinputMediaGame(_id)); + return MTPinputMedia(std::make_shared(_id)); } inline static MTPinputChatPhoto new_inputChatPhotoEmpty() { return MTPinputChatPhoto(mtpc_inputChatPhotoEmpty); } inline static MTPinputChatPhoto new_inputChatUploadedPhoto(const MTPInputFile &_file) { - return MTPinputChatPhoto(new MTPDinputChatUploadedPhoto(_file)); + return MTPinputChatPhoto(std::make_shared(_file)); } inline static MTPinputChatPhoto new_inputChatPhoto(const MTPInputPhoto &_id) { - return MTPinputChatPhoto(new MTPDinputChatPhoto(_id)); + return MTPinputChatPhoto(std::make_shared(_id)); } inline static MTPinputGeoPoint new_inputGeoPointEmpty() { return MTPinputGeoPoint(mtpc_inputGeoPointEmpty); } inline static MTPinputGeoPoint new_inputGeoPoint(const MTPdouble &_lat, const MTPdouble &_long) { - return MTPinputGeoPoint(new MTPDinputGeoPoint(_lat, _long)); + return MTPinputGeoPoint(std::make_shared(_lat, _long)); } inline static MTPinputPhoto new_inputPhotoEmpty() { return MTPinputPhoto(mtpc_inputPhotoEmpty); } inline static MTPinputPhoto new_inputPhoto(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputPhoto(new MTPDinputPhoto(_id, _access_hash)); + return MTPinputPhoto(std::make_shared(_id, _access_hash)); } inline static MTPinputFileLocation new_inputFileLocation(const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret) { - return MTPinputFileLocation(new MTPDinputFileLocation(_volume_id, _local_id, _secret)); + return MTPinputFileLocation(std::make_shared(_volume_id, _local_id, _secret)); } inline static MTPinputFileLocation new_inputEncryptedFileLocation(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputFileLocation(new MTPDinputEncryptedFileLocation(_id, _access_hash)); + return MTPinputFileLocation(std::make_shared(_id, _access_hash)); } inline static MTPinputFileLocation new_inputDocumentFileLocation(const MTPlong &_id, const MTPlong &_access_hash, MTPint _version) { - return MTPinputFileLocation(new MTPDinputDocumentFileLocation(_id, _access_hash, _version)); + return MTPinputFileLocation(std::make_shared(_id, _access_hash, _version)); } inline static MTPinputAppEvent new_inputAppEvent(const MTPdouble &_time, const MTPstring &_type, const MTPlong &_peer, const MTPstring &_data) { - return MTPinputAppEvent(new MTPDinputAppEvent(_time, _type, _peer, _data)); + return MTPinputAppEvent(std::make_shared(_time, _type, _peer, _data)); } inline static MTPpeer new_peerUser(MTPint _user_id) { - return MTPpeer(new MTPDpeerUser(_user_id)); + return MTPpeer(std::make_shared(_user_id)); } inline static MTPpeer new_peerChat(MTPint _chat_id) { - return MTPpeer(new MTPDpeerChat(_chat_id)); + return MTPpeer(std::make_shared(_chat_id)); } inline static MTPpeer new_peerChannel(MTPint _channel_id) { - return MTPpeer(new MTPDpeerChannel(_channel_id)); + return MTPpeer(std::make_shared(_channel_id)); } inline static MTPstorage_fileType new_storage_fileUnknown() { return MTPstorage_fileType(mtpc_storage_fileUnknown); @@ -25759,31 +22150,31 @@ public: return MTPstorage_fileType(mtpc_storage_fileWebp); } inline static MTPfileLocation new_fileLocationUnavailable(const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret) { - return MTPfileLocation(new MTPDfileLocationUnavailable(_volume_id, _local_id, _secret)); + return MTPfileLocation(std::make_shared(_volume_id, _local_id, _secret)); } inline static MTPfileLocation new_fileLocation(MTPint _dc_id, const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret) { - return MTPfileLocation(new MTPDfileLocation(_dc_id, _volume_id, _local_id, _secret)); + return MTPfileLocation(std::make_shared(_dc_id, _volume_id, _local_id, _secret)); } inline static MTPuser new_userEmpty(MTPint _id) { - return MTPuser(new MTPDuserEmpty(_id)); + return MTPuser(std::make_shared(_id)); } inline static MTPuser new_user(const MTPflags &_flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_username, const MTPstring &_phone, const MTPUserProfilePhoto &_photo, const MTPUserStatus &_status, MTPint _bot_info_version, const MTPstring &_restriction_reason, const MTPstring &_bot_inline_placeholder) { - return MTPuser(new MTPDuser(_flags, _id, _access_hash, _first_name, _last_name, _username, _phone, _photo, _status, _bot_info_version, _restriction_reason, _bot_inline_placeholder)); + return MTPuser(std::make_shared(_flags, _id, _access_hash, _first_name, _last_name, _username, _phone, _photo, _status, _bot_info_version, _restriction_reason, _bot_inline_placeholder)); } inline static MTPuserProfilePhoto new_userProfilePhotoEmpty() { return MTPuserProfilePhoto(mtpc_userProfilePhotoEmpty); } inline static MTPuserProfilePhoto new_userProfilePhoto(const MTPlong &_photo_id, const MTPFileLocation &_photo_small, const MTPFileLocation &_photo_big) { - return MTPuserProfilePhoto(new MTPDuserProfilePhoto(_photo_id, _photo_small, _photo_big)); + return MTPuserProfilePhoto(std::make_shared(_photo_id, _photo_small, _photo_big)); } inline static MTPuserStatus new_userStatusEmpty() { return MTPuserStatus(mtpc_userStatusEmpty); } inline static MTPuserStatus new_userStatusOnline(MTPint _expires) { - return MTPuserStatus(new MTPDuserStatusOnline(_expires)); + return MTPuserStatus(std::make_shared(_expires)); } inline static MTPuserStatus new_userStatusOffline(MTPint _was_online) { - return MTPuserStatus(new MTPDuserStatusOffline(_was_online)); + return MTPuserStatus(std::make_shared(_was_online)); } inline static MTPuserStatus new_userStatusRecently() { return MTPuserStatus(mtpc_userStatusRecently); @@ -25795,115 +22186,115 @@ public: return MTPuserStatus(mtpc_userStatusLastMonth); } inline static MTPchat new_chatEmpty(MTPint _id) { - return MTPchat(new MTPDchatEmpty(_id)); + return MTPchat(std::make_shared(_id)); } inline static MTPchat new_chat(const MTPflags &_flags, MTPint _id, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _participants_count, MTPint _date, MTPint _version, const MTPInputChannel &_migrated_to) { - return MTPchat(new MTPDchat(_flags, _id, _title, _photo, _participants_count, _date, _version, _migrated_to)); + return MTPchat(std::make_shared(_flags, _id, _title, _photo, _participants_count, _date, _version, _migrated_to)); } inline static MTPchat new_chatForbidden(MTPint _id, const MTPstring &_title) { - return MTPchat(new MTPDchatForbidden(_id, _title)); + return MTPchat(std::make_shared(_id, _title)); } inline static MTPchat new_channel(const MTPflags &_flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_username, const MTPChatPhoto &_photo, MTPint _date, MTPint _version, const MTPstring &_restriction_reason) { - return MTPchat(new MTPDchannel(_flags, _id, _access_hash, _title, _username, _photo, _date, _version, _restriction_reason)); + return MTPchat(std::make_shared(_flags, _id, _access_hash, _title, _username, _photo, _date, _version, _restriction_reason)); } inline static MTPchat new_channelForbidden(const MTPflags &_flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_title) { - return MTPchat(new MTPDchannelForbidden(_flags, _id, _access_hash, _title)); + return MTPchat(std::make_shared(_flags, _id, _access_hash, _title)); } inline static MTPchatFull new_chatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info) { - return MTPchatFull(new MTPDchatFull(_id, _participants, _chat_photo, _notify_settings, _exported_invite, _bot_info)); + return MTPchatFull(std::make_shared(_id, _participants, _chat_photo, _notify_settings, _exported_invite, _bot_info)); } inline static MTPchatFull new_channelFull(const MTPflags &_flags, MTPint _id, const MTPstring &_about, MTPint _participants_count, MTPint _admins_count, MTPint _kicked_count, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info, MTPint _migrated_from_chat_id, MTPint _migrated_from_max_id, MTPint _pinned_msg_id) { - return MTPchatFull(new MTPDchannelFull(_flags, _id, _about, _participants_count, _admins_count, _kicked_count, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _chat_photo, _notify_settings, _exported_invite, _bot_info, _migrated_from_chat_id, _migrated_from_max_id, _pinned_msg_id)); + return MTPchatFull(std::make_shared(_flags, _id, _about, _participants_count, _admins_count, _kicked_count, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _chat_photo, _notify_settings, _exported_invite, _bot_info, _migrated_from_chat_id, _migrated_from_max_id, _pinned_msg_id)); } inline static MTPchatParticipant new_chatParticipant(MTPint _user_id, MTPint _inviter_id, MTPint _date) { - return MTPchatParticipant(new MTPDchatParticipant(_user_id, _inviter_id, _date)); + return MTPchatParticipant(std::make_shared(_user_id, _inviter_id, _date)); } inline static MTPchatParticipant new_chatParticipantCreator(MTPint _user_id) { - return MTPchatParticipant(new MTPDchatParticipantCreator(_user_id)); + return MTPchatParticipant(std::make_shared(_user_id)); } inline static MTPchatParticipant new_chatParticipantAdmin(MTPint _user_id, MTPint _inviter_id, MTPint _date) { - return MTPchatParticipant(new MTPDchatParticipantAdmin(_user_id, _inviter_id, _date)); + return MTPchatParticipant(std::make_shared(_user_id, _inviter_id, _date)); } inline static MTPchatParticipants new_chatParticipantsForbidden(const MTPflags &_flags, MTPint _chat_id, const MTPChatParticipant &_self_participant) { - return MTPchatParticipants(new MTPDchatParticipantsForbidden(_flags, _chat_id, _self_participant)); + return MTPchatParticipants(std::make_shared(_flags, _chat_id, _self_participant)); } inline static MTPchatParticipants new_chatParticipants(MTPint _chat_id, const MTPVector &_participants, MTPint _version) { - return MTPchatParticipants(new MTPDchatParticipants(_chat_id, _participants, _version)); + return MTPchatParticipants(std::make_shared(_chat_id, _participants, _version)); } inline static MTPchatPhoto new_chatPhotoEmpty() { return MTPchatPhoto(mtpc_chatPhotoEmpty); } inline static MTPchatPhoto new_chatPhoto(const MTPFileLocation &_photo_small, const MTPFileLocation &_photo_big) { - return MTPchatPhoto(new MTPDchatPhoto(_photo_small, _photo_big)); + return MTPchatPhoto(std::make_shared(_photo_small, _photo_big)); } inline static MTPmessage new_messageEmpty(MTPint _id) { - return MTPmessage(new MTPDmessageEmpty(_id)); + return MTPmessage(std::make_shared(_id)); } inline static MTPmessage new_message(const MTPflags &_flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, MTPint _date, const MTPstring &_message, const MTPMessageMedia &_media, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities, MTPint _views, MTPint _edit_date) { - return MTPmessage(new MTPDmessage(_flags, _id, _from_id, _to_id, _fwd_from, _via_bot_id, _reply_to_msg_id, _date, _message, _media, _reply_markup, _entities, _views, _edit_date)); + return MTPmessage(std::make_shared(_flags, _id, _from_id, _to_id, _fwd_from, _via_bot_id, _reply_to_msg_id, _date, _message, _media, _reply_markup, _entities, _views, _edit_date)); } inline static MTPmessage new_messageService(const MTPflags &_flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, MTPint _reply_to_msg_id, MTPint _date, const MTPMessageAction &_action) { - return MTPmessage(new MTPDmessageService(_flags, _id, _from_id, _to_id, _reply_to_msg_id, _date, _action)); + return MTPmessage(std::make_shared(_flags, _id, _from_id, _to_id, _reply_to_msg_id, _date, _action)); } inline static MTPmessageMedia new_messageMediaEmpty() { return MTPmessageMedia(mtpc_messageMediaEmpty); } inline static MTPmessageMedia new_messageMediaPhoto(const MTPPhoto &_photo, const MTPstring &_caption) { - return MTPmessageMedia(new MTPDmessageMediaPhoto(_photo, _caption)); + return MTPmessageMedia(std::make_shared(_photo, _caption)); } inline static MTPmessageMedia new_messageMediaGeo(const MTPGeoPoint &_geo) { - return MTPmessageMedia(new MTPDmessageMediaGeo(_geo)); + return MTPmessageMedia(std::make_shared(_geo)); } inline static MTPmessageMedia new_messageMediaContact(const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name, MTPint _user_id) { - return MTPmessageMedia(new MTPDmessageMediaContact(_phone_number, _first_name, _last_name, _user_id)); + return MTPmessageMedia(std::make_shared(_phone_number, _first_name, _last_name, _user_id)); } inline static MTPmessageMedia new_messageMediaUnsupported() { return MTPmessageMedia(mtpc_messageMediaUnsupported); } inline static MTPmessageMedia new_messageMediaDocument(const MTPDocument &_document, const MTPstring &_caption) { - return MTPmessageMedia(new MTPDmessageMediaDocument(_document, _caption)); + return MTPmessageMedia(std::make_shared(_document, _caption)); } inline static MTPmessageMedia new_messageMediaWebPage(const MTPWebPage &_webpage) { - return MTPmessageMedia(new MTPDmessageMediaWebPage(_webpage)); + return MTPmessageMedia(std::make_shared(_webpage)); } inline static MTPmessageMedia new_messageMediaVenue(const MTPGeoPoint &_geo, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id) { - return MTPmessageMedia(new MTPDmessageMediaVenue(_geo, _title, _address, _provider, _venue_id)); + return MTPmessageMedia(std::make_shared(_geo, _title, _address, _provider, _venue_id)); } inline static MTPmessageMedia new_messageMediaGame(const MTPGame &_game) { - return MTPmessageMedia(new MTPDmessageMediaGame(_game)); + return MTPmessageMedia(std::make_shared(_game)); } inline static MTPmessageAction new_messageActionEmpty() { return MTPmessageAction(mtpc_messageActionEmpty); } inline static MTPmessageAction new_messageActionChatCreate(const MTPstring &_title, const MTPVector &_users) { - return MTPmessageAction(new MTPDmessageActionChatCreate(_title, _users)); + return MTPmessageAction(std::make_shared(_title, _users)); } inline static MTPmessageAction new_messageActionChatEditTitle(const MTPstring &_title) { - return MTPmessageAction(new MTPDmessageActionChatEditTitle(_title)); + return MTPmessageAction(std::make_shared(_title)); } inline static MTPmessageAction new_messageActionChatEditPhoto(const MTPPhoto &_photo) { - return MTPmessageAction(new MTPDmessageActionChatEditPhoto(_photo)); + return MTPmessageAction(std::make_shared(_photo)); } inline static MTPmessageAction new_messageActionChatDeletePhoto() { return MTPmessageAction(mtpc_messageActionChatDeletePhoto); } inline static MTPmessageAction new_messageActionChatAddUser(const MTPVector &_users) { - return MTPmessageAction(new MTPDmessageActionChatAddUser(_users)); + return MTPmessageAction(std::make_shared(_users)); } inline static MTPmessageAction new_messageActionChatDeleteUser(MTPint _user_id) { - return MTPmessageAction(new MTPDmessageActionChatDeleteUser(_user_id)); + return MTPmessageAction(std::make_shared(_user_id)); } inline static MTPmessageAction new_messageActionChatJoinedByLink(MTPint _inviter_id) { - return MTPmessageAction(new MTPDmessageActionChatJoinedByLink(_inviter_id)); + return MTPmessageAction(std::make_shared(_inviter_id)); } inline static MTPmessageAction new_messageActionChannelCreate(const MTPstring &_title) { - return MTPmessageAction(new MTPDmessageActionChannelCreate(_title)); + return MTPmessageAction(std::make_shared(_title)); } inline static MTPmessageAction new_messageActionChatMigrateTo(MTPint _channel_id) { - return MTPmessageAction(new MTPDmessageActionChatMigrateTo(_channel_id)); + return MTPmessageAction(std::make_shared(_channel_id)); } inline static MTPmessageAction new_messageActionChannelMigrateFrom(const MTPstring &_title, MTPint _chat_id) { - return MTPmessageAction(new MTPDmessageActionChannelMigrateFrom(_title, _chat_id)); + return MTPmessageAction(std::make_shared(_title, _chat_id)); } inline static MTPmessageAction new_messageActionPinMessage() { return MTPmessageAction(mtpc_messageActionPinMessage); @@ -25912,49 +22303,49 @@ public: return MTPmessageAction(mtpc_messageActionHistoryClear); } inline static MTPmessageAction new_messageActionGameScore(const MTPlong &_game_id, MTPint _score) { - return MTPmessageAction(new MTPDmessageActionGameScore(_game_id, _score)); + return MTPmessageAction(std::make_shared(_game_id, _score)); } inline static MTPmessageAction new_messageActionPhoneCall(const MTPflags &_flags, const MTPlong &_call_id, const MTPPhoneCallDiscardReason &_reason, MTPint _duration) { - return MTPmessageAction(new MTPDmessageActionPhoneCall(_flags, _call_id, _reason, _duration)); + return MTPmessageAction(std::make_shared(_flags, _call_id, _reason, _duration)); } inline static MTPdialog new_dialog(const MTPflags &_flags, const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts, const MTPDraftMessage &_draft) { - return MTPdialog(new MTPDdialog(_flags, _peer, _top_message, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _notify_settings, _pts, _draft)); + return MTPdialog(std::make_shared(_flags, _peer, _top_message, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _notify_settings, _pts, _draft)); } inline static MTPphoto new_photoEmpty(const MTPlong &_id) { - return MTPphoto(new MTPDphotoEmpty(_id)); + return MTPphoto(std::make_shared(_id)); } inline static MTPphoto new_photo(const MTPflags &_flags, const MTPlong &_id, const MTPlong &_access_hash, MTPint _date, const MTPVector &_sizes) { - return MTPphoto(new MTPDphoto(_flags, _id, _access_hash, _date, _sizes)); + return MTPphoto(std::make_shared(_flags, _id, _access_hash, _date, _sizes)); } inline static MTPphotoSize new_photoSizeEmpty(const MTPstring &_type) { - return MTPphotoSize(new MTPDphotoSizeEmpty(_type)); + return MTPphotoSize(std::make_shared(_type)); } inline static MTPphotoSize new_photoSize(const MTPstring &_type, const MTPFileLocation &_location, MTPint _w, MTPint _h, MTPint _size) { - return MTPphotoSize(new MTPDphotoSize(_type, _location, _w, _h, _size)); + return MTPphotoSize(std::make_shared(_type, _location, _w, _h, _size)); } inline static MTPphotoSize new_photoCachedSize(const MTPstring &_type, const MTPFileLocation &_location, MTPint _w, MTPint _h, const MTPbytes &_bytes) { - return MTPphotoSize(new MTPDphotoCachedSize(_type, _location, _w, _h, _bytes)); + return MTPphotoSize(std::make_shared(_type, _location, _w, _h, _bytes)); } inline static MTPgeoPoint new_geoPointEmpty() { return MTPgeoPoint(mtpc_geoPointEmpty); } inline static MTPgeoPoint new_geoPoint(const MTPdouble &_long, const MTPdouble &_lat) { - return MTPgeoPoint(new MTPDgeoPoint(_long, _lat)); + return MTPgeoPoint(std::make_shared(_long, _lat)); } inline static MTPauth_checkedPhone new_auth_checkedPhone(MTPBool _phone_registered) { - return MTPauth_checkedPhone(new MTPDauth_checkedPhone(_phone_registered)); + return MTPauth_checkedPhone(std::make_shared(_phone_registered)); } inline static MTPauth_sentCode new_auth_sentCode(const MTPflags &_flags, const MTPauth_SentCodeType &_type, const MTPstring &_phone_code_hash, const MTPauth_CodeType &_next_type, MTPint _timeout) { - return MTPauth_sentCode(new MTPDauth_sentCode(_flags, _type, _phone_code_hash, _next_type, _timeout)); + return MTPauth_sentCode(std::make_shared(_flags, _type, _phone_code_hash, _next_type, _timeout)); } inline static MTPauth_authorization new_auth_authorization(const MTPflags &_flags, MTPint _tmp_sessions, const MTPUser &_user) { - return MTPauth_authorization(new MTPDauth_authorization(_flags, _tmp_sessions, _user)); + return MTPauth_authorization(std::make_shared(_flags, _tmp_sessions, _user)); } inline static MTPauth_exportedAuthorization new_auth_exportedAuthorization(MTPint _id, const MTPbytes &_bytes) { - return MTPauth_exportedAuthorization(new MTPDauth_exportedAuthorization(_id, _bytes)); + return MTPauth_exportedAuthorization(std::make_shared(_id, _bytes)); } inline static MTPinputNotifyPeer new_inputNotifyPeer(const MTPInputPeer &_peer) { - return MTPinputNotifyPeer(new MTPDinputNotifyPeer(_peer)); + return MTPinputNotifyPeer(std::make_shared(_peer)); } inline static MTPinputNotifyPeer new_inputNotifyUsers() { return MTPinputNotifyPeer(mtpc_inputNotifyUsers); @@ -25972,7 +22363,7 @@ public: return MTPinputPeerNotifyEvents(mtpc_inputPeerNotifyEventsAll); } inline static MTPinputPeerNotifySettings new_inputPeerNotifySettings(const MTPflags &_flags, MTPint _mute_until, const MTPstring &_sound) { - return MTPinputPeerNotifySettings(new MTPDinputPeerNotifySettings(_flags, _mute_until, _sound)); + return MTPinputPeerNotifySettings(std::make_shared(_flags, _mute_until, _sound)); } inline static MTPpeerNotifyEvents new_peerNotifyEventsEmpty() { return MTPpeerNotifyEvents(mtpc_peerNotifyEventsEmpty); @@ -25984,16 +22375,16 @@ public: return MTPpeerNotifySettings(mtpc_peerNotifySettingsEmpty); } inline static MTPpeerNotifySettings new_peerNotifySettings(const MTPflags &_flags, MTPint _mute_until, const MTPstring &_sound) { - return MTPpeerNotifySettings(new MTPDpeerNotifySettings(_flags, _mute_until, _sound)); + return MTPpeerNotifySettings(std::make_shared(_flags, _mute_until, _sound)); } inline static MTPpeerSettings new_peerSettings(const MTPflags &_flags) { - return MTPpeerSettings(new MTPDpeerSettings(_flags)); + return MTPpeerSettings(std::make_shared(_flags)); } inline static MTPwallPaper new_wallPaper(MTPint _id, const MTPstring &_title, const MTPVector &_sizes, MTPint _color) { - return MTPwallPaper(new MTPDwallPaper(_id, _title, _sizes, _color)); + return MTPwallPaper(std::make_shared(_id, _title, _sizes, _color)); } inline static MTPwallPaper new_wallPaperSolid(MTPint _id, const MTPstring &_title, MTPint _bg_color, MTPint _color) { - return MTPwallPaper(new MTPDwallPaperSolid(_id, _title, _bg_color, _color)); + return MTPwallPaper(std::make_shared(_id, _title, _bg_color, _color)); } inline static MTPreportReason new_inputReportReasonSpam() { return MTPreportReason(mtpc_inputReportReasonSpam); @@ -26005,67 +22396,67 @@ public: return MTPreportReason(mtpc_inputReportReasonPornography); } inline static MTPreportReason new_inputReportReasonOther(const MTPstring &_text) { - return MTPreportReason(new MTPDinputReportReasonOther(_text)); + return MTPreportReason(std::make_shared(_text)); } inline static MTPuserFull new_userFull(const MTPflags &_flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info, MTPint _common_chats_count) { - return MTPuserFull(new MTPDuserFull(_flags, _user, _about, _link, _profile_photo, _notify_settings, _bot_info, _common_chats_count)); + return MTPuserFull(std::make_shared(_flags, _user, _about, _link, _profile_photo, _notify_settings, _bot_info, _common_chats_count)); } inline static MTPcontact new_contact(MTPint _user_id, MTPBool _mutual) { - return MTPcontact(new MTPDcontact(_user_id, _mutual)); + return MTPcontact(std::make_shared(_user_id, _mutual)); } inline static MTPimportedContact new_importedContact(MTPint _user_id, const MTPlong &_client_id) { - return MTPimportedContact(new MTPDimportedContact(_user_id, _client_id)); + return MTPimportedContact(std::make_shared(_user_id, _client_id)); } inline static MTPcontactBlocked new_contactBlocked(MTPint _user_id, MTPint _date) { - return MTPcontactBlocked(new MTPDcontactBlocked(_user_id, _date)); + return MTPcontactBlocked(std::make_shared(_user_id, _date)); } inline static MTPcontactStatus new_contactStatus(MTPint _user_id, const MTPUserStatus &_status) { - return MTPcontactStatus(new MTPDcontactStatus(_user_id, _status)); + return MTPcontactStatus(std::make_shared(_user_id, _status)); } inline static MTPcontacts_link new_contacts_link(const MTPContactLink &_my_link, const MTPContactLink &_foreign_link, const MTPUser &_user) { - return MTPcontacts_link(new MTPDcontacts_link(_my_link, _foreign_link, _user)); + return MTPcontacts_link(std::make_shared(_my_link, _foreign_link, _user)); } inline static MTPcontacts_contacts new_contacts_contactsNotModified() { return MTPcontacts_contacts(mtpc_contacts_contactsNotModified); } inline static MTPcontacts_contacts new_contacts_contacts(const MTPVector &_contacts, const MTPVector &_users) { - return MTPcontacts_contacts(new MTPDcontacts_contacts(_contacts, _users)); + return MTPcontacts_contacts(std::make_shared(_contacts, _users)); } inline static MTPcontacts_importedContacts new_contacts_importedContacts(const MTPVector &_imported, const MTPVector &_retry_contacts, const MTPVector &_users) { - return MTPcontacts_importedContacts(new MTPDcontacts_importedContacts(_imported, _retry_contacts, _users)); + return MTPcontacts_importedContacts(std::make_shared(_imported, _retry_contacts, _users)); } inline static MTPcontacts_blocked new_contacts_blocked(const MTPVector &_blocked, const MTPVector &_users) { - return MTPcontacts_blocked(new MTPDcontacts_blocked(_blocked, _users)); + return MTPcontacts_blocked(std::make_shared(_blocked, _users)); } inline static MTPcontacts_blocked new_contacts_blockedSlice(MTPint _count, const MTPVector &_blocked, const MTPVector &_users) { - return MTPcontacts_blocked(new MTPDcontacts_blockedSlice(_count, _blocked, _users)); + return MTPcontacts_blocked(std::make_shared(_count, _blocked, _users)); } inline static MTPmessages_dialogs new_messages_dialogs(const MTPVector &_dialogs, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_dialogs(new MTPDmessages_dialogs(_dialogs, _messages, _chats, _users)); + return MTPmessages_dialogs(std::make_shared(_dialogs, _messages, _chats, _users)); } inline static MTPmessages_dialogs new_messages_dialogsSlice(MTPint _count, const MTPVector &_dialogs, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_dialogs(new MTPDmessages_dialogsSlice(_count, _dialogs, _messages, _chats, _users)); + return MTPmessages_dialogs(std::make_shared(_count, _dialogs, _messages, _chats, _users)); } inline static MTPmessages_messages new_messages_messages(const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_messages(new MTPDmessages_messages(_messages, _chats, _users)); + return MTPmessages_messages(std::make_shared(_messages, _chats, _users)); } inline static MTPmessages_messages new_messages_messagesSlice(MTPint _count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_messages(new MTPDmessages_messagesSlice(_count, _messages, _chats, _users)); + return MTPmessages_messages(std::make_shared(_count, _messages, _chats, _users)); } inline static MTPmessages_messages new_messages_channelMessages(const MTPflags &_flags, MTPint _pts, MTPint _count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_messages(new MTPDmessages_channelMessages(_flags, _pts, _count, _messages, _chats, _users)); + return MTPmessages_messages(std::make_shared(_flags, _pts, _count, _messages, _chats, _users)); } inline static MTPmessages_chats new_messages_chats(const MTPVector &_chats) { - return MTPmessages_chats(new MTPDmessages_chats(_chats)); + return MTPmessages_chats(std::make_shared(_chats)); } inline static MTPmessages_chats new_messages_chatsSlice(MTPint _count, const MTPVector &_chats) { - return MTPmessages_chats(new MTPDmessages_chatsSlice(_count, _chats)); + return MTPmessages_chats(std::make_shared(_count, _chats)); } inline static MTPmessages_chatFull new_messages_chatFull(const MTPChatFull &_full_chat, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_chatFull(new MTPDmessages_chatFull(_full_chat, _chats, _users)); + return MTPmessages_chatFull(std::make_shared(_full_chat, _chats, _users)); } inline static MTPmessages_affectedHistory new_messages_affectedHistory(MTPint _pts, MTPint _pts_count, MTPint _offset) { - return MTPmessages_affectedHistory(new MTPDmessages_affectedHistory(_pts, _pts_count, _offset)); + return MTPmessages_affectedHistory(std::make_shared(_pts, _pts_count, _offset)); } inline static MTPmessagesFilter new_inputMessagesFilterEmpty() { return MTPmessagesFilter(mtpc_inputMessagesFilterEmpty); @@ -26101,118 +22492,118 @@ public: return MTPmessagesFilter(mtpc_inputMessagesFilterChatPhotos); } inline static MTPmessagesFilter new_inputMessagesFilterPhoneCalls(const MTPflags &_flags) { - return MTPmessagesFilter(new MTPDinputMessagesFilterPhoneCalls(_flags)); + return MTPmessagesFilter(std::make_shared(_flags)); } inline static MTPupdate new_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateNewMessage(_message, _pts, _pts_count)); + return MTPupdate(std::make_shared(_message, _pts, _pts_count)); } inline static MTPupdate new_updateMessageID(MTPint _id, const MTPlong &_random_id) { - return MTPupdate(new MTPDupdateMessageID(_id, _random_id)); + return MTPupdate(std::make_shared(_id, _random_id)); } inline static MTPupdate new_updateDeleteMessages(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateDeleteMessages(_messages, _pts, _pts_count)); + return MTPupdate(std::make_shared(_messages, _pts, _pts_count)); } inline static MTPupdate new_updateUserTyping(MTPint _user_id, const MTPSendMessageAction &_action) { - return MTPupdate(new MTPDupdateUserTyping(_user_id, _action)); + return MTPupdate(std::make_shared(_user_id, _action)); } inline static MTPupdate new_updateChatUserTyping(MTPint _chat_id, MTPint _user_id, const MTPSendMessageAction &_action) { - return MTPupdate(new MTPDupdateChatUserTyping(_chat_id, _user_id, _action)); + return MTPupdate(std::make_shared(_chat_id, _user_id, _action)); } inline static MTPupdate new_updateChatParticipants(const MTPChatParticipants &_participants) { - return MTPupdate(new MTPDupdateChatParticipants(_participants)); + return MTPupdate(std::make_shared(_participants)); } inline static MTPupdate new_updateUserStatus(MTPint _user_id, const MTPUserStatus &_status) { - return MTPupdate(new MTPDupdateUserStatus(_user_id, _status)); + return MTPupdate(std::make_shared(_user_id, _status)); } inline static MTPupdate new_updateUserName(MTPint _user_id, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_username) { - return MTPupdate(new MTPDupdateUserName(_user_id, _first_name, _last_name, _username)); + return MTPupdate(std::make_shared(_user_id, _first_name, _last_name, _username)); } inline static MTPupdate new_updateUserPhoto(MTPint _user_id, MTPint _date, const MTPUserProfilePhoto &_photo, MTPBool _previous) { - return MTPupdate(new MTPDupdateUserPhoto(_user_id, _date, _photo, _previous)); + return MTPupdate(std::make_shared(_user_id, _date, _photo, _previous)); } inline static MTPupdate new_updateContactRegistered(MTPint _user_id, MTPint _date) { - return MTPupdate(new MTPDupdateContactRegistered(_user_id, _date)); + return MTPupdate(std::make_shared(_user_id, _date)); } inline static MTPupdate new_updateContactLink(MTPint _user_id, const MTPContactLink &_my_link, const MTPContactLink &_foreign_link) { - return MTPupdate(new MTPDupdateContactLink(_user_id, _my_link, _foreign_link)); + return MTPupdate(std::make_shared(_user_id, _my_link, _foreign_link)); } inline static MTPupdate new_updateNewEncryptedMessage(const MTPEncryptedMessage &_message, MTPint _qts) { - return MTPupdate(new MTPDupdateNewEncryptedMessage(_message, _qts)); + return MTPupdate(std::make_shared(_message, _qts)); } inline static MTPupdate new_updateEncryptedChatTyping(MTPint _chat_id) { - return MTPupdate(new MTPDupdateEncryptedChatTyping(_chat_id)); + return MTPupdate(std::make_shared(_chat_id)); } inline static MTPupdate new_updateEncryption(const MTPEncryptedChat &_chat, MTPint _date) { - return MTPupdate(new MTPDupdateEncryption(_chat, _date)); + return MTPupdate(std::make_shared(_chat, _date)); } inline static MTPupdate new_updateEncryptedMessagesRead(MTPint _chat_id, MTPint _max_date, MTPint _date) { - return MTPupdate(new MTPDupdateEncryptedMessagesRead(_chat_id, _max_date, _date)); + return MTPupdate(std::make_shared(_chat_id, _max_date, _date)); } inline static MTPupdate new_updateChatParticipantAdd(MTPint _chat_id, MTPint _user_id, MTPint _inviter_id, MTPint _date, MTPint _version) { - return MTPupdate(new MTPDupdateChatParticipantAdd(_chat_id, _user_id, _inviter_id, _date, _version)); + return MTPupdate(std::make_shared(_chat_id, _user_id, _inviter_id, _date, _version)); } inline static MTPupdate new_updateChatParticipantDelete(MTPint _chat_id, MTPint _user_id, MTPint _version) { - return MTPupdate(new MTPDupdateChatParticipantDelete(_chat_id, _user_id, _version)); + return MTPupdate(std::make_shared(_chat_id, _user_id, _version)); } inline static MTPupdate new_updateDcOptions(const MTPVector &_dc_options) { - return MTPupdate(new MTPDupdateDcOptions(_dc_options)); + return MTPupdate(std::make_shared(_dc_options)); } inline static MTPupdate new_updateUserBlocked(MTPint _user_id, MTPBool _blocked) { - return MTPupdate(new MTPDupdateUserBlocked(_user_id, _blocked)); + return MTPupdate(std::make_shared(_user_id, _blocked)); } inline static MTPupdate new_updateNotifySettings(const MTPNotifyPeer &_peer, const MTPPeerNotifySettings &_notify_settings) { - return MTPupdate(new MTPDupdateNotifySettings(_peer, _notify_settings)); + return MTPupdate(std::make_shared(_peer, _notify_settings)); } inline static MTPupdate new_updateServiceNotification(const MTPflags &_flags, MTPint _inbox_date, const MTPstring &_type, const MTPstring &_message, const MTPMessageMedia &_media, const MTPVector &_entities) { - return MTPupdate(new MTPDupdateServiceNotification(_flags, _inbox_date, _type, _message, _media, _entities)); + return MTPupdate(std::make_shared(_flags, _inbox_date, _type, _message, _media, _entities)); } inline static MTPupdate new_updatePrivacy(const MTPPrivacyKey &_key, const MTPVector &_rules) { - return MTPupdate(new MTPDupdatePrivacy(_key, _rules)); + return MTPupdate(std::make_shared(_key, _rules)); } inline static MTPupdate new_updateUserPhone(MTPint _user_id, const MTPstring &_phone) { - return MTPupdate(new MTPDupdateUserPhone(_user_id, _phone)); + return MTPupdate(std::make_shared(_user_id, _phone)); } inline static MTPupdate new_updateReadHistoryInbox(const MTPPeer &_peer, MTPint _max_id, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateReadHistoryInbox(_peer, _max_id, _pts, _pts_count)); + return MTPupdate(std::make_shared(_peer, _max_id, _pts, _pts_count)); } inline static MTPupdate new_updateReadHistoryOutbox(const MTPPeer &_peer, MTPint _max_id, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateReadHistoryOutbox(_peer, _max_id, _pts, _pts_count)); + return MTPupdate(std::make_shared(_peer, _max_id, _pts, _pts_count)); } inline static MTPupdate new_updateWebPage(const MTPWebPage &_webpage, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateWebPage(_webpage, _pts, _pts_count)); + return MTPupdate(std::make_shared(_webpage, _pts, _pts_count)); } inline static MTPupdate new_updateReadMessagesContents(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateReadMessagesContents(_messages, _pts, _pts_count)); + return MTPupdate(std::make_shared(_messages, _pts, _pts_count)); } inline static MTPupdate new_updateChannelTooLong(const MTPflags &_flags, MTPint _channel_id, MTPint _pts) { - return MTPupdate(new MTPDupdateChannelTooLong(_flags, _channel_id, _pts)); + return MTPupdate(std::make_shared(_flags, _channel_id, _pts)); } inline static MTPupdate new_updateChannel(MTPint _channel_id) { - return MTPupdate(new MTPDupdateChannel(_channel_id)); + return MTPupdate(std::make_shared(_channel_id)); } inline static MTPupdate new_updateNewChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateNewChannelMessage(_message, _pts, _pts_count)); + return MTPupdate(std::make_shared(_message, _pts, _pts_count)); } inline static MTPupdate new_updateReadChannelInbox(MTPint _channel_id, MTPint _max_id) { - return MTPupdate(new MTPDupdateReadChannelInbox(_channel_id, _max_id)); + return MTPupdate(std::make_shared(_channel_id, _max_id)); } inline static MTPupdate new_updateDeleteChannelMessages(MTPint _channel_id, const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateDeleteChannelMessages(_channel_id, _messages, _pts, _pts_count)); + return MTPupdate(std::make_shared(_channel_id, _messages, _pts, _pts_count)); } inline static MTPupdate new_updateChannelMessageViews(MTPint _channel_id, MTPint _id, MTPint _views) { - return MTPupdate(new MTPDupdateChannelMessageViews(_channel_id, _id, _views)); + return MTPupdate(std::make_shared(_channel_id, _id, _views)); } inline static MTPupdate new_updateChatAdmins(MTPint _chat_id, MTPBool _enabled, MTPint _version) { - return MTPupdate(new MTPDupdateChatAdmins(_chat_id, _enabled, _version)); + return MTPupdate(std::make_shared(_chat_id, _enabled, _version)); } inline static MTPupdate new_updateChatParticipantAdmin(MTPint _chat_id, MTPint _user_id, MTPBool _is_admin, MTPint _version) { - return MTPupdate(new MTPDupdateChatParticipantAdmin(_chat_id, _user_id, _is_admin, _version)); + return MTPupdate(std::make_shared(_chat_id, _user_id, _is_admin, _version)); } inline static MTPupdate new_updateNewStickerSet(const MTPmessages_StickerSet &_stickerset) { - return MTPupdate(new MTPDupdateNewStickerSet(_stickerset)); + return MTPupdate(std::make_shared(_stickerset)); } inline static MTPupdate new_updateStickerSetsOrder(const MTPflags &_flags, const MTPVector &_order) { - return MTPupdate(new MTPDupdateStickerSetsOrder(_flags, _order)); + return MTPupdate(std::make_shared(_flags, _order)); } inline static MTPupdate new_updateStickerSets() { return MTPupdate(mtpc_updateStickerSets); @@ -26221,31 +22612,31 @@ public: return MTPupdate(mtpc_updateSavedGifs); } inline static MTPupdate new_updateBotInlineQuery(const MTPflags &_flags, const MTPlong &_query_id, MTPint _user_id, const MTPstring &_query, const MTPGeoPoint &_geo, const MTPstring &_offset) { - return MTPupdate(new MTPDupdateBotInlineQuery(_flags, _query_id, _user_id, _query, _geo, _offset)); + return MTPupdate(std::make_shared(_flags, _query_id, _user_id, _query, _geo, _offset)); } inline static MTPupdate new_updateBotInlineSend(const MTPflags &_flags, MTPint _user_id, const MTPstring &_query, const MTPGeoPoint &_geo, const MTPstring &_id, const MTPInputBotInlineMessageID &_msg_id) { - return MTPupdate(new MTPDupdateBotInlineSend(_flags, _user_id, _query, _geo, _id, _msg_id)); + return MTPupdate(std::make_shared(_flags, _user_id, _query, _geo, _id, _msg_id)); } inline static MTPupdate new_updateEditChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateEditChannelMessage(_message, _pts, _pts_count)); + return MTPupdate(std::make_shared(_message, _pts, _pts_count)); } inline static MTPupdate new_updateChannelPinnedMessage(MTPint _channel_id, MTPint _id) { - return MTPupdate(new MTPDupdateChannelPinnedMessage(_channel_id, _id)); + return MTPupdate(std::make_shared(_channel_id, _id)); } inline static MTPupdate new_updateBotCallbackQuery(const MTPflags &_flags, const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPlong &_chat_instance, const MTPbytes &_data, const MTPstring &_game_short_name) { - return MTPupdate(new MTPDupdateBotCallbackQuery(_flags, _query_id, _user_id, _peer, _msg_id, _chat_instance, _data, _game_short_name)); + return MTPupdate(std::make_shared(_flags, _query_id, _user_id, _peer, _msg_id, _chat_instance, _data, _game_short_name)); } inline static MTPupdate new_updateEditMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateEditMessage(_message, _pts, _pts_count)); + return MTPupdate(std::make_shared(_message, _pts, _pts_count)); } inline static MTPupdate new_updateInlineBotCallbackQuery(const MTPflags &_flags, const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPlong &_chat_instance, const MTPbytes &_data, const MTPstring &_game_short_name) { - return MTPupdate(new MTPDupdateInlineBotCallbackQuery(_flags, _query_id, _user_id, _msg_id, _chat_instance, _data, _game_short_name)); + return MTPupdate(std::make_shared(_flags, _query_id, _user_id, _msg_id, _chat_instance, _data, _game_short_name)); } inline static MTPupdate new_updateReadChannelOutbox(MTPint _channel_id, MTPint _max_id) { - return MTPupdate(new MTPDupdateReadChannelOutbox(_channel_id, _max_id)); + return MTPupdate(std::make_shared(_channel_id, _max_id)); } inline static MTPupdate new_updateDraftMessage(const MTPPeer &_peer, const MTPDraftMessage &_draft) { - return MTPupdate(new MTPDupdateDraftMessage(_peer, _draft)); + return MTPupdate(std::make_shared(_peer, _draft)); } inline static MTPupdate new_updateReadFeaturedStickers() { return MTPupdate(mtpc_updateReadFeaturedStickers); @@ -26260,154 +22651,154 @@ public: return MTPupdate(mtpc_updatePtsChanged); } inline static MTPupdate new_updateChannelWebPage(MTPint _channel_id, const MTPWebPage &_webpage, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateChannelWebPage(_channel_id, _webpage, _pts, _pts_count)); + return MTPupdate(std::make_shared(_channel_id, _webpage, _pts, _pts_count)); } inline static MTPupdate new_updatePhoneCall(const MTPPhoneCall &_phone_call) { - return MTPupdate(new MTPDupdatePhoneCall(_phone_call)); + return MTPupdate(std::make_shared(_phone_call)); } inline static MTPupdate new_updateDialogPinned(const MTPflags &_flags, const MTPPeer &_peer) { - return MTPupdate(new MTPDupdateDialogPinned(_flags, _peer)); + return MTPupdate(std::make_shared(_flags, _peer)); } inline static MTPupdate new_updatePinnedDialogs(const MTPflags &_flags, const MTPVector &_order) { - return MTPupdate(new MTPDupdatePinnedDialogs(_flags, _order)); + return MTPupdate(std::make_shared(_flags, _order)); } inline static MTPupdates_state new_updates_state(MTPint _pts, MTPint _qts, MTPint _date, MTPint _seq, MTPint _unread_count) { - return MTPupdates_state(new MTPDupdates_state(_pts, _qts, _date, _seq, _unread_count)); + return MTPupdates_state(std::make_shared(_pts, _qts, _date, _seq, _unread_count)); } inline static MTPupdates_difference new_updates_differenceEmpty(MTPint _date, MTPint _seq) { - return MTPupdates_difference(new MTPDupdates_differenceEmpty(_date, _seq)); + return MTPupdates_difference(std::make_shared(_date, _seq)); } inline static MTPupdates_difference new_updates_difference(const MTPVector &_new_messages, const MTPVector &_new_encrypted_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_state) { - return MTPupdates_difference(new MTPDupdates_difference(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _state)); + return MTPupdates_difference(std::make_shared(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _state)); } inline static MTPupdates_difference new_updates_differenceSlice(const MTPVector &_new_messages, const MTPVector &_new_encrypted_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_intermediate_state) { - return MTPupdates_difference(new MTPDupdates_differenceSlice(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _intermediate_state)); + return MTPupdates_difference(std::make_shared(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _intermediate_state)); } inline static MTPupdates_difference new_updates_differenceTooLong(MTPint _pts) { - return MTPupdates_difference(new MTPDupdates_differenceTooLong(_pts)); + return MTPupdates_difference(std::make_shared(_pts)); } inline static MTPupdates new_updatesTooLong() { return MTPupdates(mtpc_updatesTooLong); } inline static MTPupdates new_updateShortMessage(const MTPflags &_flags, MTPint _id, MTPint _user_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) { - return MTPupdates(new MTPDupdateShortMessage(_flags, _id, _user_id, _message, _pts, _pts_count, _date, _fwd_from, _via_bot_id, _reply_to_msg_id, _entities)); + return MTPupdates(std::make_shared(_flags, _id, _user_id, _message, _pts, _pts_count, _date, _fwd_from, _via_bot_id, _reply_to_msg_id, _entities)); } inline static MTPupdates new_updateShortChatMessage(const MTPflags &_flags, MTPint _id, MTPint _from_id, MTPint _chat_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) { - return MTPupdates(new MTPDupdateShortChatMessage(_flags, _id, _from_id, _chat_id, _message, _pts, _pts_count, _date, _fwd_from, _via_bot_id, _reply_to_msg_id, _entities)); + return MTPupdates(std::make_shared(_flags, _id, _from_id, _chat_id, _message, _pts, _pts_count, _date, _fwd_from, _via_bot_id, _reply_to_msg_id, _entities)); } inline static MTPupdates new_updateShort(const MTPUpdate &_update, MTPint _date) { - return MTPupdates(new MTPDupdateShort(_update, _date)); + return MTPupdates(std::make_shared(_update, _date)); } inline static MTPupdates new_updatesCombined(const MTPVector &_updates, const MTPVector &_users, const MTPVector &_chats, MTPint _date, MTPint _seq_start, MTPint _seq) { - return MTPupdates(new MTPDupdatesCombined(_updates, _users, _chats, _date, _seq_start, _seq)); + return MTPupdates(std::make_shared(_updates, _users, _chats, _date, _seq_start, _seq)); } inline static MTPupdates new_updates(const MTPVector &_updates, const MTPVector &_users, const MTPVector &_chats, MTPint _date, MTPint _seq) { - return MTPupdates(new MTPDupdates(_updates, _users, _chats, _date, _seq)); + return MTPupdates(std::make_shared(_updates, _users, _chats, _date, _seq)); } inline static MTPupdates new_updateShortSentMessage(const MTPflags &_flags, MTPint _id, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageMedia &_media, const MTPVector &_entities) { - return MTPupdates(new MTPDupdateShortSentMessage(_flags, _id, _pts, _pts_count, _date, _media, _entities)); + return MTPupdates(std::make_shared(_flags, _id, _pts, _pts_count, _date, _media, _entities)); } inline static MTPphotos_photos new_photos_photos(const MTPVector &_photos, const MTPVector &_users) { - return MTPphotos_photos(new MTPDphotos_photos(_photos, _users)); + return MTPphotos_photos(std::make_shared(_photos, _users)); } inline static MTPphotos_photos new_photos_photosSlice(MTPint _count, const MTPVector &_photos, const MTPVector &_users) { - return MTPphotos_photos(new MTPDphotos_photosSlice(_count, _photos, _users)); + return MTPphotos_photos(std::make_shared(_count, _photos, _users)); } inline static MTPphotos_photo new_photos_photo(const MTPPhoto &_photo, const MTPVector &_users) { - return MTPphotos_photo(new MTPDphotos_photo(_photo, _users)); + return MTPphotos_photo(std::make_shared(_photo, _users)); } inline static MTPupload_file new_upload_file(const MTPstorage_FileType &_type, MTPint _mtime, const MTPbytes &_bytes) { - return MTPupload_file(new MTPDupload_file(_type, _mtime, _bytes)); + return MTPupload_file(std::make_shared(_type, _mtime, _bytes)); } inline static MTPdcOption new_dcOption(const MTPflags &_flags, MTPint _id, const MTPstring &_ip_address, MTPint _port) { - return MTPdcOption(new MTPDdcOption(_flags, _id, _ip_address, _port)); + return MTPdcOption(std::make_shared(_flags, _id, _ip_address, _port)); } inline static MTPconfig new_config(const MTPflags &_flags, MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _megagroup_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, MTPint _saved_gifs_limit, MTPint _edit_time_limit, MTPint _rating_e_decay, MTPint _stickers_recent_limit, MTPint _tmp_sessions, MTPint _pinned_dialogs_count_max, MTPint _call_receive_timeout_ms, MTPint _call_ring_timeout_ms, MTPint _call_connect_timeout_ms, MTPint _call_packet_timeout_ms, const MTPVector &_disabled_features) { - return MTPconfig(new MTPDconfig(_flags, _date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _megagroup_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _push_chat_period_ms, _push_chat_limit, _saved_gifs_limit, _edit_time_limit, _rating_e_decay, _stickers_recent_limit, _tmp_sessions, _pinned_dialogs_count_max, _call_receive_timeout_ms, _call_ring_timeout_ms, _call_connect_timeout_ms, _call_packet_timeout_ms, _disabled_features)); + return MTPconfig(std::make_shared(_flags, _date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _megagroup_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _push_chat_period_ms, _push_chat_limit, _saved_gifs_limit, _edit_time_limit, _rating_e_decay, _stickers_recent_limit, _tmp_sessions, _pinned_dialogs_count_max, _call_receive_timeout_ms, _call_ring_timeout_ms, _call_connect_timeout_ms, _call_packet_timeout_ms, _disabled_features)); } inline static MTPnearestDc new_nearestDc(const MTPstring &_country, MTPint _this_dc, MTPint _nearest_dc) { - return MTPnearestDc(new MTPDnearestDc(_country, _this_dc, _nearest_dc)); + return MTPnearestDc(std::make_shared(_country, _this_dc, _nearest_dc)); } inline static MTPhelp_appUpdate new_help_appUpdate(MTPint _id, MTPBool _critical, const MTPstring &_url, const MTPstring &_text) { - return MTPhelp_appUpdate(new MTPDhelp_appUpdate(_id, _critical, _url, _text)); + return MTPhelp_appUpdate(std::make_shared(_id, _critical, _url, _text)); } inline static MTPhelp_appUpdate new_help_noAppUpdate() { return MTPhelp_appUpdate(mtpc_help_noAppUpdate); } inline static MTPhelp_inviteText new_help_inviteText(const MTPstring &_message) { - return MTPhelp_inviteText(new MTPDhelp_inviteText(_message)); + return MTPhelp_inviteText(std::make_shared(_message)); } inline static MTPencryptedChat new_encryptedChatEmpty(MTPint _id) { - return MTPencryptedChat(new MTPDencryptedChatEmpty(_id)); + return MTPencryptedChat(std::make_shared(_id)); } inline static MTPencryptedChat new_encryptedChatWaiting(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id) { - return MTPencryptedChat(new MTPDencryptedChatWaiting(_id, _access_hash, _date, _admin_id, _participant_id)); + return MTPencryptedChat(std::make_shared(_id, _access_hash, _date, _admin_id, _participant_id)); } inline static MTPencryptedChat new_encryptedChatRequested(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id, const MTPbytes &_g_a) { - return MTPencryptedChat(new MTPDencryptedChatRequested(_id, _access_hash, _date, _admin_id, _participant_id, _g_a)); + return MTPencryptedChat(std::make_shared(_id, _access_hash, _date, _admin_id, _participant_id, _g_a)); } inline static MTPencryptedChat new_encryptedChat(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id, const MTPbytes &_g_a_or_b, const MTPlong &_key_fingerprint) { - return MTPencryptedChat(new MTPDencryptedChat(_id, _access_hash, _date, _admin_id, _participant_id, _g_a_or_b, _key_fingerprint)); + return MTPencryptedChat(std::make_shared(_id, _access_hash, _date, _admin_id, _participant_id, _g_a_or_b, _key_fingerprint)); } inline static MTPencryptedChat new_encryptedChatDiscarded(MTPint _id) { - return MTPencryptedChat(new MTPDencryptedChatDiscarded(_id)); + return MTPencryptedChat(std::make_shared(_id)); } inline static MTPinputEncryptedChat new_inputEncryptedChat(MTPint _chat_id, const MTPlong &_access_hash) { - return MTPinputEncryptedChat(new MTPDinputEncryptedChat(_chat_id, _access_hash)); + return MTPinputEncryptedChat(std::make_shared(_chat_id, _access_hash)); } inline static MTPencryptedFile new_encryptedFileEmpty() { return MTPencryptedFile(mtpc_encryptedFileEmpty); } inline static MTPencryptedFile new_encryptedFile(const MTPlong &_id, const MTPlong &_access_hash, MTPint _size, MTPint _dc_id, MTPint _key_fingerprint) { - return MTPencryptedFile(new MTPDencryptedFile(_id, _access_hash, _size, _dc_id, _key_fingerprint)); + return MTPencryptedFile(std::make_shared(_id, _access_hash, _size, _dc_id, _key_fingerprint)); } inline static MTPinputEncryptedFile new_inputEncryptedFileEmpty() { return MTPinputEncryptedFile(mtpc_inputEncryptedFileEmpty); } inline static MTPinputEncryptedFile new_inputEncryptedFileUploaded(const MTPlong &_id, MTPint _parts, const MTPstring &_md5_checksum, MTPint _key_fingerprint) { - return MTPinputEncryptedFile(new MTPDinputEncryptedFileUploaded(_id, _parts, _md5_checksum, _key_fingerprint)); + return MTPinputEncryptedFile(std::make_shared(_id, _parts, _md5_checksum, _key_fingerprint)); } inline static MTPinputEncryptedFile new_inputEncryptedFile(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputEncryptedFile(new MTPDinputEncryptedFile(_id, _access_hash)); + return MTPinputEncryptedFile(std::make_shared(_id, _access_hash)); } inline static MTPinputEncryptedFile new_inputEncryptedFileBigUploaded(const MTPlong &_id, MTPint _parts, MTPint _key_fingerprint) { - return MTPinputEncryptedFile(new MTPDinputEncryptedFileBigUploaded(_id, _parts, _key_fingerprint)); + return MTPinputEncryptedFile(std::make_shared(_id, _parts, _key_fingerprint)); } inline static MTPencryptedMessage new_encryptedMessage(const MTPlong &_random_id, MTPint _chat_id, MTPint _date, const MTPbytes &_bytes, const MTPEncryptedFile &_file) { - return MTPencryptedMessage(new MTPDencryptedMessage(_random_id, _chat_id, _date, _bytes, _file)); + return MTPencryptedMessage(std::make_shared(_random_id, _chat_id, _date, _bytes, _file)); } inline static MTPencryptedMessage new_encryptedMessageService(const MTPlong &_random_id, MTPint _chat_id, MTPint _date, const MTPbytes &_bytes) { - return MTPencryptedMessage(new MTPDencryptedMessageService(_random_id, _chat_id, _date, _bytes)); + return MTPencryptedMessage(std::make_shared(_random_id, _chat_id, _date, _bytes)); } inline static MTPmessages_dhConfig new_messages_dhConfigNotModified(const MTPbytes &_random) { - return MTPmessages_dhConfig(new MTPDmessages_dhConfigNotModified(_random)); + return MTPmessages_dhConfig(std::make_shared(_random)); } inline static MTPmessages_dhConfig new_messages_dhConfig(MTPint _g, const MTPbytes &_p, MTPint _version, const MTPbytes &_random) { - return MTPmessages_dhConfig(new MTPDmessages_dhConfig(_g, _p, _version, _random)); + return MTPmessages_dhConfig(std::make_shared(_g, _p, _version, _random)); } inline static MTPmessages_sentEncryptedMessage new_messages_sentEncryptedMessage(MTPint _date) { - return MTPmessages_sentEncryptedMessage(new MTPDmessages_sentEncryptedMessage(_date)); + return MTPmessages_sentEncryptedMessage(std::make_shared(_date)); } inline static MTPmessages_sentEncryptedMessage new_messages_sentEncryptedFile(MTPint _date, const MTPEncryptedFile &_file) { - return MTPmessages_sentEncryptedMessage(new MTPDmessages_sentEncryptedFile(_date, _file)); + return MTPmessages_sentEncryptedMessage(std::make_shared(_date, _file)); } inline static MTPinputDocument new_inputDocumentEmpty() { return MTPinputDocument(mtpc_inputDocumentEmpty); } inline static MTPinputDocument new_inputDocument(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputDocument(new MTPDinputDocument(_id, _access_hash)); + return MTPinputDocument(std::make_shared(_id, _access_hash)); } inline static MTPdocument new_documentEmpty(const MTPlong &_id) { - return MTPdocument(new MTPDdocumentEmpty(_id)); + return MTPdocument(std::make_shared(_id)); } inline static MTPdocument new_document(const MTPlong &_id, const MTPlong &_access_hash, MTPint _date, const MTPstring &_mime_type, MTPint _size, const MTPPhotoSize &_thumb, MTPint _dc_id, MTPint _version, const MTPVector &_attributes) { - return MTPdocument(new MTPDdocument(_id, _access_hash, _date, _mime_type, _size, _thumb, _dc_id, _version, _attributes)); + return MTPdocument(std::make_shared(_id, _access_hash, _date, _mime_type, _size, _thumb, _dc_id, _version, _attributes)); } inline static MTPhelp_support new_help_support(const MTPstring &_phone_number, const MTPUser &_user) { - return MTPhelp_support(new MTPDhelp_support(_phone_number, _user)); + return MTPhelp_support(std::make_shared(_phone_number, _user)); } inline static MTPnotifyPeer new_notifyPeer(const MTPPeer &_peer) { - return MTPnotifyPeer(new MTPDnotifyPeer(_peer)); + return MTPnotifyPeer(std::make_shared(_peer)); } inline static MTPnotifyPeer new_notifyUsers() { return MTPnotifyPeer(mtpc_notifyUsers); @@ -26428,19 +22819,19 @@ public: return MTPsendMessageAction(mtpc_sendMessageRecordVideoAction); } inline static MTPsendMessageAction new_sendMessageUploadVideoAction(MTPint _progress) { - return MTPsendMessageAction(new MTPDsendMessageUploadVideoAction(_progress)); + return MTPsendMessageAction(std::make_shared(_progress)); } inline static MTPsendMessageAction new_sendMessageRecordAudioAction() { return MTPsendMessageAction(mtpc_sendMessageRecordAudioAction); } inline static MTPsendMessageAction new_sendMessageUploadAudioAction(MTPint _progress) { - return MTPsendMessageAction(new MTPDsendMessageUploadAudioAction(_progress)); + return MTPsendMessageAction(std::make_shared(_progress)); } inline static MTPsendMessageAction new_sendMessageUploadPhotoAction(MTPint _progress) { - return MTPsendMessageAction(new MTPDsendMessageUploadPhotoAction(_progress)); + return MTPsendMessageAction(std::make_shared(_progress)); } inline static MTPsendMessageAction new_sendMessageUploadDocumentAction(MTPint _progress) { - return MTPsendMessageAction(new MTPDsendMessageUploadDocumentAction(_progress)); + return MTPsendMessageAction(std::make_shared(_progress)); } inline static MTPsendMessageAction new_sendMessageGeoLocationAction() { return MTPsendMessageAction(mtpc_sendMessageGeoLocationAction); @@ -26452,7 +22843,7 @@ public: return MTPsendMessageAction(mtpc_sendMessageGamePlayAction); } inline static MTPcontacts_found new_contacts_found(const MTPVector &_results, const MTPVector &_chats, const MTPVector &_users) { - return MTPcontacts_found(new MTPDcontacts_found(_results, _chats, _users)); + return MTPcontacts_found(std::make_shared(_results, _chats, _users)); } inline static MTPinputPrivacyKey new_inputPrivacyKeyStatusTimestamp() { return MTPinputPrivacyKey(mtpc_inputPrivacyKeyStatusTimestamp); @@ -26479,7 +22870,7 @@ public: return MTPinputPrivacyRule(mtpc_inputPrivacyValueAllowAll); } inline static MTPinputPrivacyRule new_inputPrivacyValueAllowUsers(const MTPVector &_users) { - return MTPinputPrivacyRule(new MTPDinputPrivacyValueAllowUsers(_users)); + return MTPinputPrivacyRule(std::make_shared(_users)); } inline static MTPinputPrivacyRule new_inputPrivacyValueDisallowContacts() { return MTPinputPrivacyRule(mtpc_inputPrivacyValueDisallowContacts); @@ -26488,7 +22879,7 @@ public: return MTPinputPrivacyRule(mtpc_inputPrivacyValueDisallowAll); } inline static MTPinputPrivacyRule new_inputPrivacyValueDisallowUsers(const MTPVector &_users) { - return MTPinputPrivacyRule(new MTPDinputPrivacyValueDisallowUsers(_users)); + return MTPinputPrivacyRule(std::make_shared(_users)); } inline static MTPprivacyRule new_privacyValueAllowContacts() { return MTPprivacyRule(mtpc_privacyValueAllowContacts); @@ -26497,7 +22888,7 @@ public: return MTPprivacyRule(mtpc_privacyValueAllowAll); } inline static MTPprivacyRule new_privacyValueAllowUsers(const MTPVector &_users) { - return MTPprivacyRule(new MTPDprivacyValueAllowUsers(_users)); + return MTPprivacyRule(std::make_shared(_users)); } inline static MTPprivacyRule new_privacyValueDisallowContacts() { return MTPprivacyRule(mtpc_privacyValueDisallowContacts); @@ -26506,31 +22897,31 @@ public: return MTPprivacyRule(mtpc_privacyValueDisallowAll); } inline static MTPprivacyRule new_privacyValueDisallowUsers(const MTPVector &_users) { - return MTPprivacyRule(new MTPDprivacyValueDisallowUsers(_users)); + return MTPprivacyRule(std::make_shared(_users)); } inline static MTPaccount_privacyRules new_account_privacyRules(const MTPVector &_rules, const MTPVector &_users) { - return MTPaccount_privacyRules(new MTPDaccount_privacyRules(_rules, _users)); + return MTPaccount_privacyRules(std::make_shared(_rules, _users)); } inline static MTPaccountDaysTTL new_accountDaysTTL(MTPint _days) { - return MTPaccountDaysTTL(new MTPDaccountDaysTTL(_days)); + return MTPaccountDaysTTL(std::make_shared(_days)); } inline static MTPdocumentAttribute new_documentAttributeImageSize(MTPint _w, MTPint _h) { - return MTPdocumentAttribute(new MTPDdocumentAttributeImageSize(_w, _h)); + return MTPdocumentAttribute(std::make_shared(_w, _h)); } inline static MTPdocumentAttribute new_documentAttributeAnimated() { return MTPdocumentAttribute(mtpc_documentAttributeAnimated); } inline static MTPdocumentAttribute new_documentAttributeSticker(const MTPflags &_flags, const MTPstring &_alt, const MTPInputStickerSet &_stickerset, const MTPMaskCoords &_mask_coords) { - return MTPdocumentAttribute(new MTPDdocumentAttributeSticker(_flags, _alt, _stickerset, _mask_coords)); + return MTPdocumentAttribute(std::make_shared(_flags, _alt, _stickerset, _mask_coords)); } inline static MTPdocumentAttribute new_documentAttributeVideo(MTPint _duration, MTPint _w, MTPint _h) { - return MTPdocumentAttribute(new MTPDdocumentAttributeVideo(_duration, _w, _h)); + return MTPdocumentAttribute(std::make_shared(_duration, _w, _h)); } inline static MTPdocumentAttribute new_documentAttributeAudio(const MTPflags &_flags, MTPint _duration, const MTPstring &_title, const MTPstring &_performer, const MTPbytes &_waveform) { - return MTPdocumentAttribute(new MTPDdocumentAttributeAudio(_flags, _duration, _title, _performer, _waveform)); + return MTPdocumentAttribute(std::make_shared(_flags, _duration, _title, _performer, _waveform)); } inline static MTPdocumentAttribute new_documentAttributeFilename(const MTPstring &_file_name) { - return MTPdocumentAttribute(new MTPDdocumentAttributeFilename(_file_name)); + return MTPdocumentAttribute(std::make_shared(_file_name)); } inline static MTPdocumentAttribute new_documentAttributeHasStickers() { return MTPdocumentAttribute(mtpc_documentAttributeHasStickers); @@ -26539,22 +22930,22 @@ public: return MTPmessages_stickers(mtpc_messages_stickersNotModified); } inline static MTPmessages_stickers new_messages_stickers(const MTPstring &_hash, const MTPVector &_stickers) { - return MTPmessages_stickers(new MTPDmessages_stickers(_hash, _stickers)); + return MTPmessages_stickers(std::make_shared(_hash, _stickers)); } inline static MTPstickerPack new_stickerPack(const MTPstring &_emoticon, const MTPVector &_documents) { - return MTPstickerPack(new MTPDstickerPack(_emoticon, _documents)); + return MTPstickerPack(std::make_shared(_emoticon, _documents)); } inline static MTPmessages_allStickers new_messages_allStickersNotModified() { return MTPmessages_allStickers(mtpc_messages_allStickersNotModified); } inline static MTPmessages_allStickers new_messages_allStickers(MTPint _hash, const MTPVector &_sets) { - return MTPmessages_allStickers(new MTPDmessages_allStickers(_hash, _sets)); + return MTPmessages_allStickers(std::make_shared(_hash, _sets)); } inline static MTPdisabledFeature new_disabledFeature(const MTPstring &_feature, const MTPstring &_description) { - return MTPdisabledFeature(new MTPDdisabledFeature(_feature, _description)); + return MTPdisabledFeature(std::make_shared(_feature, _description)); } inline static MTPmessages_affectedMessages new_messages_affectedMessages(MTPint _pts, MTPint _pts_count) { - return MTPmessages_affectedMessages(new MTPDmessages_affectedMessages(_pts, _pts_count)); + return MTPmessages_affectedMessages(std::make_shared(_pts, _pts_count)); } inline static MTPcontactLink new_contactLinkUnknown() { return MTPcontactLink(mtpc_contactLinkUnknown); @@ -26569,199 +22960,199 @@ public: return MTPcontactLink(mtpc_contactLinkContact); } inline static MTPwebPage new_webPageEmpty(const MTPlong &_id) { - return MTPwebPage(new MTPDwebPageEmpty(_id)); + return MTPwebPage(std::make_shared(_id)); } inline static MTPwebPage new_webPagePending(const MTPlong &_id, MTPint _date) { - return MTPwebPage(new MTPDwebPagePending(_id, _date)); + return MTPwebPage(std::make_shared(_id, _date)); } inline static MTPwebPage new_webPage(const MTPflags &_flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, MTPint _hash, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document, const MTPPage &_cached_page) { - return MTPwebPage(new MTPDwebPage(_flags, _id, _url, _display_url, _hash, _type, _site_name, _title, _description, _photo, _embed_url, _embed_type, _embed_width, _embed_height, _duration, _author, _document, _cached_page)); + return MTPwebPage(std::make_shared(_flags, _id, _url, _display_url, _hash, _type, _site_name, _title, _description, _photo, _embed_url, _embed_type, _embed_width, _embed_height, _duration, _author, _document, _cached_page)); } inline static MTPwebPage new_webPageNotModified() { return MTPwebPage(mtpc_webPageNotModified); } inline static MTPauthorization new_authorization(const MTPlong &_hash, MTPint _flags, const MTPstring &_device_model, const MTPstring &_platform, const MTPstring &_system_version, MTPint _api_id, const MTPstring &_app_name, const MTPstring &_app_version, MTPint _date_created, MTPint _date_active, const MTPstring &_ip, const MTPstring &_country, const MTPstring &_region) { - return MTPauthorization(new MTPDauthorization(_hash, _flags, _device_model, _platform, _system_version, _api_id, _app_name, _app_version, _date_created, _date_active, _ip, _country, _region)); + return MTPauthorization(std::make_shared(_hash, _flags, _device_model, _platform, _system_version, _api_id, _app_name, _app_version, _date_created, _date_active, _ip, _country, _region)); } inline static MTPaccount_authorizations new_account_authorizations(const MTPVector &_authorizations) { - return MTPaccount_authorizations(new MTPDaccount_authorizations(_authorizations)); + return MTPaccount_authorizations(std::make_shared(_authorizations)); } inline static MTPaccount_password new_account_noPassword(const MTPbytes &_new_salt, const MTPstring &_email_unconfirmed_pattern) { - return MTPaccount_password(new MTPDaccount_noPassword(_new_salt, _email_unconfirmed_pattern)); + return MTPaccount_password(std::make_shared(_new_salt, _email_unconfirmed_pattern)); } inline static MTPaccount_password new_account_password(const MTPbytes &_current_salt, const MTPbytes &_new_salt, const MTPstring &_hint, MTPBool _has_recovery, const MTPstring &_email_unconfirmed_pattern) { - return MTPaccount_password(new MTPDaccount_password(_current_salt, _new_salt, _hint, _has_recovery, _email_unconfirmed_pattern)); + return MTPaccount_password(std::make_shared(_current_salt, _new_salt, _hint, _has_recovery, _email_unconfirmed_pattern)); } inline static MTPaccount_passwordSettings new_account_passwordSettings(const MTPstring &_email) { - return MTPaccount_passwordSettings(new MTPDaccount_passwordSettings(_email)); + return MTPaccount_passwordSettings(std::make_shared(_email)); } inline static MTPaccount_passwordInputSettings new_account_passwordInputSettings(const MTPflags &_flags, const MTPbytes &_new_salt, const MTPbytes &_new_password_hash, const MTPstring &_hint, const MTPstring &_email) { - return MTPaccount_passwordInputSettings(new MTPDaccount_passwordInputSettings(_flags, _new_salt, _new_password_hash, _hint, _email)); + return MTPaccount_passwordInputSettings(std::make_shared(_flags, _new_salt, _new_password_hash, _hint, _email)); } inline static MTPauth_passwordRecovery new_auth_passwordRecovery(const MTPstring &_email_pattern) { - return MTPauth_passwordRecovery(new MTPDauth_passwordRecovery(_email_pattern)); + return MTPauth_passwordRecovery(std::make_shared(_email_pattern)); } inline static MTPreceivedNotifyMessage new_receivedNotifyMessage(MTPint _id, MTPint _flags) { - return MTPreceivedNotifyMessage(new MTPDreceivedNotifyMessage(_id, _flags)); + return MTPreceivedNotifyMessage(std::make_shared(_id, _flags)); } inline static MTPexportedChatInvite new_chatInviteEmpty() { return MTPexportedChatInvite(mtpc_chatInviteEmpty); } inline static MTPexportedChatInvite new_chatInviteExported(const MTPstring &_link) { - return MTPexportedChatInvite(new MTPDchatInviteExported(_link)); + return MTPexportedChatInvite(std::make_shared(_link)); } inline static MTPchatInvite new_chatInviteAlready(const MTPChat &_chat) { - return MTPchatInvite(new MTPDchatInviteAlready(_chat)); + return MTPchatInvite(std::make_shared(_chat)); } inline static MTPchatInvite new_chatInvite(const MTPflags &_flags, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _participants_count, const MTPVector &_participants) { - return MTPchatInvite(new MTPDchatInvite(_flags, _title, _photo, _participants_count, _participants)); + return MTPchatInvite(std::make_shared(_flags, _title, _photo, _participants_count, _participants)); } inline static MTPinputStickerSet new_inputStickerSetEmpty() { return MTPinputStickerSet(mtpc_inputStickerSetEmpty); } inline static MTPinputStickerSet new_inputStickerSetID(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputStickerSet(new MTPDinputStickerSetID(_id, _access_hash)); + return MTPinputStickerSet(std::make_shared(_id, _access_hash)); } inline static MTPinputStickerSet new_inputStickerSetShortName(const MTPstring &_short_name) { - return MTPinputStickerSet(new MTPDinputStickerSetShortName(_short_name)); + return MTPinputStickerSet(std::make_shared(_short_name)); } inline static MTPstickerSet new_stickerSet(const MTPflags &_flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name, MTPint _count, MTPint _hash) { - return MTPstickerSet(new MTPDstickerSet(_flags, _id, _access_hash, _title, _short_name, _count, _hash)); + return MTPstickerSet(std::make_shared(_flags, _id, _access_hash, _title, _short_name, _count, _hash)); } inline static MTPmessages_stickerSet new_messages_stickerSet(const MTPStickerSet &_set, const MTPVector &_packs, const MTPVector &_documents) { - return MTPmessages_stickerSet(new MTPDmessages_stickerSet(_set, _packs, _documents)); + return MTPmessages_stickerSet(std::make_shared(_set, _packs, _documents)); } inline static MTPbotCommand new_botCommand(const MTPstring &_command, const MTPstring &_description) { - return MTPbotCommand(new MTPDbotCommand(_command, _description)); + return MTPbotCommand(std::make_shared(_command, _description)); } inline static MTPbotInfo new_botInfo(MTPint _user_id, const MTPstring &_description, const MTPVector &_commands) { - return MTPbotInfo(new MTPDbotInfo(_user_id, _description, _commands)); + return MTPbotInfo(std::make_shared(_user_id, _description, _commands)); } inline static MTPkeyboardButton new_keyboardButton(const MTPstring &_text) { - return MTPkeyboardButton(new MTPDkeyboardButton(_text)); + return MTPkeyboardButton(std::make_shared(_text)); } inline static MTPkeyboardButton new_keyboardButtonUrl(const MTPstring &_text, const MTPstring &_url) { - return MTPkeyboardButton(new MTPDkeyboardButtonUrl(_text, _url)); + return MTPkeyboardButton(std::make_shared(_text, _url)); } inline static MTPkeyboardButton new_keyboardButtonCallback(const MTPstring &_text, const MTPbytes &_data) { - return MTPkeyboardButton(new MTPDkeyboardButtonCallback(_text, _data)); + return MTPkeyboardButton(std::make_shared(_text, _data)); } inline static MTPkeyboardButton new_keyboardButtonRequestPhone(const MTPstring &_text) { - return MTPkeyboardButton(new MTPDkeyboardButtonRequestPhone(_text)); + return MTPkeyboardButton(std::make_shared(_text)); } inline static MTPkeyboardButton new_keyboardButtonRequestGeoLocation(const MTPstring &_text) { - return MTPkeyboardButton(new MTPDkeyboardButtonRequestGeoLocation(_text)); + return MTPkeyboardButton(std::make_shared(_text)); } inline static MTPkeyboardButton new_keyboardButtonSwitchInline(const MTPflags &_flags, const MTPstring &_text, const MTPstring &_query) { - return MTPkeyboardButton(new MTPDkeyboardButtonSwitchInline(_flags, _text, _query)); + return MTPkeyboardButton(std::make_shared(_flags, _text, _query)); } inline static MTPkeyboardButton new_keyboardButtonGame(const MTPstring &_text) { - return MTPkeyboardButton(new MTPDkeyboardButtonGame(_text)); + return MTPkeyboardButton(std::make_shared(_text)); } inline static MTPkeyboardButtonRow new_keyboardButtonRow(const MTPVector &_buttons) { - return MTPkeyboardButtonRow(new MTPDkeyboardButtonRow(_buttons)); + return MTPkeyboardButtonRow(std::make_shared(_buttons)); } inline static MTPreplyMarkup new_replyKeyboardHide(const MTPflags &_flags) { - return MTPreplyMarkup(new MTPDreplyKeyboardHide(_flags)); + return MTPreplyMarkup(std::make_shared(_flags)); } inline static MTPreplyMarkup new_replyKeyboardForceReply(const MTPflags &_flags) { - return MTPreplyMarkup(new MTPDreplyKeyboardForceReply(_flags)); + return MTPreplyMarkup(std::make_shared(_flags)); } inline static MTPreplyMarkup new_replyKeyboardMarkup(const MTPflags &_flags, const MTPVector &_rows) { - return MTPreplyMarkup(new MTPDreplyKeyboardMarkup(_flags, _rows)); + return MTPreplyMarkup(std::make_shared(_flags, _rows)); } inline static MTPreplyMarkup new_replyInlineMarkup(const MTPVector &_rows) { - return MTPreplyMarkup(new MTPDreplyInlineMarkup(_rows)); + return MTPreplyMarkup(std::make_shared(_rows)); } inline static MTPhelp_appChangelog new_help_appChangelogEmpty() { return MTPhelp_appChangelog(mtpc_help_appChangelogEmpty); } inline static MTPhelp_appChangelog new_help_appChangelog(const MTPstring &_message, const MTPMessageMedia &_media, const MTPVector &_entities) { - return MTPhelp_appChangelog(new MTPDhelp_appChangelog(_message, _media, _entities)); + return MTPhelp_appChangelog(std::make_shared(_message, _media, _entities)); } inline static MTPmessageEntity new_messageEntityUnknown(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityUnknown(_offset, _length)); + return MTPmessageEntity(std::make_shared(_offset, _length)); } inline static MTPmessageEntity new_messageEntityMention(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityMention(_offset, _length)); + return MTPmessageEntity(std::make_shared(_offset, _length)); } inline static MTPmessageEntity new_messageEntityHashtag(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityHashtag(_offset, _length)); + return MTPmessageEntity(std::make_shared(_offset, _length)); } inline static MTPmessageEntity new_messageEntityBotCommand(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityBotCommand(_offset, _length)); + return MTPmessageEntity(std::make_shared(_offset, _length)); } inline static MTPmessageEntity new_messageEntityUrl(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityUrl(_offset, _length)); + return MTPmessageEntity(std::make_shared(_offset, _length)); } inline static MTPmessageEntity new_messageEntityEmail(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityEmail(_offset, _length)); + return MTPmessageEntity(std::make_shared(_offset, _length)); } inline static MTPmessageEntity new_messageEntityBold(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityBold(_offset, _length)); + return MTPmessageEntity(std::make_shared(_offset, _length)); } inline static MTPmessageEntity new_messageEntityItalic(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityItalic(_offset, _length)); + return MTPmessageEntity(std::make_shared(_offset, _length)); } inline static MTPmessageEntity new_messageEntityCode(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityCode(_offset, _length)); + return MTPmessageEntity(std::make_shared(_offset, _length)); } inline static MTPmessageEntity new_messageEntityPre(MTPint _offset, MTPint _length, const MTPstring &_language) { - return MTPmessageEntity(new MTPDmessageEntityPre(_offset, _length, _language)); + return MTPmessageEntity(std::make_shared(_offset, _length, _language)); } inline static MTPmessageEntity new_messageEntityTextUrl(MTPint _offset, MTPint _length, const MTPstring &_url) { - return MTPmessageEntity(new MTPDmessageEntityTextUrl(_offset, _length, _url)); + return MTPmessageEntity(std::make_shared(_offset, _length, _url)); } inline static MTPmessageEntity new_messageEntityMentionName(MTPint _offset, MTPint _length, MTPint _user_id) { - return MTPmessageEntity(new MTPDmessageEntityMentionName(_offset, _length, _user_id)); + return MTPmessageEntity(std::make_shared(_offset, _length, _user_id)); } inline static MTPmessageEntity new_inputMessageEntityMentionName(MTPint _offset, MTPint _length, const MTPInputUser &_user_id) { - return MTPmessageEntity(new MTPDinputMessageEntityMentionName(_offset, _length, _user_id)); + return MTPmessageEntity(std::make_shared(_offset, _length, _user_id)); } inline static MTPinputChannel new_inputChannelEmpty() { return MTPinputChannel(mtpc_inputChannelEmpty); } inline static MTPinputChannel new_inputChannel(MTPint _channel_id, const MTPlong &_access_hash) { - return MTPinputChannel(new MTPDinputChannel(_channel_id, _access_hash)); + return MTPinputChannel(std::make_shared(_channel_id, _access_hash)); } inline static MTPcontacts_resolvedPeer new_contacts_resolvedPeer(const MTPPeer &_peer, const MTPVector &_chats, const MTPVector &_users) { - return MTPcontacts_resolvedPeer(new MTPDcontacts_resolvedPeer(_peer, _chats, _users)); + return MTPcontacts_resolvedPeer(std::make_shared(_peer, _chats, _users)); } inline static MTPmessageRange new_messageRange(MTPint _min_id, MTPint _max_id) { - return MTPmessageRange(new MTPDmessageRange(_min_id, _max_id)); + return MTPmessageRange(std::make_shared(_min_id, _max_id)); } inline static MTPupdates_channelDifference new_updates_channelDifferenceEmpty(const MTPflags &_flags, MTPint _pts, MTPint _timeout) { - return MTPupdates_channelDifference(new MTPDupdates_channelDifferenceEmpty(_flags, _pts, _timeout)); + return MTPupdates_channelDifference(std::make_shared(_flags, _pts, _timeout)); } inline static MTPupdates_channelDifference new_updates_channelDifferenceTooLong(const MTPflags &_flags, MTPint _pts, MTPint _timeout, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { - return MTPupdates_channelDifference(new MTPDupdates_channelDifferenceTooLong(_flags, _pts, _timeout, _top_message, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _messages, _chats, _users)); + return MTPupdates_channelDifference(std::make_shared(_flags, _pts, _timeout, _top_message, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _messages, _chats, _users)); } inline static MTPupdates_channelDifference new_updates_channelDifference(const MTPflags &_flags, MTPint _pts, MTPint _timeout, const MTPVector &_new_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users) { - return MTPupdates_channelDifference(new MTPDupdates_channelDifference(_flags, _pts, _timeout, _new_messages, _other_updates, _chats, _users)); + return MTPupdates_channelDifference(std::make_shared(_flags, _pts, _timeout, _new_messages, _other_updates, _chats, _users)); } inline static MTPchannelMessagesFilter new_channelMessagesFilterEmpty() { return MTPchannelMessagesFilter(mtpc_channelMessagesFilterEmpty); } inline static MTPchannelMessagesFilter new_channelMessagesFilter(const MTPflags &_flags, const MTPVector &_ranges) { - return MTPchannelMessagesFilter(new MTPDchannelMessagesFilter(_flags, _ranges)); + return MTPchannelMessagesFilter(std::make_shared(_flags, _ranges)); } inline static MTPchannelParticipant new_channelParticipant(MTPint _user_id, MTPint _date) { - return MTPchannelParticipant(new MTPDchannelParticipant(_user_id, _date)); + return MTPchannelParticipant(std::make_shared(_user_id, _date)); } inline static MTPchannelParticipant new_channelParticipantSelf(MTPint _user_id, MTPint _inviter_id, MTPint _date) { - return MTPchannelParticipant(new MTPDchannelParticipantSelf(_user_id, _inviter_id, _date)); + return MTPchannelParticipant(std::make_shared(_user_id, _inviter_id, _date)); } inline static MTPchannelParticipant new_channelParticipantModerator(MTPint _user_id, MTPint _inviter_id, MTPint _date) { - return MTPchannelParticipant(new MTPDchannelParticipantModerator(_user_id, _inviter_id, _date)); + return MTPchannelParticipant(std::make_shared(_user_id, _inviter_id, _date)); } inline static MTPchannelParticipant new_channelParticipantEditor(MTPint _user_id, MTPint _inviter_id, MTPint _date) { - return MTPchannelParticipant(new MTPDchannelParticipantEditor(_user_id, _inviter_id, _date)); + return MTPchannelParticipant(std::make_shared(_user_id, _inviter_id, _date)); } inline static MTPchannelParticipant new_channelParticipantKicked(MTPint _user_id, MTPint _kicked_by, MTPint _date) { - return MTPchannelParticipant(new MTPDchannelParticipantKicked(_user_id, _kicked_by, _date)); + return MTPchannelParticipant(std::make_shared(_user_id, _kicked_by, _date)); } inline static MTPchannelParticipant new_channelParticipantCreator(MTPint _user_id) { - return MTPchannelParticipant(new MTPDchannelParticipantCreator(_user_id)); + return MTPchannelParticipant(std::make_shared(_user_id)); } inline static MTPchannelParticipantsFilter new_channelParticipantsRecent() { return MTPchannelParticipantsFilter(mtpc_channelParticipantsRecent); @@ -26785,88 +23176,88 @@ public: return MTPchannelParticipantRole(mtpc_channelRoleEditor); } inline static MTPchannels_channelParticipants new_channels_channelParticipants(MTPint _count, const MTPVector &_participants, const MTPVector &_users) { - return MTPchannels_channelParticipants(new MTPDchannels_channelParticipants(_count, _participants, _users)); + return MTPchannels_channelParticipants(std::make_shared(_count, _participants, _users)); } inline static MTPchannels_channelParticipant new_channels_channelParticipant(const MTPChannelParticipant &_participant, const MTPVector &_users) { - return MTPchannels_channelParticipant(new MTPDchannels_channelParticipant(_participant, _users)); + return MTPchannels_channelParticipant(std::make_shared(_participant, _users)); } inline static MTPhelp_termsOfService new_help_termsOfService(const MTPstring &_text) { - return MTPhelp_termsOfService(new MTPDhelp_termsOfService(_text)); + return MTPhelp_termsOfService(std::make_shared(_text)); } inline static MTPfoundGif new_foundGif(const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h) { - return MTPfoundGif(new MTPDfoundGif(_url, _thumb_url, _content_url, _content_type, _w, _h)); + return MTPfoundGif(std::make_shared(_url, _thumb_url, _content_url, _content_type, _w, _h)); } inline static MTPfoundGif new_foundGifCached(const MTPstring &_url, const MTPPhoto &_photo, const MTPDocument &_document) { - return MTPfoundGif(new MTPDfoundGifCached(_url, _photo, _document)); + return MTPfoundGif(std::make_shared(_url, _photo, _document)); } inline static MTPmessages_foundGifs new_messages_foundGifs(MTPint _next_offset, const MTPVector &_results) { - return MTPmessages_foundGifs(new MTPDmessages_foundGifs(_next_offset, _results)); + return MTPmessages_foundGifs(std::make_shared(_next_offset, _results)); } inline static MTPmessages_savedGifs new_messages_savedGifsNotModified() { return MTPmessages_savedGifs(mtpc_messages_savedGifsNotModified); } inline static MTPmessages_savedGifs new_messages_savedGifs(MTPint _hash, const MTPVector &_gifs) { - return MTPmessages_savedGifs(new MTPDmessages_savedGifs(_hash, _gifs)); + return MTPmessages_savedGifs(std::make_shared(_hash, _gifs)); } inline static MTPinputBotInlineMessage new_inputBotInlineMessageMediaAuto(const MTPflags &_flags, const MTPstring &_caption, const MTPReplyMarkup &_reply_markup) { - return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageMediaAuto(_flags, _caption, _reply_markup)); + return MTPinputBotInlineMessage(std::make_shared(_flags, _caption, _reply_markup)); } inline static MTPinputBotInlineMessage new_inputBotInlineMessageText(const MTPflags &_flags, const MTPstring &_message, const MTPVector &_entities, const MTPReplyMarkup &_reply_markup) { - return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageText(_flags, _message, _entities, _reply_markup)); + return MTPinputBotInlineMessage(std::make_shared(_flags, _message, _entities, _reply_markup)); } inline static MTPinputBotInlineMessage new_inputBotInlineMessageMediaGeo(const MTPflags &_flags, const MTPInputGeoPoint &_geo_point, const MTPReplyMarkup &_reply_markup) { - return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageMediaGeo(_flags, _geo_point, _reply_markup)); + return MTPinputBotInlineMessage(std::make_shared(_flags, _geo_point, _reply_markup)); } inline static MTPinputBotInlineMessage new_inputBotInlineMessageMediaVenue(const MTPflags &_flags, const MTPInputGeoPoint &_geo_point, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id, const MTPReplyMarkup &_reply_markup) { - return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageMediaVenue(_flags, _geo_point, _title, _address, _provider, _venue_id, _reply_markup)); + return MTPinputBotInlineMessage(std::make_shared(_flags, _geo_point, _title, _address, _provider, _venue_id, _reply_markup)); } inline static MTPinputBotInlineMessage new_inputBotInlineMessageMediaContact(const MTPflags &_flags, const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name, const MTPReplyMarkup &_reply_markup) { - return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageMediaContact(_flags, _phone_number, _first_name, _last_name, _reply_markup)); + return MTPinputBotInlineMessage(std::make_shared(_flags, _phone_number, _first_name, _last_name, _reply_markup)); } inline static MTPinputBotInlineMessage new_inputBotInlineMessageGame(const MTPflags &_flags, const MTPReplyMarkup &_reply_markup) { - return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageGame(_flags, _reply_markup)); + return MTPinputBotInlineMessage(std::make_shared(_flags, _reply_markup)); } inline static MTPinputBotInlineResult new_inputBotInlineResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPInputBotInlineMessage &_send_message) { - return MTPinputBotInlineResult(new MTPDinputBotInlineResult(_flags, _id, _type, _title, _description, _url, _thumb_url, _content_url, _content_type, _w, _h, _duration, _send_message)); + return MTPinputBotInlineResult(std::make_shared(_flags, _id, _type, _title, _description, _url, _thumb_url, _content_url, _content_type, _w, _h, _duration, _send_message)); } inline static MTPinputBotInlineResult new_inputBotInlineResultPhoto(const MTPstring &_id, const MTPstring &_type, const MTPInputPhoto &_photo, const MTPInputBotInlineMessage &_send_message) { - return MTPinputBotInlineResult(new MTPDinputBotInlineResultPhoto(_id, _type, _photo, _send_message)); + return MTPinputBotInlineResult(std::make_shared(_id, _type, _photo, _send_message)); } inline static MTPinputBotInlineResult new_inputBotInlineResultDocument(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPInputDocument &_document, const MTPInputBotInlineMessage &_send_message) { - return MTPinputBotInlineResult(new MTPDinputBotInlineResultDocument(_flags, _id, _type, _title, _description, _document, _send_message)); + return MTPinputBotInlineResult(std::make_shared(_flags, _id, _type, _title, _description, _document, _send_message)); } inline static MTPinputBotInlineResult new_inputBotInlineResultGame(const MTPstring &_id, const MTPstring &_short_name, const MTPInputBotInlineMessage &_send_message) { - return MTPinputBotInlineResult(new MTPDinputBotInlineResultGame(_id, _short_name, _send_message)); + return MTPinputBotInlineResult(std::make_shared(_id, _short_name, _send_message)); } inline static MTPbotInlineMessage new_botInlineMessageMediaAuto(const MTPflags &_flags, const MTPstring &_caption, const MTPReplyMarkup &_reply_markup) { - return MTPbotInlineMessage(new MTPDbotInlineMessageMediaAuto(_flags, _caption, _reply_markup)); + return MTPbotInlineMessage(std::make_shared(_flags, _caption, _reply_markup)); } inline static MTPbotInlineMessage new_botInlineMessageText(const MTPflags &_flags, const MTPstring &_message, const MTPVector &_entities, const MTPReplyMarkup &_reply_markup) { - return MTPbotInlineMessage(new MTPDbotInlineMessageText(_flags, _message, _entities, _reply_markup)); + return MTPbotInlineMessage(std::make_shared(_flags, _message, _entities, _reply_markup)); } inline static MTPbotInlineMessage new_botInlineMessageMediaGeo(const MTPflags &_flags, const MTPGeoPoint &_geo, const MTPReplyMarkup &_reply_markup) { - return MTPbotInlineMessage(new MTPDbotInlineMessageMediaGeo(_flags, _geo, _reply_markup)); + return MTPbotInlineMessage(std::make_shared(_flags, _geo, _reply_markup)); } inline static MTPbotInlineMessage new_botInlineMessageMediaVenue(const MTPflags &_flags, const MTPGeoPoint &_geo, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id, const MTPReplyMarkup &_reply_markup) { - return MTPbotInlineMessage(new MTPDbotInlineMessageMediaVenue(_flags, _geo, _title, _address, _provider, _venue_id, _reply_markup)); + return MTPbotInlineMessage(std::make_shared(_flags, _geo, _title, _address, _provider, _venue_id, _reply_markup)); } inline static MTPbotInlineMessage new_botInlineMessageMediaContact(const MTPflags &_flags, const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name, const MTPReplyMarkup &_reply_markup) { - return MTPbotInlineMessage(new MTPDbotInlineMessageMediaContact(_flags, _phone_number, _first_name, _last_name, _reply_markup)); + return MTPbotInlineMessage(std::make_shared(_flags, _phone_number, _first_name, _last_name, _reply_markup)); } inline static MTPbotInlineResult new_botInlineResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPBotInlineMessage &_send_message) { - return MTPbotInlineResult(new MTPDbotInlineResult(_flags, _id, _type, _title, _description, _url, _thumb_url, _content_url, _content_type, _w, _h, _duration, _send_message)); + return MTPbotInlineResult(std::make_shared(_flags, _id, _type, _title, _description, _url, _thumb_url, _content_url, _content_type, _w, _h, _duration, _send_message)); } inline static MTPbotInlineResult new_botInlineMediaResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPPhoto &_photo, const MTPDocument &_document, const MTPstring &_title, const MTPstring &_description, const MTPBotInlineMessage &_send_message) { - return MTPbotInlineResult(new MTPDbotInlineMediaResult(_flags, _id, _type, _photo, _document, _title, _description, _send_message)); + return MTPbotInlineResult(std::make_shared(_flags, _id, _type, _photo, _document, _title, _description, _send_message)); } inline static MTPmessages_botResults new_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm, const MTPVector &_results, MTPint _cache_time) { - return MTPmessages_botResults(new MTPDmessages_botResults(_flags, _query_id, _next_offset, _switch_pm, _results, _cache_time)); + return MTPmessages_botResults(std::make_shared(_flags, _query_id, _next_offset, _switch_pm, _results, _cache_time)); } inline static MTPexportedMessageLink new_exportedMessageLink(const MTPstring &_link) { - return MTPexportedMessageLink(new MTPDexportedMessageLink(_link)); + return MTPexportedMessageLink(std::make_shared(_link)); } inline static MTPmessageFwdHeader new_messageFwdHeader(const MTPflags &_flags, MTPint _from_id, MTPint _date, MTPint _channel_id, MTPint _channel_post) { - return MTPmessageFwdHeader(new MTPDmessageFwdHeader(_flags, _from_id, _date, _channel_id, _channel_post)); + return MTPmessageFwdHeader(std::make_shared(_flags, _from_id, _date, _channel_id, _channel_post)); } inline static MTPauth_codeType new_auth_codeTypeSms() { return MTPauth_codeType(mtpc_auth_codeTypeSms); @@ -26878,34 +23269,34 @@ public: return MTPauth_codeType(mtpc_auth_codeTypeFlashCall); } inline static MTPauth_sentCodeType new_auth_sentCodeTypeApp(MTPint _length) { - return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeApp(_length)); + return MTPauth_sentCodeType(std::make_shared(_length)); } inline static MTPauth_sentCodeType new_auth_sentCodeTypeSms(MTPint _length) { - return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeSms(_length)); + return MTPauth_sentCodeType(std::make_shared(_length)); } inline static MTPauth_sentCodeType new_auth_sentCodeTypeCall(MTPint _length) { - return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeCall(_length)); + return MTPauth_sentCodeType(std::make_shared(_length)); } inline static MTPauth_sentCodeType new_auth_sentCodeTypeFlashCall(const MTPstring &_pattern) { - return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeFlashCall(_pattern)); + return MTPauth_sentCodeType(std::make_shared(_pattern)); } inline static MTPmessages_botCallbackAnswer new_messages_botCallbackAnswer(const MTPflags &_flags, const MTPstring &_message, const MTPstring &_url, MTPint _cache_time) { - return MTPmessages_botCallbackAnswer(new MTPDmessages_botCallbackAnswer(_flags, _message, _url, _cache_time)); + return MTPmessages_botCallbackAnswer(std::make_shared(_flags, _message, _url, _cache_time)); } inline static MTPmessages_messageEditData new_messages_messageEditData(const MTPflags &_flags) { - return MTPmessages_messageEditData(new MTPDmessages_messageEditData(_flags)); + return MTPmessages_messageEditData(std::make_shared(_flags)); } inline static MTPinputBotInlineMessageID new_inputBotInlineMessageID(MTPint _dc_id, const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputBotInlineMessageID(new MTPDinputBotInlineMessageID(_dc_id, _id, _access_hash)); + return MTPinputBotInlineMessageID(std::make_shared(_dc_id, _id, _access_hash)); } inline static MTPinlineBotSwitchPM new_inlineBotSwitchPM(const MTPstring &_text, const MTPstring &_start_param) { - return MTPinlineBotSwitchPM(new MTPDinlineBotSwitchPM(_text, _start_param)); + return MTPinlineBotSwitchPM(std::make_shared(_text, _start_param)); } inline static MTPmessages_peerDialogs new_messages_peerDialogs(const MTPVector &_dialogs, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_state) { - return MTPmessages_peerDialogs(new MTPDmessages_peerDialogs(_dialogs, _messages, _chats, _users, _state)); + return MTPmessages_peerDialogs(std::make_shared(_dialogs, _messages, _chats, _users, _state)); } inline static MTPtopPeer new_topPeer(const MTPPeer &_peer, const MTPdouble &_rating) { - return MTPtopPeer(new MTPDtopPeer(_peer, _rating)); + return MTPtopPeer(std::make_shared(_peer, _rating)); } inline static MTPtopPeerCategory new_topPeerCategoryBotsPM() { return MTPtopPeerCategory(mtpc_topPeerCategoryBotsPM); @@ -26923,196 +23314,196 @@ public: return MTPtopPeerCategory(mtpc_topPeerCategoryChannels); } inline static MTPtopPeerCategoryPeers new_topPeerCategoryPeers(const MTPTopPeerCategory &_category, MTPint _count, const MTPVector &_peers) { - return MTPtopPeerCategoryPeers(new MTPDtopPeerCategoryPeers(_category, _count, _peers)); + return MTPtopPeerCategoryPeers(std::make_shared(_category, _count, _peers)); } inline static MTPcontacts_topPeers new_contacts_topPeersNotModified() { return MTPcontacts_topPeers(mtpc_contacts_topPeersNotModified); } inline static MTPcontacts_topPeers new_contacts_topPeers(const MTPVector &_categories, const MTPVector &_chats, const MTPVector &_users) { - return MTPcontacts_topPeers(new MTPDcontacts_topPeers(_categories, _chats, _users)); + return MTPcontacts_topPeers(std::make_shared(_categories, _chats, _users)); } inline static MTPdraftMessage new_draftMessageEmpty() { return MTPdraftMessage(mtpc_draftMessageEmpty); } inline static MTPdraftMessage new_draftMessage(const MTPflags &_flags, MTPint _reply_to_msg_id, const MTPstring &_message, const MTPVector &_entities, MTPint _date) { - return MTPdraftMessage(new MTPDdraftMessage(_flags, _reply_to_msg_id, _message, _entities, _date)); + return MTPdraftMessage(std::make_shared(_flags, _reply_to_msg_id, _message, _entities, _date)); } inline static MTPmessages_featuredStickers new_messages_featuredStickersNotModified() { return MTPmessages_featuredStickers(mtpc_messages_featuredStickersNotModified); } inline static MTPmessages_featuredStickers new_messages_featuredStickers(MTPint _hash, const MTPVector &_sets, const MTPVector &_unread) { - return MTPmessages_featuredStickers(new MTPDmessages_featuredStickers(_hash, _sets, _unread)); + return MTPmessages_featuredStickers(std::make_shared(_hash, _sets, _unread)); } inline static MTPmessages_recentStickers new_messages_recentStickersNotModified() { return MTPmessages_recentStickers(mtpc_messages_recentStickersNotModified); } inline static MTPmessages_recentStickers new_messages_recentStickers(MTPint _hash, const MTPVector &_stickers) { - return MTPmessages_recentStickers(new MTPDmessages_recentStickers(_hash, _stickers)); + return MTPmessages_recentStickers(std::make_shared(_hash, _stickers)); } inline static MTPmessages_archivedStickers new_messages_archivedStickers(MTPint _count, const MTPVector &_sets) { - return MTPmessages_archivedStickers(new MTPDmessages_archivedStickers(_count, _sets)); + return MTPmessages_archivedStickers(std::make_shared(_count, _sets)); } inline static MTPmessages_stickerSetInstallResult new_messages_stickerSetInstallResultSuccess() { return MTPmessages_stickerSetInstallResult(mtpc_messages_stickerSetInstallResultSuccess); } inline static MTPmessages_stickerSetInstallResult new_messages_stickerSetInstallResultArchive(const MTPVector &_sets) { - return MTPmessages_stickerSetInstallResult(new MTPDmessages_stickerSetInstallResultArchive(_sets)); + return MTPmessages_stickerSetInstallResult(std::make_shared(_sets)); } inline static MTPstickerSetCovered new_stickerSetCovered(const MTPStickerSet &_set, const MTPDocument &_cover) { - return MTPstickerSetCovered(new MTPDstickerSetCovered(_set, _cover)); + return MTPstickerSetCovered(std::make_shared(_set, _cover)); } inline static MTPstickerSetCovered new_stickerSetMultiCovered(const MTPStickerSet &_set, const MTPVector &_covers) { - return MTPstickerSetCovered(new MTPDstickerSetMultiCovered(_set, _covers)); + return MTPstickerSetCovered(std::make_shared(_set, _covers)); } inline static MTPmaskCoords new_maskCoords(MTPint _n, const MTPdouble &_x, const MTPdouble &_y, const MTPdouble &_zoom) { - return MTPmaskCoords(new MTPDmaskCoords(_n, _x, _y, _zoom)); + return MTPmaskCoords(std::make_shared(_n, _x, _y, _zoom)); } inline static MTPinputStickeredMedia new_inputStickeredMediaPhoto(const MTPInputPhoto &_id) { - return MTPinputStickeredMedia(new MTPDinputStickeredMediaPhoto(_id)); + return MTPinputStickeredMedia(std::make_shared(_id)); } inline static MTPinputStickeredMedia new_inputStickeredMediaDocument(const MTPInputDocument &_id) { - return MTPinputStickeredMedia(new MTPDinputStickeredMediaDocument(_id)); + return MTPinputStickeredMedia(std::make_shared(_id)); } inline static MTPgame new_game(const MTPflags &_flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_short_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPDocument &_document) { - return MTPgame(new MTPDgame(_flags, _id, _access_hash, _short_name, _title, _description, _photo, _document)); + return MTPgame(std::make_shared(_flags, _id, _access_hash, _short_name, _title, _description, _photo, _document)); } inline static MTPinputGame new_inputGameID(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputGame(new MTPDinputGameID(_id, _access_hash)); + return MTPinputGame(std::make_shared(_id, _access_hash)); } inline static MTPinputGame new_inputGameShortName(const MTPInputUser &_bot_id, const MTPstring &_short_name) { - return MTPinputGame(new MTPDinputGameShortName(_bot_id, _short_name)); + return MTPinputGame(std::make_shared(_bot_id, _short_name)); } inline static MTPhighScore new_highScore(MTPint _pos, MTPint _user_id, MTPint _score) { - return MTPhighScore(new MTPDhighScore(_pos, _user_id, _score)); + return MTPhighScore(std::make_shared(_pos, _user_id, _score)); } inline static MTPmessages_highScores new_messages_highScores(const MTPVector &_scores, const MTPVector &_users) { - return MTPmessages_highScores(new MTPDmessages_highScores(_scores, _users)); + return MTPmessages_highScores(std::make_shared(_scores, _users)); } inline static MTPrichText new_textEmpty() { return MTPrichText(mtpc_textEmpty); } inline static MTPrichText new_textPlain(const MTPstring &_text) { - return MTPrichText(new MTPDtextPlain(_text)); + return MTPrichText(std::make_shared(_text)); } inline static MTPrichText new_textBold(const MTPRichText &_text) { - return MTPrichText(new MTPDtextBold(_text)); + return MTPrichText(std::make_shared(_text)); } inline static MTPrichText new_textItalic(const MTPRichText &_text) { - return MTPrichText(new MTPDtextItalic(_text)); + return MTPrichText(std::make_shared(_text)); } inline static MTPrichText new_textUnderline(const MTPRichText &_text) { - return MTPrichText(new MTPDtextUnderline(_text)); + return MTPrichText(std::make_shared(_text)); } inline static MTPrichText new_textStrike(const MTPRichText &_text) { - return MTPrichText(new MTPDtextStrike(_text)); + return MTPrichText(std::make_shared(_text)); } inline static MTPrichText new_textFixed(const MTPRichText &_text) { - return MTPrichText(new MTPDtextFixed(_text)); + return MTPrichText(std::make_shared(_text)); } inline static MTPrichText new_textUrl(const MTPRichText &_text, const MTPstring &_url, const MTPlong &_webpage_id) { - return MTPrichText(new MTPDtextUrl(_text, _url, _webpage_id)); + return MTPrichText(std::make_shared(_text, _url, _webpage_id)); } inline static MTPrichText new_textEmail(const MTPRichText &_text, const MTPstring &_email) { - return MTPrichText(new MTPDtextEmail(_text, _email)); + return MTPrichText(std::make_shared(_text, _email)); } inline static MTPrichText new_textConcat(const MTPVector &_texts) { - return MTPrichText(new MTPDtextConcat(_texts)); + return MTPrichText(std::make_shared(_texts)); } inline static MTPpageBlock new_pageBlockUnsupported() { return MTPpageBlock(mtpc_pageBlockUnsupported); } inline static MTPpageBlock new_pageBlockTitle(const MTPRichText &_text) { - return MTPpageBlock(new MTPDpageBlockTitle(_text)); + return MTPpageBlock(std::make_shared(_text)); } inline static MTPpageBlock new_pageBlockSubtitle(const MTPRichText &_text) { - return MTPpageBlock(new MTPDpageBlockSubtitle(_text)); + return MTPpageBlock(std::make_shared(_text)); } inline static MTPpageBlock new_pageBlockAuthorDate(const MTPRichText &_author, MTPint _published_date) { - return MTPpageBlock(new MTPDpageBlockAuthorDate(_author, _published_date)); + return MTPpageBlock(std::make_shared(_author, _published_date)); } inline static MTPpageBlock new_pageBlockHeader(const MTPRichText &_text) { - return MTPpageBlock(new MTPDpageBlockHeader(_text)); + return MTPpageBlock(std::make_shared(_text)); } inline static MTPpageBlock new_pageBlockSubheader(const MTPRichText &_text) { - return MTPpageBlock(new MTPDpageBlockSubheader(_text)); + return MTPpageBlock(std::make_shared(_text)); } inline static MTPpageBlock new_pageBlockParagraph(const MTPRichText &_text) { - return MTPpageBlock(new MTPDpageBlockParagraph(_text)); + return MTPpageBlock(std::make_shared(_text)); } inline static MTPpageBlock new_pageBlockPreformatted(const MTPRichText &_text, const MTPstring &_language) { - return MTPpageBlock(new MTPDpageBlockPreformatted(_text, _language)); + return MTPpageBlock(std::make_shared(_text, _language)); } inline static MTPpageBlock new_pageBlockFooter(const MTPRichText &_text) { - return MTPpageBlock(new MTPDpageBlockFooter(_text)); + return MTPpageBlock(std::make_shared(_text)); } inline static MTPpageBlock new_pageBlockDivider() { return MTPpageBlock(mtpc_pageBlockDivider); } inline static MTPpageBlock new_pageBlockAnchor(const MTPstring &_name) { - return MTPpageBlock(new MTPDpageBlockAnchor(_name)); + return MTPpageBlock(std::make_shared(_name)); } inline static MTPpageBlock new_pageBlockList(MTPBool _ordered, const MTPVector &_items) { - return MTPpageBlock(new MTPDpageBlockList(_ordered, _items)); + return MTPpageBlock(std::make_shared(_ordered, _items)); } inline static MTPpageBlock new_pageBlockBlockquote(const MTPRichText &_text, const MTPRichText &_caption) { - return MTPpageBlock(new MTPDpageBlockBlockquote(_text, _caption)); + return MTPpageBlock(std::make_shared(_text, _caption)); } inline static MTPpageBlock new_pageBlockPullquote(const MTPRichText &_text, const MTPRichText &_caption) { - return MTPpageBlock(new MTPDpageBlockPullquote(_text, _caption)); + return MTPpageBlock(std::make_shared(_text, _caption)); } inline static MTPpageBlock new_pageBlockPhoto(const MTPlong &_photo_id, const MTPRichText &_caption) { - return MTPpageBlock(new MTPDpageBlockPhoto(_photo_id, _caption)); + return MTPpageBlock(std::make_shared(_photo_id, _caption)); } inline static MTPpageBlock new_pageBlockVideo(const MTPflags &_flags, const MTPlong &_video_id, const MTPRichText &_caption) { - return MTPpageBlock(new MTPDpageBlockVideo(_flags, _video_id, _caption)); + return MTPpageBlock(std::make_shared(_flags, _video_id, _caption)); } inline static MTPpageBlock new_pageBlockCover(const MTPPageBlock &_cover) { - return MTPpageBlock(new MTPDpageBlockCover(_cover)); + return MTPpageBlock(std::make_shared(_cover)); } inline static MTPpageBlock new_pageBlockEmbed(const MTPflags &_flags, const MTPstring &_url, const MTPstring &_html, const MTPlong &_poster_photo_id, MTPint _w, MTPint _h, const MTPRichText &_caption) { - return MTPpageBlock(new MTPDpageBlockEmbed(_flags, _url, _html, _poster_photo_id, _w, _h, _caption)); + return MTPpageBlock(std::make_shared(_flags, _url, _html, _poster_photo_id, _w, _h, _caption)); } inline static MTPpageBlock new_pageBlockEmbedPost(const MTPstring &_url, const MTPlong &_webpage_id, const MTPlong &_author_photo_id, const MTPstring &_author, MTPint _date, const MTPVector &_blocks, const MTPRichText &_caption) { - return MTPpageBlock(new MTPDpageBlockEmbedPost(_url, _webpage_id, _author_photo_id, _author, _date, _blocks, _caption)); + return MTPpageBlock(std::make_shared(_url, _webpage_id, _author_photo_id, _author, _date, _blocks, _caption)); } inline static MTPpageBlock new_pageBlockCollage(const MTPVector &_items, const MTPRichText &_caption) { - return MTPpageBlock(new MTPDpageBlockCollage(_items, _caption)); + return MTPpageBlock(std::make_shared(_items, _caption)); } inline static MTPpageBlock new_pageBlockSlideshow(const MTPVector &_items, const MTPRichText &_caption) { - return MTPpageBlock(new MTPDpageBlockSlideshow(_items, _caption)); + return MTPpageBlock(std::make_shared(_items, _caption)); } inline static MTPpage new_pagePart(const MTPVector &_blocks, const MTPVector &_photos, const MTPVector &_videos) { - return MTPpage(new MTPDpagePart(_blocks, _photos, _videos)); + return MTPpage(std::make_shared(_blocks, _photos, _videos)); } inline static MTPpage new_pageFull(const MTPVector &_blocks, const MTPVector &_photos, const MTPVector &_videos) { - return MTPpage(new MTPDpageFull(_blocks, _photos, _videos)); + return MTPpage(std::make_shared(_blocks, _photos, _videos)); } inline static MTPinputPhoneCall new_inputPhoneCall(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputPhoneCall(new MTPDinputPhoneCall(_id, _access_hash)); + return MTPinputPhoneCall(std::make_shared(_id, _access_hash)); } inline static MTPphoneCall new_phoneCallEmpty(const MTPlong &_id) { - return MTPphoneCall(new MTPDphoneCallEmpty(_id)); + return MTPphoneCall(std::make_shared(_id)); } inline static MTPphoneCall new_phoneCallWaiting(const MTPflags &_flags, const MTPlong &_id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id, const MTPPhoneCallProtocol &_protocol, MTPint _receive_date) { - return MTPphoneCall(new MTPDphoneCallWaiting(_flags, _id, _access_hash, _date, _admin_id, _participant_id, _protocol, _receive_date)); + return MTPphoneCall(std::make_shared(_flags, _id, _access_hash, _date, _admin_id, _participant_id, _protocol, _receive_date)); } inline static MTPphoneCall new_phoneCallRequested(const MTPlong &_id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id, const MTPbytes &_g_a, const MTPPhoneCallProtocol &_protocol) { - return MTPphoneCall(new MTPDphoneCallRequested(_id, _access_hash, _date, _admin_id, _participant_id, _g_a, _protocol)); + return MTPphoneCall(std::make_shared(_id, _access_hash, _date, _admin_id, _participant_id, _g_a, _protocol)); } inline static MTPphoneCall new_phoneCall(const MTPlong &_id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id, const MTPbytes &_g_a_or_b, const MTPlong &_key_fingerprint, const MTPPhoneCallProtocol &_protocol, const MTPPhoneConnection &_connection, const MTPVector &_alternative_connections, MTPint _start_date) { - return MTPphoneCall(new MTPDphoneCall(_id, _access_hash, _date, _admin_id, _participant_id, _g_a_or_b, _key_fingerprint, _protocol, _connection, _alternative_connections, _start_date)); + return MTPphoneCall(std::make_shared(_id, _access_hash, _date, _admin_id, _participant_id, _g_a_or_b, _key_fingerprint, _protocol, _connection, _alternative_connections, _start_date)); } inline static MTPphoneCall new_phoneCallDiscarded(const MTPflags &_flags, const MTPlong &_id, const MTPPhoneCallDiscardReason &_reason, MTPint _duration) { - return MTPphoneCall(new MTPDphoneCallDiscarded(_flags, _id, _reason, _duration)); + return MTPphoneCall(std::make_shared(_flags, _id, _reason, _duration)); } inline static MTPphoneConnection new_phoneConnection(const MTPlong &_id, const MTPstring &_ip, const MTPstring &_ipv6, MTPint _port, const MTPbytes &_peer_tag) { - return MTPphoneConnection(new MTPDphoneConnection(_id, _ip, _ipv6, _port, _peer_tag)); + return MTPphoneConnection(std::make_shared(_id, _ip, _ipv6, _port, _peer_tag)); } inline static MTPphoneCallProtocol new_phoneCallProtocol(const MTPflags &_flags, MTPint _min_layer, MTPint _max_layer) { - return MTPphoneCallProtocol(new MTPDphoneCallProtocol(_flags, _min_layer, _max_layer)); + return MTPphoneCallProtocol(std::make_shared(_flags, _min_layer, _max_layer)); } inline static MTPphone_phoneCall new_phone_phoneCall(const MTPPhoneCall &_phone_call, const MTPVector &_users) { - return MTPphone_phoneCall(new MTPDphone_phoneCall(_phone_call, _users)); + return MTPphone_phoneCall(std::make_shared(_phone_call, _users)); } inline static MTPphoneCallDiscardReason new_phoneCallDiscardReasonMissed() { return MTPphoneCallDiscardReason(mtpc_phoneCallDiscardReasonMissed); @@ -27133,7 +23524,7 @@ public: // Inline methods definition -inline MTPresPQ::MTPresPQ() : mtpDataOwner(new MTPDresPQ()) { +inline MTPresPQ::MTPresPQ() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPresPQ::innerLength() const { @@ -27146,27 +23537,31 @@ inline mtpTypeId MTPresPQ::type() const { inline void MTPresPQ::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_resPQ) throw mtpErrorUnexpected(cons, "MTPresPQ"); - if (!data) setData(new MTPDresPQ()); - MTPDresPQ &v(_resPQ()); - v.vnonce.read(from, end); - v.vserver_nonce.read(from, end); - v.vpq.read(from, end); - v.vserver_public_key_fingerprints.read(from, end); + auto v = std::make_shared(); + v->vnonce.read(from, end); + v->vserver_nonce.read(from, end); + v->vpq.read(from, end); + v->vserver_public_key_fingerprints.read(from, end); + data = std::move(v); } inline void MTPresPQ::write(mtpBuffer &to) const { - const MTPDresPQ &v(c_resPQ()); + auto &v = c_resPQ(); v.vnonce.write(to); v.vserver_nonce.write(to); v.vpq.write(to); v.vserver_public_key_fingerprints.write(to); } -inline MTPresPQ::MTPresPQ(MTPDresPQ *_data) : mtpDataOwner(_data) { +inline const MTPDresPQ &MTPresPQ::c_resPQ() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPresPQ::MTPresPQ(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPresPQ MTP_resPQ(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPstring &_pq, const MTPVector &_server_public_key_fingerprints) { return MTP::internal::TypeCreator::new_resPQ(_nonce, _server_nonce, _pq, _server_public_key_fingerprints); } -inline MTPp_Q_inner_data::MTPp_Q_inner_data() : mtpDataOwner(new MTPDp_q_inner_data()) { +inline MTPp_Q_inner_data::MTPp_Q_inner_data() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPp_Q_inner_data::innerLength() const { @@ -27179,17 +23574,17 @@ inline mtpTypeId MTPp_Q_inner_data::type() const { inline void MTPp_Q_inner_data::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_p_q_inner_data) throw mtpErrorUnexpected(cons, "MTPp_Q_inner_data"); - if (!data) setData(new MTPDp_q_inner_data()); - MTPDp_q_inner_data &v(_p_q_inner_data()); - v.vpq.read(from, end); - v.vp.read(from, end); - v.vq.read(from, end); - v.vnonce.read(from, end); - v.vserver_nonce.read(from, end); - v.vnew_nonce.read(from, end); + auto v = std::make_shared(); + v->vpq.read(from, end); + v->vp.read(from, end); + v->vq.read(from, end); + v->vnonce.read(from, end); + v->vserver_nonce.read(from, end); + v->vnew_nonce.read(from, end); + data = std::move(v); } inline void MTPp_Q_inner_data::write(mtpBuffer &to) const { - const MTPDp_q_inner_data &v(c_p_q_inner_data()); + auto &v = c_p_q_inner_data(); v.vpq.write(to); v.vp.write(to); v.vq.write(to); @@ -27197,7 +23592,11 @@ inline void MTPp_Q_inner_data::write(mtpBuffer &to) const { v.vserver_nonce.write(to); v.vnew_nonce.write(to); } -inline MTPp_Q_inner_data::MTPp_Q_inner_data(MTPDp_q_inner_data *_data) : mtpDataOwner(_data) { +inline const MTPDp_q_inner_data &MTPp_Q_inner_data::c_p_q_inner_data() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPp_Q_inner_data::MTPp_Q_inner_data(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPp_Q_inner_data MTP_p_q_inner_data(const MTPstring &_pq, const MTPstring &_p, const MTPstring &_q, const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint256 &_new_nonce) { return MTP::internal::TypeCreator::new_p_q_inner_data(_pq, _p, _q, _nonce, _server_nonce, _new_nonce); @@ -27221,21 +23620,21 @@ inline mtpTypeId MTPserver_DH_Params::type() const { return _type; } inline void MTPserver_DH_Params::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_server_DH_params_fail: _type = cons; { - if (!data) setData(new MTPDserver_DH_params_fail()); - MTPDserver_DH_params_fail &v(_server_DH_params_fail()); - v.vnonce.read(from, end); - v.vserver_nonce.read(from, end); - v.vnew_nonce_hash.read(from, end); + auto v = std::make_shared(); + v->vnonce.read(from, end); + v->vserver_nonce.read(from, end); + v->vnew_nonce_hash.read(from, end); + data = std::move(v); } break; case mtpc_server_DH_params_ok: _type = cons; { - if (!data) setData(new MTPDserver_DH_params_ok()); - MTPDserver_DH_params_ok &v(_server_DH_params_ok()); - v.vnonce.read(from, end); - v.vserver_nonce.read(from, end); - v.vencrypted_answer.read(from, end); + auto v = std::make_shared(); + v->vnonce.read(from, end); + v->vserver_nonce.read(from, end); + v->vencrypted_answer.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPserver_DH_Params"); } @@ -27243,29 +23642,37 @@ inline void MTPserver_DH_Params::read(const mtpPrime *&from, const mtpPrime *end inline void MTPserver_DH_Params::write(mtpBuffer &to) const { switch (_type) { case mtpc_server_DH_params_fail: { - const MTPDserver_DH_params_fail &v(c_server_DH_params_fail()); + auto &v = c_server_DH_params_fail(); v.vnonce.write(to); v.vserver_nonce.write(to); v.vnew_nonce_hash.write(to); } break; case mtpc_server_DH_params_ok: { - const MTPDserver_DH_params_ok &v(c_server_DH_params_ok()); + auto &v = c_server_DH_params_ok(); v.vnonce.write(to); v.vserver_nonce.write(to); v.vencrypted_answer.write(to); } break; } } -inline MTPserver_DH_Params::MTPserver_DH_Params(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPserver_DH_Params::MTPserver_DH_Params(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_server_DH_params_fail: setData(new MTPDserver_DH_params_fail()); break; - case mtpc_server_DH_params_ok: setData(new MTPDserver_DH_params_ok()); break; + case mtpc_server_DH_params_fail: data = std::make_shared(); break; + case mtpc_server_DH_params_ok: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPserver_DH_Params"); } } -inline MTPserver_DH_Params::MTPserver_DH_Params(MTPDserver_DH_params_fail *_data) : mtpDataOwner(_data), _type(mtpc_server_DH_params_fail) { +inline const MTPDserver_DH_params_fail &MTPserver_DH_Params::c_server_DH_params_fail() const { + t_assert(data != nullptr && _type == mtpc_server_DH_params_fail); + return static_cast(*data); } -inline MTPserver_DH_Params::MTPserver_DH_Params(MTPDserver_DH_params_ok *_data) : mtpDataOwner(_data), _type(mtpc_server_DH_params_ok) { +inline MTPserver_DH_Params::MTPserver_DH_Params(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_server_DH_params_fail) { +} +inline const MTPDserver_DH_params_ok &MTPserver_DH_Params::c_server_DH_params_ok() const { + t_assert(data != nullptr && _type == mtpc_server_DH_params_ok); + return static_cast(*data); +} +inline MTPserver_DH_Params::MTPserver_DH_Params(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_server_DH_params_ok) { } inline MTPserver_DH_Params MTP_server_DH_params_fail(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash) { return MTP::internal::TypeCreator::new_server_DH_params_fail(_nonce, _server_nonce, _new_nonce_hash); @@ -27274,7 +23681,7 @@ inline MTPserver_DH_Params MTP_server_DH_params_ok(const MTPint128 &_nonce, cons return MTP::internal::TypeCreator::new_server_DH_params_ok(_nonce, _server_nonce, _encrypted_answer); } -inline MTPserver_DH_inner_data::MTPserver_DH_inner_data() : mtpDataOwner(new MTPDserver_DH_inner_data()) { +inline MTPserver_DH_inner_data::MTPserver_DH_inner_data() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPserver_DH_inner_data::innerLength() const { @@ -27287,17 +23694,17 @@ inline mtpTypeId MTPserver_DH_inner_data::type() const { inline void MTPserver_DH_inner_data::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_server_DH_inner_data) throw mtpErrorUnexpected(cons, "MTPserver_DH_inner_data"); - if (!data) setData(new MTPDserver_DH_inner_data()); - MTPDserver_DH_inner_data &v(_server_DH_inner_data()); - v.vnonce.read(from, end); - v.vserver_nonce.read(from, end); - v.vg.read(from, end); - v.vdh_prime.read(from, end); - v.vg_a.read(from, end); - v.vserver_time.read(from, end); + auto v = std::make_shared(); + v->vnonce.read(from, end); + v->vserver_nonce.read(from, end); + v->vg.read(from, end); + v->vdh_prime.read(from, end); + v->vg_a.read(from, end); + v->vserver_time.read(from, end); + data = std::move(v); } inline void MTPserver_DH_inner_data::write(mtpBuffer &to) const { - const MTPDserver_DH_inner_data &v(c_server_DH_inner_data()); + auto &v = c_server_DH_inner_data(); v.vnonce.write(to); v.vserver_nonce.write(to); v.vg.write(to); @@ -27305,13 +23712,17 @@ inline void MTPserver_DH_inner_data::write(mtpBuffer &to) const { v.vg_a.write(to); v.vserver_time.write(to); } -inline MTPserver_DH_inner_data::MTPserver_DH_inner_data(MTPDserver_DH_inner_data *_data) : mtpDataOwner(_data) { +inline const MTPDserver_DH_inner_data &MTPserver_DH_inner_data::c_server_DH_inner_data() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPserver_DH_inner_data::MTPserver_DH_inner_data(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPserver_DH_inner_data MTP_server_DH_inner_data(const MTPint128 &_nonce, const MTPint128 &_server_nonce, MTPint _g, const MTPstring &_dh_prime, const MTPstring &_g_a, MTPint _server_time) { return MTP::internal::TypeCreator::new_server_DH_inner_data(_nonce, _server_nonce, _g, _dh_prime, _g_a, _server_time); } -inline MTPclient_DH_Inner_Data::MTPclient_DH_Inner_Data() : mtpDataOwner(new MTPDclient_DH_inner_data()) { +inline MTPclient_DH_Inner_Data::MTPclient_DH_Inner_Data() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPclient_DH_Inner_Data::innerLength() const { @@ -27324,21 +23735,25 @@ inline mtpTypeId MTPclient_DH_Inner_Data::type() const { inline void MTPclient_DH_Inner_Data::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_client_DH_inner_data) throw mtpErrorUnexpected(cons, "MTPclient_DH_Inner_Data"); - if (!data) setData(new MTPDclient_DH_inner_data()); - MTPDclient_DH_inner_data &v(_client_DH_inner_data()); - v.vnonce.read(from, end); - v.vserver_nonce.read(from, end); - v.vretry_id.read(from, end); - v.vg_b.read(from, end); + auto v = std::make_shared(); + v->vnonce.read(from, end); + v->vserver_nonce.read(from, end); + v->vretry_id.read(from, end); + v->vg_b.read(from, end); + data = std::move(v); } inline void MTPclient_DH_Inner_Data::write(mtpBuffer &to) const { - const MTPDclient_DH_inner_data &v(c_client_DH_inner_data()); + auto &v = c_client_DH_inner_data(); v.vnonce.write(to); v.vserver_nonce.write(to); v.vretry_id.write(to); v.vg_b.write(to); } -inline MTPclient_DH_Inner_Data::MTPclient_DH_Inner_Data(MTPDclient_DH_inner_data *_data) : mtpDataOwner(_data) { +inline const MTPDclient_DH_inner_data &MTPclient_DH_Inner_Data::c_client_DH_inner_data() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPclient_DH_Inner_Data::MTPclient_DH_Inner_Data(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPclient_DH_Inner_Data MTP_client_DH_inner_data(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPlong &_retry_id, const MTPstring &_g_b) { return MTP::internal::TypeCreator::new_client_DH_inner_data(_nonce, _server_nonce, _retry_id, _g_b); @@ -27366,28 +23781,28 @@ inline mtpTypeId MTPset_client_DH_params_answer::type() const { return _type; } inline void MTPset_client_DH_params_answer::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_dh_gen_ok: _type = cons; { - if (!data) setData(new MTPDdh_gen_ok()); - MTPDdh_gen_ok &v(_dh_gen_ok()); - v.vnonce.read(from, end); - v.vserver_nonce.read(from, end); - v.vnew_nonce_hash1.read(from, end); + auto v = std::make_shared(); + v->vnonce.read(from, end); + v->vserver_nonce.read(from, end); + v->vnew_nonce_hash1.read(from, end); + data = std::move(v); } break; case mtpc_dh_gen_retry: _type = cons; { - if (!data) setData(new MTPDdh_gen_retry()); - MTPDdh_gen_retry &v(_dh_gen_retry()); - v.vnonce.read(from, end); - v.vserver_nonce.read(from, end); - v.vnew_nonce_hash2.read(from, end); + auto v = std::make_shared(); + v->vnonce.read(from, end); + v->vserver_nonce.read(from, end); + v->vnew_nonce_hash2.read(from, end); + data = std::move(v); } break; case mtpc_dh_gen_fail: _type = cons; { - if (!data) setData(new MTPDdh_gen_fail()); - MTPDdh_gen_fail &v(_dh_gen_fail()); - v.vnonce.read(from, end); - v.vserver_nonce.read(from, end); - v.vnew_nonce_hash3.read(from, end); + auto v = std::make_shared(); + v->vnonce.read(from, end); + v->vserver_nonce.read(from, end); + v->vnew_nonce_hash3.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPset_client_DH_params_answer"); } @@ -27395,38 +23810,50 @@ inline void MTPset_client_DH_params_answer::read(const mtpPrime *&from, const mt inline void MTPset_client_DH_params_answer::write(mtpBuffer &to) const { switch (_type) { case mtpc_dh_gen_ok: { - const MTPDdh_gen_ok &v(c_dh_gen_ok()); + auto &v = c_dh_gen_ok(); v.vnonce.write(to); v.vserver_nonce.write(to); v.vnew_nonce_hash1.write(to); } break; case mtpc_dh_gen_retry: { - const MTPDdh_gen_retry &v(c_dh_gen_retry()); + auto &v = c_dh_gen_retry(); v.vnonce.write(to); v.vserver_nonce.write(to); v.vnew_nonce_hash2.write(to); } break; case mtpc_dh_gen_fail: { - const MTPDdh_gen_fail &v(c_dh_gen_fail()); + auto &v = c_dh_gen_fail(); v.vnonce.write(to); v.vserver_nonce.write(to); v.vnew_nonce_hash3.write(to); } break; } } -inline MTPset_client_DH_params_answer::MTPset_client_DH_params_answer(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPset_client_DH_params_answer::MTPset_client_DH_params_answer(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_dh_gen_ok: setData(new MTPDdh_gen_ok()); break; - case mtpc_dh_gen_retry: setData(new MTPDdh_gen_retry()); break; - case mtpc_dh_gen_fail: setData(new MTPDdh_gen_fail()); break; + case mtpc_dh_gen_ok: data = std::make_shared(); break; + case mtpc_dh_gen_retry: data = std::make_shared(); break; + case mtpc_dh_gen_fail: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPset_client_DH_params_answer"); } } -inline MTPset_client_DH_params_answer::MTPset_client_DH_params_answer(MTPDdh_gen_ok *_data) : mtpDataOwner(_data), _type(mtpc_dh_gen_ok) { +inline const MTPDdh_gen_ok &MTPset_client_DH_params_answer::c_dh_gen_ok() const { + t_assert(data != nullptr && _type == mtpc_dh_gen_ok); + return static_cast(*data); } -inline MTPset_client_DH_params_answer::MTPset_client_DH_params_answer(MTPDdh_gen_retry *_data) : mtpDataOwner(_data), _type(mtpc_dh_gen_retry) { +inline MTPset_client_DH_params_answer::MTPset_client_DH_params_answer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_dh_gen_ok) { } -inline MTPset_client_DH_params_answer::MTPset_client_DH_params_answer(MTPDdh_gen_fail *_data) : mtpDataOwner(_data), _type(mtpc_dh_gen_fail) { +inline const MTPDdh_gen_retry &MTPset_client_DH_params_answer::c_dh_gen_retry() const { + t_assert(data != nullptr && _type == mtpc_dh_gen_retry); + return static_cast(*data); +} +inline MTPset_client_DH_params_answer::MTPset_client_DH_params_answer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_dh_gen_retry) { +} +inline const MTPDdh_gen_fail &MTPset_client_DH_params_answer::c_dh_gen_fail() const { + t_assert(data != nullptr && _type == mtpc_dh_gen_fail); + return static_cast(*data); +} +inline MTPset_client_DH_params_answer::MTPset_client_DH_params_answer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_dh_gen_fail) { } inline MTPset_client_DH_params_answer MTP_dh_gen_ok(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash1) { return MTP::internal::TypeCreator::new_dh_gen_ok(_nonce, _server_nonce, _new_nonce_hash1); @@ -27473,7 +23900,7 @@ inline MTPdestroyAuthKeyRes MTP_destroy_auth_key_fail() { return MTP::internal::TypeCreator::new_destroy_auth_key_fail(); } -inline MTPmsgsAck::MTPmsgsAck() : mtpDataOwner(new MTPDmsgs_ack()) { +inline MTPmsgsAck::MTPmsgsAck() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmsgsAck::innerLength() const { @@ -27486,15 +23913,19 @@ inline mtpTypeId MTPmsgsAck::type() const { inline void MTPmsgsAck::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_msgs_ack) throw mtpErrorUnexpected(cons, "MTPmsgsAck"); - if (!data) setData(new MTPDmsgs_ack()); - MTPDmsgs_ack &v(_msgs_ack()); - v.vmsg_ids.read(from, end); + auto v = std::make_shared(); + v->vmsg_ids.read(from, end); + data = std::move(v); } inline void MTPmsgsAck::write(mtpBuffer &to) const { - const MTPDmsgs_ack &v(c_msgs_ack()); + auto &v = c_msgs_ack(); v.vmsg_ids.write(to); } -inline MTPmsgsAck::MTPmsgsAck(MTPDmsgs_ack *_data) : mtpDataOwner(_data) { +inline const MTPDmsgs_ack &MTPmsgsAck::c_msgs_ack() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmsgsAck::MTPmsgsAck(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmsgsAck MTP_msgs_ack(const MTPVector &_msg_ids) { return MTP::internal::TypeCreator::new_msgs_ack(_msg_ids); @@ -27518,22 +23949,22 @@ inline mtpTypeId MTPbadMsgNotification::type() const { return _type; } inline void MTPbadMsgNotification::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_bad_msg_notification: _type = cons; { - if (!data) setData(new MTPDbad_msg_notification()); - MTPDbad_msg_notification &v(_bad_msg_notification()); - v.vbad_msg_id.read(from, end); - v.vbad_msg_seqno.read(from, end); - v.verror_code.read(from, end); + auto v = std::make_shared(); + v->vbad_msg_id.read(from, end); + v->vbad_msg_seqno.read(from, end); + v->verror_code.read(from, end); + data = std::move(v); } break; case mtpc_bad_server_salt: _type = cons; { - if (!data) setData(new MTPDbad_server_salt()); - MTPDbad_server_salt &v(_bad_server_salt()); - v.vbad_msg_id.read(from, end); - v.vbad_msg_seqno.read(from, end); - v.verror_code.read(from, end); - v.vnew_server_salt.read(from, end); + auto v = std::make_shared(); + v->vbad_msg_id.read(from, end); + v->vbad_msg_seqno.read(from, end); + v->verror_code.read(from, end); + v->vnew_server_salt.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPbadMsgNotification"); } @@ -27541,13 +23972,13 @@ inline void MTPbadMsgNotification::read(const mtpPrime *&from, const mtpPrime *e inline void MTPbadMsgNotification::write(mtpBuffer &to) const { switch (_type) { case mtpc_bad_msg_notification: { - const MTPDbad_msg_notification &v(c_bad_msg_notification()); + auto &v = c_bad_msg_notification(); v.vbad_msg_id.write(to); v.vbad_msg_seqno.write(to); v.verror_code.write(to); } break; case mtpc_bad_server_salt: { - const MTPDbad_server_salt &v(c_bad_server_salt()); + auto &v = c_bad_server_salt(); v.vbad_msg_id.write(to); v.vbad_msg_seqno.write(to); v.verror_code.write(to); @@ -27555,16 +23986,24 @@ inline void MTPbadMsgNotification::write(mtpBuffer &to) const { } break; } } -inline MTPbadMsgNotification::MTPbadMsgNotification(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPbadMsgNotification::MTPbadMsgNotification(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_bad_msg_notification: setData(new MTPDbad_msg_notification()); break; - case mtpc_bad_server_salt: setData(new MTPDbad_server_salt()); break; + case mtpc_bad_msg_notification: data = std::make_shared(); break; + case mtpc_bad_server_salt: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPbadMsgNotification"); } } -inline MTPbadMsgNotification::MTPbadMsgNotification(MTPDbad_msg_notification *_data) : mtpDataOwner(_data), _type(mtpc_bad_msg_notification) { +inline const MTPDbad_msg_notification &MTPbadMsgNotification::c_bad_msg_notification() const { + t_assert(data != nullptr && _type == mtpc_bad_msg_notification); + return static_cast(*data); } -inline MTPbadMsgNotification::MTPbadMsgNotification(MTPDbad_server_salt *_data) : mtpDataOwner(_data), _type(mtpc_bad_server_salt) { +inline MTPbadMsgNotification::MTPbadMsgNotification(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_bad_msg_notification) { +} +inline const MTPDbad_server_salt &MTPbadMsgNotification::c_bad_server_salt() const { + t_assert(data != nullptr && _type == mtpc_bad_server_salt); + return static_cast(*data); +} +inline MTPbadMsgNotification::MTPbadMsgNotification(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_bad_server_salt) { } inline MTPbadMsgNotification MTP_bad_msg_notification(const MTPlong &_bad_msg_id, MTPint _bad_msg_seqno, MTPint _error_code) { return MTP::internal::TypeCreator::new_bad_msg_notification(_bad_msg_id, _bad_msg_seqno, _error_code); @@ -27573,7 +24012,7 @@ inline MTPbadMsgNotification MTP_bad_server_salt(const MTPlong &_bad_msg_id, MTP return MTP::internal::TypeCreator::new_bad_server_salt(_bad_msg_id, _bad_msg_seqno, _error_code, _new_server_salt); } -inline MTPmsgsStateReq::MTPmsgsStateReq() : mtpDataOwner(new MTPDmsgs_state_req()) { +inline MTPmsgsStateReq::MTPmsgsStateReq() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmsgsStateReq::innerLength() const { @@ -27586,21 +24025,25 @@ inline mtpTypeId MTPmsgsStateReq::type() const { inline void MTPmsgsStateReq::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_msgs_state_req) throw mtpErrorUnexpected(cons, "MTPmsgsStateReq"); - if (!data) setData(new MTPDmsgs_state_req()); - MTPDmsgs_state_req &v(_msgs_state_req()); - v.vmsg_ids.read(from, end); + auto v = std::make_shared(); + v->vmsg_ids.read(from, end); + data = std::move(v); } inline void MTPmsgsStateReq::write(mtpBuffer &to) const { - const MTPDmsgs_state_req &v(c_msgs_state_req()); + auto &v = c_msgs_state_req(); v.vmsg_ids.write(to); } -inline MTPmsgsStateReq::MTPmsgsStateReq(MTPDmsgs_state_req *_data) : mtpDataOwner(_data) { +inline const MTPDmsgs_state_req &MTPmsgsStateReq::c_msgs_state_req() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmsgsStateReq::MTPmsgsStateReq(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmsgsStateReq MTP_msgs_state_req(const MTPVector &_msg_ids) { return MTP::internal::TypeCreator::new_msgs_state_req(_msg_ids); } -inline MTPmsgsStateInfo::MTPmsgsStateInfo() : mtpDataOwner(new MTPDmsgs_state_info()) { +inline MTPmsgsStateInfo::MTPmsgsStateInfo() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmsgsStateInfo::innerLength() const { @@ -27613,23 +24056,27 @@ inline mtpTypeId MTPmsgsStateInfo::type() const { inline void MTPmsgsStateInfo::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_msgs_state_info) throw mtpErrorUnexpected(cons, "MTPmsgsStateInfo"); - if (!data) setData(new MTPDmsgs_state_info()); - MTPDmsgs_state_info &v(_msgs_state_info()); - v.vreq_msg_id.read(from, end); - v.vinfo.read(from, end); + auto v = std::make_shared(); + v->vreq_msg_id.read(from, end); + v->vinfo.read(from, end); + data = std::move(v); } inline void MTPmsgsStateInfo::write(mtpBuffer &to) const { - const MTPDmsgs_state_info &v(c_msgs_state_info()); + auto &v = c_msgs_state_info(); v.vreq_msg_id.write(to); v.vinfo.write(to); } -inline MTPmsgsStateInfo::MTPmsgsStateInfo(MTPDmsgs_state_info *_data) : mtpDataOwner(_data) { +inline const MTPDmsgs_state_info &MTPmsgsStateInfo::c_msgs_state_info() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmsgsStateInfo::MTPmsgsStateInfo(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmsgsStateInfo MTP_msgs_state_info(const MTPlong &_req_msg_id, const MTPstring &_info) { return MTP::internal::TypeCreator::new_msgs_state_info(_req_msg_id, _info); } -inline MTPmsgsAllInfo::MTPmsgsAllInfo() : mtpDataOwner(new MTPDmsgs_all_info()) { +inline MTPmsgsAllInfo::MTPmsgsAllInfo() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmsgsAllInfo::innerLength() const { @@ -27642,17 +24089,21 @@ inline mtpTypeId MTPmsgsAllInfo::type() const { inline void MTPmsgsAllInfo::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_msgs_all_info) throw mtpErrorUnexpected(cons, "MTPmsgsAllInfo"); - if (!data) setData(new MTPDmsgs_all_info()); - MTPDmsgs_all_info &v(_msgs_all_info()); - v.vmsg_ids.read(from, end); - v.vinfo.read(from, end); + auto v = std::make_shared(); + v->vmsg_ids.read(from, end); + v->vinfo.read(from, end); + data = std::move(v); } inline void MTPmsgsAllInfo::write(mtpBuffer &to) const { - const MTPDmsgs_all_info &v(c_msgs_all_info()); + auto &v = c_msgs_all_info(); v.vmsg_ids.write(to); v.vinfo.write(to); } -inline MTPmsgsAllInfo::MTPmsgsAllInfo(MTPDmsgs_all_info *_data) : mtpDataOwner(_data) { +inline const MTPDmsgs_all_info &MTPmsgsAllInfo::c_msgs_all_info() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmsgsAllInfo::MTPmsgsAllInfo(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmsgsAllInfo MTP_msgs_all_info(const MTPVector &_msg_ids, const MTPstring &_info) { return MTP::internal::TypeCreator::new_msgs_all_info(_msg_ids, _info); @@ -27676,22 +24127,22 @@ inline mtpTypeId MTPmsgDetailedInfo::type() const { return _type; } inline void MTPmsgDetailedInfo::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_msg_detailed_info: _type = cons; { - if (!data) setData(new MTPDmsg_detailed_info()); - MTPDmsg_detailed_info &v(_msg_detailed_info()); - v.vmsg_id.read(from, end); - v.vanswer_msg_id.read(from, end); - v.vbytes.read(from, end); - v.vstatus.read(from, end); + auto v = std::make_shared(); + v->vmsg_id.read(from, end); + v->vanswer_msg_id.read(from, end); + v->vbytes.read(from, end); + v->vstatus.read(from, end); + data = std::move(v); } break; case mtpc_msg_new_detailed_info: _type = cons; { - if (!data) setData(new MTPDmsg_new_detailed_info()); - MTPDmsg_new_detailed_info &v(_msg_new_detailed_info()); - v.vanswer_msg_id.read(from, end); - v.vbytes.read(from, end); - v.vstatus.read(from, end); + auto v = std::make_shared(); + v->vanswer_msg_id.read(from, end); + v->vbytes.read(from, end); + v->vstatus.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmsgDetailedInfo"); } @@ -27699,30 +24150,38 @@ inline void MTPmsgDetailedInfo::read(const mtpPrime *&from, const mtpPrime *end, inline void MTPmsgDetailedInfo::write(mtpBuffer &to) const { switch (_type) { case mtpc_msg_detailed_info: { - const MTPDmsg_detailed_info &v(c_msg_detailed_info()); + auto &v = c_msg_detailed_info(); v.vmsg_id.write(to); v.vanswer_msg_id.write(to); v.vbytes.write(to); v.vstatus.write(to); } break; case mtpc_msg_new_detailed_info: { - const MTPDmsg_new_detailed_info &v(c_msg_new_detailed_info()); + auto &v = c_msg_new_detailed_info(); v.vanswer_msg_id.write(to); v.vbytes.write(to); v.vstatus.write(to); } break; } } -inline MTPmsgDetailedInfo::MTPmsgDetailedInfo(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmsgDetailedInfo::MTPmsgDetailedInfo(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_msg_detailed_info: setData(new MTPDmsg_detailed_info()); break; - case mtpc_msg_new_detailed_info: setData(new MTPDmsg_new_detailed_info()); break; + case mtpc_msg_detailed_info: data = std::make_shared(); break; + case mtpc_msg_new_detailed_info: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmsgDetailedInfo"); } } -inline MTPmsgDetailedInfo::MTPmsgDetailedInfo(MTPDmsg_detailed_info *_data) : mtpDataOwner(_data), _type(mtpc_msg_detailed_info) { +inline const MTPDmsg_detailed_info &MTPmsgDetailedInfo::c_msg_detailed_info() const { + t_assert(data != nullptr && _type == mtpc_msg_detailed_info); + return static_cast(*data); } -inline MTPmsgDetailedInfo::MTPmsgDetailedInfo(MTPDmsg_new_detailed_info *_data) : mtpDataOwner(_data), _type(mtpc_msg_new_detailed_info) { +inline MTPmsgDetailedInfo::MTPmsgDetailedInfo(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_msg_detailed_info) { +} +inline const MTPDmsg_new_detailed_info &MTPmsgDetailedInfo::c_msg_new_detailed_info() const { + t_assert(data != nullptr && _type == mtpc_msg_new_detailed_info); + return static_cast(*data); +} +inline MTPmsgDetailedInfo::MTPmsgDetailedInfo(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_msg_new_detailed_info) { } inline MTPmsgDetailedInfo MTP_msg_detailed_info(const MTPlong &_msg_id, const MTPlong &_answer_msg_id, MTPint _bytes, MTPint _status) { return MTP::internal::TypeCreator::new_msg_detailed_info(_msg_id, _answer_msg_id, _bytes, _status); @@ -27731,7 +24190,7 @@ inline MTPmsgDetailedInfo MTP_msg_new_detailed_info(const MTPlong &_answer_msg_i return MTP::internal::TypeCreator::new_msg_new_detailed_info(_answer_msg_id, _bytes, _status); } -inline MTPmsgResendReq::MTPmsgResendReq() : mtpDataOwner(new MTPDmsg_resend_req()) { +inline MTPmsgResendReq::MTPmsgResendReq() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmsgResendReq::innerLength() const { @@ -27744,21 +24203,25 @@ inline mtpTypeId MTPmsgResendReq::type() const { inline void MTPmsgResendReq::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_msg_resend_req) throw mtpErrorUnexpected(cons, "MTPmsgResendReq"); - if (!data) setData(new MTPDmsg_resend_req()); - MTPDmsg_resend_req &v(_msg_resend_req()); - v.vmsg_ids.read(from, end); + auto v = std::make_shared(); + v->vmsg_ids.read(from, end); + data = std::move(v); } inline void MTPmsgResendReq::write(mtpBuffer &to) const { - const MTPDmsg_resend_req &v(c_msg_resend_req()); + auto &v = c_msg_resend_req(); v.vmsg_ids.write(to); } -inline MTPmsgResendReq::MTPmsgResendReq(MTPDmsg_resend_req *_data) : mtpDataOwner(_data) { +inline const MTPDmsg_resend_req &MTPmsgResendReq::c_msg_resend_req() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmsgResendReq::MTPmsgResendReq(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmsgResendReq MTP_msg_resend_req(const MTPVector &_msg_ids) { return MTP::internal::TypeCreator::new_msg_resend_req(_msg_ids); } -inline MTPrpcError::MTPrpcError() : mtpDataOwner(new MTPDrpc_error()) { +inline MTPrpcError::MTPrpcError() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPrpcError::innerLength() const { @@ -27771,17 +24234,21 @@ inline mtpTypeId MTPrpcError::type() const { inline void MTPrpcError::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_rpc_error) throw mtpErrorUnexpected(cons, "MTPrpcError"); - if (!data) setData(new MTPDrpc_error()); - MTPDrpc_error &v(_rpc_error()); - v.verror_code.read(from, end); - v.verror_message.read(from, end); + auto v = std::make_shared(); + v->verror_code.read(from, end); + v->verror_message.read(from, end); + data = std::move(v); } inline void MTPrpcError::write(mtpBuffer &to) const { - const MTPDrpc_error &v(c_rpc_error()); + auto &v = c_rpc_error(); v.verror_code.write(to); v.verror_message.write(to); } -inline MTPrpcError::MTPrpcError(MTPDrpc_error *_data) : mtpDataOwner(_data) { +inline const MTPDrpc_error &MTPrpcError::c_rpc_error() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPrpcError::MTPrpcError(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPrpcError MTP_rpc_error(MTPint _error_code, const MTPstring &_error_message) { return MTP::internal::TypeCreator::new_rpc_error(_error_code, _error_message); @@ -27801,16 +24268,16 @@ inline mtpTypeId MTPrpcDropAnswer::type() const { return _type; } inline void MTPrpcDropAnswer::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_rpc_answer_unknown: _type = cons; break; case mtpc_rpc_answer_dropped_running: _type = cons; break; case mtpc_rpc_answer_dropped: _type = cons; { - if (!data) setData(new MTPDrpc_answer_dropped()); - MTPDrpc_answer_dropped &v(_rpc_answer_dropped()); - v.vmsg_id.read(from, end); - v.vseq_no.read(from, end); - v.vbytes.read(from, end); + auto v = std::make_shared(); + v->vmsg_id.read(from, end); + v->vseq_no.read(from, end); + v->vbytes.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPrpcDropAnswer"); } @@ -27818,22 +24285,26 @@ inline void MTPrpcDropAnswer::read(const mtpPrime *&from, const mtpPrime *end, m inline void MTPrpcDropAnswer::write(mtpBuffer &to) const { switch (_type) { case mtpc_rpc_answer_dropped: { - const MTPDrpc_answer_dropped &v(c_rpc_answer_dropped()); + auto &v = c_rpc_answer_dropped(); v.vmsg_id.write(to); v.vseq_no.write(to); v.vbytes.write(to); } break; } } -inline MTPrpcDropAnswer::MTPrpcDropAnswer(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPrpcDropAnswer::MTPrpcDropAnswer(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_rpc_answer_unknown: break; case mtpc_rpc_answer_dropped_running: break; - case mtpc_rpc_answer_dropped: setData(new MTPDrpc_answer_dropped()); break; + case mtpc_rpc_answer_dropped: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPrpcDropAnswer"); } } -inline MTPrpcDropAnswer::MTPrpcDropAnswer(MTPDrpc_answer_dropped *_data) : mtpDataOwner(_data), _type(mtpc_rpc_answer_dropped) { +inline const MTPDrpc_answer_dropped &MTPrpcDropAnswer::c_rpc_answer_dropped() const { + t_assert(data != nullptr && _type == mtpc_rpc_answer_dropped); + return static_cast(*data); +} +inline MTPrpcDropAnswer::MTPrpcDropAnswer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_rpc_answer_dropped) { } inline MTPrpcDropAnswer MTP_rpc_answer_unknown() { return MTP::internal::TypeCreator::new_rpc_answer_unknown(); @@ -27845,7 +24316,7 @@ inline MTPrpcDropAnswer MTP_rpc_answer_dropped(const MTPlong &_msg_id, MTPint _s return MTP::internal::TypeCreator::new_rpc_answer_dropped(_msg_id, _seq_no, _bytes); } -inline MTPfutureSalt::MTPfutureSalt() : mtpDataOwner(new MTPDfuture_salt()) { +inline MTPfutureSalt::MTPfutureSalt() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPfutureSalt::innerLength() const { @@ -27858,25 +24329,29 @@ inline mtpTypeId MTPfutureSalt::type() const { inline void MTPfutureSalt::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_future_salt) throw mtpErrorUnexpected(cons, "MTPfutureSalt"); - if (!data) setData(new MTPDfuture_salt()); - MTPDfuture_salt &v(_future_salt()); - v.vvalid_since.read(from, end); - v.vvalid_until.read(from, end); - v.vsalt.read(from, end); + auto v = std::make_shared(); + v->vvalid_since.read(from, end); + v->vvalid_until.read(from, end); + v->vsalt.read(from, end); + data = std::move(v); } inline void MTPfutureSalt::write(mtpBuffer &to) const { - const MTPDfuture_salt &v(c_future_salt()); + auto &v = c_future_salt(); v.vvalid_since.write(to); v.vvalid_until.write(to); v.vsalt.write(to); } -inline MTPfutureSalt::MTPfutureSalt(MTPDfuture_salt *_data) : mtpDataOwner(_data) { +inline const MTPDfuture_salt &MTPfutureSalt::c_future_salt() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPfutureSalt::MTPfutureSalt(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPfutureSalt MTP_future_salt(MTPint _valid_since, MTPint _valid_until, const MTPlong &_salt) { return MTP::internal::TypeCreator::new_future_salt(_valid_since, _valid_until, _salt); } -inline MTPfutureSalts::MTPfutureSalts() : mtpDataOwner(new MTPDfuture_salts()) { +inline MTPfutureSalts::MTPfutureSalts() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPfutureSalts::innerLength() const { @@ -27889,25 +24364,29 @@ inline mtpTypeId MTPfutureSalts::type() const { inline void MTPfutureSalts::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_future_salts) throw mtpErrorUnexpected(cons, "MTPfutureSalts"); - if (!data) setData(new MTPDfuture_salts()); - MTPDfuture_salts &v(_future_salts()); - v.vreq_msg_id.read(from, end); - v.vnow.read(from, end); - v.vsalts.read(from, end); + auto v = std::make_shared(); + v->vreq_msg_id.read(from, end); + v->vnow.read(from, end); + v->vsalts.read(from, end); + data = std::move(v); } inline void MTPfutureSalts::write(mtpBuffer &to) const { - const MTPDfuture_salts &v(c_future_salts()); + auto &v = c_future_salts(); v.vreq_msg_id.write(to); v.vnow.write(to); v.vsalts.write(to); } -inline MTPfutureSalts::MTPfutureSalts(MTPDfuture_salts *_data) : mtpDataOwner(_data) { +inline const MTPDfuture_salts &MTPfutureSalts::c_future_salts() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPfutureSalts::MTPfutureSalts(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPfutureSalts MTP_future_salts(const MTPlong &_req_msg_id, MTPint _now, const MTPvector &_salts) { return MTP::internal::TypeCreator::new_future_salts(_req_msg_id, _now, _salts); } -inline MTPpong::MTPpong() : mtpDataOwner(new MTPDpong()) { +inline MTPpong::MTPpong() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPpong::innerLength() const { @@ -27920,17 +24399,21 @@ inline mtpTypeId MTPpong::type() const { inline void MTPpong::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_pong) throw mtpErrorUnexpected(cons, "MTPpong"); - if (!data) setData(new MTPDpong()); - MTPDpong &v(_pong()); - v.vmsg_id.read(from, end); - v.vping_id.read(from, end); + auto v = std::make_shared(); + v->vmsg_id.read(from, end); + v->vping_id.read(from, end); + data = std::move(v); } inline void MTPpong::write(mtpBuffer &to) const { - const MTPDpong &v(c_pong()); + auto &v = c_pong(); v.vmsg_id.write(to); v.vping_id.write(to); } -inline MTPpong::MTPpong(MTPDpong *_data) : mtpDataOwner(_data) { +inline const MTPDpong &MTPpong::c_pong() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPpong::MTPpong(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPpong MTP_pong(const MTPlong &_msg_id, const MTPlong &_ping_id) { return MTP::internal::TypeCreator::new_pong(_msg_id, _ping_id); @@ -27954,17 +24437,17 @@ inline mtpTypeId MTPdestroySessionRes::type() const { return _type; } inline void MTPdestroySessionRes::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_destroy_session_ok: _type = cons; { - if (!data) setData(new MTPDdestroy_session_ok()); - MTPDdestroy_session_ok &v(_destroy_session_ok()); - v.vsession_id.read(from, end); + auto v = std::make_shared(); + v->vsession_id.read(from, end); + data = std::move(v); } break; case mtpc_destroy_session_none: _type = cons; { - if (!data) setData(new MTPDdestroy_session_none()); - MTPDdestroy_session_none &v(_destroy_session_none()); - v.vsession_id.read(from, end); + auto v = std::make_shared(); + v->vsession_id.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPdestroySessionRes"); } @@ -27972,25 +24455,33 @@ inline void MTPdestroySessionRes::read(const mtpPrime *&from, const mtpPrime *en inline void MTPdestroySessionRes::write(mtpBuffer &to) const { switch (_type) { case mtpc_destroy_session_ok: { - const MTPDdestroy_session_ok &v(c_destroy_session_ok()); + auto &v = c_destroy_session_ok(); v.vsession_id.write(to); } break; case mtpc_destroy_session_none: { - const MTPDdestroy_session_none &v(c_destroy_session_none()); + auto &v = c_destroy_session_none(); v.vsession_id.write(to); } break; } } -inline MTPdestroySessionRes::MTPdestroySessionRes(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPdestroySessionRes::MTPdestroySessionRes(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_destroy_session_ok: setData(new MTPDdestroy_session_ok()); break; - case mtpc_destroy_session_none: setData(new MTPDdestroy_session_none()); break; + case mtpc_destroy_session_ok: data = std::make_shared(); break; + case mtpc_destroy_session_none: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPdestroySessionRes"); } } -inline MTPdestroySessionRes::MTPdestroySessionRes(MTPDdestroy_session_ok *_data) : mtpDataOwner(_data), _type(mtpc_destroy_session_ok) { +inline const MTPDdestroy_session_ok &MTPdestroySessionRes::c_destroy_session_ok() const { + t_assert(data != nullptr && _type == mtpc_destroy_session_ok); + return static_cast(*data); } -inline MTPdestroySessionRes::MTPdestroySessionRes(MTPDdestroy_session_none *_data) : mtpDataOwner(_data), _type(mtpc_destroy_session_none) { +inline MTPdestroySessionRes::MTPdestroySessionRes(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_destroy_session_ok) { +} +inline const MTPDdestroy_session_none &MTPdestroySessionRes::c_destroy_session_none() const { + t_assert(data != nullptr && _type == mtpc_destroy_session_none); + return static_cast(*data); +} +inline MTPdestroySessionRes::MTPdestroySessionRes(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_destroy_session_none) { } inline MTPdestroySessionRes MTP_destroy_session_ok(const MTPlong &_session_id) { return MTP::internal::TypeCreator::new_destroy_session_ok(_session_id); @@ -27999,7 +24490,7 @@ inline MTPdestroySessionRes MTP_destroy_session_none(const MTPlong &_session_id) return MTP::internal::TypeCreator::new_destroy_session_none(_session_id); } -inline MTPnewSession::MTPnewSession() : mtpDataOwner(new MTPDnew_session_created()) { +inline MTPnewSession::MTPnewSession() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPnewSession::innerLength() const { @@ -28012,25 +24503,29 @@ inline mtpTypeId MTPnewSession::type() const { inline void MTPnewSession::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_new_session_created) throw mtpErrorUnexpected(cons, "MTPnewSession"); - if (!data) setData(new MTPDnew_session_created()); - MTPDnew_session_created &v(_new_session_created()); - v.vfirst_msg_id.read(from, end); - v.vunique_id.read(from, end); - v.vserver_salt.read(from, end); + auto v = std::make_shared(); + v->vfirst_msg_id.read(from, end); + v->vunique_id.read(from, end); + v->vserver_salt.read(from, end); + data = std::move(v); } inline void MTPnewSession::write(mtpBuffer &to) const { - const MTPDnew_session_created &v(c_new_session_created()); + auto &v = c_new_session_created(); v.vfirst_msg_id.write(to); v.vunique_id.write(to); v.vserver_salt.write(to); } -inline MTPnewSession::MTPnewSession(MTPDnew_session_created *_data) : mtpDataOwner(_data) { +inline const MTPDnew_session_created &MTPnewSession::c_new_session_created() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPnewSession::MTPnewSession(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPnewSession MTP_new_session_created(const MTPlong &_first_msg_id, const MTPlong &_unique_id, const MTPlong &_server_salt) { return MTP::internal::TypeCreator::new_new_session_created(_first_msg_id, _unique_id, _server_salt); } -inline MTPhttpWait::MTPhttpWait() : mtpDataOwner(new MTPDhttp_wait()) { +inline MTPhttpWait::MTPhttpWait() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPhttpWait::innerLength() const { @@ -28043,19 +24538,23 @@ inline mtpTypeId MTPhttpWait::type() const { inline void MTPhttpWait::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_http_wait) throw mtpErrorUnexpected(cons, "MTPhttpWait"); - if (!data) setData(new MTPDhttp_wait()); - MTPDhttp_wait &v(_http_wait()); - v.vmax_delay.read(from, end); - v.vwait_after.read(from, end); - v.vmax_wait.read(from, end); + auto v = std::make_shared(); + v->vmax_delay.read(from, end); + v->vwait_after.read(from, end); + v->vmax_wait.read(from, end); + data = std::move(v); } inline void MTPhttpWait::write(mtpBuffer &to) const { - const MTPDhttp_wait &v(c_http_wait()); + auto &v = c_http_wait(); v.vmax_delay.write(to); v.vwait_after.write(to); v.vmax_wait.write(to); } -inline MTPhttpWait::MTPhttpWait(MTPDhttp_wait *_data) : mtpDataOwner(_data) { +inline const MTPDhttp_wait &MTPhttpWait::c_http_wait() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPhttpWait::MTPhttpWait(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPhttpWait MTP_http_wait(MTPint _max_delay, MTPint _wait_after, MTPint _max_wait) { return MTP::internal::TypeCreator::new_http_wait(_max_delay, _wait_after, _max_wait); @@ -28105,7 +24604,7 @@ inline MTPtrue MTP_true() { return MTP::internal::TypeCreator::new_true(); } -inline MTPerror::MTPerror() : mtpDataOwner(new MTPDerror()) { +inline MTPerror::MTPerror() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPerror::innerLength() const { @@ -28118,17 +24617,21 @@ inline mtpTypeId MTPerror::type() const { inline void MTPerror::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_error) throw mtpErrorUnexpected(cons, "MTPerror"); - if (!data) setData(new MTPDerror()); - MTPDerror &v(_error()); - v.vcode.read(from, end); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vcode.read(from, end); + v->vtext.read(from, end); + data = std::move(v); } inline void MTPerror::write(mtpBuffer &to) const { - const MTPDerror &v(c_error()); + auto &v = c_error(); v.vcode.write(to); v.vtext.write(to); } -inline MTPerror::MTPerror(MTPDerror *_data) : mtpDataOwner(_data) { +inline const MTPDerror &MTPerror::c_error() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPerror::MTPerror(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPerror MTP_error(MTPint _code, const MTPstring &_text) { return MTP::internal::TypeCreator::new_error(_code, _text); @@ -28170,26 +24673,26 @@ inline mtpTypeId MTPinputPeer::type() const { return _type; } inline void MTPinputPeer::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputPeerEmpty: _type = cons; break; case mtpc_inputPeerSelf: _type = cons; break; case mtpc_inputPeerChat: _type = cons; { - if (!data) setData(new MTPDinputPeerChat()); - MTPDinputPeerChat &v(_inputPeerChat()); - v.vchat_id.read(from, end); + auto v = std::make_shared(); + v->vchat_id.read(from, end); + data = std::move(v); } break; case mtpc_inputPeerUser: _type = cons; { - if (!data) setData(new MTPDinputPeerUser()); - MTPDinputPeerUser &v(_inputPeerUser()); - v.vuser_id.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } break; case mtpc_inputPeerChannel: _type = cons; { - if (!data) setData(new MTPDinputPeerChannel()); - MTPDinputPeerChannel &v(_inputPeerChannel()); - v.vchannel_id.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vchannel_id.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputPeer"); } @@ -28197,36 +24700,48 @@ inline void MTPinputPeer::read(const mtpPrime *&from, const mtpPrime *end, mtpTy inline void MTPinputPeer::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputPeerChat: { - const MTPDinputPeerChat &v(c_inputPeerChat()); + auto &v = c_inputPeerChat(); v.vchat_id.write(to); } break; case mtpc_inputPeerUser: { - const MTPDinputPeerUser &v(c_inputPeerUser()); + auto &v = c_inputPeerUser(); v.vuser_id.write(to); v.vaccess_hash.write(to); } break; case mtpc_inputPeerChannel: { - const MTPDinputPeerChannel &v(c_inputPeerChannel()); + auto &v = c_inputPeerChannel(); v.vchannel_id.write(to); v.vaccess_hash.write(to); } break; } } -inline MTPinputPeer::MTPinputPeer(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputPeer::MTPinputPeer(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputPeerEmpty: break; case mtpc_inputPeerSelf: break; - case mtpc_inputPeerChat: setData(new MTPDinputPeerChat()); break; - case mtpc_inputPeerUser: setData(new MTPDinputPeerUser()); break; - case mtpc_inputPeerChannel: setData(new MTPDinputPeerChannel()); break; + case mtpc_inputPeerChat: data = std::make_shared(); break; + case mtpc_inputPeerUser: data = std::make_shared(); break; + case mtpc_inputPeerChannel: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputPeer"); } } -inline MTPinputPeer::MTPinputPeer(MTPDinputPeerChat *_data) : mtpDataOwner(_data), _type(mtpc_inputPeerChat) { +inline const MTPDinputPeerChat &MTPinputPeer::c_inputPeerChat() const { + t_assert(data != nullptr && _type == mtpc_inputPeerChat); + return static_cast(*data); } -inline MTPinputPeer::MTPinputPeer(MTPDinputPeerUser *_data) : mtpDataOwner(_data), _type(mtpc_inputPeerUser) { +inline MTPinputPeer::MTPinputPeer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputPeerChat) { } -inline MTPinputPeer::MTPinputPeer(MTPDinputPeerChannel *_data) : mtpDataOwner(_data), _type(mtpc_inputPeerChannel) { +inline const MTPDinputPeerUser &MTPinputPeer::c_inputPeerUser() const { + t_assert(data != nullptr && _type == mtpc_inputPeerUser); + return static_cast(*data); +} +inline MTPinputPeer::MTPinputPeer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputPeerUser) { +} +inline const MTPDinputPeerChannel &MTPinputPeer::c_inputPeerChannel() const { + t_assert(data != nullptr && _type == mtpc_inputPeerChannel); + return static_cast(*data); +} +inline MTPinputPeer::MTPinputPeer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputPeerChannel) { } inline MTPinputPeer MTP_inputPeerEmpty() { return MTP::internal::TypeCreator::new_inputPeerEmpty(); @@ -28258,15 +24773,15 @@ inline mtpTypeId MTPinputUser::type() const { return _type; } inline void MTPinputUser::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputUserEmpty: _type = cons; break; case mtpc_inputUserSelf: _type = cons; break; case mtpc_inputUser: _type = cons; { - if (!data) setData(new MTPDinputUser()); - MTPDinputUser &v(_inputUser()); - v.vuser_id.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputUser"); } @@ -28274,21 +24789,25 @@ inline void MTPinputUser::read(const mtpPrime *&from, const mtpPrime *end, mtpTy inline void MTPinputUser::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputUser: { - const MTPDinputUser &v(c_inputUser()); + auto &v = c_inputUser(); v.vuser_id.write(to); v.vaccess_hash.write(to); } break; } } -inline MTPinputUser::MTPinputUser(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputUser::MTPinputUser(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputUserEmpty: break; case mtpc_inputUserSelf: break; - case mtpc_inputUser: setData(new MTPDinputUser()); break; + case mtpc_inputUser: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputUser"); } } -inline MTPinputUser::MTPinputUser(MTPDinputUser *_data) : mtpDataOwner(_data), _type(mtpc_inputUser) { +inline const MTPDinputUser &MTPinputUser::c_inputUser() const { + t_assert(data != nullptr && _type == mtpc_inputUser); + return static_cast(*data); +} +inline MTPinputUser::MTPinputUser(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputUser) { } inline MTPinputUser MTP_inputUserEmpty() { return MTP::internal::TypeCreator::new_inputUserEmpty(); @@ -28300,7 +24819,7 @@ inline MTPinputUser MTP_inputUser(MTPint _user_id, const MTPlong &_access_hash) return MTP::internal::TypeCreator::new_inputUser(_user_id, _access_hash); } -inline MTPinputContact::MTPinputContact() : mtpDataOwner(new MTPDinputPhoneContact()) { +inline MTPinputContact::MTPinputContact() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPinputContact::innerLength() const { @@ -28313,21 +24832,25 @@ inline mtpTypeId MTPinputContact::type() const { inline void MTPinputContact::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_inputPhoneContact) throw mtpErrorUnexpected(cons, "MTPinputContact"); - if (!data) setData(new MTPDinputPhoneContact()); - MTPDinputPhoneContact &v(_inputPhoneContact()); - v.vclient_id.read(from, end); - v.vphone.read(from, end); - v.vfirst_name.read(from, end); - v.vlast_name.read(from, end); + auto v = std::make_shared(); + v->vclient_id.read(from, end); + v->vphone.read(from, end); + v->vfirst_name.read(from, end); + v->vlast_name.read(from, end); + data = std::move(v); } inline void MTPinputContact::write(mtpBuffer &to) const { - const MTPDinputPhoneContact &v(c_inputPhoneContact()); + auto &v = c_inputPhoneContact(); v.vclient_id.write(to); v.vphone.write(to); v.vfirst_name.write(to); v.vlast_name.write(to); } -inline MTPinputContact::MTPinputContact(MTPDinputPhoneContact *_data) : mtpDataOwner(_data) { +inline const MTPDinputPhoneContact &MTPinputContact::c_inputPhoneContact() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPinputContact::MTPinputContact(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPinputContact MTP_inputPhoneContact(const MTPlong &_client_id, const MTPstring &_phone, const MTPstring &_first_name, const MTPstring &_last_name) { return MTP::internal::TypeCreator::new_inputPhoneContact(_client_id, _phone, _first_name, _last_name); @@ -28351,22 +24874,22 @@ inline mtpTypeId MTPinputFile::type() const { return _type; } inline void MTPinputFile::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputFile: _type = cons; { - if (!data) setData(new MTPDinputFile()); - MTPDinputFile &v(_inputFile()); - v.vid.read(from, end); - v.vparts.read(from, end); - v.vname.read(from, end); - v.vmd5_checksum.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vparts.read(from, end); + v->vname.read(from, end); + v->vmd5_checksum.read(from, end); + data = std::move(v); } break; case mtpc_inputFileBig: _type = cons; { - if (!data) setData(new MTPDinputFileBig()); - MTPDinputFileBig &v(_inputFileBig()); - v.vid.read(from, end); - v.vparts.read(from, end); - v.vname.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vparts.read(from, end); + v->vname.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputFile"); } @@ -28374,30 +24897,38 @@ inline void MTPinputFile::read(const mtpPrime *&from, const mtpPrime *end, mtpTy inline void MTPinputFile::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputFile: { - const MTPDinputFile &v(c_inputFile()); + auto &v = c_inputFile(); v.vid.write(to); v.vparts.write(to); v.vname.write(to); v.vmd5_checksum.write(to); } break; case mtpc_inputFileBig: { - const MTPDinputFileBig &v(c_inputFileBig()); + auto &v = c_inputFileBig(); v.vid.write(to); v.vparts.write(to); v.vname.write(to); } break; } } -inline MTPinputFile::MTPinputFile(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputFile::MTPinputFile(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_inputFile: setData(new MTPDinputFile()); break; - case mtpc_inputFileBig: setData(new MTPDinputFileBig()); break; + case mtpc_inputFile: data = std::make_shared(); break; + case mtpc_inputFileBig: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputFile"); } } -inline MTPinputFile::MTPinputFile(MTPDinputFile *_data) : mtpDataOwner(_data), _type(mtpc_inputFile) { +inline const MTPDinputFile &MTPinputFile::c_inputFile() const { + t_assert(data != nullptr && _type == mtpc_inputFile); + return static_cast(*data); } -inline MTPinputFile::MTPinputFile(MTPDinputFileBig *_data) : mtpDataOwner(_data), _type(mtpc_inputFileBig) { +inline MTPinputFile::MTPinputFile(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputFile) { +} +inline const MTPDinputFileBig &MTPinputFile::c_inputFileBig() const { + t_assert(data != nullptr && _type == mtpc_inputFileBig); + return static_cast(*data); +} +inline MTPinputFile::MTPinputFile(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputFileBig) { } inline MTPinputFile MTP_inputFile(const MTPlong &_id, MTPint _parts, const MTPstring &_name, const MTPstring &_md5_checksum) { return MTP::internal::TypeCreator::new_inputFile(_id, _parts, _name, _md5_checksum); @@ -28464,93 +24995,93 @@ inline mtpTypeId MTPinputMedia::type() const { return _type; } inline void MTPinputMedia::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputMediaEmpty: _type = cons; break; case mtpc_inputMediaUploadedPhoto: _type = cons; { - if (!data) setData(new MTPDinputMediaUploadedPhoto()); - MTPDinputMediaUploadedPhoto &v(_inputMediaUploadedPhoto()); - v.vflags.read(from, end); - v.vfile.read(from, end); - v.vcaption.read(from, end); - if (v.has_stickers()) { v.vstickers.read(from, end); } else { v.vstickers = MTPVector(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vfile.read(from, end); + v->vcaption.read(from, end); + if (v->has_stickers()) { v->vstickers.read(from, end); } else { v->vstickers = MTPVector(); } + data = std::move(v); } break; case mtpc_inputMediaPhoto: _type = cons; { - if (!data) setData(new MTPDinputMediaPhoto()); - MTPDinputMediaPhoto &v(_inputMediaPhoto()); - v.vid.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_inputMediaGeoPoint: _type = cons; { - if (!data) setData(new MTPDinputMediaGeoPoint()); - MTPDinputMediaGeoPoint &v(_inputMediaGeoPoint()); - v.vgeo_point.read(from, end); + auto v = std::make_shared(); + v->vgeo_point.read(from, end); + data = std::move(v); } break; case mtpc_inputMediaContact: _type = cons; { - if (!data) setData(new MTPDinputMediaContact()); - MTPDinputMediaContact &v(_inputMediaContact()); - v.vphone_number.read(from, end); - v.vfirst_name.read(from, end); - v.vlast_name.read(from, end); + auto v = std::make_shared(); + v->vphone_number.read(from, end); + v->vfirst_name.read(from, end); + v->vlast_name.read(from, end); + data = std::move(v); } break; case mtpc_inputMediaUploadedDocument: _type = cons; { - if (!data) setData(new MTPDinputMediaUploadedDocument()); - MTPDinputMediaUploadedDocument &v(_inputMediaUploadedDocument()); - v.vflags.read(from, end); - v.vfile.read(from, end); - v.vmime_type.read(from, end); - v.vattributes.read(from, end); - v.vcaption.read(from, end); - if (v.has_stickers()) { v.vstickers.read(from, end); } else { v.vstickers = MTPVector(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vfile.read(from, end); + v->vmime_type.read(from, end); + v->vattributes.read(from, end); + v->vcaption.read(from, end); + if (v->has_stickers()) { v->vstickers.read(from, end); } else { v->vstickers = MTPVector(); } + data = std::move(v); } break; case mtpc_inputMediaUploadedThumbDocument: _type = cons; { - if (!data) setData(new MTPDinputMediaUploadedThumbDocument()); - MTPDinputMediaUploadedThumbDocument &v(_inputMediaUploadedThumbDocument()); - v.vflags.read(from, end); - v.vfile.read(from, end); - v.vthumb.read(from, end); - v.vmime_type.read(from, end); - v.vattributes.read(from, end); - v.vcaption.read(from, end); - if (v.has_stickers()) { v.vstickers.read(from, end); } else { v.vstickers = MTPVector(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vfile.read(from, end); + v->vthumb.read(from, end); + v->vmime_type.read(from, end); + v->vattributes.read(from, end); + v->vcaption.read(from, end); + if (v->has_stickers()) { v->vstickers.read(from, end); } else { v->vstickers = MTPVector(); } + data = std::move(v); } break; case mtpc_inputMediaDocument: _type = cons; { - if (!data) setData(new MTPDinputMediaDocument()); - MTPDinputMediaDocument &v(_inputMediaDocument()); - v.vid.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_inputMediaVenue: _type = cons; { - if (!data) setData(new MTPDinputMediaVenue()); - MTPDinputMediaVenue &v(_inputMediaVenue()); - v.vgeo_point.read(from, end); - v.vtitle.read(from, end); - v.vaddress.read(from, end); - v.vprovider.read(from, end); - v.vvenue_id.read(from, end); + auto v = std::make_shared(); + v->vgeo_point.read(from, end); + v->vtitle.read(from, end); + v->vaddress.read(from, end); + v->vprovider.read(from, end); + v->vvenue_id.read(from, end); + data = std::move(v); } break; case mtpc_inputMediaGifExternal: _type = cons; { - if (!data) setData(new MTPDinputMediaGifExternal()); - MTPDinputMediaGifExternal &v(_inputMediaGifExternal()); - v.vurl.read(from, end); - v.vq.read(from, end); + auto v = std::make_shared(); + v->vurl.read(from, end); + v->vq.read(from, end); + data = std::move(v); } break; case mtpc_inputMediaPhotoExternal: _type = cons; { - if (!data) setData(new MTPDinputMediaPhotoExternal()); - MTPDinputMediaPhotoExternal &v(_inputMediaPhotoExternal()); - v.vurl.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vurl.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_inputMediaDocumentExternal: _type = cons; { - if (!data) setData(new MTPDinputMediaDocumentExternal()); - MTPDinputMediaDocumentExternal &v(_inputMediaDocumentExternal()); - v.vurl.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vurl.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_inputMediaGame: _type = cons; { - if (!data) setData(new MTPDinputMediaGame()); - MTPDinputMediaGame &v(_inputMediaGame()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputMedia"); } @@ -28558,29 +25089,29 @@ inline void MTPinputMedia::read(const mtpPrime *&from, const mtpPrime *end, mtpT inline void MTPinputMedia::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputMediaUploadedPhoto: { - const MTPDinputMediaUploadedPhoto &v(c_inputMediaUploadedPhoto()); + auto &v = c_inputMediaUploadedPhoto(); v.vflags.write(to); v.vfile.write(to); v.vcaption.write(to); if (v.has_stickers()) v.vstickers.write(to); } break; case mtpc_inputMediaPhoto: { - const MTPDinputMediaPhoto &v(c_inputMediaPhoto()); + auto &v = c_inputMediaPhoto(); v.vid.write(to); v.vcaption.write(to); } break; case mtpc_inputMediaGeoPoint: { - const MTPDinputMediaGeoPoint &v(c_inputMediaGeoPoint()); + auto &v = c_inputMediaGeoPoint(); v.vgeo_point.write(to); } break; case mtpc_inputMediaContact: { - const MTPDinputMediaContact &v(c_inputMediaContact()); + auto &v = c_inputMediaContact(); v.vphone_number.write(to); v.vfirst_name.write(to); v.vlast_name.write(to); } break; case mtpc_inputMediaUploadedDocument: { - const MTPDinputMediaUploadedDocument &v(c_inputMediaUploadedDocument()); + auto &v = c_inputMediaUploadedDocument(); v.vflags.write(to); v.vfile.write(to); v.vmime_type.write(to); @@ -28589,7 +25120,7 @@ inline void MTPinputMedia::write(mtpBuffer &to) const { if (v.has_stickers()) v.vstickers.write(to); } break; case mtpc_inputMediaUploadedThumbDocument: { - const MTPDinputMediaUploadedThumbDocument &v(c_inputMediaUploadedThumbDocument()); + auto &v = c_inputMediaUploadedThumbDocument(); v.vflags.write(to); v.vfile.write(to); v.vthumb.write(to); @@ -28599,12 +25130,12 @@ inline void MTPinputMedia::write(mtpBuffer &to) const { if (v.has_stickers()) v.vstickers.write(to); } break; case mtpc_inputMediaDocument: { - const MTPDinputMediaDocument &v(c_inputMediaDocument()); + auto &v = c_inputMediaDocument(); v.vid.write(to); v.vcaption.write(to); } break; case mtpc_inputMediaVenue: { - const MTPDinputMediaVenue &v(c_inputMediaVenue()); + auto &v = c_inputMediaVenue(); v.vgeo_point.write(to); v.vtitle.write(to); v.vaddress.write(to); @@ -28612,67 +25143,115 @@ inline void MTPinputMedia::write(mtpBuffer &to) const { v.vvenue_id.write(to); } break; case mtpc_inputMediaGifExternal: { - const MTPDinputMediaGifExternal &v(c_inputMediaGifExternal()); + auto &v = c_inputMediaGifExternal(); v.vurl.write(to); v.vq.write(to); } break; case mtpc_inputMediaPhotoExternal: { - const MTPDinputMediaPhotoExternal &v(c_inputMediaPhotoExternal()); + auto &v = c_inputMediaPhotoExternal(); v.vurl.write(to); v.vcaption.write(to); } break; case mtpc_inputMediaDocumentExternal: { - const MTPDinputMediaDocumentExternal &v(c_inputMediaDocumentExternal()); + auto &v = c_inputMediaDocumentExternal(); v.vurl.write(to); v.vcaption.write(to); } break; case mtpc_inputMediaGame: { - const MTPDinputMediaGame &v(c_inputMediaGame()); + auto &v = c_inputMediaGame(); v.vid.write(to); } break; } } -inline MTPinputMedia::MTPinputMedia(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputMedia::MTPinputMedia(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputMediaEmpty: break; - case mtpc_inputMediaUploadedPhoto: setData(new MTPDinputMediaUploadedPhoto()); break; - case mtpc_inputMediaPhoto: setData(new MTPDinputMediaPhoto()); break; - case mtpc_inputMediaGeoPoint: setData(new MTPDinputMediaGeoPoint()); break; - case mtpc_inputMediaContact: setData(new MTPDinputMediaContact()); break; - case mtpc_inputMediaUploadedDocument: setData(new MTPDinputMediaUploadedDocument()); break; - case mtpc_inputMediaUploadedThumbDocument: setData(new MTPDinputMediaUploadedThumbDocument()); break; - case mtpc_inputMediaDocument: setData(new MTPDinputMediaDocument()); break; - case mtpc_inputMediaVenue: setData(new MTPDinputMediaVenue()); break; - case mtpc_inputMediaGifExternal: setData(new MTPDinputMediaGifExternal()); break; - case mtpc_inputMediaPhotoExternal: setData(new MTPDinputMediaPhotoExternal()); break; - case mtpc_inputMediaDocumentExternal: setData(new MTPDinputMediaDocumentExternal()); break; - case mtpc_inputMediaGame: setData(new MTPDinputMediaGame()); break; + case mtpc_inputMediaUploadedPhoto: data = std::make_shared(); break; + case mtpc_inputMediaPhoto: data = std::make_shared(); break; + case mtpc_inputMediaGeoPoint: data = std::make_shared(); break; + case mtpc_inputMediaContact: data = std::make_shared(); break; + case mtpc_inputMediaUploadedDocument: data = std::make_shared(); break; + case mtpc_inputMediaUploadedThumbDocument: data = std::make_shared(); break; + case mtpc_inputMediaDocument: data = std::make_shared(); break; + case mtpc_inputMediaVenue: data = std::make_shared(); break; + case mtpc_inputMediaGifExternal: data = std::make_shared(); break; + case mtpc_inputMediaPhotoExternal: data = std::make_shared(); break; + case mtpc_inputMediaDocumentExternal: data = std::make_shared(); break; + case mtpc_inputMediaGame: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputMedia"); } } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaUploadedPhoto *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaUploadedPhoto) { +inline const MTPDinputMediaUploadedPhoto &MTPinputMedia::c_inputMediaUploadedPhoto() const { + t_assert(data != nullptr && _type == mtpc_inputMediaUploadedPhoto); + return static_cast(*data); } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaPhoto *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaPhoto) { +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaUploadedPhoto) { } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaGeoPoint *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaGeoPoint) { +inline const MTPDinputMediaPhoto &MTPinputMedia::c_inputMediaPhoto() const { + t_assert(data != nullptr && _type == mtpc_inputMediaPhoto); + return static_cast(*data); } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaContact *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaContact) { +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaPhoto) { } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaUploadedDocument *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaUploadedDocument) { +inline const MTPDinputMediaGeoPoint &MTPinputMedia::c_inputMediaGeoPoint() const { + t_assert(data != nullptr && _type == mtpc_inputMediaGeoPoint); + return static_cast(*data); } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaUploadedThumbDocument *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaUploadedThumbDocument) { +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaGeoPoint) { } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaDocument *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaDocument) { +inline const MTPDinputMediaContact &MTPinputMedia::c_inputMediaContact() const { + t_assert(data != nullptr && _type == mtpc_inputMediaContact); + return static_cast(*data); } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaVenue *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaVenue) { +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaContact) { } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaGifExternal *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaGifExternal) { +inline const MTPDinputMediaUploadedDocument &MTPinputMedia::c_inputMediaUploadedDocument() const { + t_assert(data != nullptr && _type == mtpc_inputMediaUploadedDocument); + return static_cast(*data); } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaPhotoExternal *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaPhotoExternal) { +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaUploadedDocument) { } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaDocumentExternal *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaDocumentExternal) { +inline const MTPDinputMediaUploadedThumbDocument &MTPinputMedia::c_inputMediaUploadedThumbDocument() const { + t_assert(data != nullptr && _type == mtpc_inputMediaUploadedThumbDocument); + return static_cast(*data); } -inline MTPinputMedia::MTPinputMedia(MTPDinputMediaGame *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaGame) { +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaUploadedThumbDocument) { +} +inline const MTPDinputMediaDocument &MTPinputMedia::c_inputMediaDocument() const { + t_assert(data != nullptr && _type == mtpc_inputMediaDocument); + return static_cast(*data); +} +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaDocument) { +} +inline const MTPDinputMediaVenue &MTPinputMedia::c_inputMediaVenue() const { + t_assert(data != nullptr && _type == mtpc_inputMediaVenue); + return static_cast(*data); +} +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaVenue) { +} +inline const MTPDinputMediaGifExternal &MTPinputMedia::c_inputMediaGifExternal() const { + t_assert(data != nullptr && _type == mtpc_inputMediaGifExternal); + return static_cast(*data); +} +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaGifExternal) { +} +inline const MTPDinputMediaPhotoExternal &MTPinputMedia::c_inputMediaPhotoExternal() const { + t_assert(data != nullptr && _type == mtpc_inputMediaPhotoExternal); + return static_cast(*data); +} +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaPhotoExternal) { +} +inline const MTPDinputMediaDocumentExternal &MTPinputMedia::c_inputMediaDocumentExternal() const { + t_assert(data != nullptr && _type == mtpc_inputMediaDocumentExternal); + return static_cast(*data); +} +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaDocumentExternal) { +} +inline const MTPDinputMediaGame &MTPinputMedia::c_inputMediaGame() const { + t_assert(data != nullptr && _type == mtpc_inputMediaGame); + return static_cast(*data); +} +inline MTPinputMedia::MTPinputMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMediaGame) { } inline MTPinputMedia MTP_inputMediaEmpty() { return MTP::internal::TypeCreator::new_inputMediaEmpty(); @@ -28735,18 +25314,18 @@ inline mtpTypeId MTPinputChatPhoto::type() const { return _type; } inline void MTPinputChatPhoto::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputChatPhotoEmpty: _type = cons; break; case mtpc_inputChatUploadedPhoto: _type = cons; { - if (!data) setData(new MTPDinputChatUploadedPhoto()); - MTPDinputChatUploadedPhoto &v(_inputChatUploadedPhoto()); - v.vfile.read(from, end); + auto v = std::make_shared(); + v->vfile.read(from, end); + data = std::move(v); } break; case mtpc_inputChatPhoto: _type = cons; { - if (!data) setData(new MTPDinputChatPhoto()); - MTPDinputChatPhoto &v(_inputChatPhoto()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputChatPhoto"); } @@ -28754,26 +25333,34 @@ inline void MTPinputChatPhoto::read(const mtpPrime *&from, const mtpPrime *end, inline void MTPinputChatPhoto::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputChatUploadedPhoto: { - const MTPDinputChatUploadedPhoto &v(c_inputChatUploadedPhoto()); + auto &v = c_inputChatUploadedPhoto(); v.vfile.write(to); } break; case mtpc_inputChatPhoto: { - const MTPDinputChatPhoto &v(c_inputChatPhoto()); + auto &v = c_inputChatPhoto(); v.vid.write(to); } break; } } -inline MTPinputChatPhoto::MTPinputChatPhoto(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputChatPhoto::MTPinputChatPhoto(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputChatPhotoEmpty: break; - case mtpc_inputChatUploadedPhoto: setData(new MTPDinputChatUploadedPhoto()); break; - case mtpc_inputChatPhoto: setData(new MTPDinputChatPhoto()); break; + case mtpc_inputChatUploadedPhoto: data = std::make_shared(); break; + case mtpc_inputChatPhoto: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputChatPhoto"); } } -inline MTPinputChatPhoto::MTPinputChatPhoto(MTPDinputChatUploadedPhoto *_data) : mtpDataOwner(_data), _type(mtpc_inputChatUploadedPhoto) { +inline const MTPDinputChatUploadedPhoto &MTPinputChatPhoto::c_inputChatUploadedPhoto() const { + t_assert(data != nullptr && _type == mtpc_inputChatUploadedPhoto); + return static_cast(*data); } -inline MTPinputChatPhoto::MTPinputChatPhoto(MTPDinputChatPhoto *_data) : mtpDataOwner(_data), _type(mtpc_inputChatPhoto) { +inline MTPinputChatPhoto::MTPinputChatPhoto(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputChatUploadedPhoto) { +} +inline const MTPDinputChatPhoto &MTPinputChatPhoto::c_inputChatPhoto() const { + t_assert(data != nullptr && _type == mtpc_inputChatPhoto); + return static_cast(*data); +} +inline MTPinputChatPhoto::MTPinputChatPhoto(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputChatPhoto) { } inline MTPinputChatPhoto MTP_inputChatPhotoEmpty() { return MTP::internal::TypeCreator::new_inputChatPhotoEmpty(); @@ -28799,14 +25386,14 @@ inline mtpTypeId MTPinputGeoPoint::type() const { return _type; } inline void MTPinputGeoPoint::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputGeoPointEmpty: _type = cons; break; case mtpc_inputGeoPoint: _type = cons; { - if (!data) setData(new MTPDinputGeoPoint()); - MTPDinputGeoPoint &v(_inputGeoPoint()); - v.vlat.read(from, end); - v.vlong.read(from, end); + auto v = std::make_shared(); + v->vlat.read(from, end); + v->vlong.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputGeoPoint"); } @@ -28814,20 +25401,24 @@ inline void MTPinputGeoPoint::read(const mtpPrime *&from, const mtpPrime *end, m inline void MTPinputGeoPoint::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputGeoPoint: { - const MTPDinputGeoPoint &v(c_inputGeoPoint()); + auto &v = c_inputGeoPoint(); v.vlat.write(to); v.vlong.write(to); } break; } } -inline MTPinputGeoPoint::MTPinputGeoPoint(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputGeoPoint::MTPinputGeoPoint(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputGeoPointEmpty: break; - case mtpc_inputGeoPoint: setData(new MTPDinputGeoPoint()); break; + case mtpc_inputGeoPoint: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputGeoPoint"); } } -inline MTPinputGeoPoint::MTPinputGeoPoint(MTPDinputGeoPoint *_data) : mtpDataOwner(_data), _type(mtpc_inputGeoPoint) { +inline const MTPDinputGeoPoint &MTPinputGeoPoint::c_inputGeoPoint() const { + t_assert(data != nullptr && _type == mtpc_inputGeoPoint); + return static_cast(*data); +} +inline MTPinputGeoPoint::MTPinputGeoPoint(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputGeoPoint) { } inline MTPinputGeoPoint MTP_inputGeoPointEmpty() { return MTP::internal::TypeCreator::new_inputGeoPointEmpty(); @@ -28850,14 +25441,14 @@ inline mtpTypeId MTPinputPhoto::type() const { return _type; } inline void MTPinputPhoto::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputPhotoEmpty: _type = cons; break; case mtpc_inputPhoto: _type = cons; { - if (!data) setData(new MTPDinputPhoto()); - MTPDinputPhoto &v(_inputPhoto()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputPhoto"); } @@ -28865,20 +25456,24 @@ inline void MTPinputPhoto::read(const mtpPrime *&from, const mtpPrime *end, mtpT inline void MTPinputPhoto::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputPhoto: { - const MTPDinputPhoto &v(c_inputPhoto()); + auto &v = c_inputPhoto(); v.vid.write(to); v.vaccess_hash.write(to); } break; } } -inline MTPinputPhoto::MTPinputPhoto(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputPhoto::MTPinputPhoto(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputPhotoEmpty: break; - case mtpc_inputPhoto: setData(new MTPDinputPhoto()); break; + case mtpc_inputPhoto: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputPhoto"); } } -inline MTPinputPhoto::MTPinputPhoto(MTPDinputPhoto *_data) : mtpDataOwner(_data), _type(mtpc_inputPhoto) { +inline const MTPDinputPhoto &MTPinputPhoto::c_inputPhoto() const { + t_assert(data != nullptr && _type == mtpc_inputPhoto); + return static_cast(*data); +} +inline MTPinputPhoto::MTPinputPhoto(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputPhoto) { } inline MTPinputPhoto MTP_inputPhotoEmpty() { return MTP::internal::TypeCreator::new_inputPhotoEmpty(); @@ -28909,27 +25504,27 @@ inline mtpTypeId MTPinputFileLocation::type() const { return _type; } inline void MTPinputFileLocation::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputFileLocation: _type = cons; { - if (!data) setData(new MTPDinputFileLocation()); - MTPDinputFileLocation &v(_inputFileLocation()); - v.vvolume_id.read(from, end); - v.vlocal_id.read(from, end); - v.vsecret.read(from, end); + auto v = std::make_shared(); + v->vvolume_id.read(from, end); + v->vlocal_id.read(from, end); + v->vsecret.read(from, end); + data = std::move(v); } break; case mtpc_inputEncryptedFileLocation: _type = cons; { - if (!data) setData(new MTPDinputEncryptedFileLocation()); - MTPDinputEncryptedFileLocation &v(_inputEncryptedFileLocation()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } break; case mtpc_inputDocumentFileLocation: _type = cons; { - if (!data) setData(new MTPDinputDocumentFileLocation()); - MTPDinputDocumentFileLocation &v(_inputDocumentFileLocation()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vversion.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vversion.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputFileLocation"); } @@ -28937,37 +25532,49 @@ inline void MTPinputFileLocation::read(const mtpPrime *&from, const mtpPrime *en inline void MTPinputFileLocation::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputFileLocation: { - const MTPDinputFileLocation &v(c_inputFileLocation()); + auto &v = c_inputFileLocation(); v.vvolume_id.write(to); v.vlocal_id.write(to); v.vsecret.write(to); } break; case mtpc_inputEncryptedFileLocation: { - const MTPDinputEncryptedFileLocation &v(c_inputEncryptedFileLocation()); + auto &v = c_inputEncryptedFileLocation(); v.vid.write(to); v.vaccess_hash.write(to); } break; case mtpc_inputDocumentFileLocation: { - const MTPDinputDocumentFileLocation &v(c_inputDocumentFileLocation()); + auto &v = c_inputDocumentFileLocation(); v.vid.write(to); v.vaccess_hash.write(to); v.vversion.write(to); } break; } } -inline MTPinputFileLocation::MTPinputFileLocation(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputFileLocation::MTPinputFileLocation(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_inputFileLocation: setData(new MTPDinputFileLocation()); break; - case mtpc_inputEncryptedFileLocation: setData(new MTPDinputEncryptedFileLocation()); break; - case mtpc_inputDocumentFileLocation: setData(new MTPDinputDocumentFileLocation()); break; + case mtpc_inputFileLocation: data = std::make_shared(); break; + case mtpc_inputEncryptedFileLocation: data = std::make_shared(); break; + case mtpc_inputDocumentFileLocation: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputFileLocation"); } } -inline MTPinputFileLocation::MTPinputFileLocation(MTPDinputFileLocation *_data) : mtpDataOwner(_data), _type(mtpc_inputFileLocation) { +inline const MTPDinputFileLocation &MTPinputFileLocation::c_inputFileLocation() const { + t_assert(data != nullptr && _type == mtpc_inputFileLocation); + return static_cast(*data); } -inline MTPinputFileLocation::MTPinputFileLocation(MTPDinputEncryptedFileLocation *_data) : mtpDataOwner(_data), _type(mtpc_inputEncryptedFileLocation) { +inline MTPinputFileLocation::MTPinputFileLocation(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputFileLocation) { } -inline MTPinputFileLocation::MTPinputFileLocation(MTPDinputDocumentFileLocation *_data) : mtpDataOwner(_data), _type(mtpc_inputDocumentFileLocation) { +inline const MTPDinputEncryptedFileLocation &MTPinputFileLocation::c_inputEncryptedFileLocation() const { + t_assert(data != nullptr && _type == mtpc_inputEncryptedFileLocation); + return static_cast(*data); +} +inline MTPinputFileLocation::MTPinputFileLocation(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputEncryptedFileLocation) { +} +inline const MTPDinputDocumentFileLocation &MTPinputFileLocation::c_inputDocumentFileLocation() const { + t_assert(data != nullptr && _type == mtpc_inputDocumentFileLocation); + return static_cast(*data); +} +inline MTPinputFileLocation::MTPinputFileLocation(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputDocumentFileLocation) { } inline MTPinputFileLocation MTP_inputFileLocation(const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret) { return MTP::internal::TypeCreator::new_inputFileLocation(_volume_id, _local_id, _secret); @@ -28979,7 +25586,7 @@ inline MTPinputFileLocation MTP_inputDocumentFileLocation(const MTPlong &_id, co return MTP::internal::TypeCreator::new_inputDocumentFileLocation(_id, _access_hash, _version); } -inline MTPinputAppEvent::MTPinputAppEvent() : mtpDataOwner(new MTPDinputAppEvent()) { +inline MTPinputAppEvent::MTPinputAppEvent() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPinputAppEvent::innerLength() const { @@ -28992,21 +25599,25 @@ inline mtpTypeId MTPinputAppEvent::type() const { inline void MTPinputAppEvent::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_inputAppEvent) throw mtpErrorUnexpected(cons, "MTPinputAppEvent"); - if (!data) setData(new MTPDinputAppEvent()); - MTPDinputAppEvent &v(_inputAppEvent()); - v.vtime.read(from, end); - v.vtype.read(from, end); - v.vpeer.read(from, end); - v.vdata.read(from, end); + auto v = std::make_shared(); + v->vtime.read(from, end); + v->vtype.read(from, end); + v->vpeer.read(from, end); + v->vdata.read(from, end); + data = std::move(v); } inline void MTPinputAppEvent::write(mtpBuffer &to) const { - const MTPDinputAppEvent &v(c_inputAppEvent()); + auto &v = c_inputAppEvent(); v.vtime.write(to); v.vtype.write(to); v.vpeer.write(to); v.vdata.write(to); } -inline MTPinputAppEvent::MTPinputAppEvent(MTPDinputAppEvent *_data) : mtpDataOwner(_data) { +inline const MTPDinputAppEvent &MTPinputAppEvent::c_inputAppEvent() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPinputAppEvent::MTPinputAppEvent(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPinputAppEvent MTP_inputAppEvent(const MTPdouble &_time, const MTPstring &_type, const MTPlong &_peer, const MTPstring &_data) { return MTP::internal::TypeCreator::new_inputAppEvent(_time, _type, _peer, _data); @@ -29034,22 +25645,22 @@ inline mtpTypeId MTPpeer::type() const { return _type; } inline void MTPpeer::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_peerUser: _type = cons; { - if (!data) setData(new MTPDpeerUser()); - MTPDpeerUser &v(_peerUser()); - v.vuser_id.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + data = std::move(v); } break; case mtpc_peerChat: _type = cons; { - if (!data) setData(new MTPDpeerChat()); - MTPDpeerChat &v(_peerChat()); - v.vchat_id.read(from, end); + auto v = std::make_shared(); + v->vchat_id.read(from, end); + data = std::move(v); } break; case mtpc_peerChannel: _type = cons; { - if (!data) setData(new MTPDpeerChannel()); - MTPDpeerChannel &v(_peerChannel()); - v.vchannel_id.read(from, end); + auto v = std::make_shared(); + v->vchannel_id.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPpeer"); } @@ -29057,32 +25668,44 @@ inline void MTPpeer::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId inline void MTPpeer::write(mtpBuffer &to) const { switch (_type) { case mtpc_peerUser: { - const MTPDpeerUser &v(c_peerUser()); + auto &v = c_peerUser(); v.vuser_id.write(to); } break; case mtpc_peerChat: { - const MTPDpeerChat &v(c_peerChat()); + auto &v = c_peerChat(); v.vchat_id.write(to); } break; case mtpc_peerChannel: { - const MTPDpeerChannel &v(c_peerChannel()); + auto &v = c_peerChannel(); v.vchannel_id.write(to); } break; } } -inline MTPpeer::MTPpeer(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPpeer::MTPpeer(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_peerUser: setData(new MTPDpeerUser()); break; - case mtpc_peerChat: setData(new MTPDpeerChat()); break; - case mtpc_peerChannel: setData(new MTPDpeerChannel()); break; + case mtpc_peerUser: data = std::make_shared(); break; + case mtpc_peerChat: data = std::make_shared(); break; + case mtpc_peerChannel: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPpeer"); } } -inline MTPpeer::MTPpeer(MTPDpeerUser *_data) : mtpDataOwner(_data), _type(mtpc_peerUser) { +inline const MTPDpeerUser &MTPpeer::c_peerUser() const { + t_assert(data != nullptr && _type == mtpc_peerUser); + return static_cast(*data); } -inline MTPpeer::MTPpeer(MTPDpeerChat *_data) : mtpDataOwner(_data), _type(mtpc_peerChat) { +inline MTPpeer::MTPpeer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_peerUser) { } -inline MTPpeer::MTPpeer(MTPDpeerChannel *_data) : mtpDataOwner(_data), _type(mtpc_peerChannel) { +inline const MTPDpeerChat &MTPpeer::c_peerChat() const { + t_assert(data != nullptr && _type == mtpc_peerChat); + return static_cast(*data); +} +inline MTPpeer::MTPpeer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_peerChat) { +} +inline const MTPDpeerChannel &MTPpeer::c_peerChannel() const { + t_assert(data != nullptr && _type == mtpc_peerChannel); + return static_cast(*data); +} +inline MTPpeer::MTPpeer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_peerChannel) { } inline MTPpeer MTP_peerUser(MTPint _user_id) { return MTP::internal::TypeCreator::new_peerUser(_user_id); @@ -29182,22 +25805,22 @@ inline mtpTypeId MTPfileLocation::type() const { return _type; } inline void MTPfileLocation::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_fileLocationUnavailable: _type = cons; { - if (!data) setData(new MTPDfileLocationUnavailable()); - MTPDfileLocationUnavailable &v(_fileLocationUnavailable()); - v.vvolume_id.read(from, end); - v.vlocal_id.read(from, end); - v.vsecret.read(from, end); + auto v = std::make_shared(); + v->vvolume_id.read(from, end); + v->vlocal_id.read(from, end); + v->vsecret.read(from, end); + data = std::move(v); } break; case mtpc_fileLocation: _type = cons; { - if (!data) setData(new MTPDfileLocation()); - MTPDfileLocation &v(_fileLocation()); - v.vdc_id.read(from, end); - v.vvolume_id.read(from, end); - v.vlocal_id.read(from, end); - v.vsecret.read(from, end); + auto v = std::make_shared(); + v->vdc_id.read(from, end); + v->vvolume_id.read(from, end); + v->vlocal_id.read(from, end); + v->vsecret.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPfileLocation"); } @@ -29205,13 +25828,13 @@ inline void MTPfileLocation::read(const mtpPrime *&from, const mtpPrime *end, mt inline void MTPfileLocation::write(mtpBuffer &to) const { switch (_type) { case mtpc_fileLocationUnavailable: { - const MTPDfileLocationUnavailable &v(c_fileLocationUnavailable()); + auto &v = c_fileLocationUnavailable(); v.vvolume_id.write(to); v.vlocal_id.write(to); v.vsecret.write(to); } break; case mtpc_fileLocation: { - const MTPDfileLocation &v(c_fileLocation()); + auto &v = c_fileLocation(); v.vdc_id.write(to); v.vvolume_id.write(to); v.vlocal_id.write(to); @@ -29219,16 +25842,24 @@ inline void MTPfileLocation::write(mtpBuffer &to) const { } break; } } -inline MTPfileLocation::MTPfileLocation(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPfileLocation::MTPfileLocation(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_fileLocationUnavailable: setData(new MTPDfileLocationUnavailable()); break; - case mtpc_fileLocation: setData(new MTPDfileLocation()); break; + case mtpc_fileLocationUnavailable: data = std::make_shared(); break; + case mtpc_fileLocation: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPfileLocation"); } } -inline MTPfileLocation::MTPfileLocation(MTPDfileLocationUnavailable *_data) : mtpDataOwner(_data), _type(mtpc_fileLocationUnavailable) { +inline const MTPDfileLocationUnavailable &MTPfileLocation::c_fileLocationUnavailable() const { + t_assert(data != nullptr && _type == mtpc_fileLocationUnavailable); + return static_cast(*data); } -inline MTPfileLocation::MTPfileLocation(MTPDfileLocation *_data) : mtpDataOwner(_data), _type(mtpc_fileLocation) { +inline MTPfileLocation::MTPfileLocation(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_fileLocationUnavailable) { +} +inline const MTPDfileLocation &MTPfileLocation::c_fileLocation() const { + t_assert(data != nullptr && _type == mtpc_fileLocation); + return static_cast(*data); +} +inline MTPfileLocation::MTPfileLocation(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_fileLocation) { } inline MTPfileLocation MTP_fileLocationUnavailable(const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret) { return MTP::internal::TypeCreator::new_fileLocationUnavailable(_volume_id, _local_id, _secret); @@ -29255,28 +25886,28 @@ inline mtpTypeId MTPuser::type() const { return _type; } inline void MTPuser::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_userEmpty: _type = cons; { - if (!data) setData(new MTPDuserEmpty()); - MTPDuserEmpty &v(_userEmpty()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; case mtpc_user: _type = cons; { - if (!data) setData(new MTPDuser()); - MTPDuser &v(_user()); - v.vflags.read(from, end); - v.vid.read(from, end); - if (v.has_access_hash()) { v.vaccess_hash.read(from, end); } else { v.vaccess_hash = MTPlong(); } - if (v.has_first_name()) { v.vfirst_name.read(from, end); } else { v.vfirst_name = MTPstring(); } - if (v.has_last_name()) { v.vlast_name.read(from, end); } else { v.vlast_name = MTPstring(); } - if (v.has_username()) { v.vusername.read(from, end); } else { v.vusername = MTPstring(); } - if (v.has_phone()) { v.vphone.read(from, end); } else { v.vphone = MTPstring(); } - if (v.has_photo()) { v.vphoto.read(from, end); } else { v.vphoto = MTPUserProfilePhoto(); } - if (v.has_status()) { v.vstatus.read(from, end); } else { v.vstatus = MTPUserStatus(); } - if (v.has_bot_info_version()) { v.vbot_info_version.read(from, end); } else { v.vbot_info_version = MTPint(); } - if (v.has_restriction_reason()) { v.vrestriction_reason.read(from, end); } else { v.vrestriction_reason = MTPstring(); } - if (v.has_bot_inline_placeholder()) { v.vbot_inline_placeholder.read(from, end); } else { v.vbot_inline_placeholder = MTPstring(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + if (v->has_access_hash()) { v->vaccess_hash.read(from, end); } else { v->vaccess_hash = MTPlong(); } + if (v->has_first_name()) { v->vfirst_name.read(from, end); } else { v->vfirst_name = MTPstring(); } + if (v->has_last_name()) { v->vlast_name.read(from, end); } else { v->vlast_name = MTPstring(); } + if (v->has_username()) { v->vusername.read(from, end); } else { v->vusername = MTPstring(); } + if (v->has_phone()) { v->vphone.read(from, end); } else { v->vphone = MTPstring(); } + if (v->has_photo()) { v->vphoto.read(from, end); } else { v->vphoto = MTPUserProfilePhoto(); } + if (v->has_status()) { v->vstatus.read(from, end); } else { v->vstatus = MTPUserStatus(); } + if (v->has_bot_info_version()) { v->vbot_info_version.read(from, end); } else { v->vbot_info_version = MTPint(); } + if (v->has_restriction_reason()) { v->vrestriction_reason.read(from, end); } else { v->vrestriction_reason = MTPstring(); } + if (v->has_bot_inline_placeholder()) { v->vbot_inline_placeholder.read(from, end); } else { v->vbot_inline_placeholder = MTPstring(); } + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPuser"); } @@ -29284,11 +25915,11 @@ inline void MTPuser::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId inline void MTPuser::write(mtpBuffer &to) const { switch (_type) { case mtpc_userEmpty: { - const MTPDuserEmpty &v(c_userEmpty()); + auto &v = c_userEmpty(); v.vid.write(to); } break; case mtpc_user: { - const MTPDuser &v(c_user()); + auto &v = c_user(); v.vflags.write(to); v.vid.write(to); if (v.has_access_hash()) v.vaccess_hash.write(to); @@ -29304,16 +25935,24 @@ inline void MTPuser::write(mtpBuffer &to) const { } break; } } -inline MTPuser::MTPuser(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPuser::MTPuser(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_userEmpty: setData(new MTPDuserEmpty()); break; - case mtpc_user: setData(new MTPDuser()); break; + case mtpc_userEmpty: data = std::make_shared(); break; + case mtpc_user: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPuser"); } } -inline MTPuser::MTPuser(MTPDuserEmpty *_data) : mtpDataOwner(_data), _type(mtpc_userEmpty) { +inline const MTPDuserEmpty &MTPuser::c_userEmpty() const { + t_assert(data != nullptr && _type == mtpc_userEmpty); + return static_cast(*data); } -inline MTPuser::MTPuser(MTPDuser *_data) : mtpDataOwner(_data), _type(mtpc_user) { +inline MTPuser::MTPuser(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_userEmpty) { +} +inline const MTPDuser &MTPuser::c_user() const { + t_assert(data != nullptr && _type == mtpc_user); + return static_cast(*data); +} +inline MTPuser::MTPuser(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_user) { } inline MTPuser MTP_userEmpty(MTPint _id) { return MTP::internal::TypeCreator::new_userEmpty(_id); @@ -29337,15 +25976,15 @@ inline mtpTypeId MTPuserProfilePhoto::type() const { return _type; } inline void MTPuserProfilePhoto::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_userProfilePhotoEmpty: _type = cons; break; case mtpc_userProfilePhoto: _type = cons; { - if (!data) setData(new MTPDuserProfilePhoto()); - MTPDuserProfilePhoto &v(_userProfilePhoto()); - v.vphoto_id.read(from, end); - v.vphoto_small.read(from, end); - v.vphoto_big.read(from, end); + auto v = std::make_shared(); + v->vphoto_id.read(from, end); + v->vphoto_small.read(from, end); + v->vphoto_big.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPuserProfilePhoto"); } @@ -29353,21 +25992,25 @@ inline void MTPuserProfilePhoto::read(const mtpPrime *&from, const mtpPrime *end inline void MTPuserProfilePhoto::write(mtpBuffer &to) const { switch (_type) { case mtpc_userProfilePhoto: { - const MTPDuserProfilePhoto &v(c_userProfilePhoto()); + auto &v = c_userProfilePhoto(); v.vphoto_id.write(to); v.vphoto_small.write(to); v.vphoto_big.write(to); } break; } } -inline MTPuserProfilePhoto::MTPuserProfilePhoto(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPuserProfilePhoto::MTPuserProfilePhoto(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_userProfilePhotoEmpty: break; - case mtpc_userProfilePhoto: setData(new MTPDuserProfilePhoto()); break; + case mtpc_userProfilePhoto: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPuserProfilePhoto"); } } -inline MTPuserProfilePhoto::MTPuserProfilePhoto(MTPDuserProfilePhoto *_data) : mtpDataOwner(_data), _type(mtpc_userProfilePhoto) { +inline const MTPDuserProfilePhoto &MTPuserProfilePhoto::c_userProfilePhoto() const { + t_assert(data != nullptr && _type == mtpc_userProfilePhoto); + return static_cast(*data); +} +inline MTPuserProfilePhoto::MTPuserProfilePhoto(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_userProfilePhoto) { } inline MTPuserProfilePhoto MTP_userProfilePhotoEmpty() { return MTP::internal::TypeCreator::new_userProfilePhotoEmpty(); @@ -29394,18 +26037,18 @@ inline mtpTypeId MTPuserStatus::type() const { return _type; } inline void MTPuserStatus::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_userStatusEmpty: _type = cons; break; case mtpc_userStatusOnline: _type = cons; { - if (!data) setData(new MTPDuserStatusOnline()); - MTPDuserStatusOnline &v(_userStatusOnline()); - v.vexpires.read(from, end); + auto v = std::make_shared(); + v->vexpires.read(from, end); + data = std::move(v); } break; case mtpc_userStatusOffline: _type = cons; { - if (!data) setData(new MTPDuserStatusOffline()); - MTPDuserStatusOffline &v(_userStatusOffline()); - v.vwas_online.read(from, end); + auto v = std::make_shared(); + v->vwas_online.read(from, end); + data = std::move(v); } break; case mtpc_userStatusRecently: _type = cons; break; case mtpc_userStatusLastWeek: _type = cons; break; @@ -29416,29 +26059,37 @@ inline void MTPuserStatus::read(const mtpPrime *&from, const mtpPrime *end, mtpT inline void MTPuserStatus::write(mtpBuffer &to) const { switch (_type) { case mtpc_userStatusOnline: { - const MTPDuserStatusOnline &v(c_userStatusOnline()); + auto &v = c_userStatusOnline(); v.vexpires.write(to); } break; case mtpc_userStatusOffline: { - const MTPDuserStatusOffline &v(c_userStatusOffline()); + auto &v = c_userStatusOffline(); v.vwas_online.write(to); } break; } } -inline MTPuserStatus::MTPuserStatus(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPuserStatus::MTPuserStatus(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_userStatusEmpty: break; - case mtpc_userStatusOnline: setData(new MTPDuserStatusOnline()); break; - case mtpc_userStatusOffline: setData(new MTPDuserStatusOffline()); break; + case mtpc_userStatusOnline: data = std::make_shared(); break; + case mtpc_userStatusOffline: data = std::make_shared(); break; case mtpc_userStatusRecently: break; case mtpc_userStatusLastWeek: break; case mtpc_userStatusLastMonth: break; default: throw mtpErrorBadTypeId(type, "MTPuserStatus"); } } -inline MTPuserStatus::MTPuserStatus(MTPDuserStatusOnline *_data) : mtpDataOwner(_data), _type(mtpc_userStatusOnline) { +inline const MTPDuserStatusOnline &MTPuserStatus::c_userStatusOnline() const { + t_assert(data != nullptr && _type == mtpc_userStatusOnline); + return static_cast(*data); } -inline MTPuserStatus::MTPuserStatus(MTPDuserStatusOffline *_data) : mtpDataOwner(_data), _type(mtpc_userStatusOffline) { +inline MTPuserStatus::MTPuserStatus(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_userStatusOnline) { +} +inline const MTPDuserStatusOffline &MTPuserStatus::c_userStatusOffline() const { + t_assert(data != nullptr && _type == mtpc_userStatusOffline); + return static_cast(*data); +} +inline MTPuserStatus::MTPuserStatus(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_userStatusOffline) { } inline MTPuserStatus MTP_userStatusEmpty() { return MTP::internal::TypeCreator::new_userStatusEmpty(); @@ -29489,51 +26140,51 @@ inline mtpTypeId MTPchat::type() const { return _type; } inline void MTPchat::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_chatEmpty: _type = cons; { - if (!data) setData(new MTPDchatEmpty()); - MTPDchatEmpty &v(_chatEmpty()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; case mtpc_chat: _type = cons; { - if (!data) setData(new MTPDchat()); - MTPDchat &v(_chat()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vtitle.read(from, end); - v.vphoto.read(from, end); - v.vparticipants_count.read(from, end); - v.vdate.read(from, end); - v.vversion.read(from, end); - if (v.has_migrated_to()) { v.vmigrated_to.read(from, end); } else { v.vmigrated_to = MTPInputChannel(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vtitle.read(from, end); + v->vphoto.read(from, end); + v->vparticipants_count.read(from, end); + v->vdate.read(from, end); + v->vversion.read(from, end); + if (v->has_migrated_to()) { v->vmigrated_to.read(from, end); } else { v->vmigrated_to = MTPInputChannel(); } + data = std::move(v); } break; case mtpc_chatForbidden: _type = cons; { - if (!data) setData(new MTPDchatForbidden()); - MTPDchatForbidden &v(_chatForbidden()); - v.vid.read(from, end); - v.vtitle.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vtitle.read(from, end); + data = std::move(v); } break; case mtpc_channel: _type = cons; { - if (!data) setData(new MTPDchannel()); - MTPDchannel &v(_channel()); - v.vflags.read(from, end); - v.vid.read(from, end); - if (v.has_access_hash()) { v.vaccess_hash.read(from, end); } else { v.vaccess_hash = MTPlong(); } - v.vtitle.read(from, end); - if (v.has_username()) { v.vusername.read(from, end); } else { v.vusername = MTPstring(); } - v.vphoto.read(from, end); - v.vdate.read(from, end); - v.vversion.read(from, end); - if (v.has_restriction_reason()) { v.vrestriction_reason.read(from, end); } else { v.vrestriction_reason = MTPstring(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + if (v->has_access_hash()) { v->vaccess_hash.read(from, end); } else { v->vaccess_hash = MTPlong(); } + v->vtitle.read(from, end); + if (v->has_username()) { v->vusername.read(from, end); } else { v->vusername = MTPstring(); } + v->vphoto.read(from, end); + v->vdate.read(from, end); + v->vversion.read(from, end); + if (v->has_restriction_reason()) { v->vrestriction_reason.read(from, end); } else { v->vrestriction_reason = MTPstring(); } + data = std::move(v); } break; case mtpc_channelForbidden: _type = cons; { - if (!data) setData(new MTPDchannelForbidden()); - MTPDchannelForbidden &v(_channelForbidden()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vtitle.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vtitle.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPchat"); } @@ -29541,11 +26192,11 @@ inline void MTPchat::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId inline void MTPchat::write(mtpBuffer &to) const { switch (_type) { case mtpc_chatEmpty: { - const MTPDchatEmpty &v(c_chatEmpty()); + auto &v = c_chatEmpty(); v.vid.write(to); } break; case mtpc_chat: { - const MTPDchat &v(c_chat()); + auto &v = c_chat(); v.vflags.write(to); v.vid.write(to); v.vtitle.write(to); @@ -29556,12 +26207,12 @@ inline void MTPchat::write(mtpBuffer &to) const { if (v.has_migrated_to()) v.vmigrated_to.write(to); } break; case mtpc_chatForbidden: { - const MTPDchatForbidden &v(c_chatForbidden()); + auto &v = c_chatForbidden(); v.vid.write(to); v.vtitle.write(to); } break; case mtpc_channel: { - const MTPDchannel &v(c_channel()); + auto &v = c_channel(); v.vflags.write(to); v.vid.write(to); if (v.has_access_hash()) v.vaccess_hash.write(to); @@ -29573,7 +26224,7 @@ inline void MTPchat::write(mtpBuffer &to) const { if (v.has_restriction_reason()) v.vrestriction_reason.write(to); } break; case mtpc_channelForbidden: { - const MTPDchannelForbidden &v(c_channelForbidden()); + auto &v = c_channelForbidden(); v.vflags.write(to); v.vid.write(to); v.vaccess_hash.write(to); @@ -29581,25 +26232,45 @@ inline void MTPchat::write(mtpBuffer &to) const { } break; } } -inline MTPchat::MTPchat(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPchat::MTPchat(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_chatEmpty: setData(new MTPDchatEmpty()); break; - case mtpc_chat: setData(new MTPDchat()); break; - case mtpc_chatForbidden: setData(new MTPDchatForbidden()); break; - case mtpc_channel: setData(new MTPDchannel()); break; - case mtpc_channelForbidden: setData(new MTPDchannelForbidden()); break; + case mtpc_chatEmpty: data = std::make_shared(); break; + case mtpc_chat: data = std::make_shared(); break; + case mtpc_chatForbidden: data = std::make_shared(); break; + case mtpc_channel: data = std::make_shared(); break; + case mtpc_channelForbidden: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPchat"); } } -inline MTPchat::MTPchat(MTPDchatEmpty *_data) : mtpDataOwner(_data), _type(mtpc_chatEmpty) { +inline const MTPDchatEmpty &MTPchat::c_chatEmpty() const { + t_assert(data != nullptr && _type == mtpc_chatEmpty); + return static_cast(*data); } -inline MTPchat::MTPchat(MTPDchat *_data) : mtpDataOwner(_data), _type(mtpc_chat) { +inline MTPchat::MTPchat(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatEmpty) { } -inline MTPchat::MTPchat(MTPDchatForbidden *_data) : mtpDataOwner(_data), _type(mtpc_chatForbidden) { +inline const MTPDchat &MTPchat::c_chat() const { + t_assert(data != nullptr && _type == mtpc_chat); + return static_cast(*data); } -inline MTPchat::MTPchat(MTPDchannel *_data) : mtpDataOwner(_data), _type(mtpc_channel) { +inline MTPchat::MTPchat(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chat) { } -inline MTPchat::MTPchat(MTPDchannelForbidden *_data) : mtpDataOwner(_data), _type(mtpc_channelForbidden) { +inline const MTPDchatForbidden &MTPchat::c_chatForbidden() const { + t_assert(data != nullptr && _type == mtpc_chatForbidden); + return static_cast(*data); +} +inline MTPchat::MTPchat(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatForbidden) { +} +inline const MTPDchannel &MTPchat::c_channel() const { + t_assert(data != nullptr && _type == mtpc_channel); + return static_cast(*data); +} +inline MTPchat::MTPchat(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_channel) { +} +inline const MTPDchannelForbidden &MTPchat::c_channelForbidden() const { + t_assert(data != nullptr && _type == mtpc_channelForbidden); + return static_cast(*data); +} +inline MTPchat::MTPchat(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_channelForbidden) { } inline MTPchat MTP_chatEmpty(MTPint _id) { return MTP::internal::TypeCreator::new_chatEmpty(_id); @@ -29638,37 +26309,37 @@ inline mtpTypeId MTPchatFull::type() const { return _type; } inline void MTPchatFull::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_chatFull: _type = cons; { - if (!data) setData(new MTPDchatFull()); - MTPDchatFull &v(_chatFull()); - v.vid.read(from, end); - v.vparticipants.read(from, end); - v.vchat_photo.read(from, end); - v.vnotify_settings.read(from, end); - v.vexported_invite.read(from, end); - v.vbot_info.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vparticipants.read(from, end); + v->vchat_photo.read(from, end); + v->vnotify_settings.read(from, end); + v->vexported_invite.read(from, end); + v->vbot_info.read(from, end); + data = std::move(v); } break; case mtpc_channelFull: _type = cons; { - if (!data) setData(new MTPDchannelFull()); - MTPDchannelFull &v(_channelFull()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vabout.read(from, end); - if (v.has_participants_count()) { v.vparticipants_count.read(from, end); } else { v.vparticipants_count = MTPint(); } - if (v.has_admins_count()) { v.vadmins_count.read(from, end); } else { v.vadmins_count = MTPint(); } - if (v.has_kicked_count()) { v.vkicked_count.read(from, end); } else { v.vkicked_count = MTPint(); } - v.vread_inbox_max_id.read(from, end); - v.vread_outbox_max_id.read(from, end); - v.vunread_count.read(from, end); - v.vchat_photo.read(from, end); - v.vnotify_settings.read(from, end); - v.vexported_invite.read(from, end); - v.vbot_info.read(from, end); - if (v.has_migrated_from_chat_id()) { v.vmigrated_from_chat_id.read(from, end); } else { v.vmigrated_from_chat_id = MTPint(); } - if (v.has_migrated_from_max_id()) { v.vmigrated_from_max_id.read(from, end); } else { v.vmigrated_from_max_id = MTPint(); } - if (v.has_pinned_msg_id()) { v.vpinned_msg_id.read(from, end); } else { v.vpinned_msg_id = MTPint(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vabout.read(from, end); + if (v->has_participants_count()) { v->vparticipants_count.read(from, end); } else { v->vparticipants_count = MTPint(); } + if (v->has_admins_count()) { v->vadmins_count.read(from, end); } else { v->vadmins_count = MTPint(); } + if (v->has_kicked_count()) { v->vkicked_count.read(from, end); } else { v->vkicked_count = MTPint(); } + v->vread_inbox_max_id.read(from, end); + v->vread_outbox_max_id.read(from, end); + v->vunread_count.read(from, end); + v->vchat_photo.read(from, end); + v->vnotify_settings.read(from, end); + v->vexported_invite.read(from, end); + v->vbot_info.read(from, end); + if (v->has_migrated_from_chat_id()) { v->vmigrated_from_chat_id.read(from, end); } else { v->vmigrated_from_chat_id = MTPint(); } + if (v->has_migrated_from_max_id()) { v->vmigrated_from_max_id.read(from, end); } else { v->vmigrated_from_max_id = MTPint(); } + if (v->has_pinned_msg_id()) { v->vpinned_msg_id.read(from, end); } else { v->vpinned_msg_id = MTPint(); } + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPchatFull"); } @@ -29676,7 +26347,7 @@ inline void MTPchatFull::read(const mtpPrime *&from, const mtpPrime *end, mtpTyp inline void MTPchatFull::write(mtpBuffer &to) const { switch (_type) { case mtpc_chatFull: { - const MTPDchatFull &v(c_chatFull()); + auto &v = c_chatFull(); v.vid.write(to); v.vparticipants.write(to); v.vchat_photo.write(to); @@ -29685,7 +26356,7 @@ inline void MTPchatFull::write(mtpBuffer &to) const { v.vbot_info.write(to); } break; case mtpc_channelFull: { - const MTPDchannelFull &v(c_channelFull()); + auto &v = c_channelFull(); v.vflags.write(to); v.vid.write(to); v.vabout.write(to); @@ -29705,16 +26376,24 @@ inline void MTPchatFull::write(mtpBuffer &to) const { } break; } } -inline MTPchatFull::MTPchatFull(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPchatFull::MTPchatFull(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_chatFull: setData(new MTPDchatFull()); break; - case mtpc_channelFull: setData(new MTPDchannelFull()); break; + case mtpc_chatFull: data = std::make_shared(); break; + case mtpc_channelFull: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPchatFull"); } } -inline MTPchatFull::MTPchatFull(MTPDchatFull *_data) : mtpDataOwner(_data), _type(mtpc_chatFull) { +inline const MTPDchatFull &MTPchatFull::c_chatFull() const { + t_assert(data != nullptr && _type == mtpc_chatFull); + return static_cast(*data); } -inline MTPchatFull::MTPchatFull(MTPDchannelFull *_data) : mtpDataOwner(_data), _type(mtpc_channelFull) { +inline MTPchatFull::MTPchatFull(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatFull) { +} +inline const MTPDchannelFull &MTPchatFull::c_channelFull() const { + t_assert(data != nullptr && _type == mtpc_channelFull); + return static_cast(*data); +} +inline MTPchatFull::MTPchatFull(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_channelFull) { } inline MTPchatFull MTP_chatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info) { return MTP::internal::TypeCreator::new_chatFull(_id, _participants, _chat_photo, _notify_settings, _exported_invite, _bot_info); @@ -29746,26 +26425,26 @@ inline mtpTypeId MTPchatParticipant::type() const { return _type; } inline void MTPchatParticipant::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_chatParticipant: _type = cons; { - if (!data) setData(new MTPDchatParticipant()); - MTPDchatParticipant &v(_chatParticipant()); - v.vuser_id.read(from, end); - v.vinviter_id.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vinviter_id.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_chatParticipantCreator: _type = cons; { - if (!data) setData(new MTPDchatParticipantCreator()); - MTPDchatParticipantCreator &v(_chatParticipantCreator()); - v.vuser_id.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + data = std::move(v); } break; case mtpc_chatParticipantAdmin: _type = cons; { - if (!data) setData(new MTPDchatParticipantAdmin()); - MTPDchatParticipantAdmin &v(_chatParticipantAdmin()); - v.vuser_id.read(from, end); - v.vinviter_id.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vinviter_id.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPchatParticipant"); } @@ -29773,36 +26452,48 @@ inline void MTPchatParticipant::read(const mtpPrime *&from, const mtpPrime *end, inline void MTPchatParticipant::write(mtpBuffer &to) const { switch (_type) { case mtpc_chatParticipant: { - const MTPDchatParticipant &v(c_chatParticipant()); + auto &v = c_chatParticipant(); v.vuser_id.write(to); v.vinviter_id.write(to); v.vdate.write(to); } break; case mtpc_chatParticipantCreator: { - const MTPDchatParticipantCreator &v(c_chatParticipantCreator()); + auto &v = c_chatParticipantCreator(); v.vuser_id.write(to); } break; case mtpc_chatParticipantAdmin: { - const MTPDchatParticipantAdmin &v(c_chatParticipantAdmin()); + auto &v = c_chatParticipantAdmin(); v.vuser_id.write(to); v.vinviter_id.write(to); v.vdate.write(to); } break; } } -inline MTPchatParticipant::MTPchatParticipant(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPchatParticipant::MTPchatParticipant(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_chatParticipant: setData(new MTPDchatParticipant()); break; - case mtpc_chatParticipantCreator: setData(new MTPDchatParticipantCreator()); break; - case mtpc_chatParticipantAdmin: setData(new MTPDchatParticipantAdmin()); break; + case mtpc_chatParticipant: data = std::make_shared(); break; + case mtpc_chatParticipantCreator: data = std::make_shared(); break; + case mtpc_chatParticipantAdmin: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPchatParticipant"); } } -inline MTPchatParticipant::MTPchatParticipant(MTPDchatParticipant *_data) : mtpDataOwner(_data), _type(mtpc_chatParticipant) { +inline const MTPDchatParticipant &MTPchatParticipant::c_chatParticipant() const { + t_assert(data != nullptr && _type == mtpc_chatParticipant); + return static_cast(*data); } -inline MTPchatParticipant::MTPchatParticipant(MTPDchatParticipantCreator *_data) : mtpDataOwner(_data), _type(mtpc_chatParticipantCreator) { +inline MTPchatParticipant::MTPchatParticipant(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatParticipant) { } -inline MTPchatParticipant::MTPchatParticipant(MTPDchatParticipantAdmin *_data) : mtpDataOwner(_data), _type(mtpc_chatParticipantAdmin) { +inline const MTPDchatParticipantCreator &MTPchatParticipant::c_chatParticipantCreator() const { + t_assert(data != nullptr && _type == mtpc_chatParticipantCreator); + return static_cast(*data); +} +inline MTPchatParticipant::MTPchatParticipant(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatParticipantCreator) { +} +inline const MTPDchatParticipantAdmin &MTPchatParticipant::c_chatParticipantAdmin() const { + t_assert(data != nullptr && _type == mtpc_chatParticipantAdmin); + return static_cast(*data); +} +inline MTPchatParticipant::MTPchatParticipant(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatParticipantAdmin) { } inline MTPchatParticipant MTP_chatParticipant(MTPint _user_id, MTPint _inviter_id, MTPint _date) { return MTP::internal::TypeCreator::new_chatParticipant(_user_id, _inviter_id, _date); @@ -29832,21 +26523,21 @@ inline mtpTypeId MTPchatParticipants::type() const { return _type; } inline void MTPchatParticipants::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_chatParticipantsForbidden: _type = cons; { - if (!data) setData(new MTPDchatParticipantsForbidden()); - MTPDchatParticipantsForbidden &v(_chatParticipantsForbidden()); - v.vflags.read(from, end); - v.vchat_id.read(from, end); - if (v.has_self_participant()) { v.vself_participant.read(from, end); } else { v.vself_participant = MTPChatParticipant(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vchat_id.read(from, end); + if (v->has_self_participant()) { v->vself_participant.read(from, end); } else { v->vself_participant = MTPChatParticipant(); } + data = std::move(v); } break; case mtpc_chatParticipants: _type = cons; { - if (!data) setData(new MTPDchatParticipants()); - MTPDchatParticipants &v(_chatParticipants()); - v.vchat_id.read(from, end); - v.vparticipants.read(from, end); - v.vversion.read(from, end); + auto v = std::make_shared(); + v->vchat_id.read(from, end); + v->vparticipants.read(from, end); + v->vversion.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPchatParticipants"); } @@ -29854,29 +26545,37 @@ inline void MTPchatParticipants::read(const mtpPrime *&from, const mtpPrime *end inline void MTPchatParticipants::write(mtpBuffer &to) const { switch (_type) { case mtpc_chatParticipantsForbidden: { - const MTPDchatParticipantsForbidden &v(c_chatParticipantsForbidden()); + auto &v = c_chatParticipantsForbidden(); v.vflags.write(to); v.vchat_id.write(to); if (v.has_self_participant()) v.vself_participant.write(to); } break; case mtpc_chatParticipants: { - const MTPDchatParticipants &v(c_chatParticipants()); + auto &v = c_chatParticipants(); v.vchat_id.write(to); v.vparticipants.write(to); v.vversion.write(to); } break; } } -inline MTPchatParticipants::MTPchatParticipants(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPchatParticipants::MTPchatParticipants(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_chatParticipantsForbidden: setData(new MTPDchatParticipantsForbidden()); break; - case mtpc_chatParticipants: setData(new MTPDchatParticipants()); break; + case mtpc_chatParticipantsForbidden: data = std::make_shared(); break; + case mtpc_chatParticipants: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPchatParticipants"); } } -inline MTPchatParticipants::MTPchatParticipants(MTPDchatParticipantsForbidden *_data) : mtpDataOwner(_data), _type(mtpc_chatParticipantsForbidden) { +inline const MTPDchatParticipantsForbidden &MTPchatParticipants::c_chatParticipantsForbidden() const { + t_assert(data != nullptr && _type == mtpc_chatParticipantsForbidden); + return static_cast(*data); } -inline MTPchatParticipants::MTPchatParticipants(MTPDchatParticipants *_data) : mtpDataOwner(_data), _type(mtpc_chatParticipants) { +inline MTPchatParticipants::MTPchatParticipants(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatParticipantsForbidden) { +} +inline const MTPDchatParticipants &MTPchatParticipants::c_chatParticipants() const { + t_assert(data != nullptr && _type == mtpc_chatParticipants); + return static_cast(*data); +} +inline MTPchatParticipants::MTPchatParticipants(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatParticipants) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDchatParticipantsForbidden::Flags) inline MTPchatParticipants MTP_chatParticipantsForbidden(const MTPflags &_flags, MTPint _chat_id, const MTPChatParticipant &_self_participant) { @@ -29900,14 +26599,14 @@ inline mtpTypeId MTPchatPhoto::type() const { return _type; } inline void MTPchatPhoto::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_chatPhotoEmpty: _type = cons; break; case mtpc_chatPhoto: _type = cons; { - if (!data) setData(new MTPDchatPhoto()); - MTPDchatPhoto &v(_chatPhoto()); - v.vphoto_small.read(from, end); - v.vphoto_big.read(from, end); + auto v = std::make_shared(); + v->vphoto_small.read(from, end); + v->vphoto_big.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPchatPhoto"); } @@ -29915,20 +26614,24 @@ inline void MTPchatPhoto::read(const mtpPrime *&from, const mtpPrime *end, mtpTy inline void MTPchatPhoto::write(mtpBuffer &to) const { switch (_type) { case mtpc_chatPhoto: { - const MTPDchatPhoto &v(c_chatPhoto()); + auto &v = c_chatPhoto(); v.vphoto_small.write(to); v.vphoto_big.write(to); } break; } } -inline MTPchatPhoto::MTPchatPhoto(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPchatPhoto::MTPchatPhoto(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_chatPhotoEmpty: break; - case mtpc_chatPhoto: setData(new MTPDchatPhoto()); break; + case mtpc_chatPhoto: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPchatPhoto"); } } -inline MTPchatPhoto::MTPchatPhoto(MTPDchatPhoto *_data) : mtpDataOwner(_data), _type(mtpc_chatPhoto) { +inline const MTPDchatPhoto &MTPchatPhoto::c_chatPhoto() const { + t_assert(data != nullptr && _type == mtpc_chatPhoto); + return static_cast(*data); +} +inline MTPchatPhoto::MTPchatPhoto(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatPhoto) { } inline MTPchatPhoto MTP_chatPhotoEmpty() { return MTP::internal::TypeCreator::new_chatPhotoEmpty(); @@ -29959,41 +26662,41 @@ inline mtpTypeId MTPmessage::type() const { return _type; } inline void MTPmessage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messageEmpty: _type = cons; { - if (!data) setData(new MTPDmessageEmpty()); - MTPDmessageEmpty &v(_messageEmpty()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; case mtpc_message: _type = cons; { - if (!data) setData(new MTPDmessage()); - MTPDmessage &v(_message()); - v.vflags.read(from, end); - v.vid.read(from, end); - if (v.has_from_id()) { v.vfrom_id.read(from, end); } else { v.vfrom_id = MTPint(); } - v.vto_id.read(from, end); - if (v.has_fwd_from()) { v.vfwd_from.read(from, end); } else { v.vfwd_from = MTPMessageFwdHeader(); } - if (v.has_via_bot_id()) { v.vvia_bot_id.read(from, end); } else { v.vvia_bot_id = MTPint(); } - if (v.has_reply_to_msg_id()) { v.vreply_to_msg_id.read(from, end); } else { v.vreply_to_msg_id = MTPint(); } - v.vdate.read(from, end); - v.vmessage.read(from, end); - if (v.has_media()) { v.vmedia.read(from, end); } else { v.vmedia = MTPMessageMedia(); } - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } - if (v.has_entities()) { v.ventities.read(from, end); } else { v.ventities = MTPVector(); } - if (v.has_views()) { v.vviews.read(from, end); } else { v.vviews = MTPint(); } - if (v.has_edit_date()) { v.vedit_date.read(from, end); } else { v.vedit_date = MTPint(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + if (v->has_from_id()) { v->vfrom_id.read(from, end); } else { v->vfrom_id = MTPint(); } + v->vto_id.read(from, end); + if (v->has_fwd_from()) { v->vfwd_from.read(from, end); } else { v->vfwd_from = MTPMessageFwdHeader(); } + if (v->has_via_bot_id()) { v->vvia_bot_id.read(from, end); } else { v->vvia_bot_id = MTPint(); } + if (v->has_reply_to_msg_id()) { v->vreply_to_msg_id.read(from, end); } else { v->vreply_to_msg_id = MTPint(); } + v->vdate.read(from, end); + v->vmessage.read(from, end); + if (v->has_media()) { v->vmedia.read(from, end); } else { v->vmedia = MTPMessageMedia(); } + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + if (v->has_entities()) { v->ventities.read(from, end); } else { v->ventities = MTPVector(); } + if (v->has_views()) { v->vviews.read(from, end); } else { v->vviews = MTPint(); } + if (v->has_edit_date()) { v->vedit_date.read(from, end); } else { v->vedit_date = MTPint(); } + data = std::move(v); } break; case mtpc_messageService: _type = cons; { - if (!data) setData(new MTPDmessageService()); - MTPDmessageService &v(_messageService()); - v.vflags.read(from, end); - v.vid.read(from, end); - if (v.has_from_id()) { v.vfrom_id.read(from, end); } else { v.vfrom_id = MTPint(); } - v.vto_id.read(from, end); - if (v.has_reply_to_msg_id()) { v.vreply_to_msg_id.read(from, end); } else { v.vreply_to_msg_id = MTPint(); } - v.vdate.read(from, end); - v.vaction.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + if (v->has_from_id()) { v->vfrom_id.read(from, end); } else { v->vfrom_id = MTPint(); } + v->vto_id.read(from, end); + if (v->has_reply_to_msg_id()) { v->vreply_to_msg_id.read(from, end); } else { v->vreply_to_msg_id = MTPint(); } + v->vdate.read(from, end); + v->vaction.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessage"); } @@ -30001,11 +26704,11 @@ inline void MTPmessage::read(const mtpPrime *&from, const mtpPrime *end, mtpType inline void MTPmessage::write(mtpBuffer &to) const { switch (_type) { case mtpc_messageEmpty: { - const MTPDmessageEmpty &v(c_messageEmpty()); + auto &v = c_messageEmpty(); v.vid.write(to); } break; case mtpc_message: { - const MTPDmessage &v(c_message()); + auto &v = c_message(); v.vflags.write(to); v.vid.write(to); if (v.has_from_id()) v.vfrom_id.write(to); @@ -30022,7 +26725,7 @@ inline void MTPmessage::write(mtpBuffer &to) const { if (v.has_edit_date()) v.vedit_date.write(to); } break; case mtpc_messageService: { - const MTPDmessageService &v(c_messageService()); + auto &v = c_messageService(); v.vflags.write(to); v.vid.write(to); if (v.has_from_id()) v.vfrom_id.write(to); @@ -30033,19 +26736,31 @@ inline void MTPmessage::write(mtpBuffer &to) const { } break; } } -inline MTPmessage::MTPmessage(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessage::MTPmessage(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_messageEmpty: setData(new MTPDmessageEmpty()); break; - case mtpc_message: setData(new MTPDmessage()); break; - case mtpc_messageService: setData(new MTPDmessageService()); break; + case mtpc_messageEmpty: data = std::make_shared(); break; + case mtpc_message: data = std::make_shared(); break; + case mtpc_messageService: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessage"); } } -inline MTPmessage::MTPmessage(MTPDmessageEmpty *_data) : mtpDataOwner(_data), _type(mtpc_messageEmpty) { +inline const MTPDmessageEmpty &MTPmessage::c_messageEmpty() const { + t_assert(data != nullptr && _type == mtpc_messageEmpty); + return static_cast(*data); } -inline MTPmessage::MTPmessage(MTPDmessage *_data) : mtpDataOwner(_data), _type(mtpc_message) { +inline MTPmessage::MTPmessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEmpty) { } -inline MTPmessage::MTPmessage(MTPDmessageService *_data) : mtpDataOwner(_data), _type(mtpc_messageService) { +inline const MTPDmessage &MTPmessage::c_message() const { + t_assert(data != nullptr && _type == mtpc_message); + return static_cast(*data); +} +inline MTPmessage::MTPmessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_message) { +} +inline const MTPDmessageService &MTPmessage::c_messageService() const { + t_assert(data != nullptr && _type == mtpc_messageService); + return static_cast(*data); +} +inline MTPmessage::MTPmessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageService) { } inline MTPmessage MTP_messageEmpty(MTPint _id) { return MTP::internal::TypeCreator::new_messageEmpty(_id); @@ -30097,53 +26812,53 @@ inline mtpTypeId MTPmessageMedia::type() const { return _type; } inline void MTPmessageMedia::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messageMediaEmpty: _type = cons; break; case mtpc_messageMediaPhoto: _type = cons; { - if (!data) setData(new MTPDmessageMediaPhoto()); - MTPDmessageMediaPhoto &v(_messageMediaPhoto()); - v.vphoto.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vphoto.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_messageMediaGeo: _type = cons; { - if (!data) setData(new MTPDmessageMediaGeo()); - MTPDmessageMediaGeo &v(_messageMediaGeo()); - v.vgeo.read(from, end); + auto v = std::make_shared(); + v->vgeo.read(from, end); + data = std::move(v); } break; case mtpc_messageMediaContact: _type = cons; { - if (!data) setData(new MTPDmessageMediaContact()); - MTPDmessageMediaContact &v(_messageMediaContact()); - v.vphone_number.read(from, end); - v.vfirst_name.read(from, end); - v.vlast_name.read(from, end); - v.vuser_id.read(from, end); + auto v = std::make_shared(); + v->vphone_number.read(from, end); + v->vfirst_name.read(from, end); + v->vlast_name.read(from, end); + v->vuser_id.read(from, end); + data = std::move(v); } break; case mtpc_messageMediaUnsupported: _type = cons; break; case mtpc_messageMediaDocument: _type = cons; { - if (!data) setData(new MTPDmessageMediaDocument()); - MTPDmessageMediaDocument &v(_messageMediaDocument()); - v.vdocument.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vdocument.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_messageMediaWebPage: _type = cons; { - if (!data) setData(new MTPDmessageMediaWebPage()); - MTPDmessageMediaWebPage &v(_messageMediaWebPage()); - v.vwebpage.read(from, end); + auto v = std::make_shared(); + v->vwebpage.read(from, end); + data = std::move(v); } break; case mtpc_messageMediaVenue: _type = cons; { - if (!data) setData(new MTPDmessageMediaVenue()); - MTPDmessageMediaVenue &v(_messageMediaVenue()); - v.vgeo.read(from, end); - v.vtitle.read(from, end); - v.vaddress.read(from, end); - v.vprovider.read(from, end); - v.vvenue_id.read(from, end); + auto v = std::make_shared(); + v->vgeo.read(from, end); + v->vtitle.read(from, end); + v->vaddress.read(from, end); + v->vprovider.read(from, end); + v->vvenue_id.read(from, end); + data = std::move(v); } break; case mtpc_messageMediaGame: _type = cons; { - if (!data) setData(new MTPDmessageMediaGame()); - MTPDmessageMediaGame &v(_messageMediaGame()); - v.vgame.read(from, end); + auto v = std::make_shared(); + v->vgame.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessageMedia"); } @@ -30151,32 +26866,32 @@ inline void MTPmessageMedia::read(const mtpPrime *&from, const mtpPrime *end, mt inline void MTPmessageMedia::write(mtpBuffer &to) const { switch (_type) { case mtpc_messageMediaPhoto: { - const MTPDmessageMediaPhoto &v(c_messageMediaPhoto()); + auto &v = c_messageMediaPhoto(); v.vphoto.write(to); v.vcaption.write(to); } break; case mtpc_messageMediaGeo: { - const MTPDmessageMediaGeo &v(c_messageMediaGeo()); + auto &v = c_messageMediaGeo(); v.vgeo.write(to); } break; case mtpc_messageMediaContact: { - const MTPDmessageMediaContact &v(c_messageMediaContact()); + auto &v = c_messageMediaContact(); v.vphone_number.write(to); v.vfirst_name.write(to); v.vlast_name.write(to); v.vuser_id.write(to); } break; case mtpc_messageMediaDocument: { - const MTPDmessageMediaDocument &v(c_messageMediaDocument()); + auto &v = c_messageMediaDocument(); v.vdocument.write(to); v.vcaption.write(to); } break; case mtpc_messageMediaWebPage: { - const MTPDmessageMediaWebPage &v(c_messageMediaWebPage()); + auto &v = c_messageMediaWebPage(); v.vwebpage.write(to); } break; case mtpc_messageMediaVenue: { - const MTPDmessageMediaVenue &v(c_messageMediaVenue()); + auto &v = c_messageMediaVenue(); v.vgeo.write(to); v.vtitle.write(to); v.vaddress.write(to); @@ -30184,38 +26899,66 @@ inline void MTPmessageMedia::write(mtpBuffer &to) const { v.vvenue_id.write(to); } break; case mtpc_messageMediaGame: { - const MTPDmessageMediaGame &v(c_messageMediaGame()); + auto &v = c_messageMediaGame(); v.vgame.write(to); } break; } } -inline MTPmessageMedia::MTPmessageMedia(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessageMedia::MTPmessageMedia(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_messageMediaEmpty: break; - case mtpc_messageMediaPhoto: setData(new MTPDmessageMediaPhoto()); break; - case mtpc_messageMediaGeo: setData(new MTPDmessageMediaGeo()); break; - case mtpc_messageMediaContact: setData(new MTPDmessageMediaContact()); break; + case mtpc_messageMediaPhoto: data = std::make_shared(); break; + case mtpc_messageMediaGeo: data = std::make_shared(); break; + case mtpc_messageMediaContact: data = std::make_shared(); break; case mtpc_messageMediaUnsupported: break; - case mtpc_messageMediaDocument: setData(new MTPDmessageMediaDocument()); break; - case mtpc_messageMediaWebPage: setData(new MTPDmessageMediaWebPage()); break; - case mtpc_messageMediaVenue: setData(new MTPDmessageMediaVenue()); break; - case mtpc_messageMediaGame: setData(new MTPDmessageMediaGame()); break; + case mtpc_messageMediaDocument: data = std::make_shared(); break; + case mtpc_messageMediaWebPage: data = std::make_shared(); break; + case mtpc_messageMediaVenue: data = std::make_shared(); break; + case mtpc_messageMediaGame: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessageMedia"); } } -inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaPhoto *_data) : mtpDataOwner(_data), _type(mtpc_messageMediaPhoto) { +inline const MTPDmessageMediaPhoto &MTPmessageMedia::c_messageMediaPhoto() const { + t_assert(data != nullptr && _type == mtpc_messageMediaPhoto); + return static_cast(*data); } -inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaGeo *_data) : mtpDataOwner(_data), _type(mtpc_messageMediaGeo) { +inline MTPmessageMedia::MTPmessageMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageMediaPhoto) { } -inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaContact *_data) : mtpDataOwner(_data), _type(mtpc_messageMediaContact) { +inline const MTPDmessageMediaGeo &MTPmessageMedia::c_messageMediaGeo() const { + t_assert(data != nullptr && _type == mtpc_messageMediaGeo); + return static_cast(*data); } -inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaDocument *_data) : mtpDataOwner(_data), _type(mtpc_messageMediaDocument) { +inline MTPmessageMedia::MTPmessageMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageMediaGeo) { } -inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaWebPage *_data) : mtpDataOwner(_data), _type(mtpc_messageMediaWebPage) { +inline const MTPDmessageMediaContact &MTPmessageMedia::c_messageMediaContact() const { + t_assert(data != nullptr && _type == mtpc_messageMediaContact); + return static_cast(*data); } -inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaVenue *_data) : mtpDataOwner(_data), _type(mtpc_messageMediaVenue) { +inline MTPmessageMedia::MTPmessageMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageMediaContact) { } -inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaGame *_data) : mtpDataOwner(_data), _type(mtpc_messageMediaGame) { +inline const MTPDmessageMediaDocument &MTPmessageMedia::c_messageMediaDocument() const { + t_assert(data != nullptr && _type == mtpc_messageMediaDocument); + return static_cast(*data); +} +inline MTPmessageMedia::MTPmessageMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageMediaDocument) { +} +inline const MTPDmessageMediaWebPage &MTPmessageMedia::c_messageMediaWebPage() const { + t_assert(data != nullptr && _type == mtpc_messageMediaWebPage); + return static_cast(*data); +} +inline MTPmessageMedia::MTPmessageMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageMediaWebPage) { +} +inline const MTPDmessageMediaVenue &MTPmessageMedia::c_messageMediaVenue() const { + t_assert(data != nullptr && _type == mtpc_messageMediaVenue); + return static_cast(*data); +} +inline MTPmessageMedia::MTPmessageMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageMediaVenue) { +} +inline const MTPDmessageMediaGame &MTPmessageMedia::c_messageMediaGame() const { + t_assert(data != nullptr && _type == mtpc_messageMediaGame); + return static_cast(*data); +} +inline MTPmessageMedia::MTPmessageMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageMediaGame) { } inline MTPmessageMedia MTP_messageMediaEmpty() { return MTP::internal::TypeCreator::new_messageMediaEmpty(); @@ -30299,72 +27042,72 @@ inline mtpTypeId MTPmessageAction::type() const { return _type; } inline void MTPmessageAction::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messageActionEmpty: _type = cons; break; case mtpc_messageActionChatCreate: _type = cons; { - if (!data) setData(new MTPDmessageActionChatCreate()); - MTPDmessageActionChatCreate &v(_messageActionChatCreate()); - v.vtitle.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vtitle.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; case mtpc_messageActionChatEditTitle: _type = cons; { - if (!data) setData(new MTPDmessageActionChatEditTitle()); - MTPDmessageActionChatEditTitle &v(_messageActionChatEditTitle()); - v.vtitle.read(from, end); + auto v = std::make_shared(); + v->vtitle.read(from, end); + data = std::move(v); } break; case mtpc_messageActionChatEditPhoto: _type = cons; { - if (!data) setData(new MTPDmessageActionChatEditPhoto()); - MTPDmessageActionChatEditPhoto &v(_messageActionChatEditPhoto()); - v.vphoto.read(from, end); + auto v = std::make_shared(); + v->vphoto.read(from, end); + data = std::move(v); } break; case mtpc_messageActionChatDeletePhoto: _type = cons; break; case mtpc_messageActionChatAddUser: _type = cons; { - if (!data) setData(new MTPDmessageActionChatAddUser()); - MTPDmessageActionChatAddUser &v(_messageActionChatAddUser()); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vusers.read(from, end); + data = std::move(v); } break; case mtpc_messageActionChatDeleteUser: _type = cons; { - if (!data) setData(new MTPDmessageActionChatDeleteUser()); - MTPDmessageActionChatDeleteUser &v(_messageActionChatDeleteUser()); - v.vuser_id.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + data = std::move(v); } break; case mtpc_messageActionChatJoinedByLink: _type = cons; { - if (!data) setData(new MTPDmessageActionChatJoinedByLink()); - MTPDmessageActionChatJoinedByLink &v(_messageActionChatJoinedByLink()); - v.vinviter_id.read(from, end); + auto v = std::make_shared(); + v->vinviter_id.read(from, end); + data = std::move(v); } break; case mtpc_messageActionChannelCreate: _type = cons; { - if (!data) setData(new MTPDmessageActionChannelCreate()); - MTPDmessageActionChannelCreate &v(_messageActionChannelCreate()); - v.vtitle.read(from, end); + auto v = std::make_shared(); + v->vtitle.read(from, end); + data = std::move(v); } break; case mtpc_messageActionChatMigrateTo: _type = cons; { - if (!data) setData(new MTPDmessageActionChatMigrateTo()); - MTPDmessageActionChatMigrateTo &v(_messageActionChatMigrateTo()); - v.vchannel_id.read(from, end); + auto v = std::make_shared(); + v->vchannel_id.read(from, end); + data = std::move(v); } break; case mtpc_messageActionChannelMigrateFrom: _type = cons; { - if (!data) setData(new MTPDmessageActionChannelMigrateFrom()); - MTPDmessageActionChannelMigrateFrom &v(_messageActionChannelMigrateFrom()); - v.vtitle.read(from, end); - v.vchat_id.read(from, end); + auto v = std::make_shared(); + v->vtitle.read(from, end); + v->vchat_id.read(from, end); + data = std::move(v); } break; case mtpc_messageActionPinMessage: _type = cons; break; case mtpc_messageActionHistoryClear: _type = cons; break; case mtpc_messageActionGameScore: _type = cons; { - if (!data) setData(new MTPDmessageActionGameScore()); - MTPDmessageActionGameScore &v(_messageActionGameScore()); - v.vgame_id.read(from, end); - v.vscore.read(from, end); + auto v = std::make_shared(); + v->vgame_id.read(from, end); + v->vscore.read(from, end); + data = std::move(v); } break; case mtpc_messageActionPhoneCall: _type = cons; { - if (!data) setData(new MTPDmessageActionPhoneCall()); - MTPDmessageActionPhoneCall &v(_messageActionPhoneCall()); - v.vflags.read(from, end); - v.vcall_id.read(from, end); - if (v.has_reason()) { v.vreason.read(from, end); } else { v.vreason = MTPPhoneCallDiscardReason(); } - if (v.has_duration()) { v.vduration.read(from, end); } else { v.vduration = MTPint(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vcall_id.read(from, end); + if (v->has_reason()) { v->vreason.read(from, end); } else { v->vreason = MTPPhoneCallDiscardReason(); } + if (v->has_duration()) { v->vduration.read(from, end); } else { v->vduration = MTPint(); } + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessageAction"); } @@ -30372,50 +27115,50 @@ inline void MTPmessageAction::read(const mtpPrime *&from, const mtpPrime *end, m inline void MTPmessageAction::write(mtpBuffer &to) const { switch (_type) { case mtpc_messageActionChatCreate: { - const MTPDmessageActionChatCreate &v(c_messageActionChatCreate()); + auto &v = c_messageActionChatCreate(); v.vtitle.write(to); v.vusers.write(to); } break; case mtpc_messageActionChatEditTitle: { - const MTPDmessageActionChatEditTitle &v(c_messageActionChatEditTitle()); + auto &v = c_messageActionChatEditTitle(); v.vtitle.write(to); } break; case mtpc_messageActionChatEditPhoto: { - const MTPDmessageActionChatEditPhoto &v(c_messageActionChatEditPhoto()); + auto &v = c_messageActionChatEditPhoto(); v.vphoto.write(to); } break; case mtpc_messageActionChatAddUser: { - const MTPDmessageActionChatAddUser &v(c_messageActionChatAddUser()); + auto &v = c_messageActionChatAddUser(); v.vusers.write(to); } break; case mtpc_messageActionChatDeleteUser: { - const MTPDmessageActionChatDeleteUser &v(c_messageActionChatDeleteUser()); + auto &v = c_messageActionChatDeleteUser(); v.vuser_id.write(to); } break; case mtpc_messageActionChatJoinedByLink: { - const MTPDmessageActionChatJoinedByLink &v(c_messageActionChatJoinedByLink()); + auto &v = c_messageActionChatJoinedByLink(); v.vinviter_id.write(to); } break; case mtpc_messageActionChannelCreate: { - const MTPDmessageActionChannelCreate &v(c_messageActionChannelCreate()); + auto &v = c_messageActionChannelCreate(); v.vtitle.write(to); } break; case mtpc_messageActionChatMigrateTo: { - const MTPDmessageActionChatMigrateTo &v(c_messageActionChatMigrateTo()); + auto &v = c_messageActionChatMigrateTo(); v.vchannel_id.write(to); } break; case mtpc_messageActionChannelMigrateFrom: { - const MTPDmessageActionChannelMigrateFrom &v(c_messageActionChannelMigrateFrom()); + auto &v = c_messageActionChannelMigrateFrom(); v.vtitle.write(to); v.vchat_id.write(to); } break; case mtpc_messageActionGameScore: { - const MTPDmessageActionGameScore &v(c_messageActionGameScore()); + auto &v = c_messageActionGameScore(); v.vgame_id.write(to); v.vscore.write(to); } break; case mtpc_messageActionPhoneCall: { - const MTPDmessageActionPhoneCall &v(c_messageActionPhoneCall()); + auto &v = c_messageActionPhoneCall(); v.vflags.write(to); v.vcall_id.write(to); if (v.has_reason()) v.vreason.write(to); @@ -30423,47 +27166,91 @@ inline void MTPmessageAction::write(mtpBuffer &to) const { } break; } } -inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_messageActionEmpty: break; - case mtpc_messageActionChatCreate: setData(new MTPDmessageActionChatCreate()); break; - case mtpc_messageActionChatEditTitle: setData(new MTPDmessageActionChatEditTitle()); break; - case mtpc_messageActionChatEditPhoto: setData(new MTPDmessageActionChatEditPhoto()); break; + case mtpc_messageActionChatCreate: data = std::make_shared(); break; + case mtpc_messageActionChatEditTitle: data = std::make_shared(); break; + case mtpc_messageActionChatEditPhoto: data = std::make_shared(); break; case mtpc_messageActionChatDeletePhoto: break; - case mtpc_messageActionChatAddUser: setData(new MTPDmessageActionChatAddUser()); break; - case mtpc_messageActionChatDeleteUser: setData(new MTPDmessageActionChatDeleteUser()); break; - case mtpc_messageActionChatJoinedByLink: setData(new MTPDmessageActionChatJoinedByLink()); break; - case mtpc_messageActionChannelCreate: setData(new MTPDmessageActionChannelCreate()); break; - case mtpc_messageActionChatMigrateTo: setData(new MTPDmessageActionChatMigrateTo()); break; - case mtpc_messageActionChannelMigrateFrom: setData(new MTPDmessageActionChannelMigrateFrom()); break; + case mtpc_messageActionChatAddUser: data = std::make_shared(); break; + case mtpc_messageActionChatDeleteUser: data = std::make_shared(); break; + case mtpc_messageActionChatJoinedByLink: data = std::make_shared(); break; + case mtpc_messageActionChannelCreate: data = std::make_shared(); break; + case mtpc_messageActionChatMigrateTo: data = std::make_shared(); break; + case mtpc_messageActionChannelMigrateFrom: data = std::make_shared(); break; case mtpc_messageActionPinMessage: break; case mtpc_messageActionHistoryClear: break; - case mtpc_messageActionGameScore: setData(new MTPDmessageActionGameScore()); break; - case mtpc_messageActionPhoneCall: setData(new MTPDmessageActionPhoneCall()); break; + case mtpc_messageActionGameScore: data = std::make_shared(); break; + case mtpc_messageActionPhoneCall: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessageAction"); } } -inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatCreate *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChatCreate) { +inline const MTPDmessageActionChatCreate &MTPmessageAction::c_messageActionChatCreate() const { + t_assert(data != nullptr && _type == mtpc_messageActionChatCreate); + return static_cast(*data); } -inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatEditTitle *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChatEditTitle) { +inline MTPmessageAction::MTPmessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageActionChatCreate) { } -inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatEditPhoto *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChatEditPhoto) { +inline const MTPDmessageActionChatEditTitle &MTPmessageAction::c_messageActionChatEditTitle() const { + t_assert(data != nullptr && _type == mtpc_messageActionChatEditTitle); + return static_cast(*data); } -inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatAddUser *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChatAddUser) { +inline MTPmessageAction::MTPmessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageActionChatEditTitle) { } -inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatDeleteUser *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChatDeleteUser) { +inline const MTPDmessageActionChatEditPhoto &MTPmessageAction::c_messageActionChatEditPhoto() const { + t_assert(data != nullptr && _type == mtpc_messageActionChatEditPhoto); + return static_cast(*data); } -inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatJoinedByLink *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChatJoinedByLink) { +inline MTPmessageAction::MTPmessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageActionChatEditPhoto) { } -inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChannelCreate *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChannelCreate) { +inline const MTPDmessageActionChatAddUser &MTPmessageAction::c_messageActionChatAddUser() const { + t_assert(data != nullptr && _type == mtpc_messageActionChatAddUser); + return static_cast(*data); } -inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatMigrateTo *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChatMigrateTo) { +inline MTPmessageAction::MTPmessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageActionChatAddUser) { } -inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChannelMigrateFrom *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChannelMigrateFrom) { +inline const MTPDmessageActionChatDeleteUser &MTPmessageAction::c_messageActionChatDeleteUser() const { + t_assert(data != nullptr && _type == mtpc_messageActionChatDeleteUser); + return static_cast(*data); } -inline MTPmessageAction::MTPmessageAction(MTPDmessageActionGameScore *_data) : mtpDataOwner(_data), _type(mtpc_messageActionGameScore) { +inline MTPmessageAction::MTPmessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageActionChatDeleteUser) { } -inline MTPmessageAction::MTPmessageAction(MTPDmessageActionPhoneCall *_data) : mtpDataOwner(_data), _type(mtpc_messageActionPhoneCall) { +inline const MTPDmessageActionChatJoinedByLink &MTPmessageAction::c_messageActionChatJoinedByLink() const { + t_assert(data != nullptr && _type == mtpc_messageActionChatJoinedByLink); + return static_cast(*data); +} +inline MTPmessageAction::MTPmessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageActionChatJoinedByLink) { +} +inline const MTPDmessageActionChannelCreate &MTPmessageAction::c_messageActionChannelCreate() const { + t_assert(data != nullptr && _type == mtpc_messageActionChannelCreate); + return static_cast(*data); +} +inline MTPmessageAction::MTPmessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageActionChannelCreate) { +} +inline const MTPDmessageActionChatMigrateTo &MTPmessageAction::c_messageActionChatMigrateTo() const { + t_assert(data != nullptr && _type == mtpc_messageActionChatMigrateTo); + return static_cast(*data); +} +inline MTPmessageAction::MTPmessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageActionChatMigrateTo) { +} +inline const MTPDmessageActionChannelMigrateFrom &MTPmessageAction::c_messageActionChannelMigrateFrom() const { + t_assert(data != nullptr && _type == mtpc_messageActionChannelMigrateFrom); + return static_cast(*data); +} +inline MTPmessageAction::MTPmessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageActionChannelMigrateFrom) { +} +inline const MTPDmessageActionGameScore &MTPmessageAction::c_messageActionGameScore() const { + t_assert(data != nullptr && _type == mtpc_messageActionGameScore); + return static_cast(*data); +} +inline MTPmessageAction::MTPmessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageActionGameScore) { +} +inline const MTPDmessageActionPhoneCall &MTPmessageAction::c_messageActionPhoneCall() const { + t_assert(data != nullptr && _type == mtpc_messageActionPhoneCall); + return static_cast(*data); +} +inline MTPmessageAction::MTPmessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageActionPhoneCall) { } inline MTPmessageAction MTP_messageActionEmpty() { return MTP::internal::TypeCreator::new_messageActionEmpty(); @@ -30512,7 +27299,7 @@ inline MTPmessageAction MTP_messageActionPhoneCall(const MTPflags()) { } inline uint32 MTPdialog::innerLength() const { @@ -30525,20 +27312,20 @@ inline mtpTypeId MTPdialog::type() const { inline void MTPdialog::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_dialog) throw mtpErrorUnexpected(cons, "MTPdialog"); - if (!data) setData(new MTPDdialog()); - MTPDdialog &v(_dialog()); - v.vflags.read(from, end); - v.vpeer.read(from, end); - v.vtop_message.read(from, end); - v.vread_inbox_max_id.read(from, end); - v.vread_outbox_max_id.read(from, end); - v.vunread_count.read(from, end); - v.vnotify_settings.read(from, end); - if (v.has_pts()) { v.vpts.read(from, end); } else { v.vpts = MTPint(); } - if (v.has_draft()) { v.vdraft.read(from, end); } else { v.vdraft = MTPDraftMessage(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vpeer.read(from, end); + v->vtop_message.read(from, end); + v->vread_inbox_max_id.read(from, end); + v->vread_outbox_max_id.read(from, end); + v->vunread_count.read(from, end); + v->vnotify_settings.read(from, end); + if (v->has_pts()) { v->vpts.read(from, end); } else { v->vpts = MTPint(); } + if (v->has_draft()) { v->vdraft.read(from, end); } else { v->vdraft = MTPDraftMessage(); } + data = std::move(v); } inline void MTPdialog::write(mtpBuffer &to) const { - const MTPDdialog &v(c_dialog()); + auto &v = c_dialog(); v.vflags.write(to); v.vpeer.write(to); v.vtop_message.write(to); @@ -30549,7 +27336,11 @@ inline void MTPdialog::write(mtpBuffer &to) const { if (v.has_pts()) v.vpts.write(to); if (v.has_draft()) v.vdraft.write(to); } -inline MTPdialog::MTPdialog(MTPDdialog *_data) : mtpDataOwner(_data) { +inline const MTPDdialog &MTPdialog::c_dialog() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPdialog::MTPdialog(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDdialog::Flags) inline MTPdialog MTP_dialog(const MTPflags &_flags, const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts, const MTPDraftMessage &_draft) { @@ -30574,21 +27365,21 @@ inline mtpTypeId MTPphoto::type() const { return _type; } inline void MTPphoto::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_photoEmpty: _type = cons; { - if (!data) setData(new MTPDphotoEmpty()); - MTPDphotoEmpty &v(_photoEmpty()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; case mtpc_photo: _type = cons; { - if (!data) setData(new MTPDphoto()); - MTPDphoto &v(_photo()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vdate.read(from, end); - v.vsizes.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vdate.read(from, end); + v->vsizes.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPphoto"); } @@ -30596,11 +27387,11 @@ inline void MTPphoto::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId inline void MTPphoto::write(mtpBuffer &to) const { switch (_type) { case mtpc_photoEmpty: { - const MTPDphotoEmpty &v(c_photoEmpty()); + auto &v = c_photoEmpty(); v.vid.write(to); } break; case mtpc_photo: { - const MTPDphoto &v(c_photo()); + auto &v = c_photo(); v.vflags.write(to); v.vid.write(to); v.vaccess_hash.write(to); @@ -30609,16 +27400,24 @@ inline void MTPphoto::write(mtpBuffer &to) const { } break; } } -inline MTPphoto::MTPphoto(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPphoto::MTPphoto(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_photoEmpty: setData(new MTPDphotoEmpty()); break; - case mtpc_photo: setData(new MTPDphoto()); break; + case mtpc_photoEmpty: data = std::make_shared(); break; + case mtpc_photo: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPphoto"); } } -inline MTPphoto::MTPphoto(MTPDphotoEmpty *_data) : mtpDataOwner(_data), _type(mtpc_photoEmpty) { +inline const MTPDphotoEmpty &MTPphoto::c_photoEmpty() const { + t_assert(data != nullptr && _type == mtpc_photoEmpty); + return static_cast(*data); } -inline MTPphoto::MTPphoto(MTPDphoto *_data) : mtpDataOwner(_data), _type(mtpc_photo) { +inline MTPphoto::MTPphoto(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_photoEmpty) { +} +inline const MTPDphoto &MTPphoto::c_photo() const { + t_assert(data != nullptr && _type == mtpc_photo); + return static_cast(*data); +} +inline MTPphoto::MTPphoto(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_photo) { } inline MTPphoto MTP_photoEmpty(const MTPlong &_id) { return MTP::internal::TypeCreator::new_photoEmpty(_id); @@ -30650,30 +27449,30 @@ inline mtpTypeId MTPphotoSize::type() const { return _type; } inline void MTPphotoSize::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_photoSizeEmpty: _type = cons; { - if (!data) setData(new MTPDphotoSizeEmpty()); - MTPDphotoSizeEmpty &v(_photoSizeEmpty()); - v.vtype.read(from, end); + auto v = std::make_shared(); + v->vtype.read(from, end); + data = std::move(v); } break; case mtpc_photoSize: _type = cons; { - if (!data) setData(new MTPDphotoSize()); - MTPDphotoSize &v(_photoSize()); - v.vtype.read(from, end); - v.vlocation.read(from, end); - v.vw.read(from, end); - v.vh.read(from, end); - v.vsize.read(from, end); + auto v = std::make_shared(); + v->vtype.read(from, end); + v->vlocation.read(from, end); + v->vw.read(from, end); + v->vh.read(from, end); + v->vsize.read(from, end); + data = std::move(v); } break; case mtpc_photoCachedSize: _type = cons; { - if (!data) setData(new MTPDphotoCachedSize()); - MTPDphotoCachedSize &v(_photoCachedSize()); - v.vtype.read(from, end); - v.vlocation.read(from, end); - v.vw.read(from, end); - v.vh.read(from, end); - v.vbytes.read(from, end); + auto v = std::make_shared(); + v->vtype.read(from, end); + v->vlocation.read(from, end); + v->vw.read(from, end); + v->vh.read(from, end); + v->vbytes.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPphotoSize"); } @@ -30681,11 +27480,11 @@ inline void MTPphotoSize::read(const mtpPrime *&from, const mtpPrime *end, mtpTy inline void MTPphotoSize::write(mtpBuffer &to) const { switch (_type) { case mtpc_photoSizeEmpty: { - const MTPDphotoSizeEmpty &v(c_photoSizeEmpty()); + auto &v = c_photoSizeEmpty(); v.vtype.write(to); } break; case mtpc_photoSize: { - const MTPDphotoSize &v(c_photoSize()); + auto &v = c_photoSize(); v.vtype.write(to); v.vlocation.write(to); v.vw.write(to); @@ -30693,7 +27492,7 @@ inline void MTPphotoSize::write(mtpBuffer &to) const { v.vsize.write(to); } break; case mtpc_photoCachedSize: { - const MTPDphotoCachedSize &v(c_photoCachedSize()); + auto &v = c_photoCachedSize(); v.vtype.write(to); v.vlocation.write(to); v.vw.write(to); @@ -30702,19 +27501,31 @@ inline void MTPphotoSize::write(mtpBuffer &to) const { } break; } } -inline MTPphotoSize::MTPphotoSize(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPphotoSize::MTPphotoSize(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_photoSizeEmpty: setData(new MTPDphotoSizeEmpty()); break; - case mtpc_photoSize: setData(new MTPDphotoSize()); break; - case mtpc_photoCachedSize: setData(new MTPDphotoCachedSize()); break; + case mtpc_photoSizeEmpty: data = std::make_shared(); break; + case mtpc_photoSize: data = std::make_shared(); break; + case mtpc_photoCachedSize: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPphotoSize"); } } -inline MTPphotoSize::MTPphotoSize(MTPDphotoSizeEmpty *_data) : mtpDataOwner(_data), _type(mtpc_photoSizeEmpty) { +inline const MTPDphotoSizeEmpty &MTPphotoSize::c_photoSizeEmpty() const { + t_assert(data != nullptr && _type == mtpc_photoSizeEmpty); + return static_cast(*data); } -inline MTPphotoSize::MTPphotoSize(MTPDphotoSize *_data) : mtpDataOwner(_data), _type(mtpc_photoSize) { +inline MTPphotoSize::MTPphotoSize(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_photoSizeEmpty) { } -inline MTPphotoSize::MTPphotoSize(MTPDphotoCachedSize *_data) : mtpDataOwner(_data), _type(mtpc_photoCachedSize) { +inline const MTPDphotoSize &MTPphotoSize::c_photoSize() const { + t_assert(data != nullptr && _type == mtpc_photoSize); + return static_cast(*data); +} +inline MTPphotoSize::MTPphotoSize(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_photoSize) { +} +inline const MTPDphotoCachedSize &MTPphotoSize::c_photoCachedSize() const { + t_assert(data != nullptr && _type == mtpc_photoCachedSize); + return static_cast(*data); +} +inline MTPphotoSize::MTPphotoSize(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_photoCachedSize) { } inline MTPphotoSize MTP_photoSizeEmpty(const MTPstring &_type) { return MTP::internal::TypeCreator::new_photoSizeEmpty(_type); @@ -30740,14 +27551,14 @@ inline mtpTypeId MTPgeoPoint::type() const { return _type; } inline void MTPgeoPoint::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_geoPointEmpty: _type = cons; break; case mtpc_geoPoint: _type = cons; { - if (!data) setData(new MTPDgeoPoint()); - MTPDgeoPoint &v(_geoPoint()); - v.vlong.read(from, end); - v.vlat.read(from, end); + auto v = std::make_shared(); + v->vlong.read(from, end); + v->vlat.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPgeoPoint"); } @@ -30755,20 +27566,24 @@ inline void MTPgeoPoint::read(const mtpPrime *&from, const mtpPrime *end, mtpTyp inline void MTPgeoPoint::write(mtpBuffer &to) const { switch (_type) { case mtpc_geoPoint: { - const MTPDgeoPoint &v(c_geoPoint()); + auto &v = c_geoPoint(); v.vlong.write(to); v.vlat.write(to); } break; } } -inline MTPgeoPoint::MTPgeoPoint(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPgeoPoint::MTPgeoPoint(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_geoPointEmpty: break; - case mtpc_geoPoint: setData(new MTPDgeoPoint()); break; + case mtpc_geoPoint: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPgeoPoint"); } } -inline MTPgeoPoint::MTPgeoPoint(MTPDgeoPoint *_data) : mtpDataOwner(_data), _type(mtpc_geoPoint) { +inline const MTPDgeoPoint &MTPgeoPoint::c_geoPoint() const { + t_assert(data != nullptr && _type == mtpc_geoPoint); + return static_cast(*data); +} +inline MTPgeoPoint::MTPgeoPoint(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_geoPoint) { } inline MTPgeoPoint MTP_geoPointEmpty() { return MTP::internal::TypeCreator::new_geoPointEmpty(); @@ -30777,7 +27592,7 @@ inline MTPgeoPoint MTP_geoPoint(const MTPdouble &_long, const MTPdouble &_lat) { return MTP::internal::TypeCreator::new_geoPoint(_long, _lat); } -inline MTPauth_checkedPhone::MTPauth_checkedPhone() : mtpDataOwner(new MTPDauth_checkedPhone()) { +inline MTPauth_checkedPhone::MTPauth_checkedPhone() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPauth_checkedPhone::innerLength() const { @@ -30790,21 +27605,25 @@ inline mtpTypeId MTPauth_checkedPhone::type() const { inline void MTPauth_checkedPhone::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_auth_checkedPhone) throw mtpErrorUnexpected(cons, "MTPauth_checkedPhone"); - if (!data) setData(new MTPDauth_checkedPhone()); - MTPDauth_checkedPhone &v(_auth_checkedPhone()); - v.vphone_registered.read(from, end); + auto v = std::make_shared(); + v->vphone_registered.read(from, end); + data = std::move(v); } inline void MTPauth_checkedPhone::write(mtpBuffer &to) const { - const MTPDauth_checkedPhone &v(c_auth_checkedPhone()); + auto &v = c_auth_checkedPhone(); v.vphone_registered.write(to); } -inline MTPauth_checkedPhone::MTPauth_checkedPhone(MTPDauth_checkedPhone *_data) : mtpDataOwner(_data) { +inline const MTPDauth_checkedPhone &MTPauth_checkedPhone::c_auth_checkedPhone() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPauth_checkedPhone::MTPauth_checkedPhone(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPauth_checkedPhone MTP_auth_checkedPhone(MTPBool _phone_registered) { return MTP::internal::TypeCreator::new_auth_checkedPhone(_phone_registered); } -inline MTPauth_sentCode::MTPauth_sentCode() : mtpDataOwner(new MTPDauth_sentCode()) { +inline MTPauth_sentCode::MTPauth_sentCode() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPauth_sentCode::innerLength() const { @@ -30817,30 +27636,34 @@ inline mtpTypeId MTPauth_sentCode::type() const { inline void MTPauth_sentCode::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_auth_sentCode) throw mtpErrorUnexpected(cons, "MTPauth_sentCode"); - if (!data) setData(new MTPDauth_sentCode()); - MTPDauth_sentCode &v(_auth_sentCode()); - v.vflags.read(from, end); - v.vtype.read(from, end); - v.vphone_code_hash.read(from, end); - if (v.has_next_type()) { v.vnext_type.read(from, end); } else { v.vnext_type = MTPauth_CodeType(); } - if (v.has_timeout()) { v.vtimeout.read(from, end); } else { v.vtimeout = MTPint(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vtype.read(from, end); + v->vphone_code_hash.read(from, end); + if (v->has_next_type()) { v->vnext_type.read(from, end); } else { v->vnext_type = MTPauth_CodeType(); } + if (v->has_timeout()) { v->vtimeout.read(from, end); } else { v->vtimeout = MTPint(); } + data = std::move(v); } inline void MTPauth_sentCode::write(mtpBuffer &to) const { - const MTPDauth_sentCode &v(c_auth_sentCode()); + auto &v = c_auth_sentCode(); v.vflags.write(to); v.vtype.write(to); v.vphone_code_hash.write(to); if (v.has_next_type()) v.vnext_type.write(to); if (v.has_timeout()) v.vtimeout.write(to); } -inline MTPauth_sentCode::MTPauth_sentCode(MTPDauth_sentCode *_data) : mtpDataOwner(_data) { +inline const MTPDauth_sentCode &MTPauth_sentCode::c_auth_sentCode() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPauth_sentCode::MTPauth_sentCode(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDauth_sentCode::Flags) inline MTPauth_sentCode MTP_auth_sentCode(const MTPflags &_flags, const MTPauth_SentCodeType &_type, const MTPstring &_phone_code_hash, const MTPauth_CodeType &_next_type, MTPint _timeout) { return MTP::internal::TypeCreator::new_auth_sentCode(_flags, _type, _phone_code_hash, _next_type, _timeout); } -inline MTPauth_authorization::MTPauth_authorization() : mtpDataOwner(new MTPDauth_authorization()) { +inline MTPauth_authorization::MTPauth_authorization() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPauth_authorization::innerLength() const { @@ -30853,26 +27676,30 @@ inline mtpTypeId MTPauth_authorization::type() const { inline void MTPauth_authorization::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_auth_authorization) throw mtpErrorUnexpected(cons, "MTPauth_authorization"); - if (!data) setData(new MTPDauth_authorization()); - MTPDauth_authorization &v(_auth_authorization()); - v.vflags.read(from, end); - if (v.has_tmp_sessions()) { v.vtmp_sessions.read(from, end); } else { v.vtmp_sessions = MTPint(); } - v.vuser.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + if (v->has_tmp_sessions()) { v->vtmp_sessions.read(from, end); } else { v->vtmp_sessions = MTPint(); } + v->vuser.read(from, end); + data = std::move(v); } inline void MTPauth_authorization::write(mtpBuffer &to) const { - const MTPDauth_authorization &v(c_auth_authorization()); + auto &v = c_auth_authorization(); v.vflags.write(to); if (v.has_tmp_sessions()) v.vtmp_sessions.write(to); v.vuser.write(to); } -inline MTPauth_authorization::MTPauth_authorization(MTPDauth_authorization *_data) : mtpDataOwner(_data) { +inline const MTPDauth_authorization &MTPauth_authorization::c_auth_authorization() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPauth_authorization::MTPauth_authorization(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDauth_authorization::Flags) inline MTPauth_authorization MTP_auth_authorization(const MTPflags &_flags, MTPint _tmp_sessions, const MTPUser &_user) { return MTP::internal::TypeCreator::new_auth_authorization(_flags, _tmp_sessions, _user); } -inline MTPauth_exportedAuthorization::MTPauth_exportedAuthorization() : mtpDataOwner(new MTPDauth_exportedAuthorization()) { +inline MTPauth_exportedAuthorization::MTPauth_exportedAuthorization() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPauth_exportedAuthorization::innerLength() const { @@ -30885,17 +27712,21 @@ inline mtpTypeId MTPauth_exportedAuthorization::type() const { inline void MTPauth_exportedAuthorization::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_auth_exportedAuthorization) throw mtpErrorUnexpected(cons, "MTPauth_exportedAuthorization"); - if (!data) setData(new MTPDauth_exportedAuthorization()); - MTPDauth_exportedAuthorization &v(_auth_exportedAuthorization()); - v.vid.read(from, end); - v.vbytes.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vbytes.read(from, end); + data = std::move(v); } inline void MTPauth_exportedAuthorization::write(mtpBuffer &to) const { - const MTPDauth_exportedAuthorization &v(c_auth_exportedAuthorization()); + auto &v = c_auth_exportedAuthorization(); v.vid.write(to); v.vbytes.write(to); } -inline MTPauth_exportedAuthorization::MTPauth_exportedAuthorization(MTPDauth_exportedAuthorization *_data) : mtpDataOwner(_data) { +inline const MTPDauth_exportedAuthorization &MTPauth_exportedAuthorization::c_auth_exportedAuthorization() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPauth_exportedAuthorization::MTPauth_exportedAuthorization(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPauth_exportedAuthorization MTP_auth_exportedAuthorization(MTPint _id, const MTPbytes &_bytes) { return MTP::internal::TypeCreator::new_auth_exportedAuthorization(_id, _bytes); @@ -30915,12 +27746,12 @@ inline mtpTypeId MTPinputNotifyPeer::type() const { return _type; } inline void MTPinputNotifyPeer::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputNotifyPeer: _type = cons; { - if (!data) setData(new MTPDinputNotifyPeer()); - MTPDinputNotifyPeer &v(_inputNotifyPeer()); - v.vpeer.read(from, end); + auto v = std::make_shared(); + v->vpeer.read(from, end); + data = std::move(v); } break; case mtpc_inputNotifyUsers: _type = cons; break; case mtpc_inputNotifyChats: _type = cons; break; @@ -30931,21 +27762,25 @@ inline void MTPinputNotifyPeer::read(const mtpPrime *&from, const mtpPrime *end, inline void MTPinputNotifyPeer::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputNotifyPeer: { - const MTPDinputNotifyPeer &v(c_inputNotifyPeer()); + auto &v = c_inputNotifyPeer(); v.vpeer.write(to); } break; } } -inline MTPinputNotifyPeer::MTPinputNotifyPeer(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputNotifyPeer::MTPinputNotifyPeer(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_inputNotifyPeer: setData(new MTPDinputNotifyPeer()); break; + case mtpc_inputNotifyPeer: data = std::make_shared(); break; case mtpc_inputNotifyUsers: break; case mtpc_inputNotifyChats: break; case mtpc_inputNotifyAll: break; default: throw mtpErrorBadTypeId(type, "MTPinputNotifyPeer"); } } -inline MTPinputNotifyPeer::MTPinputNotifyPeer(MTPDinputNotifyPeer *_data) : mtpDataOwner(_data), _type(mtpc_inputNotifyPeer) { +inline const MTPDinputNotifyPeer &MTPinputNotifyPeer::c_inputNotifyPeer() const { + t_assert(data != nullptr && _type == mtpc_inputNotifyPeer); + return static_cast(*data); +} +inline MTPinputNotifyPeer::MTPinputNotifyPeer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputNotifyPeer) { } inline MTPinputNotifyPeer MTP_inputNotifyPeer(const MTPInputPeer &_peer) { return MTP::internal::TypeCreator::new_inputNotifyPeer(_peer); @@ -30990,7 +27825,7 @@ inline MTPinputPeerNotifyEvents MTP_inputPeerNotifyEventsAll() { return MTP::internal::TypeCreator::new_inputPeerNotifyEventsAll(); } -inline MTPinputPeerNotifySettings::MTPinputPeerNotifySettings() : mtpDataOwner(new MTPDinputPeerNotifySettings()) { +inline MTPinputPeerNotifySettings::MTPinputPeerNotifySettings() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPinputPeerNotifySettings::innerLength() const { @@ -31003,19 +27838,23 @@ inline mtpTypeId MTPinputPeerNotifySettings::type() const { inline void MTPinputPeerNotifySettings::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_inputPeerNotifySettings) throw mtpErrorUnexpected(cons, "MTPinputPeerNotifySettings"); - if (!data) setData(new MTPDinputPeerNotifySettings()); - MTPDinputPeerNotifySettings &v(_inputPeerNotifySettings()); - v.vflags.read(from, end); - v.vmute_until.read(from, end); - v.vsound.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vmute_until.read(from, end); + v->vsound.read(from, end); + data = std::move(v); } inline void MTPinputPeerNotifySettings::write(mtpBuffer &to) const { - const MTPDinputPeerNotifySettings &v(c_inputPeerNotifySettings()); + auto &v = c_inputPeerNotifySettings(); v.vflags.write(to); v.vmute_until.write(to); v.vsound.write(to); } -inline MTPinputPeerNotifySettings::MTPinputPeerNotifySettings(MTPDinputPeerNotifySettings *_data) : mtpDataOwner(_data) { +inline const MTPDinputPeerNotifySettings &MTPinputPeerNotifySettings::c_inputPeerNotifySettings() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPinputPeerNotifySettings::MTPinputPeerNotifySettings(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputPeerNotifySettings::Flags) inline MTPinputPeerNotifySettings MTP_inputPeerNotifySettings(const MTPflags &_flags, MTPint _mute_until, const MTPstring &_sound) { @@ -31066,15 +27905,15 @@ inline mtpTypeId MTPpeerNotifySettings::type() const { return _type; } inline void MTPpeerNotifySettings::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_peerNotifySettingsEmpty: _type = cons; break; case mtpc_peerNotifySettings: _type = cons; { - if (!data) setData(new MTPDpeerNotifySettings()); - MTPDpeerNotifySettings &v(_peerNotifySettings()); - v.vflags.read(from, end); - v.vmute_until.read(from, end); - v.vsound.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vmute_until.read(from, end); + v->vsound.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPpeerNotifySettings"); } @@ -31082,21 +27921,25 @@ inline void MTPpeerNotifySettings::read(const mtpPrime *&from, const mtpPrime *e inline void MTPpeerNotifySettings::write(mtpBuffer &to) const { switch (_type) { case mtpc_peerNotifySettings: { - const MTPDpeerNotifySettings &v(c_peerNotifySettings()); + auto &v = c_peerNotifySettings(); v.vflags.write(to); v.vmute_until.write(to); v.vsound.write(to); } break; } } -inline MTPpeerNotifySettings::MTPpeerNotifySettings(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPpeerNotifySettings::MTPpeerNotifySettings(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_peerNotifySettingsEmpty: break; - case mtpc_peerNotifySettings: setData(new MTPDpeerNotifySettings()); break; + case mtpc_peerNotifySettings: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPpeerNotifySettings"); } } -inline MTPpeerNotifySettings::MTPpeerNotifySettings(MTPDpeerNotifySettings *_data) : mtpDataOwner(_data), _type(mtpc_peerNotifySettings) { +inline const MTPDpeerNotifySettings &MTPpeerNotifySettings::c_peerNotifySettings() const { + t_assert(data != nullptr && _type == mtpc_peerNotifySettings); + return static_cast(*data); +} +inline MTPpeerNotifySettings::MTPpeerNotifySettings(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_peerNotifySettings) { } inline MTPpeerNotifySettings MTP_peerNotifySettingsEmpty() { return MTP::internal::TypeCreator::new_peerNotifySettingsEmpty(); @@ -31106,7 +27949,7 @@ inline MTPpeerNotifySettings MTP_peerNotifySettings(const MTPflags()) { } inline uint32 MTPpeerSettings::innerLength() const { @@ -31119,15 +27962,19 @@ inline mtpTypeId MTPpeerSettings::type() const { inline void MTPpeerSettings::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_peerSettings) throw mtpErrorUnexpected(cons, "MTPpeerSettings"); - if (!data) setData(new MTPDpeerSettings()); - MTPDpeerSettings &v(_peerSettings()); - v.vflags.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + data = std::move(v); } inline void MTPpeerSettings::write(mtpBuffer &to) const { - const MTPDpeerSettings &v(c_peerSettings()); + auto &v = c_peerSettings(); v.vflags.write(to); } -inline MTPpeerSettings::MTPpeerSettings(MTPDpeerSettings *_data) : mtpDataOwner(_data) { +inline const MTPDpeerSettings &MTPpeerSettings::c_peerSettings() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPpeerSettings::MTPpeerSettings(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDpeerSettings::Flags) inline MTPpeerSettings MTP_peerSettings(const MTPflags &_flags) { @@ -31152,23 +27999,23 @@ inline mtpTypeId MTPwallPaper::type() const { return _type; } inline void MTPwallPaper::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_wallPaper: _type = cons; { - if (!data) setData(new MTPDwallPaper()); - MTPDwallPaper &v(_wallPaper()); - v.vid.read(from, end); - v.vtitle.read(from, end); - v.vsizes.read(from, end); - v.vcolor.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vtitle.read(from, end); + v->vsizes.read(from, end); + v->vcolor.read(from, end); + data = std::move(v); } break; case mtpc_wallPaperSolid: _type = cons; { - if (!data) setData(new MTPDwallPaperSolid()); - MTPDwallPaperSolid &v(_wallPaperSolid()); - v.vid.read(from, end); - v.vtitle.read(from, end); - v.vbg_color.read(from, end); - v.vcolor.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vtitle.read(from, end); + v->vbg_color.read(from, end); + v->vcolor.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPwallPaper"); } @@ -31176,14 +28023,14 @@ inline void MTPwallPaper::read(const mtpPrime *&from, const mtpPrime *end, mtpTy inline void MTPwallPaper::write(mtpBuffer &to) const { switch (_type) { case mtpc_wallPaper: { - const MTPDwallPaper &v(c_wallPaper()); + auto &v = c_wallPaper(); v.vid.write(to); v.vtitle.write(to); v.vsizes.write(to); v.vcolor.write(to); } break; case mtpc_wallPaperSolid: { - const MTPDwallPaperSolid &v(c_wallPaperSolid()); + auto &v = c_wallPaperSolid(); v.vid.write(to); v.vtitle.write(to); v.vbg_color.write(to); @@ -31191,16 +28038,24 @@ inline void MTPwallPaper::write(mtpBuffer &to) const { } break; } } -inline MTPwallPaper::MTPwallPaper(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPwallPaper::MTPwallPaper(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_wallPaper: setData(new MTPDwallPaper()); break; - case mtpc_wallPaperSolid: setData(new MTPDwallPaperSolid()); break; + case mtpc_wallPaper: data = std::make_shared(); break; + case mtpc_wallPaperSolid: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPwallPaper"); } } -inline MTPwallPaper::MTPwallPaper(MTPDwallPaper *_data) : mtpDataOwner(_data), _type(mtpc_wallPaper) { +inline const MTPDwallPaper &MTPwallPaper::c_wallPaper() const { + t_assert(data != nullptr && _type == mtpc_wallPaper); + return static_cast(*data); } -inline MTPwallPaper::MTPwallPaper(MTPDwallPaperSolid *_data) : mtpDataOwner(_data), _type(mtpc_wallPaperSolid) { +inline MTPwallPaper::MTPwallPaper(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_wallPaper) { +} +inline const MTPDwallPaperSolid &MTPwallPaper::c_wallPaperSolid() const { + t_assert(data != nullptr && _type == mtpc_wallPaperSolid); + return static_cast(*data); +} +inline MTPwallPaper::MTPwallPaper(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_wallPaperSolid) { } inline MTPwallPaper MTP_wallPaper(MTPint _id, const MTPstring &_title, const MTPVector &_sizes, MTPint _color) { return MTP::internal::TypeCreator::new_wallPaper(_id, _title, _sizes, _color); @@ -31223,15 +28078,15 @@ inline mtpTypeId MTPreportReason::type() const { return _type; } inline void MTPreportReason::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputReportReasonSpam: _type = cons; break; case mtpc_inputReportReasonViolence: _type = cons; break; case mtpc_inputReportReasonPornography: _type = cons; break; case mtpc_inputReportReasonOther: _type = cons; { - if (!data) setData(new MTPDinputReportReasonOther()); - MTPDinputReportReasonOther &v(_inputReportReasonOther()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPreportReason"); } @@ -31239,21 +28094,25 @@ inline void MTPreportReason::read(const mtpPrime *&from, const mtpPrime *end, mt inline void MTPreportReason::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputReportReasonOther: { - const MTPDinputReportReasonOther &v(c_inputReportReasonOther()); + auto &v = c_inputReportReasonOther(); v.vtext.write(to); } break; } } -inline MTPreportReason::MTPreportReason(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPreportReason::MTPreportReason(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputReportReasonSpam: break; case mtpc_inputReportReasonViolence: break; case mtpc_inputReportReasonPornography: break; - case mtpc_inputReportReasonOther: setData(new MTPDinputReportReasonOther()); break; + case mtpc_inputReportReasonOther: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPreportReason"); } } -inline MTPreportReason::MTPreportReason(MTPDinputReportReasonOther *_data) : mtpDataOwner(_data), _type(mtpc_inputReportReasonOther) { +inline const MTPDinputReportReasonOther &MTPreportReason::c_inputReportReasonOther() const { + t_assert(data != nullptr && _type == mtpc_inputReportReasonOther); + return static_cast(*data); +} +inline MTPreportReason::MTPreportReason(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputReportReasonOther) { } inline MTPreportReason MTP_inputReportReasonSpam() { return MTP::internal::TypeCreator::new_inputReportReasonSpam(); @@ -31268,7 +28127,7 @@ inline MTPreportReason MTP_inputReportReasonOther(const MTPstring &_text) { return MTP::internal::TypeCreator::new_inputReportReasonOther(_text); } -inline MTPuserFull::MTPuserFull() : mtpDataOwner(new MTPDuserFull()) { +inline MTPuserFull::MTPuserFull() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPuserFull::innerLength() const { @@ -31281,19 +28140,19 @@ inline mtpTypeId MTPuserFull::type() const { inline void MTPuserFull::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_userFull) throw mtpErrorUnexpected(cons, "MTPuserFull"); - if (!data) setData(new MTPDuserFull()); - MTPDuserFull &v(_userFull()); - v.vflags.read(from, end); - v.vuser.read(from, end); - if (v.has_about()) { v.vabout.read(from, end); } else { v.vabout = MTPstring(); } - v.vlink.read(from, end); - if (v.has_profile_photo()) { v.vprofile_photo.read(from, end); } else { v.vprofile_photo = MTPPhoto(); } - v.vnotify_settings.read(from, end); - if (v.has_bot_info()) { v.vbot_info.read(from, end); } else { v.vbot_info = MTPBotInfo(); } - v.vcommon_chats_count.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vuser.read(from, end); + if (v->has_about()) { v->vabout.read(from, end); } else { v->vabout = MTPstring(); } + v->vlink.read(from, end); + if (v->has_profile_photo()) { v->vprofile_photo.read(from, end); } else { v->vprofile_photo = MTPPhoto(); } + v->vnotify_settings.read(from, end); + if (v->has_bot_info()) { v->vbot_info.read(from, end); } else { v->vbot_info = MTPBotInfo(); } + v->vcommon_chats_count.read(from, end); + data = std::move(v); } inline void MTPuserFull::write(mtpBuffer &to) const { - const MTPDuserFull &v(c_userFull()); + auto &v = c_userFull(); v.vflags.write(to); v.vuser.write(to); if (v.has_about()) v.vabout.write(to); @@ -31303,14 +28162,18 @@ inline void MTPuserFull::write(mtpBuffer &to) const { if (v.has_bot_info()) v.vbot_info.write(to); v.vcommon_chats_count.write(to); } -inline MTPuserFull::MTPuserFull(MTPDuserFull *_data) : mtpDataOwner(_data) { +inline const MTPDuserFull &MTPuserFull::c_userFull() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPuserFull::MTPuserFull(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDuserFull::Flags) inline MTPuserFull MTP_userFull(const MTPflags &_flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info, MTPint _common_chats_count) { return MTP::internal::TypeCreator::new_userFull(_flags, _user, _about, _link, _profile_photo, _notify_settings, _bot_info, _common_chats_count); } -inline MTPcontact::MTPcontact() : mtpDataOwner(new MTPDcontact()) { +inline MTPcontact::MTPcontact() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPcontact::innerLength() const { @@ -31323,23 +28186,27 @@ inline mtpTypeId MTPcontact::type() const { inline void MTPcontact::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_contact) throw mtpErrorUnexpected(cons, "MTPcontact"); - if (!data) setData(new MTPDcontact()); - MTPDcontact &v(_contact()); - v.vuser_id.read(from, end); - v.vmutual.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vmutual.read(from, end); + data = std::move(v); } inline void MTPcontact::write(mtpBuffer &to) const { - const MTPDcontact &v(c_contact()); + auto &v = c_contact(); v.vuser_id.write(to); v.vmutual.write(to); } -inline MTPcontact::MTPcontact(MTPDcontact *_data) : mtpDataOwner(_data) { +inline const MTPDcontact &MTPcontact::c_contact() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPcontact::MTPcontact(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPcontact MTP_contact(MTPint _user_id, MTPBool _mutual) { return MTP::internal::TypeCreator::new_contact(_user_id, _mutual); } -inline MTPimportedContact::MTPimportedContact() : mtpDataOwner(new MTPDimportedContact()) { +inline MTPimportedContact::MTPimportedContact() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPimportedContact::innerLength() const { @@ -31352,23 +28219,27 @@ inline mtpTypeId MTPimportedContact::type() const { inline void MTPimportedContact::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_importedContact) throw mtpErrorUnexpected(cons, "MTPimportedContact"); - if (!data) setData(new MTPDimportedContact()); - MTPDimportedContact &v(_importedContact()); - v.vuser_id.read(from, end); - v.vclient_id.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vclient_id.read(from, end); + data = std::move(v); } inline void MTPimportedContact::write(mtpBuffer &to) const { - const MTPDimportedContact &v(c_importedContact()); + auto &v = c_importedContact(); v.vuser_id.write(to); v.vclient_id.write(to); } -inline MTPimportedContact::MTPimportedContact(MTPDimportedContact *_data) : mtpDataOwner(_data) { +inline const MTPDimportedContact &MTPimportedContact::c_importedContact() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPimportedContact::MTPimportedContact(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPimportedContact MTP_importedContact(MTPint _user_id, const MTPlong &_client_id) { return MTP::internal::TypeCreator::new_importedContact(_user_id, _client_id); } -inline MTPcontactBlocked::MTPcontactBlocked() : mtpDataOwner(new MTPDcontactBlocked()) { +inline MTPcontactBlocked::MTPcontactBlocked() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPcontactBlocked::innerLength() const { @@ -31381,23 +28252,27 @@ inline mtpTypeId MTPcontactBlocked::type() const { inline void MTPcontactBlocked::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_contactBlocked) throw mtpErrorUnexpected(cons, "MTPcontactBlocked"); - if (!data) setData(new MTPDcontactBlocked()); - MTPDcontactBlocked &v(_contactBlocked()); - v.vuser_id.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } inline void MTPcontactBlocked::write(mtpBuffer &to) const { - const MTPDcontactBlocked &v(c_contactBlocked()); + auto &v = c_contactBlocked(); v.vuser_id.write(to); v.vdate.write(to); } -inline MTPcontactBlocked::MTPcontactBlocked(MTPDcontactBlocked *_data) : mtpDataOwner(_data) { +inline const MTPDcontactBlocked &MTPcontactBlocked::c_contactBlocked() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPcontactBlocked::MTPcontactBlocked(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPcontactBlocked MTP_contactBlocked(MTPint _user_id, MTPint _date) { return MTP::internal::TypeCreator::new_contactBlocked(_user_id, _date); } -inline MTPcontactStatus::MTPcontactStatus() : mtpDataOwner(new MTPDcontactStatus()) { +inline MTPcontactStatus::MTPcontactStatus() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPcontactStatus::innerLength() const { @@ -31410,23 +28285,27 @@ inline mtpTypeId MTPcontactStatus::type() const { inline void MTPcontactStatus::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_contactStatus) throw mtpErrorUnexpected(cons, "MTPcontactStatus"); - if (!data) setData(new MTPDcontactStatus()); - MTPDcontactStatus &v(_contactStatus()); - v.vuser_id.read(from, end); - v.vstatus.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vstatus.read(from, end); + data = std::move(v); } inline void MTPcontactStatus::write(mtpBuffer &to) const { - const MTPDcontactStatus &v(c_contactStatus()); + auto &v = c_contactStatus(); v.vuser_id.write(to); v.vstatus.write(to); } -inline MTPcontactStatus::MTPcontactStatus(MTPDcontactStatus *_data) : mtpDataOwner(_data) { +inline const MTPDcontactStatus &MTPcontactStatus::c_contactStatus() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPcontactStatus::MTPcontactStatus(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPcontactStatus MTP_contactStatus(MTPint _user_id, const MTPUserStatus &_status) { return MTP::internal::TypeCreator::new_contactStatus(_user_id, _status); } -inline MTPcontacts_link::MTPcontacts_link() : mtpDataOwner(new MTPDcontacts_link()) { +inline MTPcontacts_link::MTPcontacts_link() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPcontacts_link::innerLength() const { @@ -31439,19 +28318,23 @@ inline mtpTypeId MTPcontacts_link::type() const { inline void MTPcontacts_link::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_contacts_link) throw mtpErrorUnexpected(cons, "MTPcontacts_link"); - if (!data) setData(new MTPDcontacts_link()); - MTPDcontacts_link &v(_contacts_link()); - v.vmy_link.read(from, end); - v.vforeign_link.read(from, end); - v.vuser.read(from, end); + auto v = std::make_shared(); + v->vmy_link.read(from, end); + v->vforeign_link.read(from, end); + v->vuser.read(from, end); + data = std::move(v); } inline void MTPcontacts_link::write(mtpBuffer &to) const { - const MTPDcontacts_link &v(c_contacts_link()); + auto &v = c_contacts_link(); v.vmy_link.write(to); v.vforeign_link.write(to); v.vuser.write(to); } -inline MTPcontacts_link::MTPcontacts_link(MTPDcontacts_link *_data) : mtpDataOwner(_data) { +inline const MTPDcontacts_link &MTPcontacts_link::c_contacts_link() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPcontacts_link::MTPcontacts_link(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPcontacts_link MTP_contacts_link(const MTPContactLink &_my_link, const MTPContactLink &_foreign_link, const MTPUser &_user) { return MTP::internal::TypeCreator::new_contacts_link(_my_link, _foreign_link, _user); @@ -31471,14 +28354,14 @@ inline mtpTypeId MTPcontacts_contacts::type() const { return _type; } inline void MTPcontacts_contacts::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_contacts_contactsNotModified: _type = cons; break; case mtpc_contacts_contacts: _type = cons; { - if (!data) setData(new MTPDcontacts_contacts()); - MTPDcontacts_contacts &v(_contacts_contacts()); - v.vcontacts.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vcontacts.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPcontacts_contacts"); } @@ -31486,20 +28369,24 @@ inline void MTPcontacts_contacts::read(const mtpPrime *&from, const mtpPrime *en inline void MTPcontacts_contacts::write(mtpBuffer &to) const { switch (_type) { case mtpc_contacts_contacts: { - const MTPDcontacts_contacts &v(c_contacts_contacts()); + auto &v = c_contacts_contacts(); v.vcontacts.write(to); v.vusers.write(to); } break; } } -inline MTPcontacts_contacts::MTPcontacts_contacts(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPcontacts_contacts::MTPcontacts_contacts(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_contacts_contactsNotModified: break; - case mtpc_contacts_contacts: setData(new MTPDcontacts_contacts()); break; + case mtpc_contacts_contacts: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPcontacts_contacts"); } } -inline MTPcontacts_contacts::MTPcontacts_contacts(MTPDcontacts_contacts *_data) : mtpDataOwner(_data), _type(mtpc_contacts_contacts) { +inline const MTPDcontacts_contacts &MTPcontacts_contacts::c_contacts_contacts() const { + t_assert(data != nullptr && _type == mtpc_contacts_contacts); + return static_cast(*data); +} +inline MTPcontacts_contacts::MTPcontacts_contacts(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_contacts_contacts) { } inline MTPcontacts_contacts MTP_contacts_contactsNotModified() { return MTP::internal::TypeCreator::new_contacts_contactsNotModified(); @@ -31508,7 +28395,7 @@ inline MTPcontacts_contacts MTP_contacts_contacts(const MTPVector &_ return MTP::internal::TypeCreator::new_contacts_contacts(_contacts, _users); } -inline MTPcontacts_importedContacts::MTPcontacts_importedContacts() : mtpDataOwner(new MTPDcontacts_importedContacts()) { +inline MTPcontacts_importedContacts::MTPcontacts_importedContacts() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPcontacts_importedContacts::innerLength() const { @@ -31521,19 +28408,23 @@ inline mtpTypeId MTPcontacts_importedContacts::type() const { inline void MTPcontacts_importedContacts::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_contacts_importedContacts) throw mtpErrorUnexpected(cons, "MTPcontacts_importedContacts"); - if (!data) setData(new MTPDcontacts_importedContacts()); - MTPDcontacts_importedContacts &v(_contacts_importedContacts()); - v.vimported.read(from, end); - v.vretry_contacts.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vimported.read(from, end); + v->vretry_contacts.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } inline void MTPcontacts_importedContacts::write(mtpBuffer &to) const { - const MTPDcontacts_importedContacts &v(c_contacts_importedContacts()); + auto &v = c_contacts_importedContacts(); v.vimported.write(to); v.vretry_contacts.write(to); v.vusers.write(to); } -inline MTPcontacts_importedContacts::MTPcontacts_importedContacts(MTPDcontacts_importedContacts *_data) : mtpDataOwner(_data) { +inline const MTPDcontacts_importedContacts &MTPcontacts_importedContacts::c_contacts_importedContacts() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPcontacts_importedContacts::MTPcontacts_importedContacts(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPcontacts_importedContacts MTP_contacts_importedContacts(const MTPVector &_imported, const MTPVector &_retry_contacts, const MTPVector &_users) { return MTP::internal::TypeCreator::new_contacts_importedContacts(_imported, _retry_contacts, _users); @@ -31557,20 +28448,20 @@ inline mtpTypeId MTPcontacts_blocked::type() const { return _type; } inline void MTPcontacts_blocked::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_contacts_blocked: _type = cons; { - if (!data) setData(new MTPDcontacts_blocked()); - MTPDcontacts_blocked &v(_contacts_blocked()); - v.vblocked.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vblocked.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; case mtpc_contacts_blockedSlice: _type = cons; { - if (!data) setData(new MTPDcontacts_blockedSlice()); - MTPDcontacts_blockedSlice &v(_contacts_blockedSlice()); - v.vcount.read(from, end); - v.vblocked.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vcount.read(from, end); + v->vblocked.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPcontacts_blocked"); } @@ -31578,28 +28469,36 @@ inline void MTPcontacts_blocked::read(const mtpPrime *&from, const mtpPrime *end inline void MTPcontacts_blocked::write(mtpBuffer &to) const { switch (_type) { case mtpc_contacts_blocked: { - const MTPDcontacts_blocked &v(c_contacts_blocked()); + auto &v = c_contacts_blocked(); v.vblocked.write(to); v.vusers.write(to); } break; case mtpc_contacts_blockedSlice: { - const MTPDcontacts_blockedSlice &v(c_contacts_blockedSlice()); + auto &v = c_contacts_blockedSlice(); v.vcount.write(to); v.vblocked.write(to); v.vusers.write(to); } break; } } -inline MTPcontacts_blocked::MTPcontacts_blocked(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPcontacts_blocked::MTPcontacts_blocked(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_contacts_blocked: setData(new MTPDcontacts_blocked()); break; - case mtpc_contacts_blockedSlice: setData(new MTPDcontacts_blockedSlice()); break; + case mtpc_contacts_blocked: data = std::make_shared(); break; + case mtpc_contacts_blockedSlice: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPcontacts_blocked"); } } -inline MTPcontacts_blocked::MTPcontacts_blocked(MTPDcontacts_blocked *_data) : mtpDataOwner(_data), _type(mtpc_contacts_blocked) { +inline const MTPDcontacts_blocked &MTPcontacts_blocked::c_contacts_blocked() const { + t_assert(data != nullptr && _type == mtpc_contacts_blocked); + return static_cast(*data); } -inline MTPcontacts_blocked::MTPcontacts_blocked(MTPDcontacts_blockedSlice *_data) : mtpDataOwner(_data), _type(mtpc_contacts_blockedSlice) { +inline MTPcontacts_blocked::MTPcontacts_blocked(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_contacts_blocked) { +} +inline const MTPDcontacts_blockedSlice &MTPcontacts_blocked::c_contacts_blockedSlice() const { + t_assert(data != nullptr && _type == mtpc_contacts_blockedSlice); + return static_cast(*data); +} +inline MTPcontacts_blocked::MTPcontacts_blocked(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_contacts_blockedSlice) { } inline MTPcontacts_blocked MTP_contacts_blocked(const MTPVector &_blocked, const MTPVector &_users) { return MTP::internal::TypeCreator::new_contacts_blocked(_blocked, _users); @@ -31626,24 +28525,24 @@ inline mtpTypeId MTPmessages_dialogs::type() const { return _type; } inline void MTPmessages_dialogs::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messages_dialogs: _type = cons; { - if (!data) setData(new MTPDmessages_dialogs()); - MTPDmessages_dialogs &v(_messages_dialogs()); - v.vdialogs.read(from, end); - v.vmessages.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vdialogs.read(from, end); + v->vmessages.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; case mtpc_messages_dialogsSlice: _type = cons; { - if (!data) setData(new MTPDmessages_dialogsSlice()); - MTPDmessages_dialogsSlice &v(_messages_dialogsSlice()); - v.vcount.read(from, end); - v.vdialogs.read(from, end); - v.vmessages.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vcount.read(from, end); + v->vdialogs.read(from, end); + v->vmessages.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_dialogs"); } @@ -31651,14 +28550,14 @@ inline void MTPmessages_dialogs::read(const mtpPrime *&from, const mtpPrime *end inline void MTPmessages_dialogs::write(mtpBuffer &to) const { switch (_type) { case mtpc_messages_dialogs: { - const MTPDmessages_dialogs &v(c_messages_dialogs()); + auto &v = c_messages_dialogs(); v.vdialogs.write(to); v.vmessages.write(to); v.vchats.write(to); v.vusers.write(to); } break; case mtpc_messages_dialogsSlice: { - const MTPDmessages_dialogsSlice &v(c_messages_dialogsSlice()); + auto &v = c_messages_dialogsSlice(); v.vcount.write(to); v.vdialogs.write(to); v.vmessages.write(to); @@ -31667,16 +28566,24 @@ inline void MTPmessages_dialogs::write(mtpBuffer &to) const { } break; } } -inline MTPmessages_dialogs::MTPmessages_dialogs(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessages_dialogs::MTPmessages_dialogs(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_messages_dialogs: setData(new MTPDmessages_dialogs()); break; - case mtpc_messages_dialogsSlice: setData(new MTPDmessages_dialogsSlice()); break; + case mtpc_messages_dialogs: data = std::make_shared(); break; + case mtpc_messages_dialogsSlice: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_dialogs"); } } -inline MTPmessages_dialogs::MTPmessages_dialogs(MTPDmessages_dialogs *_data) : mtpDataOwner(_data), _type(mtpc_messages_dialogs) { +inline const MTPDmessages_dialogs &MTPmessages_dialogs::c_messages_dialogs() const { + t_assert(data != nullptr && _type == mtpc_messages_dialogs); + return static_cast(*data); } -inline MTPmessages_dialogs::MTPmessages_dialogs(MTPDmessages_dialogsSlice *_data) : mtpDataOwner(_data), _type(mtpc_messages_dialogsSlice) { +inline MTPmessages_dialogs::MTPmessages_dialogs(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_dialogs) { +} +inline const MTPDmessages_dialogsSlice &MTPmessages_dialogs::c_messages_dialogsSlice() const { + t_assert(data != nullptr && _type == mtpc_messages_dialogsSlice); + return static_cast(*data); +} +inline MTPmessages_dialogs::MTPmessages_dialogs(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_dialogsSlice) { } inline MTPmessages_dialogs MTP_messages_dialogs(const MTPVector &_dialogs, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { return MTP::internal::TypeCreator::new_messages_dialogs(_dialogs, _messages, _chats, _users); @@ -31707,32 +28614,32 @@ inline mtpTypeId MTPmessages_messages::type() const { return _type; } inline void MTPmessages_messages::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messages_messages: _type = cons; { - if (!data) setData(new MTPDmessages_messages()); - MTPDmessages_messages &v(_messages_messages()); - v.vmessages.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vmessages.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; case mtpc_messages_messagesSlice: _type = cons; { - if (!data) setData(new MTPDmessages_messagesSlice()); - MTPDmessages_messagesSlice &v(_messages_messagesSlice()); - v.vcount.read(from, end); - v.vmessages.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vcount.read(from, end); + v->vmessages.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; case mtpc_messages_channelMessages: _type = cons; { - if (!data) setData(new MTPDmessages_channelMessages()); - MTPDmessages_channelMessages &v(_messages_channelMessages()); - v.vflags.read(from, end); - v.vpts.read(from, end); - v.vcount.read(from, end); - v.vmessages.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vpts.read(from, end); + v->vcount.read(from, end); + v->vmessages.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_messages"); } @@ -31740,20 +28647,20 @@ inline void MTPmessages_messages::read(const mtpPrime *&from, const mtpPrime *en inline void MTPmessages_messages::write(mtpBuffer &to) const { switch (_type) { case mtpc_messages_messages: { - const MTPDmessages_messages &v(c_messages_messages()); + auto &v = c_messages_messages(); v.vmessages.write(to); v.vchats.write(to); v.vusers.write(to); } break; case mtpc_messages_messagesSlice: { - const MTPDmessages_messagesSlice &v(c_messages_messagesSlice()); + auto &v = c_messages_messagesSlice(); v.vcount.write(to); v.vmessages.write(to); v.vchats.write(to); v.vusers.write(to); } break; case mtpc_messages_channelMessages: { - const MTPDmessages_channelMessages &v(c_messages_channelMessages()); + auto &v = c_messages_channelMessages(); v.vflags.write(to); v.vpts.write(to); v.vcount.write(to); @@ -31763,19 +28670,31 @@ inline void MTPmessages_messages::write(mtpBuffer &to) const { } break; } } -inline MTPmessages_messages::MTPmessages_messages(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessages_messages::MTPmessages_messages(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_messages_messages: setData(new MTPDmessages_messages()); break; - case mtpc_messages_messagesSlice: setData(new MTPDmessages_messagesSlice()); break; - case mtpc_messages_channelMessages: setData(new MTPDmessages_channelMessages()); break; + case mtpc_messages_messages: data = std::make_shared(); break; + case mtpc_messages_messagesSlice: data = std::make_shared(); break; + case mtpc_messages_channelMessages: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_messages"); } } -inline MTPmessages_messages::MTPmessages_messages(MTPDmessages_messages *_data) : mtpDataOwner(_data), _type(mtpc_messages_messages) { +inline const MTPDmessages_messages &MTPmessages_messages::c_messages_messages() const { + t_assert(data != nullptr && _type == mtpc_messages_messages); + return static_cast(*data); } -inline MTPmessages_messages::MTPmessages_messages(MTPDmessages_messagesSlice *_data) : mtpDataOwner(_data), _type(mtpc_messages_messagesSlice) { +inline MTPmessages_messages::MTPmessages_messages(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_messages) { } -inline MTPmessages_messages::MTPmessages_messages(MTPDmessages_channelMessages *_data) : mtpDataOwner(_data), _type(mtpc_messages_channelMessages) { +inline const MTPDmessages_messagesSlice &MTPmessages_messages::c_messages_messagesSlice() const { + t_assert(data != nullptr && _type == mtpc_messages_messagesSlice); + return static_cast(*data); +} +inline MTPmessages_messages::MTPmessages_messages(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_messagesSlice) { +} +inline const MTPDmessages_channelMessages &MTPmessages_messages::c_messages_channelMessages() const { + t_assert(data != nullptr && _type == mtpc_messages_channelMessages); + return static_cast(*data); +} +inline MTPmessages_messages::MTPmessages_messages(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_channelMessages) { } inline MTPmessages_messages MTP_messages_messages(const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { return MTP::internal::TypeCreator::new_messages_messages(_messages, _chats, _users); @@ -31805,18 +28724,18 @@ inline mtpTypeId MTPmessages_chats::type() const { return _type; } inline void MTPmessages_chats::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messages_chats: _type = cons; { - if (!data) setData(new MTPDmessages_chats()); - MTPDmessages_chats &v(_messages_chats()); - v.vchats.read(from, end); + auto v = std::make_shared(); + v->vchats.read(from, end); + data = std::move(v); } break; case mtpc_messages_chatsSlice: _type = cons; { - if (!data) setData(new MTPDmessages_chatsSlice()); - MTPDmessages_chatsSlice &v(_messages_chatsSlice()); - v.vcount.read(from, end); - v.vchats.read(from, end); + auto v = std::make_shared(); + v->vcount.read(from, end); + v->vchats.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_chats"); } @@ -31824,26 +28743,34 @@ inline void MTPmessages_chats::read(const mtpPrime *&from, const mtpPrime *end, inline void MTPmessages_chats::write(mtpBuffer &to) const { switch (_type) { case mtpc_messages_chats: { - const MTPDmessages_chats &v(c_messages_chats()); + auto &v = c_messages_chats(); v.vchats.write(to); } break; case mtpc_messages_chatsSlice: { - const MTPDmessages_chatsSlice &v(c_messages_chatsSlice()); + auto &v = c_messages_chatsSlice(); v.vcount.write(to); v.vchats.write(to); } break; } } -inline MTPmessages_chats::MTPmessages_chats(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessages_chats::MTPmessages_chats(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_messages_chats: setData(new MTPDmessages_chats()); break; - case mtpc_messages_chatsSlice: setData(new MTPDmessages_chatsSlice()); break; + case mtpc_messages_chats: data = std::make_shared(); break; + case mtpc_messages_chatsSlice: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_chats"); } } -inline MTPmessages_chats::MTPmessages_chats(MTPDmessages_chats *_data) : mtpDataOwner(_data), _type(mtpc_messages_chats) { +inline const MTPDmessages_chats &MTPmessages_chats::c_messages_chats() const { + t_assert(data != nullptr && _type == mtpc_messages_chats); + return static_cast(*data); } -inline MTPmessages_chats::MTPmessages_chats(MTPDmessages_chatsSlice *_data) : mtpDataOwner(_data), _type(mtpc_messages_chatsSlice) { +inline MTPmessages_chats::MTPmessages_chats(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_chats) { +} +inline const MTPDmessages_chatsSlice &MTPmessages_chats::c_messages_chatsSlice() const { + t_assert(data != nullptr && _type == mtpc_messages_chatsSlice); + return static_cast(*data); +} +inline MTPmessages_chats::MTPmessages_chats(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_chatsSlice) { } inline MTPmessages_chats MTP_messages_chats(const MTPVector &_chats) { return MTP::internal::TypeCreator::new_messages_chats(_chats); @@ -31852,7 +28779,7 @@ inline MTPmessages_chats MTP_messages_chatsSlice(MTPint _count, const MTPVector< return MTP::internal::TypeCreator::new_messages_chatsSlice(_count, _chats); } -inline MTPmessages_chatFull::MTPmessages_chatFull() : mtpDataOwner(new MTPDmessages_chatFull()) { +inline MTPmessages_chatFull::MTPmessages_chatFull() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessages_chatFull::innerLength() const { @@ -31865,25 +28792,29 @@ inline mtpTypeId MTPmessages_chatFull::type() const { inline void MTPmessages_chatFull::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messages_chatFull) throw mtpErrorUnexpected(cons, "MTPmessages_chatFull"); - if (!data) setData(new MTPDmessages_chatFull()); - MTPDmessages_chatFull &v(_messages_chatFull()); - v.vfull_chat.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vfull_chat.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } inline void MTPmessages_chatFull::write(mtpBuffer &to) const { - const MTPDmessages_chatFull &v(c_messages_chatFull()); + auto &v = c_messages_chatFull(); v.vfull_chat.write(to); v.vchats.write(to); v.vusers.write(to); } -inline MTPmessages_chatFull::MTPmessages_chatFull(MTPDmessages_chatFull *_data) : mtpDataOwner(_data) { +inline const MTPDmessages_chatFull &MTPmessages_chatFull::c_messages_chatFull() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessages_chatFull::MTPmessages_chatFull(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmessages_chatFull MTP_messages_chatFull(const MTPChatFull &_full_chat, const MTPVector &_chats, const MTPVector &_users) { return MTP::internal::TypeCreator::new_messages_chatFull(_full_chat, _chats, _users); } -inline MTPmessages_affectedHistory::MTPmessages_affectedHistory() : mtpDataOwner(new MTPDmessages_affectedHistory()) { +inline MTPmessages_affectedHistory::MTPmessages_affectedHistory() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessages_affectedHistory::innerLength() const { @@ -31896,19 +28827,23 @@ inline mtpTypeId MTPmessages_affectedHistory::type() const { inline void MTPmessages_affectedHistory::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messages_affectedHistory) throw mtpErrorUnexpected(cons, "MTPmessages_affectedHistory"); - if (!data) setData(new MTPDmessages_affectedHistory()); - MTPDmessages_affectedHistory &v(_messages_affectedHistory()); - v.vpts.read(from, end); - v.vpts_count.read(from, end); - v.voffset.read(from, end); + auto v = std::make_shared(); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + v->voffset.read(from, end); + data = std::move(v); } inline void MTPmessages_affectedHistory::write(mtpBuffer &to) const { - const MTPDmessages_affectedHistory &v(c_messages_affectedHistory()); + auto &v = c_messages_affectedHistory(); v.vpts.write(to); v.vpts_count.write(to); v.voffset.write(to); } -inline MTPmessages_affectedHistory::MTPmessages_affectedHistory(MTPDmessages_affectedHistory *_data) : mtpDataOwner(_data) { +inline const MTPDmessages_affectedHistory &MTPmessages_affectedHistory::c_messages_affectedHistory() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessages_affectedHistory::MTPmessages_affectedHistory(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmessages_affectedHistory MTP_messages_affectedHistory(MTPint _pts, MTPint _pts_count, MTPint _offset) { return MTP::internal::TypeCreator::new_messages_affectedHistory(_pts, _pts_count, _offset); @@ -31928,7 +28863,7 @@ inline mtpTypeId MTPmessagesFilter::type() const { return _type; } inline void MTPmessagesFilter::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputMessagesFilterEmpty: _type = cons; break; case mtpc_inputMessagesFilterPhotos: _type = cons; break; @@ -31942,9 +28877,9 @@ inline void MTPmessagesFilter::read(const mtpPrime *&from, const mtpPrime *end, case mtpc_inputMessagesFilterMusic: _type = cons; break; case mtpc_inputMessagesFilterChatPhotos: _type = cons; break; case mtpc_inputMessagesFilterPhoneCalls: _type = cons; { - if (!data) setData(new MTPDinputMessagesFilterPhoneCalls()); - MTPDinputMessagesFilterPhoneCalls &v(_inputMessagesFilterPhoneCalls()); - v.vflags.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessagesFilter"); } @@ -31952,12 +28887,12 @@ inline void MTPmessagesFilter::read(const mtpPrime *&from, const mtpPrime *end, inline void MTPmessagesFilter::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputMessagesFilterPhoneCalls: { - const MTPDinputMessagesFilterPhoneCalls &v(c_inputMessagesFilterPhoneCalls()); + auto &v = c_inputMessagesFilterPhoneCalls(); v.vflags.write(to); } break; } } -inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputMessagesFilterEmpty: break; case mtpc_inputMessagesFilterPhotos: break; @@ -31970,11 +28905,15 @@ inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : mtpDataOwner(0), _ case mtpc_inputMessagesFilterVoice: break; case mtpc_inputMessagesFilterMusic: break; case mtpc_inputMessagesFilterChatPhotos: break; - case mtpc_inputMessagesFilterPhoneCalls: setData(new MTPDinputMessagesFilterPhoneCalls()); break; + case mtpc_inputMessagesFilterPhoneCalls: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessagesFilter"); } } -inline MTPmessagesFilter::MTPmessagesFilter(MTPDinputMessagesFilterPhoneCalls *_data) : mtpDataOwner(_data), _type(mtpc_inputMessagesFilterPhoneCalls) { +inline const MTPDinputMessagesFilterPhoneCalls &MTPmessagesFilter::c_inputMessagesFilterPhoneCalls() const { + t_assert(data != nullptr && _type == mtpc_inputMessagesFilterPhoneCalls); + return static_cast(*data); +} +inline MTPmessagesFilter::MTPmessagesFilter(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMessagesFilterPhoneCalls) { } inline MTPmessagesFilter MTP_inputMessagesFilterEmpty() { return MTP::internal::TypeCreator::new_inputMessagesFilterEmpty(); @@ -32224,361 +29163,361 @@ inline mtpTypeId MTPupdate::type() const { return _type; } inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_updateNewMessage: _type = cons; { - if (!data) setData(new MTPDupdateNewMessage()); - MTPDupdateNewMessage &v(_updateNewMessage()); - v.vmessage.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vmessage.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } break; case mtpc_updateMessageID: _type = cons; { - if (!data) setData(new MTPDupdateMessageID()); - MTPDupdateMessageID &v(_updateMessageID()); - v.vid.read(from, end); - v.vrandom_id.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vrandom_id.read(from, end); + data = std::move(v); } break; case mtpc_updateDeleteMessages: _type = cons; { - if (!data) setData(new MTPDupdateDeleteMessages()); - MTPDupdateDeleteMessages &v(_updateDeleteMessages()); - v.vmessages.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vmessages.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } break; case mtpc_updateUserTyping: _type = cons; { - if (!data) setData(new MTPDupdateUserTyping()); - MTPDupdateUserTyping &v(_updateUserTyping()); - v.vuser_id.read(from, end); - v.vaction.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vaction.read(from, end); + data = std::move(v); } break; case mtpc_updateChatUserTyping: _type = cons; { - if (!data) setData(new MTPDupdateChatUserTyping()); - MTPDupdateChatUserTyping &v(_updateChatUserTyping()); - v.vchat_id.read(from, end); - v.vuser_id.read(from, end); - v.vaction.read(from, end); + auto v = std::make_shared(); + v->vchat_id.read(from, end); + v->vuser_id.read(from, end); + v->vaction.read(from, end); + data = std::move(v); } break; case mtpc_updateChatParticipants: _type = cons; { - if (!data) setData(new MTPDupdateChatParticipants()); - MTPDupdateChatParticipants &v(_updateChatParticipants()); - v.vparticipants.read(from, end); + auto v = std::make_shared(); + v->vparticipants.read(from, end); + data = std::move(v); } break; case mtpc_updateUserStatus: _type = cons; { - if (!data) setData(new MTPDupdateUserStatus()); - MTPDupdateUserStatus &v(_updateUserStatus()); - v.vuser_id.read(from, end); - v.vstatus.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vstatus.read(from, end); + data = std::move(v); } break; case mtpc_updateUserName: _type = cons; { - if (!data) setData(new MTPDupdateUserName()); - MTPDupdateUserName &v(_updateUserName()); - v.vuser_id.read(from, end); - v.vfirst_name.read(from, end); - v.vlast_name.read(from, end); - v.vusername.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vfirst_name.read(from, end); + v->vlast_name.read(from, end); + v->vusername.read(from, end); + data = std::move(v); } break; case mtpc_updateUserPhoto: _type = cons; { - if (!data) setData(new MTPDupdateUserPhoto()); - MTPDupdateUserPhoto &v(_updateUserPhoto()); - v.vuser_id.read(from, end); - v.vdate.read(from, end); - v.vphoto.read(from, end); - v.vprevious.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vdate.read(from, end); + v->vphoto.read(from, end); + v->vprevious.read(from, end); + data = std::move(v); } break; case mtpc_updateContactRegistered: _type = cons; { - if (!data) setData(new MTPDupdateContactRegistered()); - MTPDupdateContactRegistered &v(_updateContactRegistered()); - v.vuser_id.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_updateContactLink: _type = cons; { - if (!data) setData(new MTPDupdateContactLink()); - MTPDupdateContactLink &v(_updateContactLink()); - v.vuser_id.read(from, end); - v.vmy_link.read(from, end); - v.vforeign_link.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vmy_link.read(from, end); + v->vforeign_link.read(from, end); + data = std::move(v); } break; case mtpc_updateNewEncryptedMessage: _type = cons; { - if (!data) setData(new MTPDupdateNewEncryptedMessage()); - MTPDupdateNewEncryptedMessage &v(_updateNewEncryptedMessage()); - v.vmessage.read(from, end); - v.vqts.read(from, end); + auto v = std::make_shared(); + v->vmessage.read(from, end); + v->vqts.read(from, end); + data = std::move(v); } break; case mtpc_updateEncryptedChatTyping: _type = cons; { - if (!data) setData(new MTPDupdateEncryptedChatTyping()); - MTPDupdateEncryptedChatTyping &v(_updateEncryptedChatTyping()); - v.vchat_id.read(from, end); + auto v = std::make_shared(); + v->vchat_id.read(from, end); + data = std::move(v); } break; case mtpc_updateEncryption: _type = cons; { - if (!data) setData(new MTPDupdateEncryption()); - MTPDupdateEncryption &v(_updateEncryption()); - v.vchat.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vchat.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_updateEncryptedMessagesRead: _type = cons; { - if (!data) setData(new MTPDupdateEncryptedMessagesRead()); - MTPDupdateEncryptedMessagesRead &v(_updateEncryptedMessagesRead()); - v.vchat_id.read(from, end); - v.vmax_date.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vchat_id.read(from, end); + v->vmax_date.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_updateChatParticipantAdd: _type = cons; { - if (!data) setData(new MTPDupdateChatParticipantAdd()); - MTPDupdateChatParticipantAdd &v(_updateChatParticipantAdd()); - v.vchat_id.read(from, end); - v.vuser_id.read(from, end); - v.vinviter_id.read(from, end); - v.vdate.read(from, end); - v.vversion.read(from, end); + auto v = std::make_shared(); + v->vchat_id.read(from, end); + v->vuser_id.read(from, end); + v->vinviter_id.read(from, end); + v->vdate.read(from, end); + v->vversion.read(from, end); + data = std::move(v); } break; case mtpc_updateChatParticipantDelete: _type = cons; { - if (!data) setData(new MTPDupdateChatParticipantDelete()); - MTPDupdateChatParticipantDelete &v(_updateChatParticipantDelete()); - v.vchat_id.read(from, end); - v.vuser_id.read(from, end); - v.vversion.read(from, end); + auto v = std::make_shared(); + v->vchat_id.read(from, end); + v->vuser_id.read(from, end); + v->vversion.read(from, end); + data = std::move(v); } break; case mtpc_updateDcOptions: _type = cons; { - if (!data) setData(new MTPDupdateDcOptions()); - MTPDupdateDcOptions &v(_updateDcOptions()); - v.vdc_options.read(from, end); + auto v = std::make_shared(); + v->vdc_options.read(from, end); + data = std::move(v); } break; case mtpc_updateUserBlocked: _type = cons; { - if (!data) setData(new MTPDupdateUserBlocked()); - MTPDupdateUserBlocked &v(_updateUserBlocked()); - v.vuser_id.read(from, end); - v.vblocked.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vblocked.read(from, end); + data = std::move(v); } break; case mtpc_updateNotifySettings: _type = cons; { - if (!data) setData(new MTPDupdateNotifySettings()); - MTPDupdateNotifySettings &v(_updateNotifySettings()); - v.vpeer.read(from, end); - v.vnotify_settings.read(from, end); + auto v = std::make_shared(); + v->vpeer.read(from, end); + v->vnotify_settings.read(from, end); + data = std::move(v); } break; case mtpc_updateServiceNotification: _type = cons; { - if (!data) setData(new MTPDupdateServiceNotification()); - MTPDupdateServiceNotification &v(_updateServiceNotification()); - v.vflags.read(from, end); - if (v.has_inbox_date()) { v.vinbox_date.read(from, end); } else { v.vinbox_date = MTPint(); } - v.vtype.read(from, end); - v.vmessage.read(from, end); - v.vmedia.read(from, end); - v.ventities.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + if (v->has_inbox_date()) { v->vinbox_date.read(from, end); } else { v->vinbox_date = MTPint(); } + v->vtype.read(from, end); + v->vmessage.read(from, end); + v->vmedia.read(from, end); + v->ventities.read(from, end); + data = std::move(v); } break; case mtpc_updatePrivacy: _type = cons; { - if (!data) setData(new MTPDupdatePrivacy()); - MTPDupdatePrivacy &v(_updatePrivacy()); - v.vkey.read(from, end); - v.vrules.read(from, end); + auto v = std::make_shared(); + v->vkey.read(from, end); + v->vrules.read(from, end); + data = std::move(v); } break; case mtpc_updateUserPhone: _type = cons; { - if (!data) setData(new MTPDupdateUserPhone()); - MTPDupdateUserPhone &v(_updateUserPhone()); - v.vuser_id.read(from, end); - v.vphone.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vphone.read(from, end); + data = std::move(v); } break; case mtpc_updateReadHistoryInbox: _type = cons; { - if (!data) setData(new MTPDupdateReadHistoryInbox()); - MTPDupdateReadHistoryInbox &v(_updateReadHistoryInbox()); - v.vpeer.read(from, end); - v.vmax_id.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vpeer.read(from, end); + v->vmax_id.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } break; case mtpc_updateReadHistoryOutbox: _type = cons; { - if (!data) setData(new MTPDupdateReadHistoryOutbox()); - MTPDupdateReadHistoryOutbox &v(_updateReadHistoryOutbox()); - v.vpeer.read(from, end); - v.vmax_id.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vpeer.read(from, end); + v->vmax_id.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } break; case mtpc_updateWebPage: _type = cons; { - if (!data) setData(new MTPDupdateWebPage()); - MTPDupdateWebPage &v(_updateWebPage()); - v.vwebpage.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vwebpage.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } break; case mtpc_updateReadMessagesContents: _type = cons; { - if (!data) setData(new MTPDupdateReadMessagesContents()); - MTPDupdateReadMessagesContents &v(_updateReadMessagesContents()); - v.vmessages.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vmessages.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } break; case mtpc_updateChannelTooLong: _type = cons; { - if (!data) setData(new MTPDupdateChannelTooLong()); - MTPDupdateChannelTooLong &v(_updateChannelTooLong()); - v.vflags.read(from, end); - v.vchannel_id.read(from, end); - if (v.has_pts()) { v.vpts.read(from, end); } else { v.vpts = MTPint(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vchannel_id.read(from, end); + if (v->has_pts()) { v->vpts.read(from, end); } else { v->vpts = MTPint(); } + data = std::move(v); } break; case mtpc_updateChannel: _type = cons; { - if (!data) setData(new MTPDupdateChannel()); - MTPDupdateChannel &v(_updateChannel()); - v.vchannel_id.read(from, end); + auto v = std::make_shared(); + v->vchannel_id.read(from, end); + data = std::move(v); } break; case mtpc_updateNewChannelMessage: _type = cons; { - if (!data) setData(new MTPDupdateNewChannelMessage()); - MTPDupdateNewChannelMessage &v(_updateNewChannelMessage()); - v.vmessage.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vmessage.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } break; case mtpc_updateReadChannelInbox: _type = cons; { - if (!data) setData(new MTPDupdateReadChannelInbox()); - MTPDupdateReadChannelInbox &v(_updateReadChannelInbox()); - v.vchannel_id.read(from, end); - v.vmax_id.read(from, end); + auto v = std::make_shared(); + v->vchannel_id.read(from, end); + v->vmax_id.read(from, end); + data = std::move(v); } break; case mtpc_updateDeleteChannelMessages: _type = cons; { - if (!data) setData(new MTPDupdateDeleteChannelMessages()); - MTPDupdateDeleteChannelMessages &v(_updateDeleteChannelMessages()); - v.vchannel_id.read(from, end); - v.vmessages.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vchannel_id.read(from, end); + v->vmessages.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } break; case mtpc_updateChannelMessageViews: _type = cons; { - if (!data) setData(new MTPDupdateChannelMessageViews()); - MTPDupdateChannelMessageViews &v(_updateChannelMessageViews()); - v.vchannel_id.read(from, end); - v.vid.read(from, end); - v.vviews.read(from, end); + auto v = std::make_shared(); + v->vchannel_id.read(from, end); + v->vid.read(from, end); + v->vviews.read(from, end); + data = std::move(v); } break; case mtpc_updateChatAdmins: _type = cons; { - if (!data) setData(new MTPDupdateChatAdmins()); - MTPDupdateChatAdmins &v(_updateChatAdmins()); - v.vchat_id.read(from, end); - v.venabled.read(from, end); - v.vversion.read(from, end); + auto v = std::make_shared(); + v->vchat_id.read(from, end); + v->venabled.read(from, end); + v->vversion.read(from, end); + data = std::move(v); } break; case mtpc_updateChatParticipantAdmin: _type = cons; { - if (!data) setData(new MTPDupdateChatParticipantAdmin()); - MTPDupdateChatParticipantAdmin &v(_updateChatParticipantAdmin()); - v.vchat_id.read(from, end); - v.vuser_id.read(from, end); - v.vis_admin.read(from, end); - v.vversion.read(from, end); + auto v = std::make_shared(); + v->vchat_id.read(from, end); + v->vuser_id.read(from, end); + v->vis_admin.read(from, end); + v->vversion.read(from, end); + data = std::move(v); } break; case mtpc_updateNewStickerSet: _type = cons; { - if (!data) setData(new MTPDupdateNewStickerSet()); - MTPDupdateNewStickerSet &v(_updateNewStickerSet()); - v.vstickerset.read(from, end); + auto v = std::make_shared(); + v->vstickerset.read(from, end); + data = std::move(v); } break; case mtpc_updateStickerSetsOrder: _type = cons; { - if (!data) setData(new MTPDupdateStickerSetsOrder()); - MTPDupdateStickerSetsOrder &v(_updateStickerSetsOrder()); - v.vflags.read(from, end); - v.vorder.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vorder.read(from, end); + data = std::move(v); } break; case mtpc_updateStickerSets: _type = cons; break; case mtpc_updateSavedGifs: _type = cons; break; case mtpc_updateBotInlineQuery: _type = cons; { - if (!data) setData(new MTPDupdateBotInlineQuery()); - MTPDupdateBotInlineQuery &v(_updateBotInlineQuery()); - v.vflags.read(from, end); - v.vquery_id.read(from, end); - v.vuser_id.read(from, end); - v.vquery.read(from, end); - if (v.has_geo()) { v.vgeo.read(from, end); } else { v.vgeo = MTPGeoPoint(); } - v.voffset.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vquery_id.read(from, end); + v->vuser_id.read(from, end); + v->vquery.read(from, end); + if (v->has_geo()) { v->vgeo.read(from, end); } else { v->vgeo = MTPGeoPoint(); } + v->voffset.read(from, end); + data = std::move(v); } break; case mtpc_updateBotInlineSend: _type = cons; { - if (!data) setData(new MTPDupdateBotInlineSend()); - MTPDupdateBotInlineSend &v(_updateBotInlineSend()); - v.vflags.read(from, end); - v.vuser_id.read(from, end); - v.vquery.read(from, end); - if (v.has_geo()) { v.vgeo.read(from, end); } else { v.vgeo = MTPGeoPoint(); } - v.vid.read(from, end); - if (v.has_msg_id()) { v.vmsg_id.read(from, end); } else { v.vmsg_id = MTPInputBotInlineMessageID(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vuser_id.read(from, end); + v->vquery.read(from, end); + if (v->has_geo()) { v->vgeo.read(from, end); } else { v->vgeo = MTPGeoPoint(); } + v->vid.read(from, end); + if (v->has_msg_id()) { v->vmsg_id.read(from, end); } else { v->vmsg_id = MTPInputBotInlineMessageID(); } + data = std::move(v); } break; case mtpc_updateEditChannelMessage: _type = cons; { - if (!data) setData(new MTPDupdateEditChannelMessage()); - MTPDupdateEditChannelMessage &v(_updateEditChannelMessage()); - v.vmessage.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vmessage.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } break; case mtpc_updateChannelPinnedMessage: _type = cons; { - if (!data) setData(new MTPDupdateChannelPinnedMessage()); - MTPDupdateChannelPinnedMessage &v(_updateChannelPinnedMessage()); - v.vchannel_id.read(from, end); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vchannel_id.read(from, end); + v->vid.read(from, end); + data = std::move(v); } break; case mtpc_updateBotCallbackQuery: _type = cons; { - if (!data) setData(new MTPDupdateBotCallbackQuery()); - MTPDupdateBotCallbackQuery &v(_updateBotCallbackQuery()); - v.vflags.read(from, end); - v.vquery_id.read(from, end); - v.vuser_id.read(from, end); - v.vpeer.read(from, end); - v.vmsg_id.read(from, end); - v.vchat_instance.read(from, end); - if (v.has_data()) { v.vdata.read(from, end); } else { v.vdata = MTPbytes(); } - if (v.has_game_short_name()) { v.vgame_short_name.read(from, end); } else { v.vgame_short_name = MTPstring(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vquery_id.read(from, end); + v->vuser_id.read(from, end); + v->vpeer.read(from, end); + v->vmsg_id.read(from, end); + v->vchat_instance.read(from, end); + if (v->has_data()) { v->vdata.read(from, end); } else { v->vdata = MTPbytes(); } + if (v->has_game_short_name()) { v->vgame_short_name.read(from, end); } else { v->vgame_short_name = MTPstring(); } + data = std::move(v); } break; case mtpc_updateEditMessage: _type = cons; { - if (!data) setData(new MTPDupdateEditMessage()); - MTPDupdateEditMessage &v(_updateEditMessage()); - v.vmessage.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vmessage.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } break; case mtpc_updateInlineBotCallbackQuery: _type = cons; { - if (!data) setData(new MTPDupdateInlineBotCallbackQuery()); - MTPDupdateInlineBotCallbackQuery &v(_updateInlineBotCallbackQuery()); - v.vflags.read(from, end); - v.vquery_id.read(from, end); - v.vuser_id.read(from, end); - v.vmsg_id.read(from, end); - v.vchat_instance.read(from, end); - if (v.has_data()) { v.vdata.read(from, end); } else { v.vdata = MTPbytes(); } - if (v.has_game_short_name()) { v.vgame_short_name.read(from, end); } else { v.vgame_short_name = MTPstring(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vquery_id.read(from, end); + v->vuser_id.read(from, end); + v->vmsg_id.read(from, end); + v->vchat_instance.read(from, end); + if (v->has_data()) { v->vdata.read(from, end); } else { v->vdata = MTPbytes(); } + if (v->has_game_short_name()) { v->vgame_short_name.read(from, end); } else { v->vgame_short_name = MTPstring(); } + data = std::move(v); } break; case mtpc_updateReadChannelOutbox: _type = cons; { - if (!data) setData(new MTPDupdateReadChannelOutbox()); - MTPDupdateReadChannelOutbox &v(_updateReadChannelOutbox()); - v.vchannel_id.read(from, end); - v.vmax_id.read(from, end); + auto v = std::make_shared(); + v->vchannel_id.read(from, end); + v->vmax_id.read(from, end); + data = std::move(v); } break; case mtpc_updateDraftMessage: _type = cons; { - if (!data) setData(new MTPDupdateDraftMessage()); - MTPDupdateDraftMessage &v(_updateDraftMessage()); - v.vpeer.read(from, end); - v.vdraft.read(from, end); + auto v = std::make_shared(); + v->vpeer.read(from, end); + v->vdraft.read(from, end); + data = std::move(v); } break; case mtpc_updateReadFeaturedStickers: _type = cons; break; case mtpc_updateRecentStickers: _type = cons; break; case mtpc_updateConfig: _type = cons; break; case mtpc_updatePtsChanged: _type = cons; break; case mtpc_updateChannelWebPage: _type = cons; { - if (!data) setData(new MTPDupdateChannelWebPage()); - MTPDupdateChannelWebPage &v(_updateChannelWebPage()); - v.vchannel_id.read(from, end); - v.vwebpage.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vchannel_id.read(from, end); + v->vwebpage.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } break; case mtpc_updatePhoneCall: _type = cons; { - if (!data) setData(new MTPDupdatePhoneCall()); - MTPDupdatePhoneCall &v(_updatePhoneCall()); - v.vphone_call.read(from, end); + auto v = std::make_shared(); + v->vphone_call.read(from, end); + data = std::move(v); } break; case mtpc_updateDialogPinned: _type = cons; { - if (!data) setData(new MTPDupdateDialogPinned()); - MTPDupdateDialogPinned &v(_updateDialogPinned()); - v.vflags.read(from, end); - v.vpeer.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vpeer.read(from, end); + data = std::move(v); } break; case mtpc_updatePinnedDialogs: _type = cons; { - if (!data) setData(new MTPDupdatePinnedDialogs()); - MTPDupdatePinnedDialogs &v(_updatePinnedDialogs()); - v.vflags.read(from, end); - if (v.has_order()) { v.vorder.read(from, end); } else { v.vorder = MTPVector(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + if (v->has_order()) { v->vorder.read(from, end); } else { v->vorder = MTPVector(); } + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPupdate"); } @@ -32586,89 +29525,89 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI inline void MTPupdate::write(mtpBuffer &to) const { switch (_type) { case mtpc_updateNewMessage: { - const MTPDupdateNewMessage &v(c_updateNewMessage()); + auto &v = c_updateNewMessage(); v.vmessage.write(to); v.vpts.write(to); v.vpts_count.write(to); } break; case mtpc_updateMessageID: { - const MTPDupdateMessageID &v(c_updateMessageID()); + auto &v = c_updateMessageID(); v.vid.write(to); v.vrandom_id.write(to); } break; case mtpc_updateDeleteMessages: { - const MTPDupdateDeleteMessages &v(c_updateDeleteMessages()); + auto &v = c_updateDeleteMessages(); v.vmessages.write(to); v.vpts.write(to); v.vpts_count.write(to); } break; case mtpc_updateUserTyping: { - const MTPDupdateUserTyping &v(c_updateUserTyping()); + auto &v = c_updateUserTyping(); v.vuser_id.write(to); v.vaction.write(to); } break; case mtpc_updateChatUserTyping: { - const MTPDupdateChatUserTyping &v(c_updateChatUserTyping()); + auto &v = c_updateChatUserTyping(); v.vchat_id.write(to); v.vuser_id.write(to); v.vaction.write(to); } break; case mtpc_updateChatParticipants: { - const MTPDupdateChatParticipants &v(c_updateChatParticipants()); + auto &v = c_updateChatParticipants(); v.vparticipants.write(to); } break; case mtpc_updateUserStatus: { - const MTPDupdateUserStatus &v(c_updateUserStatus()); + auto &v = c_updateUserStatus(); v.vuser_id.write(to); v.vstatus.write(to); } break; case mtpc_updateUserName: { - const MTPDupdateUserName &v(c_updateUserName()); + auto &v = c_updateUserName(); v.vuser_id.write(to); v.vfirst_name.write(to); v.vlast_name.write(to); v.vusername.write(to); } break; case mtpc_updateUserPhoto: { - const MTPDupdateUserPhoto &v(c_updateUserPhoto()); + auto &v = c_updateUserPhoto(); v.vuser_id.write(to); v.vdate.write(to); v.vphoto.write(to); v.vprevious.write(to); } break; case mtpc_updateContactRegistered: { - const MTPDupdateContactRegistered &v(c_updateContactRegistered()); + auto &v = c_updateContactRegistered(); v.vuser_id.write(to); v.vdate.write(to); } break; case mtpc_updateContactLink: { - const MTPDupdateContactLink &v(c_updateContactLink()); + auto &v = c_updateContactLink(); v.vuser_id.write(to); v.vmy_link.write(to); v.vforeign_link.write(to); } break; case mtpc_updateNewEncryptedMessage: { - const MTPDupdateNewEncryptedMessage &v(c_updateNewEncryptedMessage()); + auto &v = c_updateNewEncryptedMessage(); v.vmessage.write(to); v.vqts.write(to); } break; case mtpc_updateEncryptedChatTyping: { - const MTPDupdateEncryptedChatTyping &v(c_updateEncryptedChatTyping()); + auto &v = c_updateEncryptedChatTyping(); v.vchat_id.write(to); } break; case mtpc_updateEncryption: { - const MTPDupdateEncryption &v(c_updateEncryption()); + auto &v = c_updateEncryption(); v.vchat.write(to); v.vdate.write(to); } break; case mtpc_updateEncryptedMessagesRead: { - const MTPDupdateEncryptedMessagesRead &v(c_updateEncryptedMessagesRead()); + auto &v = c_updateEncryptedMessagesRead(); v.vchat_id.write(to); v.vmax_date.write(to); v.vdate.write(to); } break; case mtpc_updateChatParticipantAdd: { - const MTPDupdateChatParticipantAdd &v(c_updateChatParticipantAdd()); + auto &v = c_updateChatParticipantAdd(); v.vchat_id.write(to); v.vuser_id.write(to); v.vinviter_id.write(to); @@ -32676,27 +29615,27 @@ inline void MTPupdate::write(mtpBuffer &to) const { v.vversion.write(to); } break; case mtpc_updateChatParticipantDelete: { - const MTPDupdateChatParticipantDelete &v(c_updateChatParticipantDelete()); + auto &v = c_updateChatParticipantDelete(); v.vchat_id.write(to); v.vuser_id.write(to); v.vversion.write(to); } break; case mtpc_updateDcOptions: { - const MTPDupdateDcOptions &v(c_updateDcOptions()); + auto &v = c_updateDcOptions(); v.vdc_options.write(to); } break; case mtpc_updateUserBlocked: { - const MTPDupdateUserBlocked &v(c_updateUserBlocked()); + auto &v = c_updateUserBlocked(); v.vuser_id.write(to); v.vblocked.write(to); } break; case mtpc_updateNotifySettings: { - const MTPDupdateNotifySettings &v(c_updateNotifySettings()); + auto &v = c_updateNotifySettings(); v.vpeer.write(to); v.vnotify_settings.write(to); } break; case mtpc_updateServiceNotification: { - const MTPDupdateServiceNotification &v(c_updateServiceNotification()); + auto &v = c_updateServiceNotification(); v.vflags.write(to); if (v.has_inbox_date()) v.vinbox_date.write(to); v.vtype.write(to); @@ -32705,99 +29644,99 @@ inline void MTPupdate::write(mtpBuffer &to) const { v.ventities.write(to); } break; case mtpc_updatePrivacy: { - const MTPDupdatePrivacy &v(c_updatePrivacy()); + auto &v = c_updatePrivacy(); v.vkey.write(to); v.vrules.write(to); } break; case mtpc_updateUserPhone: { - const MTPDupdateUserPhone &v(c_updateUserPhone()); + auto &v = c_updateUserPhone(); v.vuser_id.write(to); v.vphone.write(to); } break; case mtpc_updateReadHistoryInbox: { - const MTPDupdateReadHistoryInbox &v(c_updateReadHistoryInbox()); + auto &v = c_updateReadHistoryInbox(); v.vpeer.write(to); v.vmax_id.write(to); v.vpts.write(to); v.vpts_count.write(to); } break; case mtpc_updateReadHistoryOutbox: { - const MTPDupdateReadHistoryOutbox &v(c_updateReadHistoryOutbox()); + auto &v = c_updateReadHistoryOutbox(); v.vpeer.write(to); v.vmax_id.write(to); v.vpts.write(to); v.vpts_count.write(to); } break; case mtpc_updateWebPage: { - const MTPDupdateWebPage &v(c_updateWebPage()); + auto &v = c_updateWebPage(); v.vwebpage.write(to); v.vpts.write(to); v.vpts_count.write(to); } break; case mtpc_updateReadMessagesContents: { - const MTPDupdateReadMessagesContents &v(c_updateReadMessagesContents()); + auto &v = c_updateReadMessagesContents(); v.vmessages.write(to); v.vpts.write(to); v.vpts_count.write(to); } break; case mtpc_updateChannelTooLong: { - const MTPDupdateChannelTooLong &v(c_updateChannelTooLong()); + auto &v = c_updateChannelTooLong(); v.vflags.write(to); v.vchannel_id.write(to); if (v.has_pts()) v.vpts.write(to); } break; case mtpc_updateChannel: { - const MTPDupdateChannel &v(c_updateChannel()); + auto &v = c_updateChannel(); v.vchannel_id.write(to); } break; case mtpc_updateNewChannelMessage: { - const MTPDupdateNewChannelMessage &v(c_updateNewChannelMessage()); + auto &v = c_updateNewChannelMessage(); v.vmessage.write(to); v.vpts.write(to); v.vpts_count.write(to); } break; case mtpc_updateReadChannelInbox: { - const MTPDupdateReadChannelInbox &v(c_updateReadChannelInbox()); + auto &v = c_updateReadChannelInbox(); v.vchannel_id.write(to); v.vmax_id.write(to); } break; case mtpc_updateDeleteChannelMessages: { - const MTPDupdateDeleteChannelMessages &v(c_updateDeleteChannelMessages()); + auto &v = c_updateDeleteChannelMessages(); v.vchannel_id.write(to); v.vmessages.write(to); v.vpts.write(to); v.vpts_count.write(to); } break; case mtpc_updateChannelMessageViews: { - const MTPDupdateChannelMessageViews &v(c_updateChannelMessageViews()); + auto &v = c_updateChannelMessageViews(); v.vchannel_id.write(to); v.vid.write(to); v.vviews.write(to); } break; case mtpc_updateChatAdmins: { - const MTPDupdateChatAdmins &v(c_updateChatAdmins()); + auto &v = c_updateChatAdmins(); v.vchat_id.write(to); v.venabled.write(to); v.vversion.write(to); } break; case mtpc_updateChatParticipantAdmin: { - const MTPDupdateChatParticipantAdmin &v(c_updateChatParticipantAdmin()); + auto &v = c_updateChatParticipantAdmin(); v.vchat_id.write(to); v.vuser_id.write(to); v.vis_admin.write(to); v.vversion.write(to); } break; case mtpc_updateNewStickerSet: { - const MTPDupdateNewStickerSet &v(c_updateNewStickerSet()); + auto &v = c_updateNewStickerSet(); v.vstickerset.write(to); } break; case mtpc_updateStickerSetsOrder: { - const MTPDupdateStickerSetsOrder &v(c_updateStickerSetsOrder()); + auto &v = c_updateStickerSetsOrder(); v.vflags.write(to); v.vorder.write(to); } break; case mtpc_updateBotInlineQuery: { - const MTPDupdateBotInlineQuery &v(c_updateBotInlineQuery()); + auto &v = c_updateBotInlineQuery(); v.vflags.write(to); v.vquery_id.write(to); v.vuser_id.write(to); @@ -32806,7 +29745,7 @@ inline void MTPupdate::write(mtpBuffer &to) const { v.voffset.write(to); } break; case mtpc_updateBotInlineSend: { - const MTPDupdateBotInlineSend &v(c_updateBotInlineSend()); + auto &v = c_updateBotInlineSend(); v.vflags.write(to); v.vuser_id.write(to); v.vquery.write(to); @@ -32815,18 +29754,18 @@ inline void MTPupdate::write(mtpBuffer &to) const { if (v.has_msg_id()) v.vmsg_id.write(to); } break; case mtpc_updateEditChannelMessage: { - const MTPDupdateEditChannelMessage &v(c_updateEditChannelMessage()); + auto &v = c_updateEditChannelMessage(); v.vmessage.write(to); v.vpts.write(to); v.vpts_count.write(to); } break; case mtpc_updateChannelPinnedMessage: { - const MTPDupdateChannelPinnedMessage &v(c_updateChannelPinnedMessage()); + auto &v = c_updateChannelPinnedMessage(); v.vchannel_id.write(to); v.vid.write(to); } break; case mtpc_updateBotCallbackQuery: { - const MTPDupdateBotCallbackQuery &v(c_updateBotCallbackQuery()); + auto &v = c_updateBotCallbackQuery(); v.vflags.write(to); v.vquery_id.write(to); v.vuser_id.write(to); @@ -32837,13 +29776,13 @@ inline void MTPupdate::write(mtpBuffer &to) const { if (v.has_game_short_name()) v.vgame_short_name.write(to); } break; case mtpc_updateEditMessage: { - const MTPDupdateEditMessage &v(c_updateEditMessage()); + auto &v = c_updateEditMessage(); v.vmessage.write(to); v.vpts.write(to); v.vpts_count.write(to); } break; case mtpc_updateInlineBotCallbackQuery: { - const MTPDupdateInlineBotCallbackQuery &v(c_updateInlineBotCallbackQuery()); + auto &v = c_updateInlineBotCallbackQuery(); v.vflags.write(to); v.vquery_id.write(to); v.vuser_id.write(to); @@ -32853,198 +29792,398 @@ inline void MTPupdate::write(mtpBuffer &to) const { if (v.has_game_short_name()) v.vgame_short_name.write(to); } break; case mtpc_updateReadChannelOutbox: { - const MTPDupdateReadChannelOutbox &v(c_updateReadChannelOutbox()); + auto &v = c_updateReadChannelOutbox(); v.vchannel_id.write(to); v.vmax_id.write(to); } break; case mtpc_updateDraftMessage: { - const MTPDupdateDraftMessage &v(c_updateDraftMessage()); + auto &v = c_updateDraftMessage(); v.vpeer.write(to); v.vdraft.write(to); } break; case mtpc_updateChannelWebPage: { - const MTPDupdateChannelWebPage &v(c_updateChannelWebPage()); + auto &v = c_updateChannelWebPage(); v.vchannel_id.write(to); v.vwebpage.write(to); v.vpts.write(to); v.vpts_count.write(to); } break; case mtpc_updatePhoneCall: { - const MTPDupdatePhoneCall &v(c_updatePhoneCall()); + auto &v = c_updatePhoneCall(); v.vphone_call.write(to); } break; case mtpc_updateDialogPinned: { - const MTPDupdateDialogPinned &v(c_updateDialogPinned()); + auto &v = c_updateDialogPinned(); v.vflags.write(to); v.vpeer.write(to); } break; case mtpc_updatePinnedDialogs: { - const MTPDupdatePinnedDialogs &v(c_updatePinnedDialogs()); + auto &v = c_updatePinnedDialogs(); v.vflags.write(to); if (v.has_order()) v.vorder.write(to); } break; } } -inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_updateNewMessage: setData(new MTPDupdateNewMessage()); break; - case mtpc_updateMessageID: setData(new MTPDupdateMessageID()); break; - case mtpc_updateDeleteMessages: setData(new MTPDupdateDeleteMessages()); break; - case mtpc_updateUserTyping: setData(new MTPDupdateUserTyping()); break; - case mtpc_updateChatUserTyping: setData(new MTPDupdateChatUserTyping()); break; - case mtpc_updateChatParticipants: setData(new MTPDupdateChatParticipants()); break; - case mtpc_updateUserStatus: setData(new MTPDupdateUserStatus()); break; - case mtpc_updateUserName: setData(new MTPDupdateUserName()); break; - case mtpc_updateUserPhoto: setData(new MTPDupdateUserPhoto()); break; - case mtpc_updateContactRegistered: setData(new MTPDupdateContactRegistered()); break; - case mtpc_updateContactLink: setData(new MTPDupdateContactLink()); break; - case mtpc_updateNewEncryptedMessage: setData(new MTPDupdateNewEncryptedMessage()); break; - case mtpc_updateEncryptedChatTyping: setData(new MTPDupdateEncryptedChatTyping()); break; - case mtpc_updateEncryption: setData(new MTPDupdateEncryption()); break; - case mtpc_updateEncryptedMessagesRead: setData(new MTPDupdateEncryptedMessagesRead()); break; - case mtpc_updateChatParticipantAdd: setData(new MTPDupdateChatParticipantAdd()); break; - case mtpc_updateChatParticipantDelete: setData(new MTPDupdateChatParticipantDelete()); break; - case mtpc_updateDcOptions: setData(new MTPDupdateDcOptions()); break; - case mtpc_updateUserBlocked: setData(new MTPDupdateUserBlocked()); break; - case mtpc_updateNotifySettings: setData(new MTPDupdateNotifySettings()); break; - case mtpc_updateServiceNotification: setData(new MTPDupdateServiceNotification()); break; - case mtpc_updatePrivacy: setData(new MTPDupdatePrivacy()); break; - case mtpc_updateUserPhone: setData(new MTPDupdateUserPhone()); break; - case mtpc_updateReadHistoryInbox: setData(new MTPDupdateReadHistoryInbox()); break; - case mtpc_updateReadHistoryOutbox: setData(new MTPDupdateReadHistoryOutbox()); break; - case mtpc_updateWebPage: setData(new MTPDupdateWebPage()); break; - case mtpc_updateReadMessagesContents: setData(new MTPDupdateReadMessagesContents()); break; - case mtpc_updateChannelTooLong: setData(new MTPDupdateChannelTooLong()); break; - case mtpc_updateChannel: setData(new MTPDupdateChannel()); break; - case mtpc_updateNewChannelMessage: setData(new MTPDupdateNewChannelMessage()); break; - case mtpc_updateReadChannelInbox: setData(new MTPDupdateReadChannelInbox()); break; - case mtpc_updateDeleteChannelMessages: setData(new MTPDupdateDeleteChannelMessages()); break; - case mtpc_updateChannelMessageViews: setData(new MTPDupdateChannelMessageViews()); break; - case mtpc_updateChatAdmins: setData(new MTPDupdateChatAdmins()); break; - case mtpc_updateChatParticipantAdmin: setData(new MTPDupdateChatParticipantAdmin()); break; - case mtpc_updateNewStickerSet: setData(new MTPDupdateNewStickerSet()); break; - case mtpc_updateStickerSetsOrder: setData(new MTPDupdateStickerSetsOrder()); break; + case mtpc_updateNewMessage: data = std::make_shared(); break; + case mtpc_updateMessageID: data = std::make_shared(); break; + case mtpc_updateDeleteMessages: data = std::make_shared(); break; + case mtpc_updateUserTyping: data = std::make_shared(); break; + case mtpc_updateChatUserTyping: data = std::make_shared(); break; + case mtpc_updateChatParticipants: data = std::make_shared(); break; + case mtpc_updateUserStatus: data = std::make_shared(); break; + case mtpc_updateUserName: data = std::make_shared(); break; + case mtpc_updateUserPhoto: data = std::make_shared(); break; + case mtpc_updateContactRegistered: data = std::make_shared(); break; + case mtpc_updateContactLink: data = std::make_shared(); break; + case mtpc_updateNewEncryptedMessage: data = std::make_shared(); break; + case mtpc_updateEncryptedChatTyping: data = std::make_shared(); break; + case mtpc_updateEncryption: data = std::make_shared(); break; + case mtpc_updateEncryptedMessagesRead: data = std::make_shared(); break; + case mtpc_updateChatParticipantAdd: data = std::make_shared(); break; + case mtpc_updateChatParticipantDelete: data = std::make_shared(); break; + case mtpc_updateDcOptions: data = std::make_shared(); break; + case mtpc_updateUserBlocked: data = std::make_shared(); break; + case mtpc_updateNotifySettings: data = std::make_shared(); break; + case mtpc_updateServiceNotification: data = std::make_shared(); break; + case mtpc_updatePrivacy: data = std::make_shared(); break; + case mtpc_updateUserPhone: data = std::make_shared(); break; + case mtpc_updateReadHistoryInbox: data = std::make_shared(); break; + case mtpc_updateReadHistoryOutbox: data = std::make_shared(); break; + case mtpc_updateWebPage: data = std::make_shared(); break; + case mtpc_updateReadMessagesContents: data = std::make_shared(); break; + case mtpc_updateChannelTooLong: data = std::make_shared(); break; + case mtpc_updateChannel: data = std::make_shared(); break; + case mtpc_updateNewChannelMessage: data = std::make_shared(); break; + case mtpc_updateReadChannelInbox: data = std::make_shared(); break; + case mtpc_updateDeleteChannelMessages: data = std::make_shared(); break; + case mtpc_updateChannelMessageViews: data = std::make_shared(); break; + case mtpc_updateChatAdmins: data = std::make_shared(); break; + case mtpc_updateChatParticipantAdmin: data = std::make_shared(); break; + case mtpc_updateNewStickerSet: data = std::make_shared(); break; + case mtpc_updateStickerSetsOrder: data = std::make_shared(); break; case mtpc_updateStickerSets: break; case mtpc_updateSavedGifs: break; - case mtpc_updateBotInlineQuery: setData(new MTPDupdateBotInlineQuery()); break; - case mtpc_updateBotInlineSend: setData(new MTPDupdateBotInlineSend()); break; - case mtpc_updateEditChannelMessage: setData(new MTPDupdateEditChannelMessage()); break; - case mtpc_updateChannelPinnedMessage: setData(new MTPDupdateChannelPinnedMessage()); break; - case mtpc_updateBotCallbackQuery: setData(new MTPDupdateBotCallbackQuery()); break; - case mtpc_updateEditMessage: setData(new MTPDupdateEditMessage()); break; - case mtpc_updateInlineBotCallbackQuery: setData(new MTPDupdateInlineBotCallbackQuery()); break; - case mtpc_updateReadChannelOutbox: setData(new MTPDupdateReadChannelOutbox()); break; - case mtpc_updateDraftMessage: setData(new MTPDupdateDraftMessage()); break; + case mtpc_updateBotInlineQuery: data = std::make_shared(); break; + case mtpc_updateBotInlineSend: data = std::make_shared(); break; + case mtpc_updateEditChannelMessage: data = std::make_shared(); break; + case mtpc_updateChannelPinnedMessage: data = std::make_shared(); break; + case mtpc_updateBotCallbackQuery: data = std::make_shared(); break; + case mtpc_updateEditMessage: data = std::make_shared(); break; + case mtpc_updateInlineBotCallbackQuery: data = std::make_shared(); break; + case mtpc_updateReadChannelOutbox: data = std::make_shared(); break; + case mtpc_updateDraftMessage: data = std::make_shared(); break; case mtpc_updateReadFeaturedStickers: break; case mtpc_updateRecentStickers: break; case mtpc_updateConfig: break; case mtpc_updatePtsChanged: break; - case mtpc_updateChannelWebPage: setData(new MTPDupdateChannelWebPage()); break; - case mtpc_updatePhoneCall: setData(new MTPDupdatePhoneCall()); break; - case mtpc_updateDialogPinned: setData(new MTPDupdateDialogPinned()); break; - case mtpc_updatePinnedDialogs: setData(new MTPDupdatePinnedDialogs()); break; + case mtpc_updateChannelWebPage: data = std::make_shared(); break; + case mtpc_updatePhoneCall: data = std::make_shared(); break; + case mtpc_updateDialogPinned: data = std::make_shared(); break; + case mtpc_updatePinnedDialogs: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPupdate"); } } -inline MTPupdate::MTPupdate(MTPDupdateNewMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateNewMessage) { +inline const MTPDupdateNewMessage &MTPupdate::c_updateNewMessage() const { + t_assert(data != nullptr && _type == mtpc_updateNewMessage); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateMessageID *_data) : mtpDataOwner(_data), _type(mtpc_updateMessageID) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateNewMessage) { } -inline MTPupdate::MTPupdate(MTPDupdateDeleteMessages *_data) : mtpDataOwner(_data), _type(mtpc_updateDeleteMessages) { +inline const MTPDupdateMessageID &MTPupdate::c_updateMessageID() const { + t_assert(data != nullptr && _type == mtpc_updateMessageID); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateUserTyping *_data) : mtpDataOwner(_data), _type(mtpc_updateUserTyping) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateMessageID) { } -inline MTPupdate::MTPupdate(MTPDupdateChatUserTyping *_data) : mtpDataOwner(_data), _type(mtpc_updateChatUserTyping) { +inline const MTPDupdateDeleteMessages &MTPupdate::c_updateDeleteMessages() const { + t_assert(data != nullptr && _type == mtpc_updateDeleteMessages); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateChatParticipants *_data) : mtpDataOwner(_data), _type(mtpc_updateChatParticipants) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateDeleteMessages) { } -inline MTPupdate::MTPupdate(MTPDupdateUserStatus *_data) : mtpDataOwner(_data), _type(mtpc_updateUserStatus) { +inline const MTPDupdateUserTyping &MTPupdate::c_updateUserTyping() const { + t_assert(data != nullptr && _type == mtpc_updateUserTyping); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateUserName *_data) : mtpDataOwner(_data), _type(mtpc_updateUserName) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateUserTyping) { } -inline MTPupdate::MTPupdate(MTPDupdateUserPhoto *_data) : mtpDataOwner(_data), _type(mtpc_updateUserPhoto) { +inline const MTPDupdateChatUserTyping &MTPupdate::c_updateChatUserTyping() const { + t_assert(data != nullptr && _type == mtpc_updateChatUserTyping); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateContactRegistered *_data) : mtpDataOwner(_data), _type(mtpc_updateContactRegistered) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateChatUserTyping) { } -inline MTPupdate::MTPupdate(MTPDupdateContactLink *_data) : mtpDataOwner(_data), _type(mtpc_updateContactLink) { +inline const MTPDupdateChatParticipants &MTPupdate::c_updateChatParticipants() const { + t_assert(data != nullptr && _type == mtpc_updateChatParticipants); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateNewEncryptedMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateNewEncryptedMessage) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateChatParticipants) { } -inline MTPupdate::MTPupdate(MTPDupdateEncryptedChatTyping *_data) : mtpDataOwner(_data), _type(mtpc_updateEncryptedChatTyping) { +inline const MTPDupdateUserStatus &MTPupdate::c_updateUserStatus() const { + t_assert(data != nullptr && _type == mtpc_updateUserStatus); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateEncryption *_data) : mtpDataOwner(_data), _type(mtpc_updateEncryption) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateUserStatus) { } -inline MTPupdate::MTPupdate(MTPDupdateEncryptedMessagesRead *_data) : mtpDataOwner(_data), _type(mtpc_updateEncryptedMessagesRead) { +inline const MTPDupdateUserName &MTPupdate::c_updateUserName() const { + t_assert(data != nullptr && _type == mtpc_updateUserName); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateChatParticipantAdd *_data) : mtpDataOwner(_data), _type(mtpc_updateChatParticipantAdd) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateUserName) { } -inline MTPupdate::MTPupdate(MTPDupdateChatParticipantDelete *_data) : mtpDataOwner(_data), _type(mtpc_updateChatParticipantDelete) { +inline const MTPDupdateUserPhoto &MTPupdate::c_updateUserPhoto() const { + t_assert(data != nullptr && _type == mtpc_updateUserPhoto); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateDcOptions *_data) : mtpDataOwner(_data), _type(mtpc_updateDcOptions) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateUserPhoto) { } -inline MTPupdate::MTPupdate(MTPDupdateUserBlocked *_data) : mtpDataOwner(_data), _type(mtpc_updateUserBlocked) { +inline const MTPDupdateContactRegistered &MTPupdate::c_updateContactRegistered() const { + t_assert(data != nullptr && _type == mtpc_updateContactRegistered); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateNotifySettings *_data) : mtpDataOwner(_data), _type(mtpc_updateNotifySettings) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateContactRegistered) { } -inline MTPupdate::MTPupdate(MTPDupdateServiceNotification *_data) : mtpDataOwner(_data), _type(mtpc_updateServiceNotification) { +inline const MTPDupdateContactLink &MTPupdate::c_updateContactLink() const { + t_assert(data != nullptr && _type == mtpc_updateContactLink); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdatePrivacy *_data) : mtpDataOwner(_data), _type(mtpc_updatePrivacy) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateContactLink) { } -inline MTPupdate::MTPupdate(MTPDupdateUserPhone *_data) : mtpDataOwner(_data), _type(mtpc_updateUserPhone) { +inline const MTPDupdateNewEncryptedMessage &MTPupdate::c_updateNewEncryptedMessage() const { + t_assert(data != nullptr && _type == mtpc_updateNewEncryptedMessage); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateReadHistoryInbox *_data) : mtpDataOwner(_data), _type(mtpc_updateReadHistoryInbox) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateNewEncryptedMessage) { } -inline MTPupdate::MTPupdate(MTPDupdateReadHistoryOutbox *_data) : mtpDataOwner(_data), _type(mtpc_updateReadHistoryOutbox) { +inline const MTPDupdateEncryptedChatTyping &MTPupdate::c_updateEncryptedChatTyping() const { + t_assert(data != nullptr && _type == mtpc_updateEncryptedChatTyping); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateWebPage *_data) : mtpDataOwner(_data), _type(mtpc_updateWebPage) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateEncryptedChatTyping) { } -inline MTPupdate::MTPupdate(MTPDupdateReadMessagesContents *_data) : mtpDataOwner(_data), _type(mtpc_updateReadMessagesContents) { +inline const MTPDupdateEncryption &MTPupdate::c_updateEncryption() const { + t_assert(data != nullptr && _type == mtpc_updateEncryption); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateChannelTooLong *_data) : mtpDataOwner(_data), _type(mtpc_updateChannelTooLong) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateEncryption) { } -inline MTPupdate::MTPupdate(MTPDupdateChannel *_data) : mtpDataOwner(_data), _type(mtpc_updateChannel) { +inline const MTPDupdateEncryptedMessagesRead &MTPupdate::c_updateEncryptedMessagesRead() const { + t_assert(data != nullptr && _type == mtpc_updateEncryptedMessagesRead); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateNewChannelMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateNewChannelMessage) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateEncryptedMessagesRead) { } -inline MTPupdate::MTPupdate(MTPDupdateReadChannelInbox *_data) : mtpDataOwner(_data), _type(mtpc_updateReadChannelInbox) { +inline const MTPDupdateChatParticipantAdd &MTPupdate::c_updateChatParticipantAdd() const { + t_assert(data != nullptr && _type == mtpc_updateChatParticipantAdd); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateDeleteChannelMessages *_data) : mtpDataOwner(_data), _type(mtpc_updateDeleteChannelMessages) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateChatParticipantAdd) { } -inline MTPupdate::MTPupdate(MTPDupdateChannelMessageViews *_data) : mtpDataOwner(_data), _type(mtpc_updateChannelMessageViews) { +inline const MTPDupdateChatParticipantDelete &MTPupdate::c_updateChatParticipantDelete() const { + t_assert(data != nullptr && _type == mtpc_updateChatParticipantDelete); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateChatAdmins *_data) : mtpDataOwner(_data), _type(mtpc_updateChatAdmins) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateChatParticipantDelete) { } -inline MTPupdate::MTPupdate(MTPDupdateChatParticipantAdmin *_data) : mtpDataOwner(_data), _type(mtpc_updateChatParticipantAdmin) { +inline const MTPDupdateDcOptions &MTPupdate::c_updateDcOptions() const { + t_assert(data != nullptr && _type == mtpc_updateDcOptions); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateNewStickerSet *_data) : mtpDataOwner(_data), _type(mtpc_updateNewStickerSet) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateDcOptions) { } -inline MTPupdate::MTPupdate(MTPDupdateStickerSetsOrder *_data) : mtpDataOwner(_data), _type(mtpc_updateStickerSetsOrder) { +inline const MTPDupdateUserBlocked &MTPupdate::c_updateUserBlocked() const { + t_assert(data != nullptr && _type == mtpc_updateUserBlocked); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateBotInlineQuery *_data) : mtpDataOwner(_data), _type(mtpc_updateBotInlineQuery) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateUserBlocked) { } -inline MTPupdate::MTPupdate(MTPDupdateBotInlineSend *_data) : mtpDataOwner(_data), _type(mtpc_updateBotInlineSend) { +inline const MTPDupdateNotifySettings &MTPupdate::c_updateNotifySettings() const { + t_assert(data != nullptr && _type == mtpc_updateNotifySettings); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateEditChannelMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateEditChannelMessage) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateNotifySettings) { } -inline MTPupdate::MTPupdate(MTPDupdateChannelPinnedMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateChannelPinnedMessage) { +inline const MTPDupdateServiceNotification &MTPupdate::c_updateServiceNotification() const { + t_assert(data != nullptr && _type == mtpc_updateServiceNotification); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateBotCallbackQuery *_data) : mtpDataOwner(_data), _type(mtpc_updateBotCallbackQuery) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateServiceNotification) { } -inline MTPupdate::MTPupdate(MTPDupdateEditMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateEditMessage) { +inline const MTPDupdatePrivacy &MTPupdate::c_updatePrivacy() const { + t_assert(data != nullptr && _type == mtpc_updatePrivacy); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateInlineBotCallbackQuery *_data) : mtpDataOwner(_data), _type(mtpc_updateInlineBotCallbackQuery) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updatePrivacy) { } -inline MTPupdate::MTPupdate(MTPDupdateReadChannelOutbox *_data) : mtpDataOwner(_data), _type(mtpc_updateReadChannelOutbox) { +inline const MTPDupdateUserPhone &MTPupdate::c_updateUserPhone() const { + t_assert(data != nullptr && _type == mtpc_updateUserPhone); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdateDraftMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateDraftMessage) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateUserPhone) { } -inline MTPupdate::MTPupdate(MTPDupdateChannelWebPage *_data) : mtpDataOwner(_data), _type(mtpc_updateChannelWebPage) { +inline const MTPDupdateReadHistoryInbox &MTPupdate::c_updateReadHistoryInbox() const { + t_assert(data != nullptr && _type == mtpc_updateReadHistoryInbox); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdatePhoneCall *_data) : mtpDataOwner(_data), _type(mtpc_updatePhoneCall) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateReadHistoryInbox) { } -inline MTPupdate::MTPupdate(MTPDupdateDialogPinned *_data) : mtpDataOwner(_data), _type(mtpc_updateDialogPinned) { +inline const MTPDupdateReadHistoryOutbox &MTPupdate::c_updateReadHistoryOutbox() const { + t_assert(data != nullptr && _type == mtpc_updateReadHistoryOutbox); + return static_cast(*data); } -inline MTPupdate::MTPupdate(MTPDupdatePinnedDialogs *_data) : mtpDataOwner(_data), _type(mtpc_updatePinnedDialogs) { +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateReadHistoryOutbox) { +} +inline const MTPDupdateWebPage &MTPupdate::c_updateWebPage() const { + t_assert(data != nullptr && _type == mtpc_updateWebPage); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateWebPage) { +} +inline const MTPDupdateReadMessagesContents &MTPupdate::c_updateReadMessagesContents() const { + t_assert(data != nullptr && _type == mtpc_updateReadMessagesContents); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateReadMessagesContents) { +} +inline const MTPDupdateChannelTooLong &MTPupdate::c_updateChannelTooLong() const { + t_assert(data != nullptr && _type == mtpc_updateChannelTooLong); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateChannelTooLong) { +} +inline const MTPDupdateChannel &MTPupdate::c_updateChannel() const { + t_assert(data != nullptr && _type == mtpc_updateChannel); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateChannel) { +} +inline const MTPDupdateNewChannelMessage &MTPupdate::c_updateNewChannelMessage() const { + t_assert(data != nullptr && _type == mtpc_updateNewChannelMessage); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateNewChannelMessage) { +} +inline const MTPDupdateReadChannelInbox &MTPupdate::c_updateReadChannelInbox() const { + t_assert(data != nullptr && _type == mtpc_updateReadChannelInbox); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateReadChannelInbox) { +} +inline const MTPDupdateDeleteChannelMessages &MTPupdate::c_updateDeleteChannelMessages() const { + t_assert(data != nullptr && _type == mtpc_updateDeleteChannelMessages); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateDeleteChannelMessages) { +} +inline const MTPDupdateChannelMessageViews &MTPupdate::c_updateChannelMessageViews() const { + t_assert(data != nullptr && _type == mtpc_updateChannelMessageViews); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateChannelMessageViews) { +} +inline const MTPDupdateChatAdmins &MTPupdate::c_updateChatAdmins() const { + t_assert(data != nullptr && _type == mtpc_updateChatAdmins); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateChatAdmins) { +} +inline const MTPDupdateChatParticipantAdmin &MTPupdate::c_updateChatParticipantAdmin() const { + t_assert(data != nullptr && _type == mtpc_updateChatParticipantAdmin); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateChatParticipantAdmin) { +} +inline const MTPDupdateNewStickerSet &MTPupdate::c_updateNewStickerSet() const { + t_assert(data != nullptr && _type == mtpc_updateNewStickerSet); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateNewStickerSet) { +} +inline const MTPDupdateStickerSetsOrder &MTPupdate::c_updateStickerSetsOrder() const { + t_assert(data != nullptr && _type == mtpc_updateStickerSetsOrder); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateStickerSetsOrder) { +} +inline const MTPDupdateBotInlineQuery &MTPupdate::c_updateBotInlineQuery() const { + t_assert(data != nullptr && _type == mtpc_updateBotInlineQuery); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateBotInlineQuery) { +} +inline const MTPDupdateBotInlineSend &MTPupdate::c_updateBotInlineSend() const { + t_assert(data != nullptr && _type == mtpc_updateBotInlineSend); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateBotInlineSend) { +} +inline const MTPDupdateEditChannelMessage &MTPupdate::c_updateEditChannelMessage() const { + t_assert(data != nullptr && _type == mtpc_updateEditChannelMessage); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateEditChannelMessage) { +} +inline const MTPDupdateChannelPinnedMessage &MTPupdate::c_updateChannelPinnedMessage() const { + t_assert(data != nullptr && _type == mtpc_updateChannelPinnedMessage); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateChannelPinnedMessage) { +} +inline const MTPDupdateBotCallbackQuery &MTPupdate::c_updateBotCallbackQuery() const { + t_assert(data != nullptr && _type == mtpc_updateBotCallbackQuery); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateBotCallbackQuery) { +} +inline const MTPDupdateEditMessage &MTPupdate::c_updateEditMessage() const { + t_assert(data != nullptr && _type == mtpc_updateEditMessage); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateEditMessage) { +} +inline const MTPDupdateInlineBotCallbackQuery &MTPupdate::c_updateInlineBotCallbackQuery() const { + t_assert(data != nullptr && _type == mtpc_updateInlineBotCallbackQuery); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateInlineBotCallbackQuery) { +} +inline const MTPDupdateReadChannelOutbox &MTPupdate::c_updateReadChannelOutbox() const { + t_assert(data != nullptr && _type == mtpc_updateReadChannelOutbox); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateReadChannelOutbox) { +} +inline const MTPDupdateDraftMessage &MTPupdate::c_updateDraftMessage() const { + t_assert(data != nullptr && _type == mtpc_updateDraftMessage); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateDraftMessage) { +} +inline const MTPDupdateChannelWebPage &MTPupdate::c_updateChannelWebPage() const { + t_assert(data != nullptr && _type == mtpc_updateChannelWebPage); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateChannelWebPage) { +} +inline const MTPDupdatePhoneCall &MTPupdate::c_updatePhoneCall() const { + t_assert(data != nullptr && _type == mtpc_updatePhoneCall); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updatePhoneCall) { +} +inline const MTPDupdateDialogPinned &MTPupdate::c_updateDialogPinned() const { + t_assert(data != nullptr && _type == mtpc_updateDialogPinned); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateDialogPinned) { +} +inline const MTPDupdatePinnedDialogs &MTPupdate::c_updatePinnedDialogs() const { + t_assert(data != nullptr && _type == mtpc_updatePinnedDialogs); + return static_cast(*data); +} +inline MTPupdate::MTPupdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updatePinnedDialogs) { } inline MTPupdate MTP_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { return MTP::internal::TypeCreator::new_updateNewMessage(_message, _pts, _pts_count); @@ -33224,7 +30363,7 @@ inline MTPupdate MTP_updatePinnedDialogs(const MTPflags()) { } inline uint32 MTPupdates_state::innerLength() const { @@ -33237,23 +30376,27 @@ inline mtpTypeId MTPupdates_state::type() const { inline void MTPupdates_state::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_updates_state) throw mtpErrorUnexpected(cons, "MTPupdates_state"); - if (!data) setData(new MTPDupdates_state()); - MTPDupdates_state &v(_updates_state()); - v.vpts.read(from, end); - v.vqts.read(from, end); - v.vdate.read(from, end); - v.vseq.read(from, end); - v.vunread_count.read(from, end); + auto v = std::make_shared(); + v->vpts.read(from, end); + v->vqts.read(from, end); + v->vdate.read(from, end); + v->vseq.read(from, end); + v->vunread_count.read(from, end); + data = std::move(v); } inline void MTPupdates_state::write(mtpBuffer &to) const { - const MTPDupdates_state &v(c_updates_state()); + auto &v = c_updates_state(); v.vpts.write(to); v.vqts.write(to); v.vdate.write(to); v.vseq.write(to); v.vunread_count.write(to); } -inline MTPupdates_state::MTPupdates_state(MTPDupdates_state *_data) : mtpDataOwner(_data) { +inline const MTPDupdates_state &MTPupdates_state::c_updates_state() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPupdates_state::MTPupdates_state(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPupdates_state MTP_updates_state(MTPint _pts, MTPint _qts, MTPint _date, MTPint _seq, MTPint _unread_count) { return MTP::internal::TypeCreator::new_updates_state(_pts, _qts, _date, _seq, _unread_count); @@ -33285,38 +30428,38 @@ inline mtpTypeId MTPupdates_difference::type() const { return _type; } inline void MTPupdates_difference::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_updates_differenceEmpty: _type = cons; { - if (!data) setData(new MTPDupdates_differenceEmpty()); - MTPDupdates_differenceEmpty &v(_updates_differenceEmpty()); - v.vdate.read(from, end); - v.vseq.read(from, end); + auto v = std::make_shared(); + v->vdate.read(from, end); + v->vseq.read(from, end); + data = std::move(v); } break; case mtpc_updates_difference: _type = cons; { - if (!data) setData(new MTPDupdates_difference()); - MTPDupdates_difference &v(_updates_difference()); - v.vnew_messages.read(from, end); - v.vnew_encrypted_messages.read(from, end); - v.vother_updates.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); - v.vstate.read(from, end); + auto v = std::make_shared(); + v->vnew_messages.read(from, end); + v->vnew_encrypted_messages.read(from, end); + v->vother_updates.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + v->vstate.read(from, end); + data = std::move(v); } break; case mtpc_updates_differenceSlice: _type = cons; { - if (!data) setData(new MTPDupdates_differenceSlice()); - MTPDupdates_differenceSlice &v(_updates_differenceSlice()); - v.vnew_messages.read(from, end); - v.vnew_encrypted_messages.read(from, end); - v.vother_updates.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); - v.vintermediate_state.read(from, end); + auto v = std::make_shared(); + v->vnew_messages.read(from, end); + v->vnew_encrypted_messages.read(from, end); + v->vother_updates.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + v->vintermediate_state.read(from, end); + data = std::move(v); } break; case mtpc_updates_differenceTooLong: _type = cons; { - if (!data) setData(new MTPDupdates_differenceTooLong()); - MTPDupdates_differenceTooLong &v(_updates_differenceTooLong()); - v.vpts.read(from, end); + auto v = std::make_shared(); + v->vpts.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPupdates_difference"); } @@ -33324,12 +30467,12 @@ inline void MTPupdates_difference::read(const mtpPrime *&from, const mtpPrime *e inline void MTPupdates_difference::write(mtpBuffer &to) const { switch (_type) { case mtpc_updates_differenceEmpty: { - const MTPDupdates_differenceEmpty &v(c_updates_differenceEmpty()); + auto &v = c_updates_differenceEmpty(); v.vdate.write(to); v.vseq.write(to); } break; case mtpc_updates_difference: { - const MTPDupdates_difference &v(c_updates_difference()); + auto &v = c_updates_difference(); v.vnew_messages.write(to); v.vnew_encrypted_messages.write(to); v.vother_updates.write(to); @@ -33338,7 +30481,7 @@ inline void MTPupdates_difference::write(mtpBuffer &to) const { v.vstate.write(to); } break; case mtpc_updates_differenceSlice: { - const MTPDupdates_differenceSlice &v(c_updates_differenceSlice()); + auto &v = c_updates_differenceSlice(); v.vnew_messages.write(to); v.vnew_encrypted_messages.write(to); v.vother_updates.write(to); @@ -33347,27 +30490,43 @@ inline void MTPupdates_difference::write(mtpBuffer &to) const { v.vintermediate_state.write(to); } break; case mtpc_updates_differenceTooLong: { - const MTPDupdates_differenceTooLong &v(c_updates_differenceTooLong()); + auto &v = c_updates_differenceTooLong(); v.vpts.write(to); } break; } } -inline MTPupdates_difference::MTPupdates_difference(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPupdates_difference::MTPupdates_difference(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_updates_differenceEmpty: setData(new MTPDupdates_differenceEmpty()); break; - case mtpc_updates_difference: setData(new MTPDupdates_difference()); break; - case mtpc_updates_differenceSlice: setData(new MTPDupdates_differenceSlice()); break; - case mtpc_updates_differenceTooLong: setData(new MTPDupdates_differenceTooLong()); break; + case mtpc_updates_differenceEmpty: data = std::make_shared(); break; + case mtpc_updates_difference: data = std::make_shared(); break; + case mtpc_updates_differenceSlice: data = std::make_shared(); break; + case mtpc_updates_differenceTooLong: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPupdates_difference"); } } -inline MTPupdates_difference::MTPupdates_difference(MTPDupdates_differenceEmpty *_data) : mtpDataOwner(_data), _type(mtpc_updates_differenceEmpty) { +inline const MTPDupdates_differenceEmpty &MTPupdates_difference::c_updates_differenceEmpty() const { + t_assert(data != nullptr && _type == mtpc_updates_differenceEmpty); + return static_cast(*data); } -inline MTPupdates_difference::MTPupdates_difference(MTPDupdates_difference *_data) : mtpDataOwner(_data), _type(mtpc_updates_difference) { +inline MTPupdates_difference::MTPupdates_difference(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updates_differenceEmpty) { } -inline MTPupdates_difference::MTPupdates_difference(MTPDupdates_differenceSlice *_data) : mtpDataOwner(_data), _type(mtpc_updates_differenceSlice) { +inline const MTPDupdates_difference &MTPupdates_difference::c_updates_difference() const { + t_assert(data != nullptr && _type == mtpc_updates_difference); + return static_cast(*data); } -inline MTPupdates_difference::MTPupdates_difference(MTPDupdates_differenceTooLong *_data) : mtpDataOwner(_data), _type(mtpc_updates_differenceTooLong) { +inline MTPupdates_difference::MTPupdates_difference(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updates_difference) { +} +inline const MTPDupdates_differenceSlice &MTPupdates_difference::c_updates_differenceSlice() const { + t_assert(data != nullptr && _type == mtpc_updates_differenceSlice); + return static_cast(*data); +} +inline MTPupdates_difference::MTPupdates_difference(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updates_differenceSlice) { +} +inline const MTPDupdates_differenceTooLong &MTPupdates_difference::c_updates_differenceTooLong() const { + t_assert(data != nullptr && _type == mtpc_updates_differenceTooLong); + return static_cast(*data); +} +inline MTPupdates_difference::MTPupdates_difference(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updates_differenceTooLong) { } inline MTPupdates_difference MTP_updates_differenceEmpty(MTPint _date, MTPint _seq) { return MTP::internal::TypeCreator::new_updates_differenceEmpty(_date, _seq); @@ -33416,75 +30575,75 @@ inline mtpTypeId MTPupdates::type() const { return _type; } inline void MTPupdates::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_updatesTooLong: _type = cons; break; case mtpc_updateShortMessage: _type = cons; { - if (!data) setData(new MTPDupdateShortMessage()); - MTPDupdateShortMessage &v(_updateShortMessage()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vuser_id.read(from, end); - v.vmessage.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); - v.vdate.read(from, end); - if (v.has_fwd_from()) { v.vfwd_from.read(from, end); } else { v.vfwd_from = MTPMessageFwdHeader(); } - if (v.has_via_bot_id()) { v.vvia_bot_id.read(from, end); } else { v.vvia_bot_id = MTPint(); } - if (v.has_reply_to_msg_id()) { v.vreply_to_msg_id.read(from, end); } else { v.vreply_to_msg_id = MTPint(); } - if (v.has_entities()) { v.ventities.read(from, end); } else { v.ventities = MTPVector(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vuser_id.read(from, end); + v->vmessage.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + v->vdate.read(from, end); + if (v->has_fwd_from()) { v->vfwd_from.read(from, end); } else { v->vfwd_from = MTPMessageFwdHeader(); } + if (v->has_via_bot_id()) { v->vvia_bot_id.read(from, end); } else { v->vvia_bot_id = MTPint(); } + if (v->has_reply_to_msg_id()) { v->vreply_to_msg_id.read(from, end); } else { v->vreply_to_msg_id = MTPint(); } + if (v->has_entities()) { v->ventities.read(from, end); } else { v->ventities = MTPVector(); } + data = std::move(v); } break; case mtpc_updateShortChatMessage: _type = cons; { - if (!data) setData(new MTPDupdateShortChatMessage()); - MTPDupdateShortChatMessage &v(_updateShortChatMessage()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vfrom_id.read(from, end); - v.vchat_id.read(from, end); - v.vmessage.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); - v.vdate.read(from, end); - if (v.has_fwd_from()) { v.vfwd_from.read(from, end); } else { v.vfwd_from = MTPMessageFwdHeader(); } - if (v.has_via_bot_id()) { v.vvia_bot_id.read(from, end); } else { v.vvia_bot_id = MTPint(); } - if (v.has_reply_to_msg_id()) { v.vreply_to_msg_id.read(from, end); } else { v.vreply_to_msg_id = MTPint(); } - if (v.has_entities()) { v.ventities.read(from, end); } else { v.ventities = MTPVector(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vfrom_id.read(from, end); + v->vchat_id.read(from, end); + v->vmessage.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + v->vdate.read(from, end); + if (v->has_fwd_from()) { v->vfwd_from.read(from, end); } else { v->vfwd_from = MTPMessageFwdHeader(); } + if (v->has_via_bot_id()) { v->vvia_bot_id.read(from, end); } else { v->vvia_bot_id = MTPint(); } + if (v->has_reply_to_msg_id()) { v->vreply_to_msg_id.read(from, end); } else { v->vreply_to_msg_id = MTPint(); } + if (v->has_entities()) { v->ventities.read(from, end); } else { v->ventities = MTPVector(); } + data = std::move(v); } break; case mtpc_updateShort: _type = cons; { - if (!data) setData(new MTPDupdateShort()); - MTPDupdateShort &v(_updateShort()); - v.vupdate.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vupdate.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_updatesCombined: _type = cons; { - if (!data) setData(new MTPDupdatesCombined()); - MTPDupdatesCombined &v(_updatesCombined()); - v.vupdates.read(from, end); - v.vusers.read(from, end); - v.vchats.read(from, end); - v.vdate.read(from, end); - v.vseq_start.read(from, end); - v.vseq.read(from, end); + auto v = std::make_shared(); + v->vupdates.read(from, end); + v->vusers.read(from, end); + v->vchats.read(from, end); + v->vdate.read(from, end); + v->vseq_start.read(from, end); + v->vseq.read(from, end); + data = std::move(v); } break; case mtpc_updates: _type = cons; { - if (!data) setData(new MTPDupdates()); - MTPDupdates &v(_updates()); - v.vupdates.read(from, end); - v.vusers.read(from, end); - v.vchats.read(from, end); - v.vdate.read(from, end); - v.vseq.read(from, end); + auto v = std::make_shared(); + v->vupdates.read(from, end); + v->vusers.read(from, end); + v->vchats.read(from, end); + v->vdate.read(from, end); + v->vseq.read(from, end); + data = std::move(v); } break; case mtpc_updateShortSentMessage: _type = cons; { - if (!data) setData(new MTPDupdateShortSentMessage()); - MTPDupdateShortSentMessage &v(_updateShortSentMessage()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); - v.vdate.read(from, end); - if (v.has_media()) { v.vmedia.read(from, end); } else { v.vmedia = MTPMessageMedia(); } - if (v.has_entities()) { v.ventities.read(from, end); } else { v.ventities = MTPVector(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + v->vdate.read(from, end); + if (v->has_media()) { v->vmedia.read(from, end); } else { v->vmedia = MTPMessageMedia(); } + if (v->has_entities()) { v->ventities.read(from, end); } else { v->ventities = MTPVector(); } + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPupdates"); } @@ -33492,7 +30651,7 @@ inline void MTPupdates::read(const mtpPrime *&from, const mtpPrime *end, mtpType inline void MTPupdates::write(mtpBuffer &to) const { switch (_type) { case mtpc_updateShortMessage: { - const MTPDupdateShortMessage &v(c_updateShortMessage()); + auto &v = c_updateShortMessage(); v.vflags.write(to); v.vid.write(to); v.vuser_id.write(to); @@ -33506,7 +30665,7 @@ inline void MTPupdates::write(mtpBuffer &to) const { if (v.has_entities()) v.ventities.write(to); } break; case mtpc_updateShortChatMessage: { - const MTPDupdateShortChatMessage &v(c_updateShortChatMessage()); + auto &v = c_updateShortChatMessage(); v.vflags.write(to); v.vid.write(to); v.vfrom_id.write(to); @@ -33521,12 +30680,12 @@ inline void MTPupdates::write(mtpBuffer &to) const { if (v.has_entities()) v.ventities.write(to); } break; case mtpc_updateShort: { - const MTPDupdateShort &v(c_updateShort()); + auto &v = c_updateShort(); v.vupdate.write(to); v.vdate.write(to); } break; case mtpc_updatesCombined: { - const MTPDupdatesCombined &v(c_updatesCombined()); + auto &v = c_updatesCombined(); v.vupdates.write(to); v.vusers.write(to); v.vchats.write(to); @@ -33535,7 +30694,7 @@ inline void MTPupdates::write(mtpBuffer &to) const { v.vseq.write(to); } break; case mtpc_updates: { - const MTPDupdates &v(c_updates()); + auto &v = c_updates(); v.vupdates.write(to); v.vusers.write(to); v.vchats.write(to); @@ -33543,7 +30702,7 @@ inline void MTPupdates::write(mtpBuffer &to) const { v.vseq.write(to); } break; case mtpc_updateShortSentMessage: { - const MTPDupdateShortSentMessage &v(c_updateShortSentMessage()); + auto &v = c_updateShortSentMessage(); v.vflags.write(to); v.vid.write(to); v.vpts.write(to); @@ -33554,29 +30713,53 @@ inline void MTPupdates::write(mtpBuffer &to) const { } break; } } -inline MTPupdates::MTPupdates(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPupdates::MTPupdates(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_updatesTooLong: break; - case mtpc_updateShortMessage: setData(new MTPDupdateShortMessage()); break; - case mtpc_updateShortChatMessage: setData(new MTPDupdateShortChatMessage()); break; - case mtpc_updateShort: setData(new MTPDupdateShort()); break; - case mtpc_updatesCombined: setData(new MTPDupdatesCombined()); break; - case mtpc_updates: setData(new MTPDupdates()); break; - case mtpc_updateShortSentMessage: setData(new MTPDupdateShortSentMessage()); break; + case mtpc_updateShortMessage: data = std::make_shared(); break; + case mtpc_updateShortChatMessage: data = std::make_shared(); break; + case mtpc_updateShort: data = std::make_shared(); break; + case mtpc_updatesCombined: data = std::make_shared(); break; + case mtpc_updates: data = std::make_shared(); break; + case mtpc_updateShortSentMessage: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPupdates"); } } -inline MTPupdates::MTPupdates(MTPDupdateShortMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateShortMessage) { +inline const MTPDupdateShortMessage &MTPupdates::c_updateShortMessage() const { + t_assert(data != nullptr && _type == mtpc_updateShortMessage); + return static_cast(*data); } -inline MTPupdates::MTPupdates(MTPDupdateShortChatMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateShortChatMessage) { +inline MTPupdates::MTPupdates(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateShortMessage) { } -inline MTPupdates::MTPupdates(MTPDupdateShort *_data) : mtpDataOwner(_data), _type(mtpc_updateShort) { +inline const MTPDupdateShortChatMessage &MTPupdates::c_updateShortChatMessage() const { + t_assert(data != nullptr && _type == mtpc_updateShortChatMessage); + return static_cast(*data); } -inline MTPupdates::MTPupdates(MTPDupdatesCombined *_data) : mtpDataOwner(_data), _type(mtpc_updatesCombined) { +inline MTPupdates::MTPupdates(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateShortChatMessage) { } -inline MTPupdates::MTPupdates(MTPDupdates *_data) : mtpDataOwner(_data), _type(mtpc_updates) { +inline const MTPDupdateShort &MTPupdates::c_updateShort() const { + t_assert(data != nullptr && _type == mtpc_updateShort); + return static_cast(*data); } -inline MTPupdates::MTPupdates(MTPDupdateShortSentMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateShortSentMessage) { +inline MTPupdates::MTPupdates(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateShort) { +} +inline const MTPDupdatesCombined &MTPupdates::c_updatesCombined() const { + t_assert(data != nullptr && _type == mtpc_updatesCombined); + return static_cast(*data); +} +inline MTPupdates::MTPupdates(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updatesCombined) { +} +inline const MTPDupdates &MTPupdates::c_updates() const { + t_assert(data != nullptr && _type == mtpc_updates); + return static_cast(*data); +} +inline MTPupdates::MTPupdates(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updates) { +} +inline const MTPDupdateShortSentMessage &MTPupdates::c_updateShortSentMessage() const { + t_assert(data != nullptr && _type == mtpc_updateShortSentMessage); + return static_cast(*data); +} +inline MTPupdates::MTPupdates(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updateShortSentMessage) { } inline MTPupdates MTP_updatesTooLong() { return MTP::internal::TypeCreator::new_updatesTooLong(); @@ -33621,20 +30804,20 @@ inline mtpTypeId MTPphotos_photos::type() const { return _type; } inline void MTPphotos_photos::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_photos_photos: _type = cons; { - if (!data) setData(new MTPDphotos_photos()); - MTPDphotos_photos &v(_photos_photos()); - v.vphotos.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vphotos.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; case mtpc_photos_photosSlice: _type = cons; { - if (!data) setData(new MTPDphotos_photosSlice()); - MTPDphotos_photosSlice &v(_photos_photosSlice()); - v.vcount.read(from, end); - v.vphotos.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vcount.read(from, end); + v->vphotos.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPphotos_photos"); } @@ -33642,28 +30825,36 @@ inline void MTPphotos_photos::read(const mtpPrime *&from, const mtpPrime *end, m inline void MTPphotos_photos::write(mtpBuffer &to) const { switch (_type) { case mtpc_photos_photos: { - const MTPDphotos_photos &v(c_photos_photos()); + auto &v = c_photos_photos(); v.vphotos.write(to); v.vusers.write(to); } break; case mtpc_photos_photosSlice: { - const MTPDphotos_photosSlice &v(c_photos_photosSlice()); + auto &v = c_photos_photosSlice(); v.vcount.write(to); v.vphotos.write(to); v.vusers.write(to); } break; } } -inline MTPphotos_photos::MTPphotos_photos(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPphotos_photos::MTPphotos_photos(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_photos_photos: setData(new MTPDphotos_photos()); break; - case mtpc_photos_photosSlice: setData(new MTPDphotos_photosSlice()); break; + case mtpc_photos_photos: data = std::make_shared(); break; + case mtpc_photos_photosSlice: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPphotos_photos"); } } -inline MTPphotos_photos::MTPphotos_photos(MTPDphotos_photos *_data) : mtpDataOwner(_data), _type(mtpc_photos_photos) { +inline const MTPDphotos_photos &MTPphotos_photos::c_photos_photos() const { + t_assert(data != nullptr && _type == mtpc_photos_photos); + return static_cast(*data); } -inline MTPphotos_photos::MTPphotos_photos(MTPDphotos_photosSlice *_data) : mtpDataOwner(_data), _type(mtpc_photos_photosSlice) { +inline MTPphotos_photos::MTPphotos_photos(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_photos_photos) { +} +inline const MTPDphotos_photosSlice &MTPphotos_photos::c_photos_photosSlice() const { + t_assert(data != nullptr && _type == mtpc_photos_photosSlice); + return static_cast(*data); +} +inline MTPphotos_photos::MTPphotos_photos(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_photos_photosSlice) { } inline MTPphotos_photos MTP_photos_photos(const MTPVector &_photos, const MTPVector &_users) { return MTP::internal::TypeCreator::new_photos_photos(_photos, _users); @@ -33672,7 +30863,7 @@ inline MTPphotos_photos MTP_photos_photosSlice(MTPint _count, const MTPVector()) { } inline uint32 MTPphotos_photo::innerLength() const { @@ -33685,23 +30876,27 @@ inline mtpTypeId MTPphotos_photo::type() const { inline void MTPphotos_photo::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_photos_photo) throw mtpErrorUnexpected(cons, "MTPphotos_photo"); - if (!data) setData(new MTPDphotos_photo()); - MTPDphotos_photo &v(_photos_photo()); - v.vphoto.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vphoto.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } inline void MTPphotos_photo::write(mtpBuffer &to) const { - const MTPDphotos_photo &v(c_photos_photo()); + auto &v = c_photos_photo(); v.vphoto.write(to); v.vusers.write(to); } -inline MTPphotos_photo::MTPphotos_photo(MTPDphotos_photo *_data) : mtpDataOwner(_data) { +inline const MTPDphotos_photo &MTPphotos_photo::c_photos_photo() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPphotos_photo::MTPphotos_photo(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPphotos_photo MTP_photos_photo(const MTPPhoto &_photo, const MTPVector &_users) { return MTP::internal::TypeCreator::new_photos_photo(_photo, _users); } -inline MTPupload_file::MTPupload_file() : mtpDataOwner(new MTPDupload_file()) { +inline MTPupload_file::MTPupload_file() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPupload_file::innerLength() const { @@ -33714,25 +30909,29 @@ inline mtpTypeId MTPupload_file::type() const { inline void MTPupload_file::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_upload_file) throw mtpErrorUnexpected(cons, "MTPupload_file"); - if (!data) setData(new MTPDupload_file()); - MTPDupload_file &v(_upload_file()); - v.vtype.read(from, end); - v.vmtime.read(from, end); - v.vbytes.read(from, end); + auto v = std::make_shared(); + v->vtype.read(from, end); + v->vmtime.read(from, end); + v->vbytes.read(from, end); + data = std::move(v); } inline void MTPupload_file::write(mtpBuffer &to) const { - const MTPDupload_file &v(c_upload_file()); + auto &v = c_upload_file(); v.vtype.write(to); v.vmtime.write(to); v.vbytes.write(to); } -inline MTPupload_file::MTPupload_file(MTPDupload_file *_data) : mtpDataOwner(_data) { +inline const MTPDupload_file &MTPupload_file::c_upload_file() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPupload_file::MTPupload_file(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPupload_file MTP_upload_file(const MTPstorage_FileType &_type, MTPint _mtime, const MTPbytes &_bytes) { return MTP::internal::TypeCreator::new_upload_file(_type, _mtime, _bytes); } -inline MTPdcOption::MTPdcOption() : mtpDataOwner(new MTPDdcOption()) { +inline MTPdcOption::MTPdcOption() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPdcOption::innerLength() const { @@ -33745,28 +30944,32 @@ inline mtpTypeId MTPdcOption::type() const { inline void MTPdcOption::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_dcOption) throw mtpErrorUnexpected(cons, "MTPdcOption"); - if (!data) setData(new MTPDdcOption()); - MTPDdcOption &v(_dcOption()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vip_address.read(from, end); - v.vport.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vip_address.read(from, end); + v->vport.read(from, end); + data = std::move(v); } inline void MTPdcOption::write(mtpBuffer &to) const { - const MTPDdcOption &v(c_dcOption()); + auto &v = c_dcOption(); v.vflags.write(to); v.vid.write(to); v.vip_address.write(to); v.vport.write(to); } -inline MTPdcOption::MTPdcOption(MTPDdcOption *_data) : mtpDataOwner(_data) { +inline const MTPDdcOption &MTPdcOption::c_dcOption() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPdcOption::MTPdcOption(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDdcOption::Flags) inline MTPdcOption MTP_dcOption(const MTPflags &_flags, MTPint _id, const MTPstring &_ip_address, MTPint _port) { return MTP::internal::TypeCreator::new_dcOption(_flags, _id, _ip_address, _port); } -inline MTPconfig::MTPconfig() : mtpDataOwner(new MTPDconfig()) { +inline MTPconfig::MTPconfig() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPconfig::innerLength() const { @@ -33779,40 +30982,40 @@ inline mtpTypeId MTPconfig::type() const { inline void MTPconfig::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_config) throw mtpErrorUnexpected(cons, "MTPconfig"); - if (!data) setData(new MTPDconfig()); - MTPDconfig &v(_config()); - v.vflags.read(from, end); - v.vdate.read(from, end); - v.vexpires.read(from, end); - v.vtest_mode.read(from, end); - v.vthis_dc.read(from, end); - v.vdc_options.read(from, end); - v.vchat_size_max.read(from, end); - v.vmegagroup_size_max.read(from, end); - v.vforwarded_count_max.read(from, end); - v.vonline_update_period_ms.read(from, end); - v.voffline_blur_timeout_ms.read(from, end); - v.voffline_idle_timeout_ms.read(from, end); - v.vonline_cloud_timeout_ms.read(from, end); - v.vnotify_cloud_delay_ms.read(from, end); - v.vnotify_default_delay_ms.read(from, end); - v.vchat_big_size.read(from, end); - v.vpush_chat_period_ms.read(from, end); - v.vpush_chat_limit.read(from, end); - v.vsaved_gifs_limit.read(from, end); - v.vedit_time_limit.read(from, end); - v.vrating_e_decay.read(from, end); - v.vstickers_recent_limit.read(from, end); - if (v.has_tmp_sessions()) { v.vtmp_sessions.read(from, end); } else { v.vtmp_sessions = MTPint(); } - v.vpinned_dialogs_count_max.read(from, end); - v.vcall_receive_timeout_ms.read(from, end); - v.vcall_ring_timeout_ms.read(from, end); - v.vcall_connect_timeout_ms.read(from, end); - v.vcall_packet_timeout_ms.read(from, end); - v.vdisabled_features.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vdate.read(from, end); + v->vexpires.read(from, end); + v->vtest_mode.read(from, end); + v->vthis_dc.read(from, end); + v->vdc_options.read(from, end); + v->vchat_size_max.read(from, end); + v->vmegagroup_size_max.read(from, end); + v->vforwarded_count_max.read(from, end); + v->vonline_update_period_ms.read(from, end); + v->voffline_blur_timeout_ms.read(from, end); + v->voffline_idle_timeout_ms.read(from, end); + v->vonline_cloud_timeout_ms.read(from, end); + v->vnotify_cloud_delay_ms.read(from, end); + v->vnotify_default_delay_ms.read(from, end); + v->vchat_big_size.read(from, end); + v->vpush_chat_period_ms.read(from, end); + v->vpush_chat_limit.read(from, end); + v->vsaved_gifs_limit.read(from, end); + v->vedit_time_limit.read(from, end); + v->vrating_e_decay.read(from, end); + v->vstickers_recent_limit.read(from, end); + if (v->has_tmp_sessions()) { v->vtmp_sessions.read(from, end); } else { v->vtmp_sessions = MTPint(); } + v->vpinned_dialogs_count_max.read(from, end); + v->vcall_receive_timeout_ms.read(from, end); + v->vcall_ring_timeout_ms.read(from, end); + v->vcall_connect_timeout_ms.read(from, end); + v->vcall_packet_timeout_ms.read(from, end); + v->vdisabled_features.read(from, end); + data = std::move(v); } inline void MTPconfig::write(mtpBuffer &to) const { - const MTPDconfig &v(c_config()); + auto &v = c_config(); v.vflags.write(to); v.vdate.write(to); v.vexpires.write(to); @@ -33843,14 +31046,18 @@ inline void MTPconfig::write(mtpBuffer &to) const { v.vcall_packet_timeout_ms.write(to); v.vdisabled_features.write(to); } -inline MTPconfig::MTPconfig(MTPDconfig *_data) : mtpDataOwner(_data) { +inline const MTPDconfig &MTPconfig::c_config() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPconfig::MTPconfig(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDconfig::Flags) inline MTPconfig MTP_config(const MTPflags &_flags, MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _megagroup_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, MTPint _saved_gifs_limit, MTPint _edit_time_limit, MTPint _rating_e_decay, MTPint _stickers_recent_limit, MTPint _tmp_sessions, MTPint _pinned_dialogs_count_max, MTPint _call_receive_timeout_ms, MTPint _call_ring_timeout_ms, MTPint _call_connect_timeout_ms, MTPint _call_packet_timeout_ms, const MTPVector &_disabled_features) { return MTP::internal::TypeCreator::new_config(_flags, _date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _megagroup_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _push_chat_period_ms, _push_chat_limit, _saved_gifs_limit, _edit_time_limit, _rating_e_decay, _stickers_recent_limit, _tmp_sessions, _pinned_dialogs_count_max, _call_receive_timeout_ms, _call_ring_timeout_ms, _call_connect_timeout_ms, _call_packet_timeout_ms, _disabled_features); } -inline MTPnearestDc::MTPnearestDc() : mtpDataOwner(new MTPDnearestDc()) { +inline MTPnearestDc::MTPnearestDc() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPnearestDc::innerLength() const { @@ -33863,19 +31070,23 @@ inline mtpTypeId MTPnearestDc::type() const { inline void MTPnearestDc::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_nearestDc) throw mtpErrorUnexpected(cons, "MTPnearestDc"); - if (!data) setData(new MTPDnearestDc()); - MTPDnearestDc &v(_nearestDc()); - v.vcountry.read(from, end); - v.vthis_dc.read(from, end); - v.vnearest_dc.read(from, end); + auto v = std::make_shared(); + v->vcountry.read(from, end); + v->vthis_dc.read(from, end); + v->vnearest_dc.read(from, end); + data = std::move(v); } inline void MTPnearestDc::write(mtpBuffer &to) const { - const MTPDnearestDc &v(c_nearestDc()); + auto &v = c_nearestDc(); v.vcountry.write(to); v.vthis_dc.write(to); v.vnearest_dc.write(to); } -inline MTPnearestDc::MTPnearestDc(MTPDnearestDc *_data) : mtpDataOwner(_data) { +inline const MTPDnearestDc &MTPnearestDc::c_nearestDc() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPnearestDc::MTPnearestDc(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPnearestDc MTP_nearestDc(const MTPstring &_country, MTPint _this_dc, MTPint _nearest_dc) { return MTP::internal::TypeCreator::new_nearestDc(_country, _this_dc, _nearest_dc); @@ -33895,15 +31106,15 @@ inline mtpTypeId MTPhelp_appUpdate::type() const { return _type; } inline void MTPhelp_appUpdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_help_appUpdate: _type = cons; { - if (!data) setData(new MTPDhelp_appUpdate()); - MTPDhelp_appUpdate &v(_help_appUpdate()); - v.vid.read(from, end); - v.vcritical.read(from, end); - v.vurl.read(from, end); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vcritical.read(from, end); + v->vurl.read(from, end); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_help_noAppUpdate: _type = cons; break; default: throw mtpErrorUnexpected(cons, "MTPhelp_appUpdate"); @@ -33912,7 +31123,7 @@ inline void MTPhelp_appUpdate::read(const mtpPrime *&from, const mtpPrime *end, inline void MTPhelp_appUpdate::write(mtpBuffer &to) const { switch (_type) { case mtpc_help_appUpdate: { - const MTPDhelp_appUpdate &v(c_help_appUpdate()); + auto &v = c_help_appUpdate(); v.vid.write(to); v.vcritical.write(to); v.vurl.write(to); @@ -33920,14 +31131,18 @@ inline void MTPhelp_appUpdate::write(mtpBuffer &to) const { } break; } } -inline MTPhelp_appUpdate::MTPhelp_appUpdate(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPhelp_appUpdate::MTPhelp_appUpdate(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_help_appUpdate: setData(new MTPDhelp_appUpdate()); break; + case mtpc_help_appUpdate: data = std::make_shared(); break; case mtpc_help_noAppUpdate: break; default: throw mtpErrorBadTypeId(type, "MTPhelp_appUpdate"); } } -inline MTPhelp_appUpdate::MTPhelp_appUpdate(MTPDhelp_appUpdate *_data) : mtpDataOwner(_data), _type(mtpc_help_appUpdate) { +inline const MTPDhelp_appUpdate &MTPhelp_appUpdate::c_help_appUpdate() const { + t_assert(data != nullptr && _type == mtpc_help_appUpdate); + return static_cast(*data); +} +inline MTPhelp_appUpdate::MTPhelp_appUpdate(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_help_appUpdate) { } inline MTPhelp_appUpdate MTP_help_appUpdate(MTPint _id, MTPBool _critical, const MTPstring &_url, const MTPstring &_text) { return MTP::internal::TypeCreator::new_help_appUpdate(_id, _critical, _url, _text); @@ -33936,7 +31151,7 @@ inline MTPhelp_appUpdate MTP_help_noAppUpdate() { return MTP::internal::TypeCreator::new_help_noAppUpdate(); } -inline MTPhelp_inviteText::MTPhelp_inviteText() : mtpDataOwner(new MTPDhelp_inviteText()) { +inline MTPhelp_inviteText::MTPhelp_inviteText() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPhelp_inviteText::innerLength() const { @@ -33949,15 +31164,19 @@ inline mtpTypeId MTPhelp_inviteText::type() const { inline void MTPhelp_inviteText::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_help_inviteText) throw mtpErrorUnexpected(cons, "MTPhelp_inviteText"); - if (!data) setData(new MTPDhelp_inviteText()); - MTPDhelp_inviteText &v(_help_inviteText()); - v.vmessage.read(from, end); + auto v = std::make_shared(); + v->vmessage.read(from, end); + data = std::move(v); } inline void MTPhelp_inviteText::write(mtpBuffer &to) const { - const MTPDhelp_inviteText &v(c_help_inviteText()); + auto &v = c_help_inviteText(); v.vmessage.write(to); } -inline MTPhelp_inviteText::MTPhelp_inviteText(MTPDhelp_inviteText *_data) : mtpDataOwner(_data) { +inline const MTPDhelp_inviteText &MTPhelp_inviteText::c_help_inviteText() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPhelp_inviteText::MTPhelp_inviteText(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPhelp_inviteText MTP_help_inviteText(const MTPstring &_message) { return MTP::internal::TypeCreator::new_help_inviteText(_message); @@ -33993,47 +31212,47 @@ inline mtpTypeId MTPencryptedChat::type() const { return _type; } inline void MTPencryptedChat::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_encryptedChatEmpty: _type = cons; { - if (!data) setData(new MTPDencryptedChatEmpty()); - MTPDencryptedChatEmpty &v(_encryptedChatEmpty()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; case mtpc_encryptedChatWaiting: _type = cons; { - if (!data) setData(new MTPDencryptedChatWaiting()); - MTPDencryptedChatWaiting &v(_encryptedChatWaiting()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vdate.read(from, end); - v.vadmin_id.read(from, end); - v.vparticipant_id.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vdate.read(from, end); + v->vadmin_id.read(from, end); + v->vparticipant_id.read(from, end); + data = std::move(v); } break; case mtpc_encryptedChatRequested: _type = cons; { - if (!data) setData(new MTPDencryptedChatRequested()); - MTPDencryptedChatRequested &v(_encryptedChatRequested()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vdate.read(from, end); - v.vadmin_id.read(from, end); - v.vparticipant_id.read(from, end); - v.vg_a.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vdate.read(from, end); + v->vadmin_id.read(from, end); + v->vparticipant_id.read(from, end); + v->vg_a.read(from, end); + data = std::move(v); } break; case mtpc_encryptedChat: _type = cons; { - if (!data) setData(new MTPDencryptedChat()); - MTPDencryptedChat &v(_encryptedChat()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vdate.read(from, end); - v.vadmin_id.read(from, end); - v.vparticipant_id.read(from, end); - v.vg_a_or_b.read(from, end); - v.vkey_fingerprint.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vdate.read(from, end); + v->vadmin_id.read(from, end); + v->vparticipant_id.read(from, end); + v->vg_a_or_b.read(from, end); + v->vkey_fingerprint.read(from, end); + data = std::move(v); } break; case mtpc_encryptedChatDiscarded: _type = cons; { - if (!data) setData(new MTPDencryptedChatDiscarded()); - MTPDencryptedChatDiscarded &v(_encryptedChatDiscarded()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPencryptedChat"); } @@ -34041,11 +31260,11 @@ inline void MTPencryptedChat::read(const mtpPrime *&from, const mtpPrime *end, m inline void MTPencryptedChat::write(mtpBuffer &to) const { switch (_type) { case mtpc_encryptedChatEmpty: { - const MTPDencryptedChatEmpty &v(c_encryptedChatEmpty()); + auto &v = c_encryptedChatEmpty(); v.vid.write(to); } break; case mtpc_encryptedChatWaiting: { - const MTPDencryptedChatWaiting &v(c_encryptedChatWaiting()); + auto &v = c_encryptedChatWaiting(); v.vid.write(to); v.vaccess_hash.write(to); v.vdate.write(to); @@ -34053,7 +31272,7 @@ inline void MTPencryptedChat::write(mtpBuffer &to) const { v.vparticipant_id.write(to); } break; case mtpc_encryptedChatRequested: { - const MTPDencryptedChatRequested &v(c_encryptedChatRequested()); + auto &v = c_encryptedChatRequested(); v.vid.write(to); v.vaccess_hash.write(to); v.vdate.write(to); @@ -34062,7 +31281,7 @@ inline void MTPencryptedChat::write(mtpBuffer &to) const { v.vg_a.write(to); } break; case mtpc_encryptedChat: { - const MTPDencryptedChat &v(c_encryptedChat()); + auto &v = c_encryptedChat(); v.vid.write(to); v.vaccess_hash.write(to); v.vdate.write(to); @@ -34072,30 +31291,50 @@ inline void MTPencryptedChat::write(mtpBuffer &to) const { v.vkey_fingerprint.write(to); } break; case mtpc_encryptedChatDiscarded: { - const MTPDencryptedChatDiscarded &v(c_encryptedChatDiscarded()); + auto &v = c_encryptedChatDiscarded(); v.vid.write(to); } break; } } -inline MTPencryptedChat::MTPencryptedChat(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPencryptedChat::MTPencryptedChat(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_encryptedChatEmpty: setData(new MTPDencryptedChatEmpty()); break; - case mtpc_encryptedChatWaiting: setData(new MTPDencryptedChatWaiting()); break; - case mtpc_encryptedChatRequested: setData(new MTPDencryptedChatRequested()); break; - case mtpc_encryptedChat: setData(new MTPDencryptedChat()); break; - case mtpc_encryptedChatDiscarded: setData(new MTPDencryptedChatDiscarded()); break; + case mtpc_encryptedChatEmpty: data = std::make_shared(); break; + case mtpc_encryptedChatWaiting: data = std::make_shared(); break; + case mtpc_encryptedChatRequested: data = std::make_shared(); break; + case mtpc_encryptedChat: data = std::make_shared(); break; + case mtpc_encryptedChatDiscarded: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPencryptedChat"); } } -inline MTPencryptedChat::MTPencryptedChat(MTPDencryptedChatEmpty *_data) : mtpDataOwner(_data), _type(mtpc_encryptedChatEmpty) { +inline const MTPDencryptedChatEmpty &MTPencryptedChat::c_encryptedChatEmpty() const { + t_assert(data != nullptr && _type == mtpc_encryptedChatEmpty); + return static_cast(*data); } -inline MTPencryptedChat::MTPencryptedChat(MTPDencryptedChatWaiting *_data) : mtpDataOwner(_data), _type(mtpc_encryptedChatWaiting) { +inline MTPencryptedChat::MTPencryptedChat(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_encryptedChatEmpty) { } -inline MTPencryptedChat::MTPencryptedChat(MTPDencryptedChatRequested *_data) : mtpDataOwner(_data), _type(mtpc_encryptedChatRequested) { +inline const MTPDencryptedChatWaiting &MTPencryptedChat::c_encryptedChatWaiting() const { + t_assert(data != nullptr && _type == mtpc_encryptedChatWaiting); + return static_cast(*data); } -inline MTPencryptedChat::MTPencryptedChat(MTPDencryptedChat *_data) : mtpDataOwner(_data), _type(mtpc_encryptedChat) { +inline MTPencryptedChat::MTPencryptedChat(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_encryptedChatWaiting) { } -inline MTPencryptedChat::MTPencryptedChat(MTPDencryptedChatDiscarded *_data) : mtpDataOwner(_data), _type(mtpc_encryptedChatDiscarded) { +inline const MTPDencryptedChatRequested &MTPencryptedChat::c_encryptedChatRequested() const { + t_assert(data != nullptr && _type == mtpc_encryptedChatRequested); + return static_cast(*data); +} +inline MTPencryptedChat::MTPencryptedChat(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_encryptedChatRequested) { +} +inline const MTPDencryptedChat &MTPencryptedChat::c_encryptedChat() const { + t_assert(data != nullptr && _type == mtpc_encryptedChat); + return static_cast(*data); +} +inline MTPencryptedChat::MTPencryptedChat(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_encryptedChat) { +} +inline const MTPDencryptedChatDiscarded &MTPencryptedChat::c_encryptedChatDiscarded() const { + t_assert(data != nullptr && _type == mtpc_encryptedChatDiscarded); + return static_cast(*data); +} +inline MTPencryptedChat::MTPencryptedChat(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_encryptedChatDiscarded) { } inline MTPencryptedChat MTP_encryptedChatEmpty(MTPint _id) { return MTP::internal::TypeCreator::new_encryptedChatEmpty(_id); @@ -34113,7 +31352,7 @@ inline MTPencryptedChat MTP_encryptedChatDiscarded(MTPint _id) { return MTP::internal::TypeCreator::new_encryptedChatDiscarded(_id); } -inline MTPinputEncryptedChat::MTPinputEncryptedChat() : mtpDataOwner(new MTPDinputEncryptedChat()) { +inline MTPinputEncryptedChat::MTPinputEncryptedChat() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPinputEncryptedChat::innerLength() const { @@ -34126,17 +31365,21 @@ inline mtpTypeId MTPinputEncryptedChat::type() const { inline void MTPinputEncryptedChat::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_inputEncryptedChat) throw mtpErrorUnexpected(cons, "MTPinputEncryptedChat"); - if (!data) setData(new MTPDinputEncryptedChat()); - MTPDinputEncryptedChat &v(_inputEncryptedChat()); - v.vchat_id.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vchat_id.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } inline void MTPinputEncryptedChat::write(mtpBuffer &to) const { - const MTPDinputEncryptedChat &v(c_inputEncryptedChat()); + auto &v = c_inputEncryptedChat(); v.vchat_id.write(to); v.vaccess_hash.write(to); } -inline MTPinputEncryptedChat::MTPinputEncryptedChat(MTPDinputEncryptedChat *_data) : mtpDataOwner(_data) { +inline const MTPDinputEncryptedChat &MTPinputEncryptedChat::c_inputEncryptedChat() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPinputEncryptedChat::MTPinputEncryptedChat(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPinputEncryptedChat MTP_inputEncryptedChat(MTPint _chat_id, const MTPlong &_access_hash) { return MTP::internal::TypeCreator::new_inputEncryptedChat(_chat_id, _access_hash); @@ -34156,17 +31399,17 @@ inline mtpTypeId MTPencryptedFile::type() const { return _type; } inline void MTPencryptedFile::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_encryptedFileEmpty: _type = cons; break; case mtpc_encryptedFile: _type = cons; { - if (!data) setData(new MTPDencryptedFile()); - MTPDencryptedFile &v(_encryptedFile()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vsize.read(from, end); - v.vdc_id.read(from, end); - v.vkey_fingerprint.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vsize.read(from, end); + v->vdc_id.read(from, end); + v->vkey_fingerprint.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPencryptedFile"); } @@ -34174,7 +31417,7 @@ inline void MTPencryptedFile::read(const mtpPrime *&from, const mtpPrime *end, m inline void MTPencryptedFile::write(mtpBuffer &to) const { switch (_type) { case mtpc_encryptedFile: { - const MTPDencryptedFile &v(c_encryptedFile()); + auto &v = c_encryptedFile(); v.vid.write(to); v.vaccess_hash.write(to); v.vsize.write(to); @@ -34183,14 +31426,18 @@ inline void MTPencryptedFile::write(mtpBuffer &to) const { } break; } } -inline MTPencryptedFile::MTPencryptedFile(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPencryptedFile::MTPencryptedFile(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_encryptedFileEmpty: break; - case mtpc_encryptedFile: setData(new MTPDencryptedFile()); break; + case mtpc_encryptedFile: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPencryptedFile"); } } -inline MTPencryptedFile::MTPencryptedFile(MTPDencryptedFile *_data) : mtpDataOwner(_data), _type(mtpc_encryptedFile) { +inline const MTPDencryptedFile &MTPencryptedFile::c_encryptedFile() const { + t_assert(data != nullptr && _type == mtpc_encryptedFile); + return static_cast(*data); +} +inline MTPencryptedFile::MTPencryptedFile(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_encryptedFile) { } inline MTPencryptedFile MTP_encryptedFileEmpty() { return MTP::internal::TypeCreator::new_encryptedFileEmpty(); @@ -34221,29 +31468,29 @@ inline mtpTypeId MTPinputEncryptedFile::type() const { return _type; } inline void MTPinputEncryptedFile::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputEncryptedFileEmpty: _type = cons; break; case mtpc_inputEncryptedFileUploaded: _type = cons; { - if (!data) setData(new MTPDinputEncryptedFileUploaded()); - MTPDinputEncryptedFileUploaded &v(_inputEncryptedFileUploaded()); - v.vid.read(from, end); - v.vparts.read(from, end); - v.vmd5_checksum.read(from, end); - v.vkey_fingerprint.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vparts.read(from, end); + v->vmd5_checksum.read(from, end); + v->vkey_fingerprint.read(from, end); + data = std::move(v); } break; case mtpc_inputEncryptedFile: _type = cons; { - if (!data) setData(new MTPDinputEncryptedFile()); - MTPDinputEncryptedFile &v(_inputEncryptedFile()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } break; case mtpc_inputEncryptedFileBigUploaded: _type = cons; { - if (!data) setData(new MTPDinputEncryptedFileBigUploaded()); - MTPDinputEncryptedFileBigUploaded &v(_inputEncryptedFileBigUploaded()); - v.vid.read(from, end); - v.vparts.read(from, end); - v.vkey_fingerprint.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vparts.read(from, end); + v->vkey_fingerprint.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputEncryptedFile"); } @@ -34251,39 +31498,51 @@ inline void MTPinputEncryptedFile::read(const mtpPrime *&from, const mtpPrime *e inline void MTPinputEncryptedFile::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputEncryptedFileUploaded: { - const MTPDinputEncryptedFileUploaded &v(c_inputEncryptedFileUploaded()); + auto &v = c_inputEncryptedFileUploaded(); v.vid.write(to); v.vparts.write(to); v.vmd5_checksum.write(to); v.vkey_fingerprint.write(to); } break; case mtpc_inputEncryptedFile: { - const MTPDinputEncryptedFile &v(c_inputEncryptedFile()); + auto &v = c_inputEncryptedFile(); v.vid.write(to); v.vaccess_hash.write(to); } break; case mtpc_inputEncryptedFileBigUploaded: { - const MTPDinputEncryptedFileBigUploaded &v(c_inputEncryptedFileBigUploaded()); + auto &v = c_inputEncryptedFileBigUploaded(); v.vid.write(to); v.vparts.write(to); v.vkey_fingerprint.write(to); } break; } } -inline MTPinputEncryptedFile::MTPinputEncryptedFile(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputEncryptedFile::MTPinputEncryptedFile(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputEncryptedFileEmpty: break; - case mtpc_inputEncryptedFileUploaded: setData(new MTPDinputEncryptedFileUploaded()); break; - case mtpc_inputEncryptedFile: setData(new MTPDinputEncryptedFile()); break; - case mtpc_inputEncryptedFileBigUploaded: setData(new MTPDinputEncryptedFileBigUploaded()); break; + case mtpc_inputEncryptedFileUploaded: data = std::make_shared(); break; + case mtpc_inputEncryptedFile: data = std::make_shared(); break; + case mtpc_inputEncryptedFileBigUploaded: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputEncryptedFile"); } } -inline MTPinputEncryptedFile::MTPinputEncryptedFile(MTPDinputEncryptedFileUploaded *_data) : mtpDataOwner(_data), _type(mtpc_inputEncryptedFileUploaded) { +inline const MTPDinputEncryptedFileUploaded &MTPinputEncryptedFile::c_inputEncryptedFileUploaded() const { + t_assert(data != nullptr && _type == mtpc_inputEncryptedFileUploaded); + return static_cast(*data); } -inline MTPinputEncryptedFile::MTPinputEncryptedFile(MTPDinputEncryptedFile *_data) : mtpDataOwner(_data), _type(mtpc_inputEncryptedFile) { +inline MTPinputEncryptedFile::MTPinputEncryptedFile(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputEncryptedFileUploaded) { } -inline MTPinputEncryptedFile::MTPinputEncryptedFile(MTPDinputEncryptedFileBigUploaded *_data) : mtpDataOwner(_data), _type(mtpc_inputEncryptedFileBigUploaded) { +inline const MTPDinputEncryptedFile &MTPinputEncryptedFile::c_inputEncryptedFile() const { + t_assert(data != nullptr && _type == mtpc_inputEncryptedFile); + return static_cast(*data); +} +inline MTPinputEncryptedFile::MTPinputEncryptedFile(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputEncryptedFile) { +} +inline const MTPDinputEncryptedFileBigUploaded &MTPinputEncryptedFile::c_inputEncryptedFileBigUploaded() const { + t_assert(data != nullptr && _type == mtpc_inputEncryptedFileBigUploaded); + return static_cast(*data); +} +inline MTPinputEncryptedFile::MTPinputEncryptedFile(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputEncryptedFileBigUploaded) { } inline MTPinputEncryptedFile MTP_inputEncryptedFileEmpty() { return MTP::internal::TypeCreator::new_inputEncryptedFileEmpty(); @@ -34316,24 +31575,24 @@ inline mtpTypeId MTPencryptedMessage::type() const { return _type; } inline void MTPencryptedMessage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_encryptedMessage: _type = cons; { - if (!data) setData(new MTPDencryptedMessage()); - MTPDencryptedMessage &v(_encryptedMessage()); - v.vrandom_id.read(from, end); - v.vchat_id.read(from, end); - v.vdate.read(from, end); - v.vbytes.read(from, end); - v.vfile.read(from, end); + auto v = std::make_shared(); + v->vrandom_id.read(from, end); + v->vchat_id.read(from, end); + v->vdate.read(from, end); + v->vbytes.read(from, end); + v->vfile.read(from, end); + data = std::move(v); } break; case mtpc_encryptedMessageService: _type = cons; { - if (!data) setData(new MTPDencryptedMessageService()); - MTPDencryptedMessageService &v(_encryptedMessageService()); - v.vrandom_id.read(from, end); - v.vchat_id.read(from, end); - v.vdate.read(from, end); - v.vbytes.read(from, end); + auto v = std::make_shared(); + v->vrandom_id.read(from, end); + v->vchat_id.read(from, end); + v->vdate.read(from, end); + v->vbytes.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPencryptedMessage"); } @@ -34341,7 +31600,7 @@ inline void MTPencryptedMessage::read(const mtpPrime *&from, const mtpPrime *end inline void MTPencryptedMessage::write(mtpBuffer &to) const { switch (_type) { case mtpc_encryptedMessage: { - const MTPDencryptedMessage &v(c_encryptedMessage()); + auto &v = c_encryptedMessage(); v.vrandom_id.write(to); v.vchat_id.write(to); v.vdate.write(to); @@ -34349,7 +31608,7 @@ inline void MTPencryptedMessage::write(mtpBuffer &to) const { v.vfile.write(to); } break; case mtpc_encryptedMessageService: { - const MTPDencryptedMessageService &v(c_encryptedMessageService()); + auto &v = c_encryptedMessageService(); v.vrandom_id.write(to); v.vchat_id.write(to); v.vdate.write(to); @@ -34357,16 +31616,24 @@ inline void MTPencryptedMessage::write(mtpBuffer &to) const { } break; } } -inline MTPencryptedMessage::MTPencryptedMessage(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPencryptedMessage::MTPencryptedMessage(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_encryptedMessage: setData(new MTPDencryptedMessage()); break; - case mtpc_encryptedMessageService: setData(new MTPDencryptedMessageService()); break; + case mtpc_encryptedMessage: data = std::make_shared(); break; + case mtpc_encryptedMessageService: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPencryptedMessage"); } } -inline MTPencryptedMessage::MTPencryptedMessage(MTPDencryptedMessage *_data) : mtpDataOwner(_data), _type(mtpc_encryptedMessage) { +inline const MTPDencryptedMessage &MTPencryptedMessage::c_encryptedMessage() const { + t_assert(data != nullptr && _type == mtpc_encryptedMessage); + return static_cast(*data); } -inline MTPencryptedMessage::MTPencryptedMessage(MTPDencryptedMessageService *_data) : mtpDataOwner(_data), _type(mtpc_encryptedMessageService) { +inline MTPencryptedMessage::MTPencryptedMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_encryptedMessage) { +} +inline const MTPDencryptedMessageService &MTPencryptedMessage::c_encryptedMessageService() const { + t_assert(data != nullptr && _type == mtpc_encryptedMessageService); + return static_cast(*data); +} +inline MTPencryptedMessage::MTPencryptedMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_encryptedMessageService) { } inline MTPencryptedMessage MTP_encryptedMessage(const MTPlong &_random_id, MTPint _chat_id, MTPint _date, const MTPbytes &_bytes, const MTPEncryptedFile &_file) { return MTP::internal::TypeCreator::new_encryptedMessage(_random_id, _chat_id, _date, _bytes, _file); @@ -34393,20 +31660,20 @@ inline mtpTypeId MTPmessages_dhConfig::type() const { return _type; } inline void MTPmessages_dhConfig::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messages_dhConfigNotModified: _type = cons; { - if (!data) setData(new MTPDmessages_dhConfigNotModified()); - MTPDmessages_dhConfigNotModified &v(_messages_dhConfigNotModified()); - v.vrandom.read(from, end); + auto v = std::make_shared(); + v->vrandom.read(from, end); + data = std::move(v); } break; case mtpc_messages_dhConfig: _type = cons; { - if (!data) setData(new MTPDmessages_dhConfig()); - MTPDmessages_dhConfig &v(_messages_dhConfig()); - v.vg.read(from, end); - v.vp.read(from, end); - v.vversion.read(from, end); - v.vrandom.read(from, end); + auto v = std::make_shared(); + v->vg.read(from, end); + v->vp.read(from, end); + v->vversion.read(from, end); + v->vrandom.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_dhConfig"); } @@ -34414,11 +31681,11 @@ inline void MTPmessages_dhConfig::read(const mtpPrime *&from, const mtpPrime *en inline void MTPmessages_dhConfig::write(mtpBuffer &to) const { switch (_type) { case mtpc_messages_dhConfigNotModified: { - const MTPDmessages_dhConfigNotModified &v(c_messages_dhConfigNotModified()); + auto &v = c_messages_dhConfigNotModified(); v.vrandom.write(to); } break; case mtpc_messages_dhConfig: { - const MTPDmessages_dhConfig &v(c_messages_dhConfig()); + auto &v = c_messages_dhConfig(); v.vg.write(to); v.vp.write(to); v.vversion.write(to); @@ -34426,16 +31693,24 @@ inline void MTPmessages_dhConfig::write(mtpBuffer &to) const { } break; } } -inline MTPmessages_dhConfig::MTPmessages_dhConfig(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessages_dhConfig::MTPmessages_dhConfig(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_messages_dhConfigNotModified: setData(new MTPDmessages_dhConfigNotModified()); break; - case mtpc_messages_dhConfig: setData(new MTPDmessages_dhConfig()); break; + case mtpc_messages_dhConfigNotModified: data = std::make_shared(); break; + case mtpc_messages_dhConfig: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_dhConfig"); } } -inline MTPmessages_dhConfig::MTPmessages_dhConfig(MTPDmessages_dhConfigNotModified *_data) : mtpDataOwner(_data), _type(mtpc_messages_dhConfigNotModified) { +inline const MTPDmessages_dhConfigNotModified &MTPmessages_dhConfig::c_messages_dhConfigNotModified() const { + t_assert(data != nullptr && _type == mtpc_messages_dhConfigNotModified); + return static_cast(*data); } -inline MTPmessages_dhConfig::MTPmessages_dhConfig(MTPDmessages_dhConfig *_data) : mtpDataOwner(_data), _type(mtpc_messages_dhConfig) { +inline MTPmessages_dhConfig::MTPmessages_dhConfig(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_dhConfigNotModified) { +} +inline const MTPDmessages_dhConfig &MTPmessages_dhConfig::c_messages_dhConfig() const { + t_assert(data != nullptr && _type == mtpc_messages_dhConfig); + return static_cast(*data); +} +inline MTPmessages_dhConfig::MTPmessages_dhConfig(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_dhConfig) { } inline MTPmessages_dhConfig MTP_messages_dhConfigNotModified(const MTPbytes &_random) { return MTP::internal::TypeCreator::new_messages_dhConfigNotModified(_random); @@ -34462,18 +31737,18 @@ inline mtpTypeId MTPmessages_sentEncryptedMessage::type() const { return _type; } inline void MTPmessages_sentEncryptedMessage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messages_sentEncryptedMessage: _type = cons; { - if (!data) setData(new MTPDmessages_sentEncryptedMessage()); - MTPDmessages_sentEncryptedMessage &v(_messages_sentEncryptedMessage()); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_messages_sentEncryptedFile: _type = cons; { - if (!data) setData(new MTPDmessages_sentEncryptedFile()); - MTPDmessages_sentEncryptedFile &v(_messages_sentEncryptedFile()); - v.vdate.read(from, end); - v.vfile.read(from, end); + auto v = std::make_shared(); + v->vdate.read(from, end); + v->vfile.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_sentEncryptedMessage"); } @@ -34481,26 +31756,34 @@ inline void MTPmessages_sentEncryptedMessage::read(const mtpPrime *&from, const inline void MTPmessages_sentEncryptedMessage::write(mtpBuffer &to) const { switch (_type) { case mtpc_messages_sentEncryptedMessage: { - const MTPDmessages_sentEncryptedMessage &v(c_messages_sentEncryptedMessage()); + auto &v = c_messages_sentEncryptedMessage(); v.vdate.write(to); } break; case mtpc_messages_sentEncryptedFile: { - const MTPDmessages_sentEncryptedFile &v(c_messages_sentEncryptedFile()); + auto &v = c_messages_sentEncryptedFile(); v.vdate.write(to); v.vfile.write(to); } break; } } -inline MTPmessages_sentEncryptedMessage::MTPmessages_sentEncryptedMessage(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessages_sentEncryptedMessage::MTPmessages_sentEncryptedMessage(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_messages_sentEncryptedMessage: setData(new MTPDmessages_sentEncryptedMessage()); break; - case mtpc_messages_sentEncryptedFile: setData(new MTPDmessages_sentEncryptedFile()); break; + case mtpc_messages_sentEncryptedMessage: data = std::make_shared(); break; + case mtpc_messages_sentEncryptedFile: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_sentEncryptedMessage"); } } -inline MTPmessages_sentEncryptedMessage::MTPmessages_sentEncryptedMessage(MTPDmessages_sentEncryptedMessage *_data) : mtpDataOwner(_data), _type(mtpc_messages_sentEncryptedMessage) { +inline const MTPDmessages_sentEncryptedMessage &MTPmessages_sentEncryptedMessage::c_messages_sentEncryptedMessage() const { + t_assert(data != nullptr && _type == mtpc_messages_sentEncryptedMessage); + return static_cast(*data); } -inline MTPmessages_sentEncryptedMessage::MTPmessages_sentEncryptedMessage(MTPDmessages_sentEncryptedFile *_data) : mtpDataOwner(_data), _type(mtpc_messages_sentEncryptedFile) { +inline MTPmessages_sentEncryptedMessage::MTPmessages_sentEncryptedMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_sentEncryptedMessage) { +} +inline const MTPDmessages_sentEncryptedFile &MTPmessages_sentEncryptedMessage::c_messages_sentEncryptedFile() const { + t_assert(data != nullptr && _type == mtpc_messages_sentEncryptedFile); + return static_cast(*data); +} +inline MTPmessages_sentEncryptedMessage::MTPmessages_sentEncryptedMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_sentEncryptedFile) { } inline MTPmessages_sentEncryptedMessage MTP_messages_sentEncryptedMessage(MTPint _date) { return MTP::internal::TypeCreator::new_messages_sentEncryptedMessage(_date); @@ -34523,14 +31806,14 @@ inline mtpTypeId MTPinputDocument::type() const { return _type; } inline void MTPinputDocument::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputDocumentEmpty: _type = cons; break; case mtpc_inputDocument: _type = cons; { - if (!data) setData(new MTPDinputDocument()); - MTPDinputDocument &v(_inputDocument()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputDocument"); } @@ -34538,20 +31821,24 @@ inline void MTPinputDocument::read(const mtpPrime *&from, const mtpPrime *end, m inline void MTPinputDocument::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputDocument: { - const MTPDinputDocument &v(c_inputDocument()); + auto &v = c_inputDocument(); v.vid.write(to); v.vaccess_hash.write(to); } break; } } -inline MTPinputDocument::MTPinputDocument(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputDocument::MTPinputDocument(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputDocumentEmpty: break; - case mtpc_inputDocument: setData(new MTPDinputDocument()); break; + case mtpc_inputDocument: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputDocument"); } } -inline MTPinputDocument::MTPinputDocument(MTPDinputDocument *_data) : mtpDataOwner(_data), _type(mtpc_inputDocument) { +inline const MTPDinputDocument &MTPinputDocument::c_inputDocument() const { + t_assert(data != nullptr && _type == mtpc_inputDocument); + return static_cast(*data); +} +inline MTPinputDocument::MTPinputDocument(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputDocument) { } inline MTPinputDocument MTP_inputDocumentEmpty() { return MTP::internal::TypeCreator::new_inputDocumentEmpty(); @@ -34578,25 +31865,25 @@ inline mtpTypeId MTPdocument::type() const { return _type; } inline void MTPdocument::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_documentEmpty: _type = cons; { - if (!data) setData(new MTPDdocumentEmpty()); - MTPDdocumentEmpty &v(_documentEmpty()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; case mtpc_document: _type = cons; { - if (!data) setData(new MTPDdocument()); - MTPDdocument &v(_document()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vdate.read(from, end); - v.vmime_type.read(from, end); - v.vsize.read(from, end); - v.vthumb.read(from, end); - v.vdc_id.read(from, end); - v.vversion.read(from, end); - v.vattributes.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vdate.read(from, end); + v->vmime_type.read(from, end); + v->vsize.read(from, end); + v->vthumb.read(from, end); + v->vdc_id.read(from, end); + v->vversion.read(from, end); + v->vattributes.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPdocument"); } @@ -34604,11 +31891,11 @@ inline void MTPdocument::read(const mtpPrime *&from, const mtpPrime *end, mtpTyp inline void MTPdocument::write(mtpBuffer &to) const { switch (_type) { case mtpc_documentEmpty: { - const MTPDdocumentEmpty &v(c_documentEmpty()); + auto &v = c_documentEmpty(); v.vid.write(to); } break; case mtpc_document: { - const MTPDdocument &v(c_document()); + auto &v = c_document(); v.vid.write(to); v.vaccess_hash.write(to); v.vdate.write(to); @@ -34621,16 +31908,24 @@ inline void MTPdocument::write(mtpBuffer &to) const { } break; } } -inline MTPdocument::MTPdocument(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPdocument::MTPdocument(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_documentEmpty: setData(new MTPDdocumentEmpty()); break; - case mtpc_document: setData(new MTPDdocument()); break; + case mtpc_documentEmpty: data = std::make_shared(); break; + case mtpc_document: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPdocument"); } } -inline MTPdocument::MTPdocument(MTPDdocumentEmpty *_data) : mtpDataOwner(_data), _type(mtpc_documentEmpty) { +inline const MTPDdocumentEmpty &MTPdocument::c_documentEmpty() const { + t_assert(data != nullptr && _type == mtpc_documentEmpty); + return static_cast(*data); } -inline MTPdocument::MTPdocument(MTPDdocument *_data) : mtpDataOwner(_data), _type(mtpc_document) { +inline MTPdocument::MTPdocument(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_documentEmpty) { +} +inline const MTPDdocument &MTPdocument::c_document() const { + t_assert(data != nullptr && _type == mtpc_document); + return static_cast(*data); +} +inline MTPdocument::MTPdocument(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_document) { } inline MTPdocument MTP_documentEmpty(const MTPlong &_id) { return MTP::internal::TypeCreator::new_documentEmpty(_id); @@ -34639,7 +31934,7 @@ inline MTPdocument MTP_document(const MTPlong &_id, const MTPlong &_access_hash, return MTP::internal::TypeCreator::new_document(_id, _access_hash, _date, _mime_type, _size, _thumb, _dc_id, _version, _attributes); } -inline MTPhelp_support::MTPhelp_support() : mtpDataOwner(new MTPDhelp_support()) { +inline MTPhelp_support::MTPhelp_support() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPhelp_support::innerLength() const { @@ -34652,17 +31947,21 @@ inline mtpTypeId MTPhelp_support::type() const { inline void MTPhelp_support::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_help_support) throw mtpErrorUnexpected(cons, "MTPhelp_support"); - if (!data) setData(new MTPDhelp_support()); - MTPDhelp_support &v(_help_support()); - v.vphone_number.read(from, end); - v.vuser.read(from, end); + auto v = std::make_shared(); + v->vphone_number.read(from, end); + v->vuser.read(from, end); + data = std::move(v); } inline void MTPhelp_support::write(mtpBuffer &to) const { - const MTPDhelp_support &v(c_help_support()); + auto &v = c_help_support(); v.vphone_number.write(to); v.vuser.write(to); } -inline MTPhelp_support::MTPhelp_support(MTPDhelp_support *_data) : mtpDataOwner(_data) { +inline const MTPDhelp_support &MTPhelp_support::c_help_support() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPhelp_support::MTPhelp_support(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPhelp_support MTP_help_support(const MTPstring &_phone_number, const MTPUser &_user) { return MTP::internal::TypeCreator::new_help_support(_phone_number, _user); @@ -34682,12 +31981,12 @@ inline mtpTypeId MTPnotifyPeer::type() const { return _type; } inline void MTPnotifyPeer::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_notifyPeer: _type = cons; { - if (!data) setData(new MTPDnotifyPeer()); - MTPDnotifyPeer &v(_notifyPeer()); - v.vpeer.read(from, end); + auto v = std::make_shared(); + v->vpeer.read(from, end); + data = std::move(v); } break; case mtpc_notifyUsers: _type = cons; break; case mtpc_notifyChats: _type = cons; break; @@ -34698,21 +31997,25 @@ inline void MTPnotifyPeer::read(const mtpPrime *&from, const mtpPrime *end, mtpT inline void MTPnotifyPeer::write(mtpBuffer &to) const { switch (_type) { case mtpc_notifyPeer: { - const MTPDnotifyPeer &v(c_notifyPeer()); + auto &v = c_notifyPeer(); v.vpeer.write(to); } break; } } -inline MTPnotifyPeer::MTPnotifyPeer(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPnotifyPeer::MTPnotifyPeer(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_notifyPeer: setData(new MTPDnotifyPeer()); break; + case mtpc_notifyPeer: data = std::make_shared(); break; case mtpc_notifyUsers: break; case mtpc_notifyChats: break; case mtpc_notifyAll: break; default: throw mtpErrorBadTypeId(type, "MTPnotifyPeer"); } } -inline MTPnotifyPeer::MTPnotifyPeer(MTPDnotifyPeer *_data) : mtpDataOwner(_data), _type(mtpc_notifyPeer) { +inline const MTPDnotifyPeer &MTPnotifyPeer::c_notifyPeer() const { + t_assert(data != nullptr && _type == mtpc_notifyPeer); + return static_cast(*data); +} +inline MTPnotifyPeer::MTPnotifyPeer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_notifyPeer) { } inline MTPnotifyPeer MTP_notifyPeer(const MTPPeer &_peer) { return MTP::internal::TypeCreator::new_notifyPeer(_peer); @@ -34753,31 +32056,31 @@ inline mtpTypeId MTPsendMessageAction::type() const { return _type; } inline void MTPsendMessageAction::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_sendMessageTypingAction: _type = cons; break; case mtpc_sendMessageCancelAction: _type = cons; break; case mtpc_sendMessageRecordVideoAction: _type = cons; break; case mtpc_sendMessageUploadVideoAction: _type = cons; { - if (!data) setData(new MTPDsendMessageUploadVideoAction()); - MTPDsendMessageUploadVideoAction &v(_sendMessageUploadVideoAction()); - v.vprogress.read(from, end); + auto v = std::make_shared(); + v->vprogress.read(from, end); + data = std::move(v); } break; case mtpc_sendMessageRecordAudioAction: _type = cons; break; case mtpc_sendMessageUploadAudioAction: _type = cons; { - if (!data) setData(new MTPDsendMessageUploadAudioAction()); - MTPDsendMessageUploadAudioAction &v(_sendMessageUploadAudioAction()); - v.vprogress.read(from, end); + auto v = std::make_shared(); + v->vprogress.read(from, end); + data = std::move(v); } break; case mtpc_sendMessageUploadPhotoAction: _type = cons; { - if (!data) setData(new MTPDsendMessageUploadPhotoAction()); - MTPDsendMessageUploadPhotoAction &v(_sendMessageUploadPhotoAction()); - v.vprogress.read(from, end); + auto v = std::make_shared(); + v->vprogress.read(from, end); + data = std::move(v); } break; case mtpc_sendMessageUploadDocumentAction: _type = cons; { - if (!data) setData(new MTPDsendMessageUploadDocumentAction()); - MTPDsendMessageUploadDocumentAction &v(_sendMessageUploadDocumentAction()); - v.vprogress.read(from, end); + auto v = std::make_shared(); + v->vprogress.read(from, end); + data = std::move(v); } break; case mtpc_sendMessageGeoLocationAction: _type = cons; break; case mtpc_sendMessageChooseContactAction: _type = cons; break; @@ -34788,46 +32091,62 @@ inline void MTPsendMessageAction::read(const mtpPrime *&from, const mtpPrime *en inline void MTPsendMessageAction::write(mtpBuffer &to) const { switch (_type) { case mtpc_sendMessageUploadVideoAction: { - const MTPDsendMessageUploadVideoAction &v(c_sendMessageUploadVideoAction()); + auto &v = c_sendMessageUploadVideoAction(); v.vprogress.write(to); } break; case mtpc_sendMessageUploadAudioAction: { - const MTPDsendMessageUploadAudioAction &v(c_sendMessageUploadAudioAction()); + auto &v = c_sendMessageUploadAudioAction(); v.vprogress.write(to); } break; case mtpc_sendMessageUploadPhotoAction: { - const MTPDsendMessageUploadPhotoAction &v(c_sendMessageUploadPhotoAction()); + auto &v = c_sendMessageUploadPhotoAction(); v.vprogress.write(to); } break; case mtpc_sendMessageUploadDocumentAction: { - const MTPDsendMessageUploadDocumentAction &v(c_sendMessageUploadDocumentAction()); + auto &v = c_sendMessageUploadDocumentAction(); v.vprogress.write(to); } break; } } -inline MTPsendMessageAction::MTPsendMessageAction(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPsendMessageAction::MTPsendMessageAction(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_sendMessageTypingAction: break; case mtpc_sendMessageCancelAction: break; case mtpc_sendMessageRecordVideoAction: break; - case mtpc_sendMessageUploadVideoAction: setData(new MTPDsendMessageUploadVideoAction()); break; + case mtpc_sendMessageUploadVideoAction: data = std::make_shared(); break; case mtpc_sendMessageRecordAudioAction: break; - case mtpc_sendMessageUploadAudioAction: setData(new MTPDsendMessageUploadAudioAction()); break; - case mtpc_sendMessageUploadPhotoAction: setData(new MTPDsendMessageUploadPhotoAction()); break; - case mtpc_sendMessageUploadDocumentAction: setData(new MTPDsendMessageUploadDocumentAction()); break; + case mtpc_sendMessageUploadAudioAction: data = std::make_shared(); break; + case mtpc_sendMessageUploadPhotoAction: data = std::make_shared(); break; + case mtpc_sendMessageUploadDocumentAction: data = std::make_shared(); break; case mtpc_sendMessageGeoLocationAction: break; case mtpc_sendMessageChooseContactAction: break; case mtpc_sendMessageGamePlayAction: break; default: throw mtpErrorBadTypeId(type, "MTPsendMessageAction"); } } -inline MTPsendMessageAction::MTPsendMessageAction(MTPDsendMessageUploadVideoAction *_data) : mtpDataOwner(_data), _type(mtpc_sendMessageUploadVideoAction) { +inline const MTPDsendMessageUploadVideoAction &MTPsendMessageAction::c_sendMessageUploadVideoAction() const { + t_assert(data != nullptr && _type == mtpc_sendMessageUploadVideoAction); + return static_cast(*data); } -inline MTPsendMessageAction::MTPsendMessageAction(MTPDsendMessageUploadAudioAction *_data) : mtpDataOwner(_data), _type(mtpc_sendMessageUploadAudioAction) { +inline MTPsendMessageAction::MTPsendMessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_sendMessageUploadVideoAction) { } -inline MTPsendMessageAction::MTPsendMessageAction(MTPDsendMessageUploadPhotoAction *_data) : mtpDataOwner(_data), _type(mtpc_sendMessageUploadPhotoAction) { +inline const MTPDsendMessageUploadAudioAction &MTPsendMessageAction::c_sendMessageUploadAudioAction() const { + t_assert(data != nullptr && _type == mtpc_sendMessageUploadAudioAction); + return static_cast(*data); } -inline MTPsendMessageAction::MTPsendMessageAction(MTPDsendMessageUploadDocumentAction *_data) : mtpDataOwner(_data), _type(mtpc_sendMessageUploadDocumentAction) { +inline MTPsendMessageAction::MTPsendMessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_sendMessageUploadAudioAction) { +} +inline const MTPDsendMessageUploadPhotoAction &MTPsendMessageAction::c_sendMessageUploadPhotoAction() const { + t_assert(data != nullptr && _type == mtpc_sendMessageUploadPhotoAction); + return static_cast(*data); +} +inline MTPsendMessageAction::MTPsendMessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_sendMessageUploadPhotoAction) { +} +inline const MTPDsendMessageUploadDocumentAction &MTPsendMessageAction::c_sendMessageUploadDocumentAction() const { + t_assert(data != nullptr && _type == mtpc_sendMessageUploadDocumentAction); + return static_cast(*data); +} +inline MTPsendMessageAction::MTPsendMessageAction(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_sendMessageUploadDocumentAction) { } inline MTPsendMessageAction MTP_sendMessageTypingAction() { return MTP::internal::TypeCreator::new_sendMessageTypingAction(); @@ -34863,7 +32182,7 @@ inline MTPsendMessageAction MTP_sendMessageGamePlayAction() { return MTP::internal::TypeCreator::new_sendMessageGamePlayAction(); } -inline MTPcontacts_found::MTPcontacts_found() : mtpDataOwner(new MTPDcontacts_found()) { +inline MTPcontacts_found::MTPcontacts_found() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPcontacts_found::innerLength() const { @@ -34876,19 +32195,23 @@ inline mtpTypeId MTPcontacts_found::type() const { inline void MTPcontacts_found::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_contacts_found) throw mtpErrorUnexpected(cons, "MTPcontacts_found"); - if (!data) setData(new MTPDcontacts_found()); - MTPDcontacts_found &v(_contacts_found()); - v.vresults.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vresults.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } inline void MTPcontacts_found::write(mtpBuffer &to) const { - const MTPDcontacts_found &v(c_contacts_found()); + auto &v = c_contacts_found(); v.vresults.write(to); v.vchats.write(to); v.vusers.write(to); } -inline MTPcontacts_found::MTPcontacts_found(MTPDcontacts_found *_data) : mtpDataOwner(_data) { +inline const MTPDcontacts_found &MTPcontacts_found::c_contacts_found() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPcontacts_found::MTPcontacts_found(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPcontacts_found MTP_contacts_found(const MTPVector &_results, const MTPVector &_chats, const MTPVector &_users) { return MTP::internal::TypeCreator::new_contacts_found(_results, _chats, _users); @@ -34982,21 +32305,21 @@ inline mtpTypeId MTPinputPrivacyRule::type() const { return _type; } inline void MTPinputPrivacyRule::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputPrivacyValueAllowContacts: _type = cons; break; case mtpc_inputPrivacyValueAllowAll: _type = cons; break; case mtpc_inputPrivacyValueAllowUsers: _type = cons; { - if (!data) setData(new MTPDinputPrivacyValueAllowUsers()); - MTPDinputPrivacyValueAllowUsers &v(_inputPrivacyValueAllowUsers()); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vusers.read(from, end); + data = std::move(v); } break; case mtpc_inputPrivacyValueDisallowContacts: _type = cons; break; case mtpc_inputPrivacyValueDisallowAll: _type = cons; break; case mtpc_inputPrivacyValueDisallowUsers: _type = cons; { - if (!data) setData(new MTPDinputPrivacyValueDisallowUsers()); - MTPDinputPrivacyValueDisallowUsers &v(_inputPrivacyValueDisallowUsers()); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vusers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputPrivacyRule"); } @@ -35004,29 +32327,37 @@ inline void MTPinputPrivacyRule::read(const mtpPrime *&from, const mtpPrime *end inline void MTPinputPrivacyRule::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputPrivacyValueAllowUsers: { - const MTPDinputPrivacyValueAllowUsers &v(c_inputPrivacyValueAllowUsers()); + auto &v = c_inputPrivacyValueAllowUsers(); v.vusers.write(to); } break; case mtpc_inputPrivacyValueDisallowUsers: { - const MTPDinputPrivacyValueDisallowUsers &v(c_inputPrivacyValueDisallowUsers()); + auto &v = c_inputPrivacyValueDisallowUsers(); v.vusers.write(to); } break; } } -inline MTPinputPrivacyRule::MTPinputPrivacyRule(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputPrivacyRule::MTPinputPrivacyRule(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputPrivacyValueAllowContacts: break; case mtpc_inputPrivacyValueAllowAll: break; - case mtpc_inputPrivacyValueAllowUsers: setData(new MTPDinputPrivacyValueAllowUsers()); break; + case mtpc_inputPrivacyValueAllowUsers: data = std::make_shared(); break; case mtpc_inputPrivacyValueDisallowContacts: break; case mtpc_inputPrivacyValueDisallowAll: break; - case mtpc_inputPrivacyValueDisallowUsers: setData(new MTPDinputPrivacyValueDisallowUsers()); break; + case mtpc_inputPrivacyValueDisallowUsers: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputPrivacyRule"); } } -inline MTPinputPrivacyRule::MTPinputPrivacyRule(MTPDinputPrivacyValueAllowUsers *_data) : mtpDataOwner(_data), _type(mtpc_inputPrivacyValueAllowUsers) { +inline const MTPDinputPrivacyValueAllowUsers &MTPinputPrivacyRule::c_inputPrivacyValueAllowUsers() const { + t_assert(data != nullptr && _type == mtpc_inputPrivacyValueAllowUsers); + return static_cast(*data); } -inline MTPinputPrivacyRule::MTPinputPrivacyRule(MTPDinputPrivacyValueDisallowUsers *_data) : mtpDataOwner(_data), _type(mtpc_inputPrivacyValueDisallowUsers) { +inline MTPinputPrivacyRule::MTPinputPrivacyRule(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputPrivacyValueAllowUsers) { +} +inline const MTPDinputPrivacyValueDisallowUsers &MTPinputPrivacyRule::c_inputPrivacyValueDisallowUsers() const { + t_assert(data != nullptr && _type == mtpc_inputPrivacyValueDisallowUsers); + return static_cast(*data); +} +inline MTPinputPrivacyRule::MTPinputPrivacyRule(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputPrivacyValueDisallowUsers) { } inline MTPinputPrivacyRule MTP_inputPrivacyValueAllowContacts() { return MTP::internal::TypeCreator::new_inputPrivacyValueAllowContacts(); @@ -35065,21 +32396,21 @@ inline mtpTypeId MTPprivacyRule::type() const { return _type; } inline void MTPprivacyRule::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_privacyValueAllowContacts: _type = cons; break; case mtpc_privacyValueAllowAll: _type = cons; break; case mtpc_privacyValueAllowUsers: _type = cons; { - if (!data) setData(new MTPDprivacyValueAllowUsers()); - MTPDprivacyValueAllowUsers &v(_privacyValueAllowUsers()); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vusers.read(from, end); + data = std::move(v); } break; case mtpc_privacyValueDisallowContacts: _type = cons; break; case mtpc_privacyValueDisallowAll: _type = cons; break; case mtpc_privacyValueDisallowUsers: _type = cons; { - if (!data) setData(new MTPDprivacyValueDisallowUsers()); - MTPDprivacyValueDisallowUsers &v(_privacyValueDisallowUsers()); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vusers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPprivacyRule"); } @@ -35087,29 +32418,37 @@ inline void MTPprivacyRule::read(const mtpPrime *&from, const mtpPrime *end, mtp inline void MTPprivacyRule::write(mtpBuffer &to) const { switch (_type) { case mtpc_privacyValueAllowUsers: { - const MTPDprivacyValueAllowUsers &v(c_privacyValueAllowUsers()); + auto &v = c_privacyValueAllowUsers(); v.vusers.write(to); } break; case mtpc_privacyValueDisallowUsers: { - const MTPDprivacyValueDisallowUsers &v(c_privacyValueDisallowUsers()); + auto &v = c_privacyValueDisallowUsers(); v.vusers.write(to); } break; } } -inline MTPprivacyRule::MTPprivacyRule(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPprivacyRule::MTPprivacyRule(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_privacyValueAllowContacts: break; case mtpc_privacyValueAllowAll: break; - case mtpc_privacyValueAllowUsers: setData(new MTPDprivacyValueAllowUsers()); break; + case mtpc_privacyValueAllowUsers: data = std::make_shared(); break; case mtpc_privacyValueDisallowContacts: break; case mtpc_privacyValueDisallowAll: break; - case mtpc_privacyValueDisallowUsers: setData(new MTPDprivacyValueDisallowUsers()); break; + case mtpc_privacyValueDisallowUsers: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPprivacyRule"); } } -inline MTPprivacyRule::MTPprivacyRule(MTPDprivacyValueAllowUsers *_data) : mtpDataOwner(_data), _type(mtpc_privacyValueAllowUsers) { +inline const MTPDprivacyValueAllowUsers &MTPprivacyRule::c_privacyValueAllowUsers() const { + t_assert(data != nullptr && _type == mtpc_privacyValueAllowUsers); + return static_cast(*data); } -inline MTPprivacyRule::MTPprivacyRule(MTPDprivacyValueDisallowUsers *_data) : mtpDataOwner(_data), _type(mtpc_privacyValueDisallowUsers) { +inline MTPprivacyRule::MTPprivacyRule(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_privacyValueAllowUsers) { +} +inline const MTPDprivacyValueDisallowUsers &MTPprivacyRule::c_privacyValueDisallowUsers() const { + t_assert(data != nullptr && _type == mtpc_privacyValueDisallowUsers); + return static_cast(*data); +} +inline MTPprivacyRule::MTPprivacyRule(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_privacyValueDisallowUsers) { } inline MTPprivacyRule MTP_privacyValueAllowContacts() { return MTP::internal::TypeCreator::new_privacyValueAllowContacts(); @@ -35130,7 +32469,7 @@ inline MTPprivacyRule MTP_privacyValueDisallowUsers(const MTPVector &_us return MTP::internal::TypeCreator::new_privacyValueDisallowUsers(_users); } -inline MTPaccount_privacyRules::MTPaccount_privacyRules() : mtpDataOwner(new MTPDaccount_privacyRules()) { +inline MTPaccount_privacyRules::MTPaccount_privacyRules() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPaccount_privacyRules::innerLength() const { @@ -35143,23 +32482,27 @@ inline mtpTypeId MTPaccount_privacyRules::type() const { inline void MTPaccount_privacyRules::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_account_privacyRules) throw mtpErrorUnexpected(cons, "MTPaccount_privacyRules"); - if (!data) setData(new MTPDaccount_privacyRules()); - MTPDaccount_privacyRules &v(_account_privacyRules()); - v.vrules.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vrules.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } inline void MTPaccount_privacyRules::write(mtpBuffer &to) const { - const MTPDaccount_privacyRules &v(c_account_privacyRules()); + auto &v = c_account_privacyRules(); v.vrules.write(to); v.vusers.write(to); } -inline MTPaccount_privacyRules::MTPaccount_privacyRules(MTPDaccount_privacyRules *_data) : mtpDataOwner(_data) { +inline const MTPDaccount_privacyRules &MTPaccount_privacyRules::c_account_privacyRules() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPaccount_privacyRules::MTPaccount_privacyRules(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPaccount_privacyRules MTP_account_privacyRules(const MTPVector &_rules, const MTPVector &_users) { return MTP::internal::TypeCreator::new_account_privacyRules(_rules, _users); } -inline MTPaccountDaysTTL::MTPaccountDaysTTL() : mtpDataOwner(new MTPDaccountDaysTTL()) { +inline MTPaccountDaysTTL::MTPaccountDaysTTL() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPaccountDaysTTL::innerLength() const { @@ -35172,15 +32515,19 @@ inline mtpTypeId MTPaccountDaysTTL::type() const { inline void MTPaccountDaysTTL::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_accountDaysTTL) throw mtpErrorUnexpected(cons, "MTPaccountDaysTTL"); - if (!data) setData(new MTPDaccountDaysTTL()); - MTPDaccountDaysTTL &v(_accountDaysTTL()); - v.vdays.read(from, end); + auto v = std::make_shared(); + v->vdays.read(from, end); + data = std::move(v); } inline void MTPaccountDaysTTL::write(mtpBuffer &to) const { - const MTPDaccountDaysTTL &v(c_accountDaysTTL()); + auto &v = c_accountDaysTTL(); v.vdays.write(to); } -inline MTPaccountDaysTTL::MTPaccountDaysTTL(MTPDaccountDaysTTL *_data) : mtpDataOwner(_data) { +inline const MTPDaccountDaysTTL &MTPaccountDaysTTL::c_accountDaysTTL() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPaccountDaysTTL::MTPaccountDaysTTL(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPaccountDaysTTL MTP_accountDaysTTL(MTPint _days) { return MTP::internal::TypeCreator::new_accountDaysTTL(_days); @@ -35216,43 +32563,43 @@ inline mtpTypeId MTPdocumentAttribute::type() const { return _type; } inline void MTPdocumentAttribute::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_documentAttributeImageSize: _type = cons; { - if (!data) setData(new MTPDdocumentAttributeImageSize()); - MTPDdocumentAttributeImageSize &v(_documentAttributeImageSize()); - v.vw.read(from, end); - v.vh.read(from, end); + auto v = std::make_shared(); + v->vw.read(from, end); + v->vh.read(from, end); + data = std::move(v); } break; case mtpc_documentAttributeAnimated: _type = cons; break; case mtpc_documentAttributeSticker: _type = cons; { - if (!data) setData(new MTPDdocumentAttributeSticker()); - MTPDdocumentAttributeSticker &v(_documentAttributeSticker()); - v.vflags.read(from, end); - v.valt.read(from, end); - v.vstickerset.read(from, end); - if (v.has_mask_coords()) { v.vmask_coords.read(from, end); } else { v.vmask_coords = MTPMaskCoords(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->valt.read(from, end); + v->vstickerset.read(from, end); + if (v->has_mask_coords()) { v->vmask_coords.read(from, end); } else { v->vmask_coords = MTPMaskCoords(); } + data = std::move(v); } break; case mtpc_documentAttributeVideo: _type = cons; { - if (!data) setData(new MTPDdocumentAttributeVideo()); - MTPDdocumentAttributeVideo &v(_documentAttributeVideo()); - v.vduration.read(from, end); - v.vw.read(from, end); - v.vh.read(from, end); + auto v = std::make_shared(); + v->vduration.read(from, end); + v->vw.read(from, end); + v->vh.read(from, end); + data = std::move(v); } break; case mtpc_documentAttributeAudio: _type = cons; { - if (!data) setData(new MTPDdocumentAttributeAudio()); - MTPDdocumentAttributeAudio &v(_documentAttributeAudio()); - v.vflags.read(from, end); - v.vduration.read(from, end); - if (v.has_title()) { v.vtitle.read(from, end); } else { v.vtitle = MTPstring(); } - if (v.has_performer()) { v.vperformer.read(from, end); } else { v.vperformer = MTPstring(); } - if (v.has_waveform()) { v.vwaveform.read(from, end); } else { v.vwaveform = MTPbytes(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vduration.read(from, end); + if (v->has_title()) { v->vtitle.read(from, end); } else { v->vtitle = MTPstring(); } + if (v->has_performer()) { v->vperformer.read(from, end); } else { v->vperformer = MTPstring(); } + if (v->has_waveform()) { v->vwaveform.read(from, end); } else { v->vwaveform = MTPbytes(); } + data = std::move(v); } break; case mtpc_documentAttributeFilename: _type = cons; { - if (!data) setData(new MTPDdocumentAttributeFilename()); - MTPDdocumentAttributeFilename &v(_documentAttributeFilename()); - v.vfile_name.read(from, end); + auto v = std::make_shared(); + v->vfile_name.read(from, end); + data = std::move(v); } break; case mtpc_documentAttributeHasStickers: _type = cons; break; default: throw mtpErrorUnexpected(cons, "MTPdocumentAttribute"); @@ -35261,25 +32608,25 @@ inline void MTPdocumentAttribute::read(const mtpPrime *&from, const mtpPrime *en inline void MTPdocumentAttribute::write(mtpBuffer &to) const { switch (_type) { case mtpc_documentAttributeImageSize: { - const MTPDdocumentAttributeImageSize &v(c_documentAttributeImageSize()); + auto &v = c_documentAttributeImageSize(); v.vw.write(to); v.vh.write(to); } break; case mtpc_documentAttributeSticker: { - const MTPDdocumentAttributeSticker &v(c_documentAttributeSticker()); + auto &v = c_documentAttributeSticker(); v.vflags.write(to); v.valt.write(to); v.vstickerset.write(to); if (v.has_mask_coords()) v.vmask_coords.write(to); } break; case mtpc_documentAttributeVideo: { - const MTPDdocumentAttributeVideo &v(c_documentAttributeVideo()); + auto &v = c_documentAttributeVideo(); v.vduration.write(to); v.vw.write(to); v.vh.write(to); } break; case mtpc_documentAttributeAudio: { - const MTPDdocumentAttributeAudio &v(c_documentAttributeAudio()); + auto &v = c_documentAttributeAudio(); v.vflags.write(to); v.vduration.write(to); if (v.has_title()) v.vtitle.write(to); @@ -35287,32 +32634,52 @@ inline void MTPdocumentAttribute::write(mtpBuffer &to) const { if (v.has_waveform()) v.vwaveform.write(to); } break; case mtpc_documentAttributeFilename: { - const MTPDdocumentAttributeFilename &v(c_documentAttributeFilename()); + auto &v = c_documentAttributeFilename(); v.vfile_name.write(to); } break; } } -inline MTPdocumentAttribute::MTPdocumentAttribute(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPdocumentAttribute::MTPdocumentAttribute(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_documentAttributeImageSize: setData(new MTPDdocumentAttributeImageSize()); break; + case mtpc_documentAttributeImageSize: data = std::make_shared(); break; case mtpc_documentAttributeAnimated: break; - case mtpc_documentAttributeSticker: setData(new MTPDdocumentAttributeSticker()); break; - case mtpc_documentAttributeVideo: setData(new MTPDdocumentAttributeVideo()); break; - case mtpc_documentAttributeAudio: setData(new MTPDdocumentAttributeAudio()); break; - case mtpc_documentAttributeFilename: setData(new MTPDdocumentAttributeFilename()); break; + case mtpc_documentAttributeSticker: data = std::make_shared(); break; + case mtpc_documentAttributeVideo: data = std::make_shared(); break; + case mtpc_documentAttributeAudio: data = std::make_shared(); break; + case mtpc_documentAttributeFilename: data = std::make_shared(); break; case mtpc_documentAttributeHasStickers: break; default: throw mtpErrorBadTypeId(type, "MTPdocumentAttribute"); } } -inline MTPdocumentAttribute::MTPdocumentAttribute(MTPDdocumentAttributeImageSize *_data) : mtpDataOwner(_data), _type(mtpc_documentAttributeImageSize) { +inline const MTPDdocumentAttributeImageSize &MTPdocumentAttribute::c_documentAttributeImageSize() const { + t_assert(data != nullptr && _type == mtpc_documentAttributeImageSize); + return static_cast(*data); } -inline MTPdocumentAttribute::MTPdocumentAttribute(MTPDdocumentAttributeSticker *_data) : mtpDataOwner(_data), _type(mtpc_documentAttributeSticker) { +inline MTPdocumentAttribute::MTPdocumentAttribute(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_documentAttributeImageSize) { } -inline MTPdocumentAttribute::MTPdocumentAttribute(MTPDdocumentAttributeVideo *_data) : mtpDataOwner(_data), _type(mtpc_documentAttributeVideo) { +inline const MTPDdocumentAttributeSticker &MTPdocumentAttribute::c_documentAttributeSticker() const { + t_assert(data != nullptr && _type == mtpc_documentAttributeSticker); + return static_cast(*data); } -inline MTPdocumentAttribute::MTPdocumentAttribute(MTPDdocumentAttributeAudio *_data) : mtpDataOwner(_data), _type(mtpc_documentAttributeAudio) { +inline MTPdocumentAttribute::MTPdocumentAttribute(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_documentAttributeSticker) { } -inline MTPdocumentAttribute::MTPdocumentAttribute(MTPDdocumentAttributeFilename *_data) : mtpDataOwner(_data), _type(mtpc_documentAttributeFilename) { +inline const MTPDdocumentAttributeVideo &MTPdocumentAttribute::c_documentAttributeVideo() const { + t_assert(data != nullptr && _type == mtpc_documentAttributeVideo); + return static_cast(*data); +} +inline MTPdocumentAttribute::MTPdocumentAttribute(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_documentAttributeVideo) { +} +inline const MTPDdocumentAttributeAudio &MTPdocumentAttribute::c_documentAttributeAudio() const { + t_assert(data != nullptr && _type == mtpc_documentAttributeAudio); + return static_cast(*data); +} +inline MTPdocumentAttribute::MTPdocumentAttribute(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_documentAttributeAudio) { +} +inline const MTPDdocumentAttributeFilename &MTPdocumentAttribute::c_documentAttributeFilename() const { + t_assert(data != nullptr && _type == mtpc_documentAttributeFilename); + return static_cast(*data); +} +inline MTPdocumentAttribute::MTPdocumentAttribute(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_documentAttributeFilename) { } inline MTPdocumentAttribute MTP_documentAttributeImageSize(MTPint _w, MTPint _h) { return MTP::internal::TypeCreator::new_documentAttributeImageSize(_w, _h); @@ -35352,14 +32719,14 @@ inline mtpTypeId MTPmessages_stickers::type() const { return _type; } inline void MTPmessages_stickers::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messages_stickersNotModified: _type = cons; break; case mtpc_messages_stickers: _type = cons; { - if (!data) setData(new MTPDmessages_stickers()); - MTPDmessages_stickers &v(_messages_stickers()); - v.vhash.read(from, end); - v.vstickers.read(from, end); + auto v = std::make_shared(); + v->vhash.read(from, end); + v->vstickers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_stickers"); } @@ -35367,20 +32734,24 @@ inline void MTPmessages_stickers::read(const mtpPrime *&from, const mtpPrime *en inline void MTPmessages_stickers::write(mtpBuffer &to) const { switch (_type) { case mtpc_messages_stickers: { - const MTPDmessages_stickers &v(c_messages_stickers()); + auto &v = c_messages_stickers(); v.vhash.write(to); v.vstickers.write(to); } break; } } -inline MTPmessages_stickers::MTPmessages_stickers(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessages_stickers::MTPmessages_stickers(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_messages_stickersNotModified: break; - case mtpc_messages_stickers: setData(new MTPDmessages_stickers()); break; + case mtpc_messages_stickers: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_stickers"); } } -inline MTPmessages_stickers::MTPmessages_stickers(MTPDmessages_stickers *_data) : mtpDataOwner(_data), _type(mtpc_messages_stickers) { +inline const MTPDmessages_stickers &MTPmessages_stickers::c_messages_stickers() const { + t_assert(data != nullptr && _type == mtpc_messages_stickers); + return static_cast(*data); +} +inline MTPmessages_stickers::MTPmessages_stickers(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_stickers) { } inline MTPmessages_stickers MTP_messages_stickersNotModified() { return MTP::internal::TypeCreator::new_messages_stickersNotModified(); @@ -35389,7 +32760,7 @@ inline MTPmessages_stickers MTP_messages_stickers(const MTPstring &_hash, const return MTP::internal::TypeCreator::new_messages_stickers(_hash, _stickers); } -inline MTPstickerPack::MTPstickerPack() : mtpDataOwner(new MTPDstickerPack()) { +inline MTPstickerPack::MTPstickerPack() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPstickerPack::innerLength() const { @@ -35402,17 +32773,21 @@ inline mtpTypeId MTPstickerPack::type() const { inline void MTPstickerPack::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_stickerPack) throw mtpErrorUnexpected(cons, "MTPstickerPack"); - if (!data) setData(new MTPDstickerPack()); - MTPDstickerPack &v(_stickerPack()); - v.vemoticon.read(from, end); - v.vdocuments.read(from, end); + auto v = std::make_shared(); + v->vemoticon.read(from, end); + v->vdocuments.read(from, end); + data = std::move(v); } inline void MTPstickerPack::write(mtpBuffer &to) const { - const MTPDstickerPack &v(c_stickerPack()); + auto &v = c_stickerPack(); v.vemoticon.write(to); v.vdocuments.write(to); } -inline MTPstickerPack::MTPstickerPack(MTPDstickerPack *_data) : mtpDataOwner(_data) { +inline const MTPDstickerPack &MTPstickerPack::c_stickerPack() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPstickerPack::MTPstickerPack(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPstickerPack MTP_stickerPack(const MTPstring &_emoticon, const MTPVector &_documents) { return MTP::internal::TypeCreator::new_stickerPack(_emoticon, _documents); @@ -35432,14 +32807,14 @@ inline mtpTypeId MTPmessages_allStickers::type() const { return _type; } inline void MTPmessages_allStickers::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messages_allStickersNotModified: _type = cons; break; case mtpc_messages_allStickers: _type = cons; { - if (!data) setData(new MTPDmessages_allStickers()); - MTPDmessages_allStickers &v(_messages_allStickers()); - v.vhash.read(from, end); - v.vsets.read(from, end); + auto v = std::make_shared(); + v->vhash.read(from, end); + v->vsets.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_allStickers"); } @@ -35447,20 +32822,24 @@ inline void MTPmessages_allStickers::read(const mtpPrime *&from, const mtpPrime inline void MTPmessages_allStickers::write(mtpBuffer &to) const { switch (_type) { case mtpc_messages_allStickers: { - const MTPDmessages_allStickers &v(c_messages_allStickers()); + auto &v = c_messages_allStickers(); v.vhash.write(to); v.vsets.write(to); } break; } } -inline MTPmessages_allStickers::MTPmessages_allStickers(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessages_allStickers::MTPmessages_allStickers(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_messages_allStickersNotModified: break; - case mtpc_messages_allStickers: setData(new MTPDmessages_allStickers()); break; + case mtpc_messages_allStickers: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_allStickers"); } } -inline MTPmessages_allStickers::MTPmessages_allStickers(MTPDmessages_allStickers *_data) : mtpDataOwner(_data), _type(mtpc_messages_allStickers) { +inline const MTPDmessages_allStickers &MTPmessages_allStickers::c_messages_allStickers() const { + t_assert(data != nullptr && _type == mtpc_messages_allStickers); + return static_cast(*data); +} +inline MTPmessages_allStickers::MTPmessages_allStickers(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_allStickers) { } inline MTPmessages_allStickers MTP_messages_allStickersNotModified() { return MTP::internal::TypeCreator::new_messages_allStickersNotModified(); @@ -35469,7 +32848,7 @@ inline MTPmessages_allStickers MTP_messages_allStickers(MTPint _hash, const MTPV return MTP::internal::TypeCreator::new_messages_allStickers(_hash, _sets); } -inline MTPdisabledFeature::MTPdisabledFeature() : mtpDataOwner(new MTPDdisabledFeature()) { +inline MTPdisabledFeature::MTPdisabledFeature() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPdisabledFeature::innerLength() const { @@ -35482,23 +32861,27 @@ inline mtpTypeId MTPdisabledFeature::type() const { inline void MTPdisabledFeature::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_disabledFeature) throw mtpErrorUnexpected(cons, "MTPdisabledFeature"); - if (!data) setData(new MTPDdisabledFeature()); - MTPDdisabledFeature &v(_disabledFeature()); - v.vfeature.read(from, end); - v.vdescription.read(from, end); + auto v = std::make_shared(); + v->vfeature.read(from, end); + v->vdescription.read(from, end); + data = std::move(v); } inline void MTPdisabledFeature::write(mtpBuffer &to) const { - const MTPDdisabledFeature &v(c_disabledFeature()); + auto &v = c_disabledFeature(); v.vfeature.write(to); v.vdescription.write(to); } -inline MTPdisabledFeature::MTPdisabledFeature(MTPDdisabledFeature *_data) : mtpDataOwner(_data) { +inline const MTPDdisabledFeature &MTPdisabledFeature::c_disabledFeature() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPdisabledFeature::MTPdisabledFeature(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPdisabledFeature MTP_disabledFeature(const MTPstring &_feature, const MTPstring &_description) { return MTP::internal::TypeCreator::new_disabledFeature(_feature, _description); } -inline MTPmessages_affectedMessages::MTPmessages_affectedMessages() : mtpDataOwner(new MTPDmessages_affectedMessages()) { +inline MTPmessages_affectedMessages::MTPmessages_affectedMessages() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessages_affectedMessages::innerLength() const { @@ -35511,17 +32894,21 @@ inline mtpTypeId MTPmessages_affectedMessages::type() const { inline void MTPmessages_affectedMessages::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messages_affectedMessages) throw mtpErrorUnexpected(cons, "MTPmessages_affectedMessages"); - if (!data) setData(new MTPDmessages_affectedMessages()); - MTPDmessages_affectedMessages &v(_messages_affectedMessages()); - v.vpts.read(from, end); - v.vpts_count.read(from, end); + auto v = std::make_shared(); + v->vpts.read(from, end); + v->vpts_count.read(from, end); + data = std::move(v); } inline void MTPmessages_affectedMessages::write(mtpBuffer &to) const { - const MTPDmessages_affectedMessages &v(c_messages_affectedMessages()); + auto &v = c_messages_affectedMessages(); v.vpts.write(to); v.vpts_count.write(to); } -inline MTPmessages_affectedMessages::MTPmessages_affectedMessages(MTPDmessages_affectedMessages *_data) : mtpDataOwner(_data) { +inline const MTPDmessages_affectedMessages &MTPmessages_affectedMessages::c_messages_affectedMessages() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessages_affectedMessages::MTPmessages_affectedMessages(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmessages_affectedMessages MTP_messages_affectedMessages(MTPint _pts, MTPint _pts_count) { return MTP::internal::TypeCreator::new_messages_affectedMessages(_pts, _pts_count); @@ -35589,40 +32976,40 @@ inline mtpTypeId MTPwebPage::type() const { return _type; } inline void MTPwebPage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_webPageEmpty: _type = cons; { - if (!data) setData(new MTPDwebPageEmpty()); - MTPDwebPageEmpty &v(_webPageEmpty()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; case mtpc_webPagePending: _type = cons; { - if (!data) setData(new MTPDwebPagePending()); - MTPDwebPagePending &v(_webPagePending()); - v.vid.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_webPage: _type = cons; { - if (!data) setData(new MTPDwebPage()); - MTPDwebPage &v(_webPage()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vurl.read(from, end); - v.vdisplay_url.read(from, end); - v.vhash.read(from, end); - if (v.has_type()) { v.vtype.read(from, end); } else { v.vtype = MTPstring(); } - if (v.has_site_name()) { v.vsite_name.read(from, end); } else { v.vsite_name = MTPstring(); } - if (v.has_title()) { v.vtitle.read(from, end); } else { v.vtitle = MTPstring(); } - if (v.has_description()) { v.vdescription.read(from, end); } else { v.vdescription = MTPstring(); } - if (v.has_photo()) { v.vphoto.read(from, end); } else { v.vphoto = MTPPhoto(); } - if (v.has_embed_url()) { v.vembed_url.read(from, end); } else { v.vembed_url = MTPstring(); } - if (v.has_embed_type()) { v.vembed_type.read(from, end); } else { v.vembed_type = MTPstring(); } - if (v.has_embed_width()) { v.vembed_width.read(from, end); } else { v.vembed_width = MTPint(); } - if (v.has_embed_height()) { v.vembed_height.read(from, end); } else { v.vembed_height = MTPint(); } - if (v.has_duration()) { v.vduration.read(from, end); } else { v.vduration = MTPint(); } - if (v.has_author()) { v.vauthor.read(from, end); } else { v.vauthor = MTPstring(); } - if (v.has_document()) { v.vdocument.read(from, end); } else { v.vdocument = MTPDocument(); } - if (v.has_cached_page()) { v.vcached_page.read(from, end); } else { v.vcached_page = MTPPage(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vurl.read(from, end); + v->vdisplay_url.read(from, end); + v->vhash.read(from, end); + if (v->has_type()) { v->vtype.read(from, end); } else { v->vtype = MTPstring(); } + if (v->has_site_name()) { v->vsite_name.read(from, end); } else { v->vsite_name = MTPstring(); } + if (v->has_title()) { v->vtitle.read(from, end); } else { v->vtitle = MTPstring(); } + if (v->has_description()) { v->vdescription.read(from, end); } else { v->vdescription = MTPstring(); } + if (v->has_photo()) { v->vphoto.read(from, end); } else { v->vphoto = MTPPhoto(); } + if (v->has_embed_url()) { v->vembed_url.read(from, end); } else { v->vembed_url = MTPstring(); } + if (v->has_embed_type()) { v->vembed_type.read(from, end); } else { v->vembed_type = MTPstring(); } + if (v->has_embed_width()) { v->vembed_width.read(from, end); } else { v->vembed_width = MTPint(); } + if (v->has_embed_height()) { v->vembed_height.read(from, end); } else { v->vembed_height = MTPint(); } + if (v->has_duration()) { v->vduration.read(from, end); } else { v->vduration = MTPint(); } + if (v->has_author()) { v->vauthor.read(from, end); } else { v->vauthor = MTPstring(); } + if (v->has_document()) { v->vdocument.read(from, end); } else { v->vdocument = MTPDocument(); } + if (v->has_cached_page()) { v->vcached_page.read(from, end); } else { v->vcached_page = MTPPage(); } + data = std::move(v); } break; case mtpc_webPageNotModified: _type = cons; break; default: throw mtpErrorUnexpected(cons, "MTPwebPage"); @@ -35631,16 +33018,16 @@ inline void MTPwebPage::read(const mtpPrime *&from, const mtpPrime *end, mtpType inline void MTPwebPage::write(mtpBuffer &to) const { switch (_type) { case mtpc_webPageEmpty: { - const MTPDwebPageEmpty &v(c_webPageEmpty()); + auto &v = c_webPageEmpty(); v.vid.write(to); } break; case mtpc_webPagePending: { - const MTPDwebPagePending &v(c_webPagePending()); + auto &v = c_webPagePending(); v.vid.write(to); v.vdate.write(to); } break; case mtpc_webPage: { - const MTPDwebPage &v(c_webPage()); + auto &v = c_webPage(); v.vflags.write(to); v.vid.write(to); v.vurl.write(to); @@ -35662,20 +33049,32 @@ inline void MTPwebPage::write(mtpBuffer &to) const { } break; } } -inline MTPwebPage::MTPwebPage(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPwebPage::MTPwebPage(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_webPageEmpty: setData(new MTPDwebPageEmpty()); break; - case mtpc_webPagePending: setData(new MTPDwebPagePending()); break; - case mtpc_webPage: setData(new MTPDwebPage()); break; + case mtpc_webPageEmpty: data = std::make_shared(); break; + case mtpc_webPagePending: data = std::make_shared(); break; + case mtpc_webPage: data = std::make_shared(); break; case mtpc_webPageNotModified: break; default: throw mtpErrorBadTypeId(type, "MTPwebPage"); } } -inline MTPwebPage::MTPwebPage(MTPDwebPageEmpty *_data) : mtpDataOwner(_data), _type(mtpc_webPageEmpty) { +inline const MTPDwebPageEmpty &MTPwebPage::c_webPageEmpty() const { + t_assert(data != nullptr && _type == mtpc_webPageEmpty); + return static_cast(*data); } -inline MTPwebPage::MTPwebPage(MTPDwebPagePending *_data) : mtpDataOwner(_data), _type(mtpc_webPagePending) { +inline MTPwebPage::MTPwebPage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_webPageEmpty) { } -inline MTPwebPage::MTPwebPage(MTPDwebPage *_data) : mtpDataOwner(_data), _type(mtpc_webPage) { +inline const MTPDwebPagePending &MTPwebPage::c_webPagePending() const { + t_assert(data != nullptr && _type == mtpc_webPagePending); + return static_cast(*data); +} +inline MTPwebPage::MTPwebPage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_webPagePending) { +} +inline const MTPDwebPage &MTPwebPage::c_webPage() const { + t_assert(data != nullptr && _type == mtpc_webPage); + return static_cast(*data); +} +inline MTPwebPage::MTPwebPage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_webPage) { } inline MTPwebPage MTP_webPageEmpty(const MTPlong &_id) { return MTP::internal::TypeCreator::new_webPageEmpty(_id); @@ -35691,7 +33090,7 @@ inline MTPwebPage MTP_webPageNotModified() { return MTP::internal::TypeCreator::new_webPageNotModified(); } -inline MTPauthorization::MTPauthorization() : mtpDataOwner(new MTPDauthorization()) { +inline MTPauthorization::MTPauthorization() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPauthorization::innerLength() const { @@ -35704,24 +33103,24 @@ inline mtpTypeId MTPauthorization::type() const { inline void MTPauthorization::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_authorization) throw mtpErrorUnexpected(cons, "MTPauthorization"); - if (!data) setData(new MTPDauthorization()); - MTPDauthorization &v(_authorization()); - v.vhash.read(from, end); - v.vflags.read(from, end); - v.vdevice_model.read(from, end); - v.vplatform.read(from, end); - v.vsystem_version.read(from, end); - v.vapi_id.read(from, end); - v.vapp_name.read(from, end); - v.vapp_version.read(from, end); - v.vdate_created.read(from, end); - v.vdate_active.read(from, end); - v.vip.read(from, end); - v.vcountry.read(from, end); - v.vregion.read(from, end); + auto v = std::make_shared(); + v->vhash.read(from, end); + v->vflags.read(from, end); + v->vdevice_model.read(from, end); + v->vplatform.read(from, end); + v->vsystem_version.read(from, end); + v->vapi_id.read(from, end); + v->vapp_name.read(from, end); + v->vapp_version.read(from, end); + v->vdate_created.read(from, end); + v->vdate_active.read(from, end); + v->vip.read(from, end); + v->vcountry.read(from, end); + v->vregion.read(from, end); + data = std::move(v); } inline void MTPauthorization::write(mtpBuffer &to) const { - const MTPDauthorization &v(c_authorization()); + auto &v = c_authorization(); v.vhash.write(to); v.vflags.write(to); v.vdevice_model.write(to); @@ -35736,13 +33135,17 @@ inline void MTPauthorization::write(mtpBuffer &to) const { v.vcountry.write(to); v.vregion.write(to); } -inline MTPauthorization::MTPauthorization(MTPDauthorization *_data) : mtpDataOwner(_data) { +inline const MTPDauthorization &MTPauthorization::c_authorization() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPauthorization::MTPauthorization(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPauthorization MTP_authorization(const MTPlong &_hash, MTPint _flags, const MTPstring &_device_model, const MTPstring &_platform, const MTPstring &_system_version, MTPint _api_id, const MTPstring &_app_name, const MTPstring &_app_version, MTPint _date_created, MTPint _date_active, const MTPstring &_ip, const MTPstring &_country, const MTPstring &_region) { return MTP::internal::TypeCreator::new_authorization(_hash, _flags, _device_model, _platform, _system_version, _api_id, _app_name, _app_version, _date_created, _date_active, _ip, _country, _region); } -inline MTPaccount_authorizations::MTPaccount_authorizations() : mtpDataOwner(new MTPDaccount_authorizations()) { +inline MTPaccount_authorizations::MTPaccount_authorizations() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPaccount_authorizations::innerLength() const { @@ -35755,15 +33158,19 @@ inline mtpTypeId MTPaccount_authorizations::type() const { inline void MTPaccount_authorizations::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_account_authorizations) throw mtpErrorUnexpected(cons, "MTPaccount_authorizations"); - if (!data) setData(new MTPDaccount_authorizations()); - MTPDaccount_authorizations &v(_account_authorizations()); - v.vauthorizations.read(from, end); + auto v = std::make_shared(); + v->vauthorizations.read(from, end); + data = std::move(v); } inline void MTPaccount_authorizations::write(mtpBuffer &to) const { - const MTPDaccount_authorizations &v(c_account_authorizations()); + auto &v = c_account_authorizations(); v.vauthorizations.write(to); } -inline MTPaccount_authorizations::MTPaccount_authorizations(MTPDaccount_authorizations *_data) : mtpDataOwner(_data) { +inline const MTPDaccount_authorizations &MTPaccount_authorizations::c_account_authorizations() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPaccount_authorizations::MTPaccount_authorizations(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPaccount_authorizations MTP_account_authorizations(const MTPVector &_authorizations) { return MTP::internal::TypeCreator::new_account_authorizations(_authorizations); @@ -35787,22 +33194,22 @@ inline mtpTypeId MTPaccount_password::type() const { return _type; } inline void MTPaccount_password::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_account_noPassword: _type = cons; { - if (!data) setData(new MTPDaccount_noPassword()); - MTPDaccount_noPassword &v(_account_noPassword()); - v.vnew_salt.read(from, end); - v.vemail_unconfirmed_pattern.read(from, end); + auto v = std::make_shared(); + v->vnew_salt.read(from, end); + v->vemail_unconfirmed_pattern.read(from, end); + data = std::move(v); } break; case mtpc_account_password: _type = cons; { - if (!data) setData(new MTPDaccount_password()); - MTPDaccount_password &v(_account_password()); - v.vcurrent_salt.read(from, end); - v.vnew_salt.read(from, end); - v.vhint.read(from, end); - v.vhas_recovery.read(from, end); - v.vemail_unconfirmed_pattern.read(from, end); + auto v = std::make_shared(); + v->vcurrent_salt.read(from, end); + v->vnew_salt.read(from, end); + v->vhint.read(from, end); + v->vhas_recovery.read(from, end); + v->vemail_unconfirmed_pattern.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPaccount_password"); } @@ -35810,12 +33217,12 @@ inline void MTPaccount_password::read(const mtpPrime *&from, const mtpPrime *end inline void MTPaccount_password::write(mtpBuffer &to) const { switch (_type) { case mtpc_account_noPassword: { - const MTPDaccount_noPassword &v(c_account_noPassword()); + auto &v = c_account_noPassword(); v.vnew_salt.write(to); v.vemail_unconfirmed_pattern.write(to); } break; case mtpc_account_password: { - const MTPDaccount_password &v(c_account_password()); + auto &v = c_account_password(); v.vcurrent_salt.write(to); v.vnew_salt.write(to); v.vhint.write(to); @@ -35824,16 +33231,24 @@ inline void MTPaccount_password::write(mtpBuffer &to) const { } break; } } -inline MTPaccount_password::MTPaccount_password(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPaccount_password::MTPaccount_password(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_account_noPassword: setData(new MTPDaccount_noPassword()); break; - case mtpc_account_password: setData(new MTPDaccount_password()); break; + case mtpc_account_noPassword: data = std::make_shared(); break; + case mtpc_account_password: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPaccount_password"); } } -inline MTPaccount_password::MTPaccount_password(MTPDaccount_noPassword *_data) : mtpDataOwner(_data), _type(mtpc_account_noPassword) { +inline const MTPDaccount_noPassword &MTPaccount_password::c_account_noPassword() const { + t_assert(data != nullptr && _type == mtpc_account_noPassword); + return static_cast(*data); } -inline MTPaccount_password::MTPaccount_password(MTPDaccount_password *_data) : mtpDataOwner(_data), _type(mtpc_account_password) { +inline MTPaccount_password::MTPaccount_password(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_account_noPassword) { +} +inline const MTPDaccount_password &MTPaccount_password::c_account_password() const { + t_assert(data != nullptr && _type == mtpc_account_password); + return static_cast(*data); +} +inline MTPaccount_password::MTPaccount_password(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_account_password) { } inline MTPaccount_password MTP_account_noPassword(const MTPbytes &_new_salt, const MTPstring &_email_unconfirmed_pattern) { return MTP::internal::TypeCreator::new_account_noPassword(_new_salt, _email_unconfirmed_pattern); @@ -35842,7 +33257,7 @@ inline MTPaccount_password MTP_account_password(const MTPbytes &_current_salt, c return MTP::internal::TypeCreator::new_account_password(_current_salt, _new_salt, _hint, _has_recovery, _email_unconfirmed_pattern); } -inline MTPaccount_passwordSettings::MTPaccount_passwordSettings() : mtpDataOwner(new MTPDaccount_passwordSettings()) { +inline MTPaccount_passwordSettings::MTPaccount_passwordSettings() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPaccount_passwordSettings::innerLength() const { @@ -35855,21 +33270,25 @@ inline mtpTypeId MTPaccount_passwordSettings::type() const { inline void MTPaccount_passwordSettings::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_account_passwordSettings) throw mtpErrorUnexpected(cons, "MTPaccount_passwordSettings"); - if (!data) setData(new MTPDaccount_passwordSettings()); - MTPDaccount_passwordSettings &v(_account_passwordSettings()); - v.vemail.read(from, end); + auto v = std::make_shared(); + v->vemail.read(from, end); + data = std::move(v); } inline void MTPaccount_passwordSettings::write(mtpBuffer &to) const { - const MTPDaccount_passwordSettings &v(c_account_passwordSettings()); + auto &v = c_account_passwordSettings(); v.vemail.write(to); } -inline MTPaccount_passwordSettings::MTPaccount_passwordSettings(MTPDaccount_passwordSettings *_data) : mtpDataOwner(_data) { +inline const MTPDaccount_passwordSettings &MTPaccount_passwordSettings::c_account_passwordSettings() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPaccount_passwordSettings::MTPaccount_passwordSettings(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPaccount_passwordSettings MTP_account_passwordSettings(const MTPstring &_email) { return MTP::internal::TypeCreator::new_account_passwordSettings(_email); } -inline MTPaccount_passwordInputSettings::MTPaccount_passwordInputSettings() : mtpDataOwner(new MTPDaccount_passwordInputSettings()) { +inline MTPaccount_passwordInputSettings::MTPaccount_passwordInputSettings() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPaccount_passwordInputSettings::innerLength() const { @@ -35882,30 +33301,34 @@ inline mtpTypeId MTPaccount_passwordInputSettings::type() const { inline void MTPaccount_passwordInputSettings::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_account_passwordInputSettings) throw mtpErrorUnexpected(cons, "MTPaccount_passwordInputSettings"); - if (!data) setData(new MTPDaccount_passwordInputSettings()); - MTPDaccount_passwordInputSettings &v(_account_passwordInputSettings()); - v.vflags.read(from, end); - if (v.has_new_salt()) { v.vnew_salt.read(from, end); } else { v.vnew_salt = MTPbytes(); } - if (v.has_new_password_hash()) { v.vnew_password_hash.read(from, end); } else { v.vnew_password_hash = MTPbytes(); } - if (v.has_hint()) { v.vhint.read(from, end); } else { v.vhint = MTPstring(); } - if (v.has_email()) { v.vemail.read(from, end); } else { v.vemail = MTPstring(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + if (v->has_new_salt()) { v->vnew_salt.read(from, end); } else { v->vnew_salt = MTPbytes(); } + if (v->has_new_password_hash()) { v->vnew_password_hash.read(from, end); } else { v->vnew_password_hash = MTPbytes(); } + if (v->has_hint()) { v->vhint.read(from, end); } else { v->vhint = MTPstring(); } + if (v->has_email()) { v->vemail.read(from, end); } else { v->vemail = MTPstring(); } + data = std::move(v); } inline void MTPaccount_passwordInputSettings::write(mtpBuffer &to) const { - const MTPDaccount_passwordInputSettings &v(c_account_passwordInputSettings()); + auto &v = c_account_passwordInputSettings(); v.vflags.write(to); if (v.has_new_salt()) v.vnew_salt.write(to); if (v.has_new_password_hash()) v.vnew_password_hash.write(to); if (v.has_hint()) v.vhint.write(to); if (v.has_email()) v.vemail.write(to); } -inline MTPaccount_passwordInputSettings::MTPaccount_passwordInputSettings(MTPDaccount_passwordInputSettings *_data) : mtpDataOwner(_data) { +inline const MTPDaccount_passwordInputSettings &MTPaccount_passwordInputSettings::c_account_passwordInputSettings() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPaccount_passwordInputSettings::MTPaccount_passwordInputSettings(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDaccount_passwordInputSettings::Flags) inline MTPaccount_passwordInputSettings MTP_account_passwordInputSettings(const MTPflags &_flags, const MTPbytes &_new_salt, const MTPbytes &_new_password_hash, const MTPstring &_hint, const MTPstring &_email) { return MTP::internal::TypeCreator::new_account_passwordInputSettings(_flags, _new_salt, _new_password_hash, _hint, _email); } -inline MTPauth_passwordRecovery::MTPauth_passwordRecovery() : mtpDataOwner(new MTPDauth_passwordRecovery()) { +inline MTPauth_passwordRecovery::MTPauth_passwordRecovery() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPauth_passwordRecovery::innerLength() const { @@ -35918,21 +33341,25 @@ inline mtpTypeId MTPauth_passwordRecovery::type() const { inline void MTPauth_passwordRecovery::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_auth_passwordRecovery) throw mtpErrorUnexpected(cons, "MTPauth_passwordRecovery"); - if (!data) setData(new MTPDauth_passwordRecovery()); - MTPDauth_passwordRecovery &v(_auth_passwordRecovery()); - v.vemail_pattern.read(from, end); + auto v = std::make_shared(); + v->vemail_pattern.read(from, end); + data = std::move(v); } inline void MTPauth_passwordRecovery::write(mtpBuffer &to) const { - const MTPDauth_passwordRecovery &v(c_auth_passwordRecovery()); + auto &v = c_auth_passwordRecovery(); v.vemail_pattern.write(to); } -inline MTPauth_passwordRecovery::MTPauth_passwordRecovery(MTPDauth_passwordRecovery *_data) : mtpDataOwner(_data) { +inline const MTPDauth_passwordRecovery &MTPauth_passwordRecovery::c_auth_passwordRecovery() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPauth_passwordRecovery::MTPauth_passwordRecovery(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPauth_passwordRecovery MTP_auth_passwordRecovery(const MTPstring &_email_pattern) { return MTP::internal::TypeCreator::new_auth_passwordRecovery(_email_pattern); } -inline MTPreceivedNotifyMessage::MTPreceivedNotifyMessage() : mtpDataOwner(new MTPDreceivedNotifyMessage()) { +inline MTPreceivedNotifyMessage::MTPreceivedNotifyMessage() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPreceivedNotifyMessage::innerLength() const { @@ -35945,17 +33372,21 @@ inline mtpTypeId MTPreceivedNotifyMessage::type() const { inline void MTPreceivedNotifyMessage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_receivedNotifyMessage) throw mtpErrorUnexpected(cons, "MTPreceivedNotifyMessage"); - if (!data) setData(new MTPDreceivedNotifyMessage()); - MTPDreceivedNotifyMessage &v(_receivedNotifyMessage()); - v.vid.read(from, end); - v.vflags.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vflags.read(from, end); + data = std::move(v); } inline void MTPreceivedNotifyMessage::write(mtpBuffer &to) const { - const MTPDreceivedNotifyMessage &v(c_receivedNotifyMessage()); + auto &v = c_receivedNotifyMessage(); v.vid.write(to); v.vflags.write(to); } -inline MTPreceivedNotifyMessage::MTPreceivedNotifyMessage(MTPDreceivedNotifyMessage *_data) : mtpDataOwner(_data) { +inline const MTPDreceivedNotifyMessage &MTPreceivedNotifyMessage::c_receivedNotifyMessage() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPreceivedNotifyMessage::MTPreceivedNotifyMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPreceivedNotifyMessage MTP_receivedNotifyMessage(MTPint _id, MTPint _flags) { return MTP::internal::TypeCreator::new_receivedNotifyMessage(_id, _flags); @@ -35975,13 +33406,13 @@ inline mtpTypeId MTPexportedChatInvite::type() const { return _type; } inline void MTPexportedChatInvite::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_chatInviteEmpty: _type = cons; break; case mtpc_chatInviteExported: _type = cons; { - if (!data) setData(new MTPDchatInviteExported()); - MTPDchatInviteExported &v(_chatInviteExported()); - v.vlink.read(from, end); + auto v = std::make_shared(); + v->vlink.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPexportedChatInvite"); } @@ -35989,19 +33420,23 @@ inline void MTPexportedChatInvite::read(const mtpPrime *&from, const mtpPrime *e inline void MTPexportedChatInvite::write(mtpBuffer &to) const { switch (_type) { case mtpc_chatInviteExported: { - const MTPDchatInviteExported &v(c_chatInviteExported()); + auto &v = c_chatInviteExported(); v.vlink.write(to); } break; } } -inline MTPexportedChatInvite::MTPexportedChatInvite(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPexportedChatInvite::MTPexportedChatInvite(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_chatInviteEmpty: break; - case mtpc_chatInviteExported: setData(new MTPDchatInviteExported()); break; + case mtpc_chatInviteExported: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPexportedChatInvite"); } } -inline MTPexportedChatInvite::MTPexportedChatInvite(MTPDchatInviteExported *_data) : mtpDataOwner(_data), _type(mtpc_chatInviteExported) { +inline const MTPDchatInviteExported &MTPexportedChatInvite::c_chatInviteExported() const { + t_assert(data != nullptr && _type == mtpc_chatInviteExported); + return static_cast(*data); +} +inline MTPexportedChatInvite::MTPexportedChatInvite(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatInviteExported) { } inline MTPexportedChatInvite MTP_chatInviteEmpty() { return MTP::internal::TypeCreator::new_chatInviteEmpty(); @@ -36028,21 +33463,21 @@ inline mtpTypeId MTPchatInvite::type() const { return _type; } inline void MTPchatInvite::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_chatInviteAlready: _type = cons; { - if (!data) setData(new MTPDchatInviteAlready()); - MTPDchatInviteAlready &v(_chatInviteAlready()); - v.vchat.read(from, end); + auto v = std::make_shared(); + v->vchat.read(from, end); + data = std::move(v); } break; case mtpc_chatInvite: _type = cons; { - if (!data) setData(new MTPDchatInvite()); - MTPDchatInvite &v(_chatInvite()); - v.vflags.read(from, end); - v.vtitle.read(from, end); - v.vphoto.read(from, end); - v.vparticipants_count.read(from, end); - if (v.has_participants()) { v.vparticipants.read(from, end); } else { v.vparticipants = MTPVector(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vtitle.read(from, end); + v->vphoto.read(from, end); + v->vparticipants_count.read(from, end); + if (v->has_participants()) { v->vparticipants.read(from, end); } else { v->vparticipants = MTPVector(); } + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPchatInvite"); } @@ -36050,11 +33485,11 @@ inline void MTPchatInvite::read(const mtpPrime *&from, const mtpPrime *end, mtpT inline void MTPchatInvite::write(mtpBuffer &to) const { switch (_type) { case mtpc_chatInviteAlready: { - const MTPDchatInviteAlready &v(c_chatInviteAlready()); + auto &v = c_chatInviteAlready(); v.vchat.write(to); } break; case mtpc_chatInvite: { - const MTPDchatInvite &v(c_chatInvite()); + auto &v = c_chatInvite(); v.vflags.write(to); v.vtitle.write(to); v.vphoto.write(to); @@ -36063,16 +33498,24 @@ inline void MTPchatInvite::write(mtpBuffer &to) const { } break; } } -inline MTPchatInvite::MTPchatInvite(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPchatInvite::MTPchatInvite(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_chatInviteAlready: setData(new MTPDchatInviteAlready()); break; - case mtpc_chatInvite: setData(new MTPDchatInvite()); break; + case mtpc_chatInviteAlready: data = std::make_shared(); break; + case mtpc_chatInvite: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPchatInvite"); } } -inline MTPchatInvite::MTPchatInvite(MTPDchatInviteAlready *_data) : mtpDataOwner(_data), _type(mtpc_chatInviteAlready) { +inline const MTPDchatInviteAlready &MTPchatInvite::c_chatInviteAlready() const { + t_assert(data != nullptr && _type == mtpc_chatInviteAlready); + return static_cast(*data); } -inline MTPchatInvite::MTPchatInvite(MTPDchatInvite *_data) : mtpDataOwner(_data), _type(mtpc_chatInvite) { +inline MTPchatInvite::MTPchatInvite(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatInviteAlready) { +} +inline const MTPDchatInvite &MTPchatInvite::c_chatInvite() const { + t_assert(data != nullptr && _type == mtpc_chatInvite); + return static_cast(*data); +} +inline MTPchatInvite::MTPchatInvite(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_chatInvite) { } inline MTPchatInvite MTP_chatInviteAlready(const MTPChat &_chat) { return MTP::internal::TypeCreator::new_chatInviteAlready(_chat); @@ -36100,19 +33543,19 @@ inline mtpTypeId MTPinputStickerSet::type() const { return _type; } inline void MTPinputStickerSet::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputStickerSetEmpty: _type = cons; break; case mtpc_inputStickerSetID: _type = cons; { - if (!data) setData(new MTPDinputStickerSetID()); - MTPDinputStickerSetID &v(_inputStickerSetID()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } break; case mtpc_inputStickerSetShortName: _type = cons; { - if (!data) setData(new MTPDinputStickerSetShortName()); - MTPDinputStickerSetShortName &v(_inputStickerSetShortName()); - v.vshort_name.read(from, end); + auto v = std::make_shared(); + v->vshort_name.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputStickerSet"); } @@ -36120,27 +33563,35 @@ inline void MTPinputStickerSet::read(const mtpPrime *&from, const mtpPrime *end, inline void MTPinputStickerSet::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputStickerSetID: { - const MTPDinputStickerSetID &v(c_inputStickerSetID()); + auto &v = c_inputStickerSetID(); v.vid.write(to); v.vaccess_hash.write(to); } break; case mtpc_inputStickerSetShortName: { - const MTPDinputStickerSetShortName &v(c_inputStickerSetShortName()); + auto &v = c_inputStickerSetShortName(); v.vshort_name.write(to); } break; } } -inline MTPinputStickerSet::MTPinputStickerSet(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputStickerSet::MTPinputStickerSet(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputStickerSetEmpty: break; - case mtpc_inputStickerSetID: setData(new MTPDinputStickerSetID()); break; - case mtpc_inputStickerSetShortName: setData(new MTPDinputStickerSetShortName()); break; + case mtpc_inputStickerSetID: data = std::make_shared(); break; + case mtpc_inputStickerSetShortName: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputStickerSet"); } } -inline MTPinputStickerSet::MTPinputStickerSet(MTPDinputStickerSetID *_data) : mtpDataOwner(_data), _type(mtpc_inputStickerSetID) { +inline const MTPDinputStickerSetID &MTPinputStickerSet::c_inputStickerSetID() const { + t_assert(data != nullptr && _type == mtpc_inputStickerSetID); + return static_cast(*data); } -inline MTPinputStickerSet::MTPinputStickerSet(MTPDinputStickerSetShortName *_data) : mtpDataOwner(_data), _type(mtpc_inputStickerSetShortName) { +inline MTPinputStickerSet::MTPinputStickerSet(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputStickerSetID) { +} +inline const MTPDinputStickerSetShortName &MTPinputStickerSet::c_inputStickerSetShortName() const { + t_assert(data != nullptr && _type == mtpc_inputStickerSetShortName); + return static_cast(*data); +} +inline MTPinputStickerSet::MTPinputStickerSet(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputStickerSetShortName) { } inline MTPinputStickerSet MTP_inputStickerSetEmpty() { return MTP::internal::TypeCreator::new_inputStickerSetEmpty(); @@ -36152,7 +33603,7 @@ inline MTPinputStickerSet MTP_inputStickerSetShortName(const MTPstring &_short_n return MTP::internal::TypeCreator::new_inputStickerSetShortName(_short_name); } -inline MTPstickerSet::MTPstickerSet() : mtpDataOwner(new MTPDstickerSet()) { +inline MTPstickerSet::MTPstickerSet() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPstickerSet::innerLength() const { @@ -36165,18 +33616,18 @@ inline mtpTypeId MTPstickerSet::type() const { inline void MTPstickerSet::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_stickerSet) throw mtpErrorUnexpected(cons, "MTPstickerSet"); - if (!data) setData(new MTPDstickerSet()); - MTPDstickerSet &v(_stickerSet()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vtitle.read(from, end); - v.vshort_name.read(from, end); - v.vcount.read(from, end); - v.vhash.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vtitle.read(from, end); + v->vshort_name.read(from, end); + v->vcount.read(from, end); + v->vhash.read(from, end); + data = std::move(v); } inline void MTPstickerSet::write(mtpBuffer &to) const { - const MTPDstickerSet &v(c_stickerSet()); + auto &v = c_stickerSet(); v.vflags.write(to); v.vid.write(to); v.vaccess_hash.write(to); @@ -36185,14 +33636,18 @@ inline void MTPstickerSet::write(mtpBuffer &to) const { v.vcount.write(to); v.vhash.write(to); } -inline MTPstickerSet::MTPstickerSet(MTPDstickerSet *_data) : mtpDataOwner(_data) { +inline const MTPDstickerSet &MTPstickerSet::c_stickerSet() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPstickerSet::MTPstickerSet(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDstickerSet::Flags) inline MTPstickerSet MTP_stickerSet(const MTPflags &_flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name, MTPint _count, MTPint _hash) { return MTP::internal::TypeCreator::new_stickerSet(_flags, _id, _access_hash, _title, _short_name, _count, _hash); } -inline MTPmessages_stickerSet::MTPmessages_stickerSet() : mtpDataOwner(new MTPDmessages_stickerSet()) { +inline MTPmessages_stickerSet::MTPmessages_stickerSet() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessages_stickerSet::innerLength() const { @@ -36205,25 +33660,29 @@ inline mtpTypeId MTPmessages_stickerSet::type() const { inline void MTPmessages_stickerSet::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messages_stickerSet) throw mtpErrorUnexpected(cons, "MTPmessages_stickerSet"); - if (!data) setData(new MTPDmessages_stickerSet()); - MTPDmessages_stickerSet &v(_messages_stickerSet()); - v.vset.read(from, end); - v.vpacks.read(from, end); - v.vdocuments.read(from, end); + auto v = std::make_shared(); + v->vset.read(from, end); + v->vpacks.read(from, end); + v->vdocuments.read(from, end); + data = std::move(v); } inline void MTPmessages_stickerSet::write(mtpBuffer &to) const { - const MTPDmessages_stickerSet &v(c_messages_stickerSet()); + auto &v = c_messages_stickerSet(); v.vset.write(to); v.vpacks.write(to); v.vdocuments.write(to); } -inline MTPmessages_stickerSet::MTPmessages_stickerSet(MTPDmessages_stickerSet *_data) : mtpDataOwner(_data) { +inline const MTPDmessages_stickerSet &MTPmessages_stickerSet::c_messages_stickerSet() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessages_stickerSet::MTPmessages_stickerSet(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmessages_stickerSet MTP_messages_stickerSet(const MTPStickerSet &_set, const MTPVector &_packs, const MTPVector &_documents) { return MTP::internal::TypeCreator::new_messages_stickerSet(_set, _packs, _documents); } -inline MTPbotCommand::MTPbotCommand() : mtpDataOwner(new MTPDbotCommand()) { +inline MTPbotCommand::MTPbotCommand() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPbotCommand::innerLength() const { @@ -36236,23 +33695,27 @@ inline mtpTypeId MTPbotCommand::type() const { inline void MTPbotCommand::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_botCommand) throw mtpErrorUnexpected(cons, "MTPbotCommand"); - if (!data) setData(new MTPDbotCommand()); - MTPDbotCommand &v(_botCommand()); - v.vcommand.read(from, end); - v.vdescription.read(from, end); + auto v = std::make_shared(); + v->vcommand.read(from, end); + v->vdescription.read(from, end); + data = std::move(v); } inline void MTPbotCommand::write(mtpBuffer &to) const { - const MTPDbotCommand &v(c_botCommand()); + auto &v = c_botCommand(); v.vcommand.write(to); v.vdescription.write(to); } -inline MTPbotCommand::MTPbotCommand(MTPDbotCommand *_data) : mtpDataOwner(_data) { +inline const MTPDbotCommand &MTPbotCommand::c_botCommand() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPbotCommand::MTPbotCommand(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPbotCommand MTP_botCommand(const MTPstring &_command, const MTPstring &_description) { return MTP::internal::TypeCreator::new_botCommand(_command, _description); } -inline MTPbotInfo::MTPbotInfo() : mtpDataOwner(new MTPDbotInfo()) { +inline MTPbotInfo::MTPbotInfo() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPbotInfo::innerLength() const { @@ -36265,19 +33728,23 @@ inline mtpTypeId MTPbotInfo::type() const { inline void MTPbotInfo::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_botInfo) throw mtpErrorUnexpected(cons, "MTPbotInfo"); - if (!data) setData(new MTPDbotInfo()); - MTPDbotInfo &v(_botInfo()); - v.vuser_id.read(from, end); - v.vdescription.read(from, end); - v.vcommands.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vdescription.read(from, end); + v->vcommands.read(from, end); + data = std::move(v); } inline void MTPbotInfo::write(mtpBuffer &to) const { - const MTPDbotInfo &v(c_botInfo()); + auto &v = c_botInfo(); v.vuser_id.write(to); v.vdescription.write(to); v.vcommands.write(to); } -inline MTPbotInfo::MTPbotInfo(MTPDbotInfo *_data) : mtpDataOwner(_data) { +inline const MTPDbotInfo &MTPbotInfo::c_botInfo() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPbotInfo::MTPbotInfo(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPbotInfo MTP_botInfo(MTPint _user_id, const MTPstring &_description, const MTPVector &_commands) { return MTP::internal::TypeCreator::new_botInfo(_user_id, _description, _commands); @@ -36321,46 +33788,46 @@ inline mtpTypeId MTPkeyboardButton::type() const { return _type; } inline void MTPkeyboardButton::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_keyboardButton: _type = cons; { - if (!data) setData(new MTPDkeyboardButton()); - MTPDkeyboardButton &v(_keyboardButton()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_keyboardButtonUrl: _type = cons; { - if (!data) setData(new MTPDkeyboardButtonUrl()); - MTPDkeyboardButtonUrl &v(_keyboardButtonUrl()); - v.vtext.read(from, end); - v.vurl.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + v->vurl.read(from, end); + data = std::move(v); } break; case mtpc_keyboardButtonCallback: _type = cons; { - if (!data) setData(new MTPDkeyboardButtonCallback()); - MTPDkeyboardButtonCallback &v(_keyboardButtonCallback()); - v.vtext.read(from, end); - v.vdata.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + v->vdata.read(from, end); + data = std::move(v); } break; case mtpc_keyboardButtonRequestPhone: _type = cons; { - if (!data) setData(new MTPDkeyboardButtonRequestPhone()); - MTPDkeyboardButtonRequestPhone &v(_keyboardButtonRequestPhone()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_keyboardButtonRequestGeoLocation: _type = cons; { - if (!data) setData(new MTPDkeyboardButtonRequestGeoLocation()); - MTPDkeyboardButtonRequestGeoLocation &v(_keyboardButtonRequestGeoLocation()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_keyboardButtonSwitchInline: _type = cons; { - if (!data) setData(new MTPDkeyboardButtonSwitchInline()); - MTPDkeyboardButtonSwitchInline &v(_keyboardButtonSwitchInline()); - v.vflags.read(from, end); - v.vtext.read(from, end); - v.vquery.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vtext.read(from, end); + v->vquery.read(from, end); + data = std::move(v); } break; case mtpc_keyboardButtonGame: _type = cons; { - if (!data) setData(new MTPDkeyboardButtonGame()); - MTPDkeyboardButtonGame &v(_keyboardButtonGame()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPkeyboardButton"); } @@ -36368,64 +33835,92 @@ inline void MTPkeyboardButton::read(const mtpPrime *&from, const mtpPrime *end, inline void MTPkeyboardButton::write(mtpBuffer &to) const { switch (_type) { case mtpc_keyboardButton: { - const MTPDkeyboardButton &v(c_keyboardButton()); + auto &v = c_keyboardButton(); v.vtext.write(to); } break; case mtpc_keyboardButtonUrl: { - const MTPDkeyboardButtonUrl &v(c_keyboardButtonUrl()); + auto &v = c_keyboardButtonUrl(); v.vtext.write(to); v.vurl.write(to); } break; case mtpc_keyboardButtonCallback: { - const MTPDkeyboardButtonCallback &v(c_keyboardButtonCallback()); + auto &v = c_keyboardButtonCallback(); v.vtext.write(to); v.vdata.write(to); } break; case mtpc_keyboardButtonRequestPhone: { - const MTPDkeyboardButtonRequestPhone &v(c_keyboardButtonRequestPhone()); + auto &v = c_keyboardButtonRequestPhone(); v.vtext.write(to); } break; case mtpc_keyboardButtonRequestGeoLocation: { - const MTPDkeyboardButtonRequestGeoLocation &v(c_keyboardButtonRequestGeoLocation()); + auto &v = c_keyboardButtonRequestGeoLocation(); v.vtext.write(to); } break; case mtpc_keyboardButtonSwitchInline: { - const MTPDkeyboardButtonSwitchInline &v(c_keyboardButtonSwitchInline()); + auto &v = c_keyboardButtonSwitchInline(); v.vflags.write(to); v.vtext.write(to); v.vquery.write(to); } break; case mtpc_keyboardButtonGame: { - const MTPDkeyboardButtonGame &v(c_keyboardButtonGame()); + auto &v = c_keyboardButtonGame(); v.vtext.write(to); } break; } } -inline MTPkeyboardButton::MTPkeyboardButton(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPkeyboardButton::MTPkeyboardButton(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_keyboardButton: setData(new MTPDkeyboardButton()); break; - case mtpc_keyboardButtonUrl: setData(new MTPDkeyboardButtonUrl()); break; - case mtpc_keyboardButtonCallback: setData(new MTPDkeyboardButtonCallback()); break; - case mtpc_keyboardButtonRequestPhone: setData(new MTPDkeyboardButtonRequestPhone()); break; - case mtpc_keyboardButtonRequestGeoLocation: setData(new MTPDkeyboardButtonRequestGeoLocation()); break; - case mtpc_keyboardButtonSwitchInline: setData(new MTPDkeyboardButtonSwitchInline()); break; - case mtpc_keyboardButtonGame: setData(new MTPDkeyboardButtonGame()); break; + case mtpc_keyboardButton: data = std::make_shared(); break; + case mtpc_keyboardButtonUrl: data = std::make_shared(); break; + case mtpc_keyboardButtonCallback: data = std::make_shared(); break; + case mtpc_keyboardButtonRequestPhone: data = std::make_shared(); break; + case mtpc_keyboardButtonRequestGeoLocation: data = std::make_shared(); break; + case mtpc_keyboardButtonSwitchInline: data = std::make_shared(); break; + case mtpc_keyboardButtonGame: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPkeyboardButton"); } } -inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButton *_data) : mtpDataOwner(_data), _type(mtpc_keyboardButton) { +inline const MTPDkeyboardButton &MTPkeyboardButton::c_keyboardButton() const { + t_assert(data != nullptr && _type == mtpc_keyboardButton); + return static_cast(*data); } -inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonUrl *_data) : mtpDataOwner(_data), _type(mtpc_keyboardButtonUrl) { +inline MTPkeyboardButton::MTPkeyboardButton(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_keyboardButton) { } -inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonCallback *_data) : mtpDataOwner(_data), _type(mtpc_keyboardButtonCallback) { +inline const MTPDkeyboardButtonUrl &MTPkeyboardButton::c_keyboardButtonUrl() const { + t_assert(data != nullptr && _type == mtpc_keyboardButtonUrl); + return static_cast(*data); } -inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonRequestPhone *_data) : mtpDataOwner(_data), _type(mtpc_keyboardButtonRequestPhone) { +inline MTPkeyboardButton::MTPkeyboardButton(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_keyboardButtonUrl) { } -inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonRequestGeoLocation *_data) : mtpDataOwner(_data), _type(mtpc_keyboardButtonRequestGeoLocation) { +inline const MTPDkeyboardButtonCallback &MTPkeyboardButton::c_keyboardButtonCallback() const { + t_assert(data != nullptr && _type == mtpc_keyboardButtonCallback); + return static_cast(*data); } -inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonSwitchInline *_data) : mtpDataOwner(_data), _type(mtpc_keyboardButtonSwitchInline) { +inline MTPkeyboardButton::MTPkeyboardButton(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_keyboardButtonCallback) { } -inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonGame *_data) : mtpDataOwner(_data), _type(mtpc_keyboardButtonGame) { +inline const MTPDkeyboardButtonRequestPhone &MTPkeyboardButton::c_keyboardButtonRequestPhone() const { + t_assert(data != nullptr && _type == mtpc_keyboardButtonRequestPhone); + return static_cast(*data); +} +inline MTPkeyboardButton::MTPkeyboardButton(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_keyboardButtonRequestPhone) { +} +inline const MTPDkeyboardButtonRequestGeoLocation &MTPkeyboardButton::c_keyboardButtonRequestGeoLocation() const { + t_assert(data != nullptr && _type == mtpc_keyboardButtonRequestGeoLocation); + return static_cast(*data); +} +inline MTPkeyboardButton::MTPkeyboardButton(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_keyboardButtonRequestGeoLocation) { +} +inline const MTPDkeyboardButtonSwitchInline &MTPkeyboardButton::c_keyboardButtonSwitchInline() const { + t_assert(data != nullptr && _type == mtpc_keyboardButtonSwitchInline); + return static_cast(*data); +} +inline MTPkeyboardButton::MTPkeyboardButton(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_keyboardButtonSwitchInline) { +} +inline const MTPDkeyboardButtonGame &MTPkeyboardButton::c_keyboardButtonGame() const { + t_assert(data != nullptr && _type == mtpc_keyboardButtonGame); + return static_cast(*data); +} +inline MTPkeyboardButton::MTPkeyboardButton(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_keyboardButtonGame) { } inline MTPkeyboardButton MTP_keyboardButton(const MTPstring &_text) { return MTP::internal::TypeCreator::new_keyboardButton(_text); @@ -36450,7 +33945,7 @@ inline MTPkeyboardButton MTP_keyboardButtonGame(const MTPstring &_text) { return MTP::internal::TypeCreator::new_keyboardButtonGame(_text); } -inline MTPkeyboardButtonRow::MTPkeyboardButtonRow() : mtpDataOwner(new MTPDkeyboardButtonRow()) { +inline MTPkeyboardButtonRow::MTPkeyboardButtonRow() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPkeyboardButtonRow::innerLength() const { @@ -36463,15 +33958,19 @@ inline mtpTypeId MTPkeyboardButtonRow::type() const { inline void MTPkeyboardButtonRow::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_keyboardButtonRow) throw mtpErrorUnexpected(cons, "MTPkeyboardButtonRow"); - if (!data) setData(new MTPDkeyboardButtonRow()); - MTPDkeyboardButtonRow &v(_keyboardButtonRow()); - v.vbuttons.read(from, end); + auto v = std::make_shared(); + v->vbuttons.read(from, end); + data = std::move(v); } inline void MTPkeyboardButtonRow::write(mtpBuffer &to) const { - const MTPDkeyboardButtonRow &v(c_keyboardButtonRow()); + auto &v = c_keyboardButtonRow(); v.vbuttons.write(to); } -inline MTPkeyboardButtonRow::MTPkeyboardButtonRow(MTPDkeyboardButtonRow *_data) : mtpDataOwner(_data) { +inline const MTPDkeyboardButtonRow &MTPkeyboardButtonRow::c_keyboardButtonRow() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPkeyboardButtonRow::MTPkeyboardButtonRow(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPkeyboardButtonRow MTP_keyboardButtonRow(const MTPVector &_buttons) { return MTP::internal::TypeCreator::new_keyboardButtonRow(_buttons); @@ -36503,28 +34002,28 @@ inline mtpTypeId MTPreplyMarkup::type() const { return _type; } inline void MTPreplyMarkup::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_replyKeyboardHide: _type = cons; { - if (!data) setData(new MTPDreplyKeyboardHide()); - MTPDreplyKeyboardHide &v(_replyKeyboardHide()); - v.vflags.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + data = std::move(v); } break; case mtpc_replyKeyboardForceReply: _type = cons; { - if (!data) setData(new MTPDreplyKeyboardForceReply()); - MTPDreplyKeyboardForceReply &v(_replyKeyboardForceReply()); - v.vflags.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + data = std::move(v); } break; case mtpc_replyKeyboardMarkup: _type = cons; { - if (!data) setData(new MTPDreplyKeyboardMarkup()); - MTPDreplyKeyboardMarkup &v(_replyKeyboardMarkup()); - v.vflags.read(from, end); - v.vrows.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vrows.read(from, end); + data = std::move(v); } break; case mtpc_replyInlineMarkup: _type = cons; { - if (!data) setData(new MTPDreplyInlineMarkup()); - MTPDreplyInlineMarkup &v(_replyInlineMarkup()); - v.vrows.read(from, end); + auto v = std::make_shared(); + v->vrows.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPreplyMarkup"); } @@ -36532,40 +34031,56 @@ inline void MTPreplyMarkup::read(const mtpPrime *&from, const mtpPrime *end, mtp inline void MTPreplyMarkup::write(mtpBuffer &to) const { switch (_type) { case mtpc_replyKeyboardHide: { - const MTPDreplyKeyboardHide &v(c_replyKeyboardHide()); + auto &v = c_replyKeyboardHide(); v.vflags.write(to); } break; case mtpc_replyKeyboardForceReply: { - const MTPDreplyKeyboardForceReply &v(c_replyKeyboardForceReply()); + auto &v = c_replyKeyboardForceReply(); v.vflags.write(to); } break; case mtpc_replyKeyboardMarkup: { - const MTPDreplyKeyboardMarkup &v(c_replyKeyboardMarkup()); + auto &v = c_replyKeyboardMarkup(); v.vflags.write(to); v.vrows.write(to); } break; case mtpc_replyInlineMarkup: { - const MTPDreplyInlineMarkup &v(c_replyInlineMarkup()); + auto &v = c_replyInlineMarkup(); v.vrows.write(to); } break; } } -inline MTPreplyMarkup::MTPreplyMarkup(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPreplyMarkup::MTPreplyMarkup(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_replyKeyboardHide: setData(new MTPDreplyKeyboardHide()); break; - case mtpc_replyKeyboardForceReply: setData(new MTPDreplyKeyboardForceReply()); break; - case mtpc_replyKeyboardMarkup: setData(new MTPDreplyKeyboardMarkup()); break; - case mtpc_replyInlineMarkup: setData(new MTPDreplyInlineMarkup()); break; + case mtpc_replyKeyboardHide: data = std::make_shared(); break; + case mtpc_replyKeyboardForceReply: data = std::make_shared(); break; + case mtpc_replyKeyboardMarkup: data = std::make_shared(); break; + case mtpc_replyInlineMarkup: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPreplyMarkup"); } } -inline MTPreplyMarkup::MTPreplyMarkup(MTPDreplyKeyboardHide *_data) : mtpDataOwner(_data), _type(mtpc_replyKeyboardHide) { +inline const MTPDreplyKeyboardHide &MTPreplyMarkup::c_replyKeyboardHide() const { + t_assert(data != nullptr && _type == mtpc_replyKeyboardHide); + return static_cast(*data); } -inline MTPreplyMarkup::MTPreplyMarkup(MTPDreplyKeyboardForceReply *_data) : mtpDataOwner(_data), _type(mtpc_replyKeyboardForceReply) { +inline MTPreplyMarkup::MTPreplyMarkup(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_replyKeyboardHide) { } -inline MTPreplyMarkup::MTPreplyMarkup(MTPDreplyKeyboardMarkup *_data) : mtpDataOwner(_data), _type(mtpc_replyKeyboardMarkup) { +inline const MTPDreplyKeyboardForceReply &MTPreplyMarkup::c_replyKeyboardForceReply() const { + t_assert(data != nullptr && _type == mtpc_replyKeyboardForceReply); + return static_cast(*data); } -inline MTPreplyMarkup::MTPreplyMarkup(MTPDreplyInlineMarkup *_data) : mtpDataOwner(_data), _type(mtpc_replyInlineMarkup) { +inline MTPreplyMarkup::MTPreplyMarkup(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_replyKeyboardForceReply) { +} +inline const MTPDreplyKeyboardMarkup &MTPreplyMarkup::c_replyKeyboardMarkup() const { + t_assert(data != nullptr && _type == mtpc_replyKeyboardMarkup); + return static_cast(*data); +} +inline MTPreplyMarkup::MTPreplyMarkup(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_replyKeyboardMarkup) { +} +inline const MTPDreplyInlineMarkup &MTPreplyMarkup::c_replyInlineMarkup() const { + t_assert(data != nullptr && _type == mtpc_replyInlineMarkup); + return static_cast(*data); +} +inline MTPreplyMarkup::MTPreplyMarkup(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_replyInlineMarkup) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDreplyKeyboardHide::Flags) inline MTPreplyMarkup MTP_replyKeyboardHide(const MTPflags &_flags) { @@ -36597,15 +34112,15 @@ inline mtpTypeId MTPhelp_appChangelog::type() const { return _type; } inline void MTPhelp_appChangelog::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_help_appChangelogEmpty: _type = cons; break; case mtpc_help_appChangelog: _type = cons; { - if (!data) setData(new MTPDhelp_appChangelog()); - MTPDhelp_appChangelog &v(_help_appChangelog()); - v.vmessage.read(from, end); - v.vmedia.read(from, end); - v.ventities.read(from, end); + auto v = std::make_shared(); + v->vmessage.read(from, end); + v->vmedia.read(from, end); + v->ventities.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPhelp_appChangelog"); } @@ -36613,21 +34128,25 @@ inline void MTPhelp_appChangelog::read(const mtpPrime *&from, const mtpPrime *en inline void MTPhelp_appChangelog::write(mtpBuffer &to) const { switch (_type) { case mtpc_help_appChangelog: { - const MTPDhelp_appChangelog &v(c_help_appChangelog()); + auto &v = c_help_appChangelog(); v.vmessage.write(to); v.vmedia.write(to); v.ventities.write(to); } break; } } -inline MTPhelp_appChangelog::MTPhelp_appChangelog(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPhelp_appChangelog::MTPhelp_appChangelog(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_help_appChangelogEmpty: break; - case mtpc_help_appChangelog: setData(new MTPDhelp_appChangelog()); break; + case mtpc_help_appChangelog: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPhelp_appChangelog"); } } -inline MTPhelp_appChangelog::MTPhelp_appChangelog(MTPDhelp_appChangelog *_data) : mtpDataOwner(_data), _type(mtpc_help_appChangelog) { +inline const MTPDhelp_appChangelog &MTPhelp_appChangelog::c_help_appChangelog() const { + t_assert(data != nullptr && _type == mtpc_help_appChangelog); + return static_cast(*data); +} +inline MTPhelp_appChangelog::MTPhelp_appChangelog(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_help_appChangelog) { } inline MTPhelp_appChangelog MTP_help_appChangelogEmpty() { return MTP::internal::TypeCreator::new_help_appChangelogEmpty(); @@ -36698,89 +34217,89 @@ inline mtpTypeId MTPmessageEntity::type() const { return _type; } inline void MTPmessageEntity::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messageEntityUnknown: _type = cons; { - if (!data) setData(new MTPDmessageEntityUnknown()); - MTPDmessageEntityUnknown &v(_messageEntityUnknown()); - v.voffset.read(from, end); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_messageEntityMention: _type = cons; { - if (!data) setData(new MTPDmessageEntityMention()); - MTPDmessageEntityMention &v(_messageEntityMention()); - v.voffset.read(from, end); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_messageEntityHashtag: _type = cons; { - if (!data) setData(new MTPDmessageEntityHashtag()); - MTPDmessageEntityHashtag &v(_messageEntityHashtag()); - v.voffset.read(from, end); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_messageEntityBotCommand: _type = cons; { - if (!data) setData(new MTPDmessageEntityBotCommand()); - MTPDmessageEntityBotCommand &v(_messageEntityBotCommand()); - v.voffset.read(from, end); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_messageEntityUrl: _type = cons; { - if (!data) setData(new MTPDmessageEntityUrl()); - MTPDmessageEntityUrl &v(_messageEntityUrl()); - v.voffset.read(from, end); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_messageEntityEmail: _type = cons; { - if (!data) setData(new MTPDmessageEntityEmail()); - MTPDmessageEntityEmail &v(_messageEntityEmail()); - v.voffset.read(from, end); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_messageEntityBold: _type = cons; { - if (!data) setData(new MTPDmessageEntityBold()); - MTPDmessageEntityBold &v(_messageEntityBold()); - v.voffset.read(from, end); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_messageEntityItalic: _type = cons; { - if (!data) setData(new MTPDmessageEntityItalic()); - MTPDmessageEntityItalic &v(_messageEntityItalic()); - v.voffset.read(from, end); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_messageEntityCode: _type = cons; { - if (!data) setData(new MTPDmessageEntityCode()); - MTPDmessageEntityCode &v(_messageEntityCode()); - v.voffset.read(from, end); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_messageEntityPre: _type = cons; { - if (!data) setData(new MTPDmessageEntityPre()); - MTPDmessageEntityPre &v(_messageEntityPre()); - v.voffset.read(from, end); - v.vlength.read(from, end); - v.vlanguage.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + v->vlanguage.read(from, end); + data = std::move(v); } break; case mtpc_messageEntityTextUrl: _type = cons; { - if (!data) setData(new MTPDmessageEntityTextUrl()); - MTPDmessageEntityTextUrl &v(_messageEntityTextUrl()); - v.voffset.read(from, end); - v.vlength.read(from, end); - v.vurl.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + v->vurl.read(from, end); + data = std::move(v); } break; case mtpc_messageEntityMentionName: _type = cons; { - if (!data) setData(new MTPDmessageEntityMentionName()); - MTPDmessageEntityMentionName &v(_messageEntityMentionName()); - v.voffset.read(from, end); - v.vlength.read(from, end); - v.vuser_id.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + v->vuser_id.read(from, end); + data = std::move(v); } break; case mtpc_inputMessageEntityMentionName: _type = cons; { - if (!data) setData(new MTPDinputMessageEntityMentionName()); - MTPDinputMessageEntityMentionName &v(_inputMessageEntityMentionName()); - v.voffset.read(from, end); - v.vlength.read(from, end); - v.vuser_id.read(from, end); + auto v = std::make_shared(); + v->voffset.read(from, end); + v->vlength.read(from, end); + v->vuser_id.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessageEntity"); } @@ -36788,119 +34307,171 @@ inline void MTPmessageEntity::read(const mtpPrime *&from, const mtpPrime *end, m inline void MTPmessageEntity::write(mtpBuffer &to) const { switch (_type) { case mtpc_messageEntityUnknown: { - const MTPDmessageEntityUnknown &v(c_messageEntityUnknown()); + auto &v = c_messageEntityUnknown(); v.voffset.write(to); v.vlength.write(to); } break; case mtpc_messageEntityMention: { - const MTPDmessageEntityMention &v(c_messageEntityMention()); + auto &v = c_messageEntityMention(); v.voffset.write(to); v.vlength.write(to); } break; case mtpc_messageEntityHashtag: { - const MTPDmessageEntityHashtag &v(c_messageEntityHashtag()); + auto &v = c_messageEntityHashtag(); v.voffset.write(to); v.vlength.write(to); } break; case mtpc_messageEntityBotCommand: { - const MTPDmessageEntityBotCommand &v(c_messageEntityBotCommand()); + auto &v = c_messageEntityBotCommand(); v.voffset.write(to); v.vlength.write(to); } break; case mtpc_messageEntityUrl: { - const MTPDmessageEntityUrl &v(c_messageEntityUrl()); + auto &v = c_messageEntityUrl(); v.voffset.write(to); v.vlength.write(to); } break; case mtpc_messageEntityEmail: { - const MTPDmessageEntityEmail &v(c_messageEntityEmail()); + auto &v = c_messageEntityEmail(); v.voffset.write(to); v.vlength.write(to); } break; case mtpc_messageEntityBold: { - const MTPDmessageEntityBold &v(c_messageEntityBold()); + auto &v = c_messageEntityBold(); v.voffset.write(to); v.vlength.write(to); } break; case mtpc_messageEntityItalic: { - const MTPDmessageEntityItalic &v(c_messageEntityItalic()); + auto &v = c_messageEntityItalic(); v.voffset.write(to); v.vlength.write(to); } break; case mtpc_messageEntityCode: { - const MTPDmessageEntityCode &v(c_messageEntityCode()); + auto &v = c_messageEntityCode(); v.voffset.write(to); v.vlength.write(to); } break; case mtpc_messageEntityPre: { - const MTPDmessageEntityPre &v(c_messageEntityPre()); + auto &v = c_messageEntityPre(); v.voffset.write(to); v.vlength.write(to); v.vlanguage.write(to); } break; case mtpc_messageEntityTextUrl: { - const MTPDmessageEntityTextUrl &v(c_messageEntityTextUrl()); + auto &v = c_messageEntityTextUrl(); v.voffset.write(to); v.vlength.write(to); v.vurl.write(to); } break; case mtpc_messageEntityMentionName: { - const MTPDmessageEntityMentionName &v(c_messageEntityMentionName()); + auto &v = c_messageEntityMentionName(); v.voffset.write(to); v.vlength.write(to); v.vuser_id.write(to); } break; case mtpc_inputMessageEntityMentionName: { - const MTPDinputMessageEntityMentionName &v(c_inputMessageEntityMentionName()); + auto &v = c_inputMessageEntityMentionName(); v.voffset.write(to); v.vlength.write(to); v.vuser_id.write(to); } break; } } -inline MTPmessageEntity::MTPmessageEntity(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessageEntity::MTPmessageEntity(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_messageEntityUnknown: setData(new MTPDmessageEntityUnknown()); break; - case mtpc_messageEntityMention: setData(new MTPDmessageEntityMention()); break; - case mtpc_messageEntityHashtag: setData(new MTPDmessageEntityHashtag()); break; - case mtpc_messageEntityBotCommand: setData(new MTPDmessageEntityBotCommand()); break; - case mtpc_messageEntityUrl: setData(new MTPDmessageEntityUrl()); break; - case mtpc_messageEntityEmail: setData(new MTPDmessageEntityEmail()); break; - case mtpc_messageEntityBold: setData(new MTPDmessageEntityBold()); break; - case mtpc_messageEntityItalic: setData(new MTPDmessageEntityItalic()); break; - case mtpc_messageEntityCode: setData(new MTPDmessageEntityCode()); break; - case mtpc_messageEntityPre: setData(new MTPDmessageEntityPre()); break; - case mtpc_messageEntityTextUrl: setData(new MTPDmessageEntityTextUrl()); break; - case mtpc_messageEntityMentionName: setData(new MTPDmessageEntityMentionName()); break; - case mtpc_inputMessageEntityMentionName: setData(new MTPDinputMessageEntityMentionName()); break; + case mtpc_messageEntityUnknown: data = std::make_shared(); break; + case mtpc_messageEntityMention: data = std::make_shared(); break; + case mtpc_messageEntityHashtag: data = std::make_shared(); break; + case mtpc_messageEntityBotCommand: data = std::make_shared(); break; + case mtpc_messageEntityUrl: data = std::make_shared(); break; + case mtpc_messageEntityEmail: data = std::make_shared(); break; + case mtpc_messageEntityBold: data = std::make_shared(); break; + case mtpc_messageEntityItalic: data = std::make_shared(); break; + case mtpc_messageEntityCode: data = std::make_shared(); break; + case mtpc_messageEntityPre: data = std::make_shared(); break; + case mtpc_messageEntityTextUrl: data = std::make_shared(); break; + case mtpc_messageEntityMentionName: data = std::make_shared(); break; + case mtpc_inputMessageEntityMentionName: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessageEntity"); } } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityUnknown *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityUnknown) { +inline const MTPDmessageEntityUnknown &MTPmessageEntity::c_messageEntityUnknown() const { + t_assert(data != nullptr && _type == mtpc_messageEntityUnknown); + return static_cast(*data); } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityMention *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityMention) { +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityUnknown) { } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityHashtag *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityHashtag) { +inline const MTPDmessageEntityMention &MTPmessageEntity::c_messageEntityMention() const { + t_assert(data != nullptr && _type == mtpc_messageEntityMention); + return static_cast(*data); } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityBotCommand *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityBotCommand) { +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityMention) { } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityUrl *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityUrl) { +inline const MTPDmessageEntityHashtag &MTPmessageEntity::c_messageEntityHashtag() const { + t_assert(data != nullptr && _type == mtpc_messageEntityHashtag); + return static_cast(*data); } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityEmail *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityEmail) { +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityHashtag) { } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityBold *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityBold) { +inline const MTPDmessageEntityBotCommand &MTPmessageEntity::c_messageEntityBotCommand() const { + t_assert(data != nullptr && _type == mtpc_messageEntityBotCommand); + return static_cast(*data); } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityItalic *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityItalic) { +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityBotCommand) { } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityCode *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityCode) { +inline const MTPDmessageEntityUrl &MTPmessageEntity::c_messageEntityUrl() const { + t_assert(data != nullptr && _type == mtpc_messageEntityUrl); + return static_cast(*data); } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityPre *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityPre) { +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityUrl) { } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityTextUrl *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityTextUrl) { +inline const MTPDmessageEntityEmail &MTPmessageEntity::c_messageEntityEmail() const { + t_assert(data != nullptr && _type == mtpc_messageEntityEmail); + return static_cast(*data); } -inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityMentionName *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityMentionName) { +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityEmail) { } -inline MTPmessageEntity::MTPmessageEntity(MTPDinputMessageEntityMentionName *_data) : mtpDataOwner(_data), _type(mtpc_inputMessageEntityMentionName) { +inline const MTPDmessageEntityBold &MTPmessageEntity::c_messageEntityBold() const { + t_assert(data != nullptr && _type == mtpc_messageEntityBold); + return static_cast(*data); +} +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityBold) { +} +inline const MTPDmessageEntityItalic &MTPmessageEntity::c_messageEntityItalic() const { + t_assert(data != nullptr && _type == mtpc_messageEntityItalic); + return static_cast(*data); +} +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityItalic) { +} +inline const MTPDmessageEntityCode &MTPmessageEntity::c_messageEntityCode() const { + t_assert(data != nullptr && _type == mtpc_messageEntityCode); + return static_cast(*data); +} +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityCode) { +} +inline const MTPDmessageEntityPre &MTPmessageEntity::c_messageEntityPre() const { + t_assert(data != nullptr && _type == mtpc_messageEntityPre); + return static_cast(*data); +} +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityPre) { +} +inline const MTPDmessageEntityTextUrl &MTPmessageEntity::c_messageEntityTextUrl() const { + t_assert(data != nullptr && _type == mtpc_messageEntityTextUrl); + return static_cast(*data); +} +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityTextUrl) { +} +inline const MTPDmessageEntityMentionName &MTPmessageEntity::c_messageEntityMentionName() const { + t_assert(data != nullptr && _type == mtpc_messageEntityMentionName); + return static_cast(*data); +} +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messageEntityMentionName) { +} +inline const MTPDinputMessageEntityMentionName &MTPmessageEntity::c_inputMessageEntityMentionName() const { + t_assert(data != nullptr && _type == mtpc_inputMessageEntityMentionName); + return static_cast(*data); +} +inline MTPmessageEntity::MTPmessageEntity(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputMessageEntityMentionName) { } inline MTPmessageEntity MTP_messageEntityUnknown(MTPint _offset, MTPint _length) { return MTP::internal::TypeCreator::new_messageEntityUnknown(_offset, _length); @@ -36956,14 +34527,14 @@ inline mtpTypeId MTPinputChannel::type() const { return _type; } inline void MTPinputChannel::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputChannelEmpty: _type = cons; break; case mtpc_inputChannel: _type = cons; { - if (!data) setData(new MTPDinputChannel()); - MTPDinputChannel &v(_inputChannel()); - v.vchannel_id.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vchannel_id.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputChannel"); } @@ -36971,20 +34542,24 @@ inline void MTPinputChannel::read(const mtpPrime *&from, const mtpPrime *end, mt inline void MTPinputChannel::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputChannel: { - const MTPDinputChannel &v(c_inputChannel()); + auto &v = c_inputChannel(); v.vchannel_id.write(to); v.vaccess_hash.write(to); } break; } } -inline MTPinputChannel::MTPinputChannel(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputChannel::MTPinputChannel(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_inputChannelEmpty: break; - case mtpc_inputChannel: setData(new MTPDinputChannel()); break; + case mtpc_inputChannel: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputChannel"); } } -inline MTPinputChannel::MTPinputChannel(MTPDinputChannel *_data) : mtpDataOwner(_data), _type(mtpc_inputChannel) { +inline const MTPDinputChannel &MTPinputChannel::c_inputChannel() const { + t_assert(data != nullptr && _type == mtpc_inputChannel); + return static_cast(*data); +} +inline MTPinputChannel::MTPinputChannel(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputChannel) { } inline MTPinputChannel MTP_inputChannelEmpty() { return MTP::internal::TypeCreator::new_inputChannelEmpty(); @@ -36993,7 +34568,7 @@ inline MTPinputChannel MTP_inputChannel(MTPint _channel_id, const MTPlong &_acce return MTP::internal::TypeCreator::new_inputChannel(_channel_id, _access_hash); } -inline MTPcontacts_resolvedPeer::MTPcontacts_resolvedPeer() : mtpDataOwner(new MTPDcontacts_resolvedPeer()) { +inline MTPcontacts_resolvedPeer::MTPcontacts_resolvedPeer() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPcontacts_resolvedPeer::innerLength() const { @@ -37006,25 +34581,29 @@ inline mtpTypeId MTPcontacts_resolvedPeer::type() const { inline void MTPcontacts_resolvedPeer::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_contacts_resolvedPeer) throw mtpErrorUnexpected(cons, "MTPcontacts_resolvedPeer"); - if (!data) setData(new MTPDcontacts_resolvedPeer()); - MTPDcontacts_resolvedPeer &v(_contacts_resolvedPeer()); - v.vpeer.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vpeer.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } inline void MTPcontacts_resolvedPeer::write(mtpBuffer &to) const { - const MTPDcontacts_resolvedPeer &v(c_contacts_resolvedPeer()); + auto &v = c_contacts_resolvedPeer(); v.vpeer.write(to); v.vchats.write(to); v.vusers.write(to); } -inline MTPcontacts_resolvedPeer::MTPcontacts_resolvedPeer(MTPDcontacts_resolvedPeer *_data) : mtpDataOwner(_data) { +inline const MTPDcontacts_resolvedPeer &MTPcontacts_resolvedPeer::c_contacts_resolvedPeer() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPcontacts_resolvedPeer::MTPcontacts_resolvedPeer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPcontacts_resolvedPeer MTP_contacts_resolvedPeer(const MTPPeer &_peer, const MTPVector &_chats, const MTPVector &_users) { return MTP::internal::TypeCreator::new_contacts_resolvedPeer(_peer, _chats, _users); } -inline MTPmessageRange::MTPmessageRange() : mtpDataOwner(new MTPDmessageRange()) { +inline MTPmessageRange::MTPmessageRange() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessageRange::innerLength() const { @@ -37037,17 +34616,21 @@ inline mtpTypeId MTPmessageRange::type() const { inline void MTPmessageRange::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messageRange) throw mtpErrorUnexpected(cons, "MTPmessageRange"); - if (!data) setData(new MTPDmessageRange()); - MTPDmessageRange &v(_messageRange()); - v.vmin_id.read(from, end); - v.vmax_id.read(from, end); + auto v = std::make_shared(); + v->vmin_id.read(from, end); + v->vmax_id.read(from, end); + data = std::move(v); } inline void MTPmessageRange::write(mtpBuffer &to) const { - const MTPDmessageRange &v(c_messageRange()); + auto &v = c_messageRange(); v.vmin_id.write(to); v.vmax_id.write(to); } -inline MTPmessageRange::MTPmessageRange(MTPDmessageRange *_data) : mtpDataOwner(_data) { +inline const MTPDmessageRange &MTPmessageRange::c_messageRange() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessageRange::MTPmessageRange(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmessageRange MTP_messageRange(MTPint _min_id, MTPint _max_id) { return MTP::internal::TypeCreator::new_messageRange(_min_id, _max_id); @@ -37075,39 +34658,39 @@ inline mtpTypeId MTPupdates_channelDifference::type() const { return _type; } inline void MTPupdates_channelDifference::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_updates_channelDifferenceEmpty: _type = cons; { - if (!data) setData(new MTPDupdates_channelDifferenceEmpty()); - MTPDupdates_channelDifferenceEmpty &v(_updates_channelDifferenceEmpty()); - v.vflags.read(from, end); - v.vpts.read(from, end); - if (v.has_timeout()) { v.vtimeout.read(from, end); } else { v.vtimeout = MTPint(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vpts.read(from, end); + if (v->has_timeout()) { v->vtimeout.read(from, end); } else { v->vtimeout = MTPint(); } + data = std::move(v); } break; case mtpc_updates_channelDifferenceTooLong: _type = cons; { - if (!data) setData(new MTPDupdates_channelDifferenceTooLong()); - MTPDupdates_channelDifferenceTooLong &v(_updates_channelDifferenceTooLong()); - v.vflags.read(from, end); - v.vpts.read(from, end); - if (v.has_timeout()) { v.vtimeout.read(from, end); } else { v.vtimeout = MTPint(); } - v.vtop_message.read(from, end); - v.vread_inbox_max_id.read(from, end); - v.vread_outbox_max_id.read(from, end); - v.vunread_count.read(from, end); - v.vmessages.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vpts.read(from, end); + if (v->has_timeout()) { v->vtimeout.read(from, end); } else { v->vtimeout = MTPint(); } + v->vtop_message.read(from, end); + v->vread_inbox_max_id.read(from, end); + v->vread_outbox_max_id.read(from, end); + v->vunread_count.read(from, end); + v->vmessages.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; case mtpc_updates_channelDifference: _type = cons; { - if (!data) setData(new MTPDupdates_channelDifference()); - MTPDupdates_channelDifference &v(_updates_channelDifference()); - v.vflags.read(from, end); - v.vpts.read(from, end); - if (v.has_timeout()) { v.vtimeout.read(from, end); } else { v.vtimeout = MTPint(); } - v.vnew_messages.read(from, end); - v.vother_updates.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vpts.read(from, end); + if (v->has_timeout()) { v->vtimeout.read(from, end); } else { v->vtimeout = MTPint(); } + v->vnew_messages.read(from, end); + v->vother_updates.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPupdates_channelDifference"); } @@ -37115,13 +34698,13 @@ inline void MTPupdates_channelDifference::read(const mtpPrime *&from, const mtpP inline void MTPupdates_channelDifference::write(mtpBuffer &to) const { switch (_type) { case mtpc_updates_channelDifferenceEmpty: { - const MTPDupdates_channelDifferenceEmpty &v(c_updates_channelDifferenceEmpty()); + auto &v = c_updates_channelDifferenceEmpty(); v.vflags.write(to); v.vpts.write(to); if (v.has_timeout()) v.vtimeout.write(to); } break; case mtpc_updates_channelDifferenceTooLong: { - const MTPDupdates_channelDifferenceTooLong &v(c_updates_channelDifferenceTooLong()); + auto &v = c_updates_channelDifferenceTooLong(); v.vflags.write(to); v.vpts.write(to); if (v.has_timeout()) v.vtimeout.write(to); @@ -37134,7 +34717,7 @@ inline void MTPupdates_channelDifference::write(mtpBuffer &to) const { v.vusers.write(to); } break; case mtpc_updates_channelDifference: { - const MTPDupdates_channelDifference &v(c_updates_channelDifference()); + auto &v = c_updates_channelDifference(); v.vflags.write(to); v.vpts.write(to); if (v.has_timeout()) v.vtimeout.write(to); @@ -37145,19 +34728,31 @@ inline void MTPupdates_channelDifference::write(mtpBuffer &to) const { } break; } } -inline MTPupdates_channelDifference::MTPupdates_channelDifference(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPupdates_channelDifference::MTPupdates_channelDifference(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_updates_channelDifferenceEmpty: setData(new MTPDupdates_channelDifferenceEmpty()); break; - case mtpc_updates_channelDifferenceTooLong: setData(new MTPDupdates_channelDifferenceTooLong()); break; - case mtpc_updates_channelDifference: setData(new MTPDupdates_channelDifference()); break; + case mtpc_updates_channelDifferenceEmpty: data = std::make_shared(); break; + case mtpc_updates_channelDifferenceTooLong: data = std::make_shared(); break; + case mtpc_updates_channelDifference: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPupdates_channelDifference"); } } -inline MTPupdates_channelDifference::MTPupdates_channelDifference(MTPDupdates_channelDifferenceEmpty *_data) : mtpDataOwner(_data), _type(mtpc_updates_channelDifferenceEmpty) { +inline const MTPDupdates_channelDifferenceEmpty &MTPupdates_channelDifference::c_updates_channelDifferenceEmpty() const { + t_assert(data != nullptr && _type == mtpc_updates_channelDifferenceEmpty); + return static_cast(*data); } -inline MTPupdates_channelDifference::MTPupdates_channelDifference(MTPDupdates_channelDifferenceTooLong *_data) : mtpDataOwner(_data), _type(mtpc_updates_channelDifferenceTooLong) { +inline MTPupdates_channelDifference::MTPupdates_channelDifference(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updates_channelDifferenceEmpty) { } -inline MTPupdates_channelDifference::MTPupdates_channelDifference(MTPDupdates_channelDifference *_data) : mtpDataOwner(_data), _type(mtpc_updates_channelDifference) { +inline const MTPDupdates_channelDifferenceTooLong &MTPupdates_channelDifference::c_updates_channelDifferenceTooLong() const { + t_assert(data != nullptr && _type == mtpc_updates_channelDifferenceTooLong); + return static_cast(*data); +} +inline MTPupdates_channelDifference::MTPupdates_channelDifference(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updates_channelDifferenceTooLong) { +} +inline const MTPDupdates_channelDifference &MTPupdates_channelDifference::c_updates_channelDifference() const { + t_assert(data != nullptr && _type == mtpc_updates_channelDifference); + return static_cast(*data); +} +inline MTPupdates_channelDifference::MTPupdates_channelDifference(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_updates_channelDifference) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDupdates_channelDifferenceEmpty::Flags) inline MTPupdates_channelDifference MTP_updates_channelDifferenceEmpty(const MTPflags &_flags, MTPint _pts, MTPint _timeout) { @@ -37186,14 +34781,14 @@ inline mtpTypeId MTPchannelMessagesFilter::type() const { return _type; } inline void MTPchannelMessagesFilter::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_channelMessagesFilterEmpty: _type = cons; break; case mtpc_channelMessagesFilter: _type = cons; { - if (!data) setData(new MTPDchannelMessagesFilter()); - MTPDchannelMessagesFilter &v(_channelMessagesFilter()); - v.vflags.read(from, end); - v.vranges.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vranges.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPchannelMessagesFilter"); } @@ -37201,20 +34796,24 @@ inline void MTPchannelMessagesFilter::read(const mtpPrime *&from, const mtpPrime inline void MTPchannelMessagesFilter::write(mtpBuffer &to) const { switch (_type) { case mtpc_channelMessagesFilter: { - const MTPDchannelMessagesFilter &v(c_channelMessagesFilter()); + auto &v = c_channelMessagesFilter(); v.vflags.write(to); v.vranges.write(to); } break; } } -inline MTPchannelMessagesFilter::MTPchannelMessagesFilter(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPchannelMessagesFilter::MTPchannelMessagesFilter(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_channelMessagesFilterEmpty: break; - case mtpc_channelMessagesFilter: setData(new MTPDchannelMessagesFilter()); break; + case mtpc_channelMessagesFilter: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPchannelMessagesFilter"); } } -inline MTPchannelMessagesFilter::MTPchannelMessagesFilter(MTPDchannelMessagesFilter *_data) : mtpDataOwner(_data), _type(mtpc_channelMessagesFilter) { +inline const MTPDchannelMessagesFilter &MTPchannelMessagesFilter::c_channelMessagesFilter() const { + t_assert(data != nullptr && _type == mtpc_channelMessagesFilter); + return static_cast(*data); +} +inline MTPchannelMessagesFilter::MTPchannelMessagesFilter(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_channelMessagesFilter) { } inline MTPchannelMessagesFilter MTP_channelMessagesFilterEmpty() { return MTP::internal::TypeCreator::new_channelMessagesFilterEmpty(); @@ -37258,46 +34857,46 @@ inline mtpTypeId MTPchannelParticipant::type() const { return _type; } inline void MTPchannelParticipant::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_channelParticipant: _type = cons; { - if (!data) setData(new MTPDchannelParticipant()); - MTPDchannelParticipant &v(_channelParticipant()); - v.vuser_id.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_channelParticipantSelf: _type = cons; { - if (!data) setData(new MTPDchannelParticipantSelf()); - MTPDchannelParticipantSelf &v(_channelParticipantSelf()); - v.vuser_id.read(from, end); - v.vinviter_id.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vinviter_id.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_channelParticipantModerator: _type = cons; { - if (!data) setData(new MTPDchannelParticipantModerator()); - MTPDchannelParticipantModerator &v(_channelParticipantModerator()); - v.vuser_id.read(from, end); - v.vinviter_id.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vinviter_id.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_channelParticipantEditor: _type = cons; { - if (!data) setData(new MTPDchannelParticipantEditor()); - MTPDchannelParticipantEditor &v(_channelParticipantEditor()); - v.vuser_id.read(from, end); - v.vinviter_id.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vinviter_id.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_channelParticipantKicked: _type = cons; { - if (!data) setData(new MTPDchannelParticipantKicked()); - MTPDchannelParticipantKicked &v(_channelParticipantKicked()); - v.vuser_id.read(from, end); - v.vkicked_by.read(from, end); - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + v->vkicked_by.read(from, end); + v->vdate.read(from, end); + data = std::move(v); } break; case mtpc_channelParticipantCreator: _type = cons; { - if (!data) setData(new MTPDchannelParticipantCreator()); - MTPDchannelParticipantCreator &v(_channelParticipantCreator()); - v.vuser_id.read(from, end); + auto v = std::make_shared(); + v->vuser_id.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPchannelParticipant"); } @@ -37305,62 +34904,86 @@ inline void MTPchannelParticipant::read(const mtpPrime *&from, const mtpPrime *e inline void MTPchannelParticipant::write(mtpBuffer &to) const { switch (_type) { case mtpc_channelParticipant: { - const MTPDchannelParticipant &v(c_channelParticipant()); + auto &v = c_channelParticipant(); v.vuser_id.write(to); v.vdate.write(to); } break; case mtpc_channelParticipantSelf: { - const MTPDchannelParticipantSelf &v(c_channelParticipantSelf()); + auto &v = c_channelParticipantSelf(); v.vuser_id.write(to); v.vinviter_id.write(to); v.vdate.write(to); } break; case mtpc_channelParticipantModerator: { - const MTPDchannelParticipantModerator &v(c_channelParticipantModerator()); + auto &v = c_channelParticipantModerator(); v.vuser_id.write(to); v.vinviter_id.write(to); v.vdate.write(to); } break; case mtpc_channelParticipantEditor: { - const MTPDchannelParticipantEditor &v(c_channelParticipantEditor()); + auto &v = c_channelParticipantEditor(); v.vuser_id.write(to); v.vinviter_id.write(to); v.vdate.write(to); } break; case mtpc_channelParticipantKicked: { - const MTPDchannelParticipantKicked &v(c_channelParticipantKicked()); + auto &v = c_channelParticipantKicked(); v.vuser_id.write(to); v.vkicked_by.write(to); v.vdate.write(to); } break; case mtpc_channelParticipantCreator: { - const MTPDchannelParticipantCreator &v(c_channelParticipantCreator()); + auto &v = c_channelParticipantCreator(); v.vuser_id.write(to); } break; } } -inline MTPchannelParticipant::MTPchannelParticipant(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPchannelParticipant::MTPchannelParticipant(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_channelParticipant: setData(new MTPDchannelParticipant()); break; - case mtpc_channelParticipantSelf: setData(new MTPDchannelParticipantSelf()); break; - case mtpc_channelParticipantModerator: setData(new MTPDchannelParticipantModerator()); break; - case mtpc_channelParticipantEditor: setData(new MTPDchannelParticipantEditor()); break; - case mtpc_channelParticipantKicked: setData(new MTPDchannelParticipantKicked()); break; - case mtpc_channelParticipantCreator: setData(new MTPDchannelParticipantCreator()); break; + case mtpc_channelParticipant: data = std::make_shared(); break; + case mtpc_channelParticipantSelf: data = std::make_shared(); break; + case mtpc_channelParticipantModerator: data = std::make_shared(); break; + case mtpc_channelParticipantEditor: data = std::make_shared(); break; + case mtpc_channelParticipantKicked: data = std::make_shared(); break; + case mtpc_channelParticipantCreator: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPchannelParticipant"); } } -inline MTPchannelParticipant::MTPchannelParticipant(MTPDchannelParticipant *_data) : mtpDataOwner(_data), _type(mtpc_channelParticipant) { +inline const MTPDchannelParticipant &MTPchannelParticipant::c_channelParticipant() const { + t_assert(data != nullptr && _type == mtpc_channelParticipant); + return static_cast(*data); } -inline MTPchannelParticipant::MTPchannelParticipant(MTPDchannelParticipantSelf *_data) : mtpDataOwner(_data), _type(mtpc_channelParticipantSelf) { +inline MTPchannelParticipant::MTPchannelParticipant(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_channelParticipant) { } -inline MTPchannelParticipant::MTPchannelParticipant(MTPDchannelParticipantModerator *_data) : mtpDataOwner(_data), _type(mtpc_channelParticipantModerator) { +inline const MTPDchannelParticipantSelf &MTPchannelParticipant::c_channelParticipantSelf() const { + t_assert(data != nullptr && _type == mtpc_channelParticipantSelf); + return static_cast(*data); } -inline MTPchannelParticipant::MTPchannelParticipant(MTPDchannelParticipantEditor *_data) : mtpDataOwner(_data), _type(mtpc_channelParticipantEditor) { +inline MTPchannelParticipant::MTPchannelParticipant(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_channelParticipantSelf) { } -inline MTPchannelParticipant::MTPchannelParticipant(MTPDchannelParticipantKicked *_data) : mtpDataOwner(_data), _type(mtpc_channelParticipantKicked) { +inline const MTPDchannelParticipantModerator &MTPchannelParticipant::c_channelParticipantModerator() const { + t_assert(data != nullptr && _type == mtpc_channelParticipantModerator); + return static_cast(*data); } -inline MTPchannelParticipant::MTPchannelParticipant(MTPDchannelParticipantCreator *_data) : mtpDataOwner(_data), _type(mtpc_channelParticipantCreator) { +inline MTPchannelParticipant::MTPchannelParticipant(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_channelParticipantModerator) { +} +inline const MTPDchannelParticipantEditor &MTPchannelParticipant::c_channelParticipantEditor() const { + t_assert(data != nullptr && _type == mtpc_channelParticipantEditor); + return static_cast(*data); +} +inline MTPchannelParticipant::MTPchannelParticipant(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_channelParticipantEditor) { +} +inline const MTPDchannelParticipantKicked &MTPchannelParticipant::c_channelParticipantKicked() const { + t_assert(data != nullptr && _type == mtpc_channelParticipantKicked); + return static_cast(*data); +} +inline MTPchannelParticipant::MTPchannelParticipant(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_channelParticipantKicked) { +} +inline const MTPDchannelParticipantCreator &MTPchannelParticipant::c_channelParticipantCreator() const { + t_assert(data != nullptr && _type == mtpc_channelParticipantCreator); + return static_cast(*data); +} +inline MTPchannelParticipant::MTPchannelParticipant(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_channelParticipantCreator) { } inline MTPchannelParticipant MTP_channelParticipant(MTPint _user_id, MTPint _date) { return MTP::internal::TypeCreator::new_channelParticipant(_user_id, _date); @@ -37456,7 +35079,7 @@ inline MTPchannelParticipantRole MTP_channelRoleEditor() { return MTP::internal::TypeCreator::new_channelRoleEditor(); } -inline MTPchannels_channelParticipants::MTPchannels_channelParticipants() : mtpDataOwner(new MTPDchannels_channelParticipants()) { +inline MTPchannels_channelParticipants::MTPchannels_channelParticipants() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPchannels_channelParticipants::innerLength() const { @@ -37469,25 +35092,29 @@ inline mtpTypeId MTPchannels_channelParticipants::type() const { inline void MTPchannels_channelParticipants::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_channels_channelParticipants) throw mtpErrorUnexpected(cons, "MTPchannels_channelParticipants"); - if (!data) setData(new MTPDchannels_channelParticipants()); - MTPDchannels_channelParticipants &v(_channels_channelParticipants()); - v.vcount.read(from, end); - v.vparticipants.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vcount.read(from, end); + v->vparticipants.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } inline void MTPchannels_channelParticipants::write(mtpBuffer &to) const { - const MTPDchannels_channelParticipants &v(c_channels_channelParticipants()); + auto &v = c_channels_channelParticipants(); v.vcount.write(to); v.vparticipants.write(to); v.vusers.write(to); } -inline MTPchannels_channelParticipants::MTPchannels_channelParticipants(MTPDchannels_channelParticipants *_data) : mtpDataOwner(_data) { +inline const MTPDchannels_channelParticipants &MTPchannels_channelParticipants::c_channels_channelParticipants() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPchannels_channelParticipants::MTPchannels_channelParticipants(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPchannels_channelParticipants MTP_channels_channelParticipants(MTPint _count, const MTPVector &_participants, const MTPVector &_users) { return MTP::internal::TypeCreator::new_channels_channelParticipants(_count, _participants, _users); } -inline MTPchannels_channelParticipant::MTPchannels_channelParticipant() : mtpDataOwner(new MTPDchannels_channelParticipant()) { +inline MTPchannels_channelParticipant::MTPchannels_channelParticipant() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPchannels_channelParticipant::innerLength() const { @@ -37500,23 +35127,27 @@ inline mtpTypeId MTPchannels_channelParticipant::type() const { inline void MTPchannels_channelParticipant::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_channels_channelParticipant) throw mtpErrorUnexpected(cons, "MTPchannels_channelParticipant"); - if (!data) setData(new MTPDchannels_channelParticipant()); - MTPDchannels_channelParticipant &v(_channels_channelParticipant()); - v.vparticipant.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vparticipant.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } inline void MTPchannels_channelParticipant::write(mtpBuffer &to) const { - const MTPDchannels_channelParticipant &v(c_channels_channelParticipant()); + auto &v = c_channels_channelParticipant(); v.vparticipant.write(to); v.vusers.write(to); } -inline MTPchannels_channelParticipant::MTPchannels_channelParticipant(MTPDchannels_channelParticipant *_data) : mtpDataOwner(_data) { +inline const MTPDchannels_channelParticipant &MTPchannels_channelParticipant::c_channels_channelParticipant() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPchannels_channelParticipant::MTPchannels_channelParticipant(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPchannels_channelParticipant MTP_channels_channelParticipant(const MTPChannelParticipant &_participant, const MTPVector &_users) { return MTP::internal::TypeCreator::new_channels_channelParticipant(_participant, _users); } -inline MTPhelp_termsOfService::MTPhelp_termsOfService() : mtpDataOwner(new MTPDhelp_termsOfService()) { +inline MTPhelp_termsOfService::MTPhelp_termsOfService() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPhelp_termsOfService::innerLength() const { @@ -37529,15 +35160,19 @@ inline mtpTypeId MTPhelp_termsOfService::type() const { inline void MTPhelp_termsOfService::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_help_termsOfService) throw mtpErrorUnexpected(cons, "MTPhelp_termsOfService"); - if (!data) setData(new MTPDhelp_termsOfService()); - MTPDhelp_termsOfService &v(_help_termsOfService()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } inline void MTPhelp_termsOfService::write(mtpBuffer &to) const { - const MTPDhelp_termsOfService &v(c_help_termsOfService()); + auto &v = c_help_termsOfService(); v.vtext.write(to); } -inline MTPhelp_termsOfService::MTPhelp_termsOfService(MTPDhelp_termsOfService *_data) : mtpDataOwner(_data) { +inline const MTPDhelp_termsOfService &MTPhelp_termsOfService::c_help_termsOfService() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPhelp_termsOfService::MTPhelp_termsOfService(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPhelp_termsOfService MTP_help_termsOfService(const MTPstring &_text) { return MTP::internal::TypeCreator::new_help_termsOfService(_text); @@ -37561,24 +35196,24 @@ inline mtpTypeId MTPfoundGif::type() const { return _type; } inline void MTPfoundGif::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_foundGif: _type = cons; { - if (!data) setData(new MTPDfoundGif()); - MTPDfoundGif &v(_foundGif()); - v.vurl.read(from, end); - v.vthumb_url.read(from, end); - v.vcontent_url.read(from, end); - v.vcontent_type.read(from, end); - v.vw.read(from, end); - v.vh.read(from, end); + auto v = std::make_shared(); + v->vurl.read(from, end); + v->vthumb_url.read(from, end); + v->vcontent_url.read(from, end); + v->vcontent_type.read(from, end); + v->vw.read(from, end); + v->vh.read(from, end); + data = std::move(v); } break; case mtpc_foundGifCached: _type = cons; { - if (!data) setData(new MTPDfoundGifCached()); - MTPDfoundGifCached &v(_foundGifCached()); - v.vurl.read(from, end); - v.vphoto.read(from, end); - v.vdocument.read(from, end); + auto v = std::make_shared(); + v->vurl.read(from, end); + v->vphoto.read(from, end); + v->vdocument.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPfoundGif"); } @@ -37586,7 +35221,7 @@ inline void MTPfoundGif::read(const mtpPrime *&from, const mtpPrime *end, mtpTyp inline void MTPfoundGif::write(mtpBuffer &to) const { switch (_type) { case mtpc_foundGif: { - const MTPDfoundGif &v(c_foundGif()); + auto &v = c_foundGif(); v.vurl.write(to); v.vthumb_url.write(to); v.vcontent_url.write(to); @@ -37595,23 +35230,31 @@ inline void MTPfoundGif::write(mtpBuffer &to) const { v.vh.write(to); } break; case mtpc_foundGifCached: { - const MTPDfoundGifCached &v(c_foundGifCached()); + auto &v = c_foundGifCached(); v.vurl.write(to); v.vphoto.write(to); v.vdocument.write(to); } break; } } -inline MTPfoundGif::MTPfoundGif(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPfoundGif::MTPfoundGif(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_foundGif: setData(new MTPDfoundGif()); break; - case mtpc_foundGifCached: setData(new MTPDfoundGifCached()); break; + case mtpc_foundGif: data = std::make_shared(); break; + case mtpc_foundGifCached: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPfoundGif"); } } -inline MTPfoundGif::MTPfoundGif(MTPDfoundGif *_data) : mtpDataOwner(_data), _type(mtpc_foundGif) { +inline const MTPDfoundGif &MTPfoundGif::c_foundGif() const { + t_assert(data != nullptr && _type == mtpc_foundGif); + return static_cast(*data); } -inline MTPfoundGif::MTPfoundGif(MTPDfoundGifCached *_data) : mtpDataOwner(_data), _type(mtpc_foundGifCached) { +inline MTPfoundGif::MTPfoundGif(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_foundGif) { +} +inline const MTPDfoundGifCached &MTPfoundGif::c_foundGifCached() const { + t_assert(data != nullptr && _type == mtpc_foundGifCached); + return static_cast(*data); +} +inline MTPfoundGif::MTPfoundGif(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_foundGifCached) { } inline MTPfoundGif MTP_foundGif(const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h) { return MTP::internal::TypeCreator::new_foundGif(_url, _thumb_url, _content_url, _content_type, _w, _h); @@ -37620,7 +35263,7 @@ inline MTPfoundGif MTP_foundGifCached(const MTPstring &_url, const MTPPhoto &_ph return MTP::internal::TypeCreator::new_foundGifCached(_url, _photo, _document); } -inline MTPmessages_foundGifs::MTPmessages_foundGifs() : mtpDataOwner(new MTPDmessages_foundGifs()) { +inline MTPmessages_foundGifs::MTPmessages_foundGifs() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessages_foundGifs::innerLength() const { @@ -37633,17 +35276,21 @@ inline mtpTypeId MTPmessages_foundGifs::type() const { inline void MTPmessages_foundGifs::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messages_foundGifs) throw mtpErrorUnexpected(cons, "MTPmessages_foundGifs"); - if (!data) setData(new MTPDmessages_foundGifs()); - MTPDmessages_foundGifs &v(_messages_foundGifs()); - v.vnext_offset.read(from, end); - v.vresults.read(from, end); + auto v = std::make_shared(); + v->vnext_offset.read(from, end); + v->vresults.read(from, end); + data = std::move(v); } inline void MTPmessages_foundGifs::write(mtpBuffer &to) const { - const MTPDmessages_foundGifs &v(c_messages_foundGifs()); + auto &v = c_messages_foundGifs(); v.vnext_offset.write(to); v.vresults.write(to); } -inline MTPmessages_foundGifs::MTPmessages_foundGifs(MTPDmessages_foundGifs *_data) : mtpDataOwner(_data) { +inline const MTPDmessages_foundGifs &MTPmessages_foundGifs::c_messages_foundGifs() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessages_foundGifs::MTPmessages_foundGifs(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmessages_foundGifs MTP_messages_foundGifs(MTPint _next_offset, const MTPVector &_results) { return MTP::internal::TypeCreator::new_messages_foundGifs(_next_offset, _results); @@ -37663,14 +35310,14 @@ inline mtpTypeId MTPmessages_savedGifs::type() const { return _type; } inline void MTPmessages_savedGifs::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messages_savedGifsNotModified: _type = cons; break; case mtpc_messages_savedGifs: _type = cons; { - if (!data) setData(new MTPDmessages_savedGifs()); - MTPDmessages_savedGifs &v(_messages_savedGifs()); - v.vhash.read(from, end); - v.vgifs.read(from, end); + auto v = std::make_shared(); + v->vhash.read(from, end); + v->vgifs.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_savedGifs"); } @@ -37678,20 +35325,24 @@ inline void MTPmessages_savedGifs::read(const mtpPrime *&from, const mtpPrime *e inline void MTPmessages_savedGifs::write(mtpBuffer &to) const { switch (_type) { case mtpc_messages_savedGifs: { - const MTPDmessages_savedGifs &v(c_messages_savedGifs()); + auto &v = c_messages_savedGifs(); v.vhash.write(to); v.vgifs.write(to); } break; } } -inline MTPmessages_savedGifs::MTPmessages_savedGifs(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessages_savedGifs::MTPmessages_savedGifs(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_messages_savedGifsNotModified: break; - case mtpc_messages_savedGifs: setData(new MTPDmessages_savedGifs()); break; + case mtpc_messages_savedGifs: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_savedGifs"); } } -inline MTPmessages_savedGifs::MTPmessages_savedGifs(MTPDmessages_savedGifs *_data) : mtpDataOwner(_data), _type(mtpc_messages_savedGifs) { +inline const MTPDmessages_savedGifs &MTPmessages_savedGifs::c_messages_savedGifs() const { + t_assert(data != nullptr && _type == mtpc_messages_savedGifs); + return static_cast(*data); +} +inline MTPmessages_savedGifs::MTPmessages_savedGifs(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_savedGifs) { } inline MTPmessages_savedGifs MTP_messages_savedGifsNotModified() { return MTP::internal::TypeCreator::new_messages_savedGifsNotModified(); @@ -37734,55 +35385,55 @@ inline mtpTypeId MTPinputBotInlineMessage::type() const { return _type; } inline void MTPinputBotInlineMessage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputBotInlineMessageMediaAuto: _type = cons; { - if (!data) setData(new MTPDinputBotInlineMessageMediaAuto()); - MTPDinputBotInlineMessageMediaAuto &v(_inputBotInlineMessageMediaAuto()); - v.vflags.read(from, end); - v.vcaption.read(from, end); - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vcaption.read(from, end); + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + data = std::move(v); } break; case mtpc_inputBotInlineMessageText: _type = cons; { - if (!data) setData(new MTPDinputBotInlineMessageText()); - MTPDinputBotInlineMessageText &v(_inputBotInlineMessageText()); - v.vflags.read(from, end); - v.vmessage.read(from, end); - if (v.has_entities()) { v.ventities.read(from, end); } else { v.ventities = MTPVector(); } - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vmessage.read(from, end); + if (v->has_entities()) { v->ventities.read(from, end); } else { v->ventities = MTPVector(); } + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + data = std::move(v); } break; case mtpc_inputBotInlineMessageMediaGeo: _type = cons; { - if (!data) setData(new MTPDinputBotInlineMessageMediaGeo()); - MTPDinputBotInlineMessageMediaGeo &v(_inputBotInlineMessageMediaGeo()); - v.vflags.read(from, end); - v.vgeo_point.read(from, end); - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vgeo_point.read(from, end); + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + data = std::move(v); } break; case mtpc_inputBotInlineMessageMediaVenue: _type = cons; { - if (!data) setData(new MTPDinputBotInlineMessageMediaVenue()); - MTPDinputBotInlineMessageMediaVenue &v(_inputBotInlineMessageMediaVenue()); - v.vflags.read(from, end); - v.vgeo_point.read(from, end); - v.vtitle.read(from, end); - v.vaddress.read(from, end); - v.vprovider.read(from, end); - v.vvenue_id.read(from, end); - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vgeo_point.read(from, end); + v->vtitle.read(from, end); + v->vaddress.read(from, end); + v->vprovider.read(from, end); + v->vvenue_id.read(from, end); + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + data = std::move(v); } break; case mtpc_inputBotInlineMessageMediaContact: _type = cons; { - if (!data) setData(new MTPDinputBotInlineMessageMediaContact()); - MTPDinputBotInlineMessageMediaContact &v(_inputBotInlineMessageMediaContact()); - v.vflags.read(from, end); - v.vphone_number.read(from, end); - v.vfirst_name.read(from, end); - v.vlast_name.read(from, end); - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vphone_number.read(from, end); + v->vfirst_name.read(from, end); + v->vlast_name.read(from, end); + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + data = std::move(v); } break; case mtpc_inputBotInlineMessageGame: _type = cons; { - if (!data) setData(new MTPDinputBotInlineMessageGame()); - MTPDinputBotInlineMessageGame &v(_inputBotInlineMessageGame()); - v.vflags.read(from, end); - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputBotInlineMessage"); } @@ -37790,26 +35441,26 @@ inline void MTPinputBotInlineMessage::read(const mtpPrime *&from, const mtpPrime inline void MTPinputBotInlineMessage::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputBotInlineMessageMediaAuto: { - const MTPDinputBotInlineMessageMediaAuto &v(c_inputBotInlineMessageMediaAuto()); + auto &v = c_inputBotInlineMessageMediaAuto(); v.vflags.write(to); v.vcaption.write(to); if (v.has_reply_markup()) v.vreply_markup.write(to); } break; case mtpc_inputBotInlineMessageText: { - const MTPDinputBotInlineMessageText &v(c_inputBotInlineMessageText()); + auto &v = c_inputBotInlineMessageText(); v.vflags.write(to); v.vmessage.write(to); if (v.has_entities()) v.ventities.write(to); if (v.has_reply_markup()) v.vreply_markup.write(to); } break; case mtpc_inputBotInlineMessageMediaGeo: { - const MTPDinputBotInlineMessageMediaGeo &v(c_inputBotInlineMessageMediaGeo()); + auto &v = c_inputBotInlineMessageMediaGeo(); v.vflags.write(to); v.vgeo_point.write(to); if (v.has_reply_markup()) v.vreply_markup.write(to); } break; case mtpc_inputBotInlineMessageMediaVenue: { - const MTPDinputBotInlineMessageMediaVenue &v(c_inputBotInlineMessageMediaVenue()); + auto &v = c_inputBotInlineMessageMediaVenue(); v.vflags.write(to); v.vgeo_point.write(to); v.vtitle.write(to); @@ -37819,7 +35470,7 @@ inline void MTPinputBotInlineMessage::write(mtpBuffer &to) const { if (v.has_reply_markup()) v.vreply_markup.write(to); } break; case mtpc_inputBotInlineMessageMediaContact: { - const MTPDinputBotInlineMessageMediaContact &v(c_inputBotInlineMessageMediaContact()); + auto &v = c_inputBotInlineMessageMediaContact(); v.vflags.write(to); v.vphone_number.write(to); v.vfirst_name.write(to); @@ -37827,34 +35478,58 @@ inline void MTPinputBotInlineMessage::write(mtpBuffer &to) const { if (v.has_reply_markup()) v.vreply_markup.write(to); } break; case mtpc_inputBotInlineMessageGame: { - const MTPDinputBotInlineMessageGame &v(c_inputBotInlineMessageGame()); + auto &v = c_inputBotInlineMessageGame(); v.vflags.write(to); if (v.has_reply_markup()) v.vreply_markup.write(to); } break; } } -inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_inputBotInlineMessageMediaAuto: setData(new MTPDinputBotInlineMessageMediaAuto()); break; - case mtpc_inputBotInlineMessageText: setData(new MTPDinputBotInlineMessageText()); break; - case mtpc_inputBotInlineMessageMediaGeo: setData(new MTPDinputBotInlineMessageMediaGeo()); break; - case mtpc_inputBotInlineMessageMediaVenue: setData(new MTPDinputBotInlineMessageMediaVenue()); break; - case mtpc_inputBotInlineMessageMediaContact: setData(new MTPDinputBotInlineMessageMediaContact()); break; - case mtpc_inputBotInlineMessageGame: setData(new MTPDinputBotInlineMessageGame()); break; + case mtpc_inputBotInlineMessageMediaAuto: data = std::make_shared(); break; + case mtpc_inputBotInlineMessageText: data = std::make_shared(); break; + case mtpc_inputBotInlineMessageMediaGeo: data = std::make_shared(); break; + case mtpc_inputBotInlineMessageMediaVenue: data = std::make_shared(); break; + case mtpc_inputBotInlineMessageMediaContact: data = std::make_shared(); break; + case mtpc_inputBotInlineMessageGame: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputBotInlineMessage"); } } -inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(MTPDinputBotInlineMessageMediaAuto *_data) : mtpDataOwner(_data), _type(mtpc_inputBotInlineMessageMediaAuto) { +inline const MTPDinputBotInlineMessageMediaAuto &MTPinputBotInlineMessage::c_inputBotInlineMessageMediaAuto() const { + t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaAuto); + return static_cast(*data); } -inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(MTPDinputBotInlineMessageText *_data) : mtpDataOwner(_data), _type(mtpc_inputBotInlineMessageText) { +inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputBotInlineMessageMediaAuto) { } -inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(MTPDinputBotInlineMessageMediaGeo *_data) : mtpDataOwner(_data), _type(mtpc_inputBotInlineMessageMediaGeo) { +inline const MTPDinputBotInlineMessageText &MTPinputBotInlineMessage::c_inputBotInlineMessageText() const { + t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageText); + return static_cast(*data); } -inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(MTPDinputBotInlineMessageMediaVenue *_data) : mtpDataOwner(_data), _type(mtpc_inputBotInlineMessageMediaVenue) { +inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputBotInlineMessageText) { } -inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(MTPDinputBotInlineMessageMediaContact *_data) : mtpDataOwner(_data), _type(mtpc_inputBotInlineMessageMediaContact) { +inline const MTPDinputBotInlineMessageMediaGeo &MTPinputBotInlineMessage::c_inputBotInlineMessageMediaGeo() const { + t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaGeo); + return static_cast(*data); } -inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(MTPDinputBotInlineMessageGame *_data) : mtpDataOwner(_data), _type(mtpc_inputBotInlineMessageGame) { +inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputBotInlineMessageMediaGeo) { +} +inline const MTPDinputBotInlineMessageMediaVenue &MTPinputBotInlineMessage::c_inputBotInlineMessageMediaVenue() const { + t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaVenue); + return static_cast(*data); +} +inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputBotInlineMessageMediaVenue) { +} +inline const MTPDinputBotInlineMessageMediaContact &MTPinputBotInlineMessage::c_inputBotInlineMessageMediaContact() const { + t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageMediaContact); + return static_cast(*data); +} +inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputBotInlineMessageMediaContact) { +} +inline const MTPDinputBotInlineMessageGame &MTPinputBotInlineMessage::c_inputBotInlineMessageGame() const { + t_assert(data != nullptr && _type == mtpc_inputBotInlineMessageGame); + return static_cast(*data); +} +inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputBotInlineMessageGame) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputBotInlineMessageMediaAuto::Flags) inline MTPinputBotInlineMessage MTP_inputBotInlineMessageMediaAuto(const MTPflags &_flags, const MTPstring &_caption, const MTPReplyMarkup &_reply_markup) { @@ -37907,50 +35582,50 @@ inline mtpTypeId MTPinputBotInlineResult::type() const { return _type; } inline void MTPinputBotInlineResult::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputBotInlineResult: _type = cons; { - if (!data) setData(new MTPDinputBotInlineResult()); - MTPDinputBotInlineResult &v(_inputBotInlineResult()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vtype.read(from, end); - if (v.has_title()) { v.vtitle.read(from, end); } else { v.vtitle = MTPstring(); } - if (v.has_description()) { v.vdescription.read(from, end); } else { v.vdescription = MTPstring(); } - if (v.has_url()) { v.vurl.read(from, end); } else { v.vurl = MTPstring(); } - if (v.has_thumb_url()) { v.vthumb_url.read(from, end); } else { v.vthumb_url = MTPstring(); } - if (v.has_content_url()) { v.vcontent_url.read(from, end); } else { v.vcontent_url = MTPstring(); } - if (v.has_content_type()) { v.vcontent_type.read(from, end); } else { v.vcontent_type = MTPstring(); } - if (v.has_w()) { v.vw.read(from, end); } else { v.vw = MTPint(); } - if (v.has_h()) { v.vh.read(from, end); } else { v.vh = MTPint(); } - if (v.has_duration()) { v.vduration.read(from, end); } else { v.vduration = MTPint(); } - v.vsend_message.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vtype.read(from, end); + if (v->has_title()) { v->vtitle.read(from, end); } else { v->vtitle = MTPstring(); } + if (v->has_description()) { v->vdescription.read(from, end); } else { v->vdescription = MTPstring(); } + if (v->has_url()) { v->vurl.read(from, end); } else { v->vurl = MTPstring(); } + if (v->has_thumb_url()) { v->vthumb_url.read(from, end); } else { v->vthumb_url = MTPstring(); } + if (v->has_content_url()) { v->vcontent_url.read(from, end); } else { v->vcontent_url = MTPstring(); } + if (v->has_content_type()) { v->vcontent_type.read(from, end); } else { v->vcontent_type = MTPstring(); } + if (v->has_w()) { v->vw.read(from, end); } else { v->vw = MTPint(); } + if (v->has_h()) { v->vh.read(from, end); } else { v->vh = MTPint(); } + if (v->has_duration()) { v->vduration.read(from, end); } else { v->vduration = MTPint(); } + v->vsend_message.read(from, end); + data = std::move(v); } break; case mtpc_inputBotInlineResultPhoto: _type = cons; { - if (!data) setData(new MTPDinputBotInlineResultPhoto()); - MTPDinputBotInlineResultPhoto &v(_inputBotInlineResultPhoto()); - v.vid.read(from, end); - v.vtype.read(from, end); - v.vphoto.read(from, end); - v.vsend_message.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vtype.read(from, end); + v->vphoto.read(from, end); + v->vsend_message.read(from, end); + data = std::move(v); } break; case mtpc_inputBotInlineResultDocument: _type = cons; { - if (!data) setData(new MTPDinputBotInlineResultDocument()); - MTPDinputBotInlineResultDocument &v(_inputBotInlineResultDocument()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vtype.read(from, end); - if (v.has_title()) { v.vtitle.read(from, end); } else { v.vtitle = MTPstring(); } - if (v.has_description()) { v.vdescription.read(from, end); } else { v.vdescription = MTPstring(); } - v.vdocument.read(from, end); - v.vsend_message.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vtype.read(from, end); + if (v->has_title()) { v->vtitle.read(from, end); } else { v->vtitle = MTPstring(); } + if (v->has_description()) { v->vdescription.read(from, end); } else { v->vdescription = MTPstring(); } + v->vdocument.read(from, end); + v->vsend_message.read(from, end); + data = std::move(v); } break; case mtpc_inputBotInlineResultGame: _type = cons; { - if (!data) setData(new MTPDinputBotInlineResultGame()); - MTPDinputBotInlineResultGame &v(_inputBotInlineResultGame()); - v.vid.read(from, end); - v.vshort_name.read(from, end); - v.vsend_message.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vshort_name.read(from, end); + v->vsend_message.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputBotInlineResult"); } @@ -37958,7 +35633,7 @@ inline void MTPinputBotInlineResult::read(const mtpPrime *&from, const mtpPrime inline void MTPinputBotInlineResult::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputBotInlineResult: { - const MTPDinputBotInlineResult &v(c_inputBotInlineResult()); + auto &v = c_inputBotInlineResult(); v.vflags.write(to); v.vid.write(to); v.vtype.write(to); @@ -37974,14 +35649,14 @@ inline void MTPinputBotInlineResult::write(mtpBuffer &to) const { v.vsend_message.write(to); } break; case mtpc_inputBotInlineResultPhoto: { - const MTPDinputBotInlineResultPhoto &v(c_inputBotInlineResultPhoto()); + auto &v = c_inputBotInlineResultPhoto(); v.vid.write(to); v.vtype.write(to); v.vphoto.write(to); v.vsend_message.write(to); } break; case mtpc_inputBotInlineResultDocument: { - const MTPDinputBotInlineResultDocument &v(c_inputBotInlineResultDocument()); + auto &v = c_inputBotInlineResultDocument(); v.vflags.write(to); v.vid.write(to); v.vtype.write(to); @@ -37991,29 +35666,45 @@ inline void MTPinputBotInlineResult::write(mtpBuffer &to) const { v.vsend_message.write(to); } break; case mtpc_inputBotInlineResultGame: { - const MTPDinputBotInlineResultGame &v(c_inputBotInlineResultGame()); + auto &v = c_inputBotInlineResultGame(); v.vid.write(to); v.vshort_name.write(to); v.vsend_message.write(to); } break; } } -inline MTPinputBotInlineResult::MTPinputBotInlineResult(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputBotInlineResult::MTPinputBotInlineResult(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_inputBotInlineResult: setData(new MTPDinputBotInlineResult()); break; - case mtpc_inputBotInlineResultPhoto: setData(new MTPDinputBotInlineResultPhoto()); break; - case mtpc_inputBotInlineResultDocument: setData(new MTPDinputBotInlineResultDocument()); break; - case mtpc_inputBotInlineResultGame: setData(new MTPDinputBotInlineResultGame()); break; + case mtpc_inputBotInlineResult: data = std::make_shared(); break; + case mtpc_inputBotInlineResultPhoto: data = std::make_shared(); break; + case mtpc_inputBotInlineResultDocument: data = std::make_shared(); break; + case mtpc_inputBotInlineResultGame: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputBotInlineResult"); } } -inline MTPinputBotInlineResult::MTPinputBotInlineResult(MTPDinputBotInlineResult *_data) : mtpDataOwner(_data), _type(mtpc_inputBotInlineResult) { +inline const MTPDinputBotInlineResult &MTPinputBotInlineResult::c_inputBotInlineResult() const { + t_assert(data != nullptr && _type == mtpc_inputBotInlineResult); + return static_cast(*data); } -inline MTPinputBotInlineResult::MTPinputBotInlineResult(MTPDinputBotInlineResultPhoto *_data) : mtpDataOwner(_data), _type(mtpc_inputBotInlineResultPhoto) { +inline MTPinputBotInlineResult::MTPinputBotInlineResult(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputBotInlineResult) { } -inline MTPinputBotInlineResult::MTPinputBotInlineResult(MTPDinputBotInlineResultDocument *_data) : mtpDataOwner(_data), _type(mtpc_inputBotInlineResultDocument) { +inline const MTPDinputBotInlineResultPhoto &MTPinputBotInlineResult::c_inputBotInlineResultPhoto() const { + t_assert(data != nullptr && _type == mtpc_inputBotInlineResultPhoto); + return static_cast(*data); } -inline MTPinputBotInlineResult::MTPinputBotInlineResult(MTPDinputBotInlineResultGame *_data) : mtpDataOwner(_data), _type(mtpc_inputBotInlineResultGame) { +inline MTPinputBotInlineResult::MTPinputBotInlineResult(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputBotInlineResultPhoto) { +} +inline const MTPDinputBotInlineResultDocument &MTPinputBotInlineResult::c_inputBotInlineResultDocument() const { + t_assert(data != nullptr && _type == mtpc_inputBotInlineResultDocument); + return static_cast(*data); +} +inline MTPinputBotInlineResult::MTPinputBotInlineResult(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputBotInlineResultDocument) { +} +inline const MTPDinputBotInlineResultGame &MTPinputBotInlineResult::c_inputBotInlineResultGame() const { + t_assert(data != nullptr && _type == mtpc_inputBotInlineResultGame); + return static_cast(*data); +} +inline MTPinputBotInlineResult::MTPinputBotInlineResult(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputBotInlineResultGame) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputBotInlineResult::Flags) inline MTPinputBotInlineResult MTP_inputBotInlineResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPInputBotInlineMessage &_send_message) { @@ -38060,49 +35751,49 @@ inline mtpTypeId MTPbotInlineMessage::type() const { return _type; } inline void MTPbotInlineMessage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_botInlineMessageMediaAuto: _type = cons; { - if (!data) setData(new MTPDbotInlineMessageMediaAuto()); - MTPDbotInlineMessageMediaAuto &v(_botInlineMessageMediaAuto()); - v.vflags.read(from, end); - v.vcaption.read(from, end); - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vcaption.read(from, end); + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + data = std::move(v); } break; case mtpc_botInlineMessageText: _type = cons; { - if (!data) setData(new MTPDbotInlineMessageText()); - MTPDbotInlineMessageText &v(_botInlineMessageText()); - v.vflags.read(from, end); - v.vmessage.read(from, end); - if (v.has_entities()) { v.ventities.read(from, end); } else { v.ventities = MTPVector(); } - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vmessage.read(from, end); + if (v->has_entities()) { v->ventities.read(from, end); } else { v->ventities = MTPVector(); } + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + data = std::move(v); } break; case mtpc_botInlineMessageMediaGeo: _type = cons; { - if (!data) setData(new MTPDbotInlineMessageMediaGeo()); - MTPDbotInlineMessageMediaGeo &v(_botInlineMessageMediaGeo()); - v.vflags.read(from, end); - v.vgeo.read(from, end); - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vgeo.read(from, end); + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + data = std::move(v); } break; case mtpc_botInlineMessageMediaVenue: _type = cons; { - if (!data) setData(new MTPDbotInlineMessageMediaVenue()); - MTPDbotInlineMessageMediaVenue &v(_botInlineMessageMediaVenue()); - v.vflags.read(from, end); - v.vgeo.read(from, end); - v.vtitle.read(from, end); - v.vaddress.read(from, end); - v.vprovider.read(from, end); - v.vvenue_id.read(from, end); - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vgeo.read(from, end); + v->vtitle.read(from, end); + v->vaddress.read(from, end); + v->vprovider.read(from, end); + v->vvenue_id.read(from, end); + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + data = std::move(v); } break; case mtpc_botInlineMessageMediaContact: _type = cons; { - if (!data) setData(new MTPDbotInlineMessageMediaContact()); - MTPDbotInlineMessageMediaContact &v(_botInlineMessageMediaContact()); - v.vflags.read(from, end); - v.vphone_number.read(from, end); - v.vfirst_name.read(from, end); - v.vlast_name.read(from, end); - if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vphone_number.read(from, end); + v->vfirst_name.read(from, end); + v->vlast_name.read(from, end); + if (v->has_reply_markup()) { v->vreply_markup.read(from, end); } else { v->vreply_markup = MTPReplyMarkup(); } + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPbotInlineMessage"); } @@ -38110,26 +35801,26 @@ inline void MTPbotInlineMessage::read(const mtpPrime *&from, const mtpPrime *end inline void MTPbotInlineMessage::write(mtpBuffer &to) const { switch (_type) { case mtpc_botInlineMessageMediaAuto: { - const MTPDbotInlineMessageMediaAuto &v(c_botInlineMessageMediaAuto()); + auto &v = c_botInlineMessageMediaAuto(); v.vflags.write(to); v.vcaption.write(to); if (v.has_reply_markup()) v.vreply_markup.write(to); } break; case mtpc_botInlineMessageText: { - const MTPDbotInlineMessageText &v(c_botInlineMessageText()); + auto &v = c_botInlineMessageText(); v.vflags.write(to); v.vmessage.write(to); if (v.has_entities()) v.ventities.write(to); if (v.has_reply_markup()) v.vreply_markup.write(to); } break; case mtpc_botInlineMessageMediaGeo: { - const MTPDbotInlineMessageMediaGeo &v(c_botInlineMessageMediaGeo()); + auto &v = c_botInlineMessageMediaGeo(); v.vflags.write(to); v.vgeo.write(to); if (v.has_reply_markup()) v.vreply_markup.write(to); } break; case mtpc_botInlineMessageMediaVenue: { - const MTPDbotInlineMessageMediaVenue &v(c_botInlineMessageMediaVenue()); + auto &v = c_botInlineMessageMediaVenue(); v.vflags.write(to); v.vgeo.write(to); v.vtitle.write(to); @@ -38139,7 +35830,7 @@ inline void MTPbotInlineMessage::write(mtpBuffer &to) const { if (v.has_reply_markup()) v.vreply_markup.write(to); } break; case mtpc_botInlineMessageMediaContact: { - const MTPDbotInlineMessageMediaContact &v(c_botInlineMessageMediaContact()); + auto &v = c_botInlineMessageMediaContact(); v.vflags.write(to); v.vphone_number.write(to); v.vfirst_name.write(to); @@ -38148,25 +35839,45 @@ inline void MTPbotInlineMessage::write(mtpBuffer &to) const { } break; } } -inline MTPbotInlineMessage::MTPbotInlineMessage(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPbotInlineMessage::MTPbotInlineMessage(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_botInlineMessageMediaAuto: setData(new MTPDbotInlineMessageMediaAuto()); break; - case mtpc_botInlineMessageText: setData(new MTPDbotInlineMessageText()); break; - case mtpc_botInlineMessageMediaGeo: setData(new MTPDbotInlineMessageMediaGeo()); break; - case mtpc_botInlineMessageMediaVenue: setData(new MTPDbotInlineMessageMediaVenue()); break; - case mtpc_botInlineMessageMediaContact: setData(new MTPDbotInlineMessageMediaContact()); break; + case mtpc_botInlineMessageMediaAuto: data = std::make_shared(); break; + case mtpc_botInlineMessageText: data = std::make_shared(); break; + case mtpc_botInlineMessageMediaGeo: data = std::make_shared(); break; + case mtpc_botInlineMessageMediaVenue: data = std::make_shared(); break; + case mtpc_botInlineMessageMediaContact: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPbotInlineMessage"); } } -inline MTPbotInlineMessage::MTPbotInlineMessage(MTPDbotInlineMessageMediaAuto *_data) : mtpDataOwner(_data), _type(mtpc_botInlineMessageMediaAuto) { +inline const MTPDbotInlineMessageMediaAuto &MTPbotInlineMessage::c_botInlineMessageMediaAuto() const { + t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaAuto); + return static_cast(*data); } -inline MTPbotInlineMessage::MTPbotInlineMessage(MTPDbotInlineMessageText *_data) : mtpDataOwner(_data), _type(mtpc_botInlineMessageText) { +inline MTPbotInlineMessage::MTPbotInlineMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_botInlineMessageMediaAuto) { } -inline MTPbotInlineMessage::MTPbotInlineMessage(MTPDbotInlineMessageMediaGeo *_data) : mtpDataOwner(_data), _type(mtpc_botInlineMessageMediaGeo) { +inline const MTPDbotInlineMessageText &MTPbotInlineMessage::c_botInlineMessageText() const { + t_assert(data != nullptr && _type == mtpc_botInlineMessageText); + return static_cast(*data); } -inline MTPbotInlineMessage::MTPbotInlineMessage(MTPDbotInlineMessageMediaVenue *_data) : mtpDataOwner(_data), _type(mtpc_botInlineMessageMediaVenue) { +inline MTPbotInlineMessage::MTPbotInlineMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_botInlineMessageText) { } -inline MTPbotInlineMessage::MTPbotInlineMessage(MTPDbotInlineMessageMediaContact *_data) : mtpDataOwner(_data), _type(mtpc_botInlineMessageMediaContact) { +inline const MTPDbotInlineMessageMediaGeo &MTPbotInlineMessage::c_botInlineMessageMediaGeo() const { + t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaGeo); + return static_cast(*data); +} +inline MTPbotInlineMessage::MTPbotInlineMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_botInlineMessageMediaGeo) { +} +inline const MTPDbotInlineMessageMediaVenue &MTPbotInlineMessage::c_botInlineMessageMediaVenue() const { + t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaVenue); + return static_cast(*data); +} +inline MTPbotInlineMessage::MTPbotInlineMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_botInlineMessageMediaVenue) { +} +inline const MTPDbotInlineMessageMediaContact &MTPbotInlineMessage::c_botInlineMessageMediaContact() const { + t_assert(data != nullptr && _type == mtpc_botInlineMessageMediaContact); + return static_cast(*data); +} +inline MTPbotInlineMessage::MTPbotInlineMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_botInlineMessageMediaContact) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDbotInlineMessageMediaAuto::Flags) inline MTPbotInlineMessage MTP_botInlineMessageMediaAuto(const MTPflags &_flags, const MTPstring &_caption, const MTPReplyMarkup &_reply_markup) { @@ -38207,36 +35918,36 @@ inline mtpTypeId MTPbotInlineResult::type() const { return _type; } inline void MTPbotInlineResult::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_botInlineResult: _type = cons; { - if (!data) setData(new MTPDbotInlineResult()); - MTPDbotInlineResult &v(_botInlineResult()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vtype.read(from, end); - if (v.has_title()) { v.vtitle.read(from, end); } else { v.vtitle = MTPstring(); } - if (v.has_description()) { v.vdescription.read(from, end); } else { v.vdescription = MTPstring(); } - if (v.has_url()) { v.vurl.read(from, end); } else { v.vurl = MTPstring(); } - if (v.has_thumb_url()) { v.vthumb_url.read(from, end); } else { v.vthumb_url = MTPstring(); } - if (v.has_content_url()) { v.vcontent_url.read(from, end); } else { v.vcontent_url = MTPstring(); } - if (v.has_content_type()) { v.vcontent_type.read(from, end); } else { v.vcontent_type = MTPstring(); } - if (v.has_w()) { v.vw.read(from, end); } else { v.vw = MTPint(); } - if (v.has_h()) { v.vh.read(from, end); } else { v.vh = MTPint(); } - if (v.has_duration()) { v.vduration.read(from, end); } else { v.vduration = MTPint(); } - v.vsend_message.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vtype.read(from, end); + if (v->has_title()) { v->vtitle.read(from, end); } else { v->vtitle = MTPstring(); } + if (v->has_description()) { v->vdescription.read(from, end); } else { v->vdescription = MTPstring(); } + if (v->has_url()) { v->vurl.read(from, end); } else { v->vurl = MTPstring(); } + if (v->has_thumb_url()) { v->vthumb_url.read(from, end); } else { v->vthumb_url = MTPstring(); } + if (v->has_content_url()) { v->vcontent_url.read(from, end); } else { v->vcontent_url = MTPstring(); } + if (v->has_content_type()) { v->vcontent_type.read(from, end); } else { v->vcontent_type = MTPstring(); } + if (v->has_w()) { v->vw.read(from, end); } else { v->vw = MTPint(); } + if (v->has_h()) { v->vh.read(from, end); } else { v->vh = MTPint(); } + if (v->has_duration()) { v->vduration.read(from, end); } else { v->vduration = MTPint(); } + v->vsend_message.read(from, end); + data = std::move(v); } break; case mtpc_botInlineMediaResult: _type = cons; { - if (!data) setData(new MTPDbotInlineMediaResult()); - MTPDbotInlineMediaResult &v(_botInlineMediaResult()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vtype.read(from, end); - if (v.has_photo()) { v.vphoto.read(from, end); } else { v.vphoto = MTPPhoto(); } - if (v.has_document()) { v.vdocument.read(from, end); } else { v.vdocument = MTPDocument(); } - if (v.has_title()) { v.vtitle.read(from, end); } else { v.vtitle = MTPstring(); } - if (v.has_description()) { v.vdescription.read(from, end); } else { v.vdescription = MTPstring(); } - v.vsend_message.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vtype.read(from, end); + if (v->has_photo()) { v->vphoto.read(from, end); } else { v->vphoto = MTPPhoto(); } + if (v->has_document()) { v->vdocument.read(from, end); } else { v->vdocument = MTPDocument(); } + if (v->has_title()) { v->vtitle.read(from, end); } else { v->vtitle = MTPstring(); } + if (v->has_description()) { v->vdescription.read(from, end); } else { v->vdescription = MTPstring(); } + v->vsend_message.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPbotInlineResult"); } @@ -38244,7 +35955,7 @@ inline void MTPbotInlineResult::read(const mtpPrime *&from, const mtpPrime *end, inline void MTPbotInlineResult::write(mtpBuffer &to) const { switch (_type) { case mtpc_botInlineResult: { - const MTPDbotInlineResult &v(c_botInlineResult()); + auto &v = c_botInlineResult(); v.vflags.write(to); v.vid.write(to); v.vtype.write(to); @@ -38260,7 +35971,7 @@ inline void MTPbotInlineResult::write(mtpBuffer &to) const { v.vsend_message.write(to); } break; case mtpc_botInlineMediaResult: { - const MTPDbotInlineMediaResult &v(c_botInlineMediaResult()); + auto &v = c_botInlineMediaResult(); v.vflags.write(to); v.vid.write(to); v.vtype.write(to); @@ -38272,16 +35983,24 @@ inline void MTPbotInlineResult::write(mtpBuffer &to) const { } break; } } -inline MTPbotInlineResult::MTPbotInlineResult(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPbotInlineResult::MTPbotInlineResult(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_botInlineResult: setData(new MTPDbotInlineResult()); break; - case mtpc_botInlineMediaResult: setData(new MTPDbotInlineMediaResult()); break; + case mtpc_botInlineResult: data = std::make_shared(); break; + case mtpc_botInlineMediaResult: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPbotInlineResult"); } } -inline MTPbotInlineResult::MTPbotInlineResult(MTPDbotInlineResult *_data) : mtpDataOwner(_data), _type(mtpc_botInlineResult) { +inline const MTPDbotInlineResult &MTPbotInlineResult::c_botInlineResult() const { + t_assert(data != nullptr && _type == mtpc_botInlineResult); + return static_cast(*data); } -inline MTPbotInlineResult::MTPbotInlineResult(MTPDbotInlineMediaResult *_data) : mtpDataOwner(_data), _type(mtpc_botInlineMediaResult) { +inline MTPbotInlineResult::MTPbotInlineResult(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_botInlineResult) { +} +inline const MTPDbotInlineMediaResult &MTPbotInlineResult::c_botInlineMediaResult() const { + t_assert(data != nullptr && _type == mtpc_botInlineMediaResult); + return static_cast(*data); +} +inline MTPbotInlineResult::MTPbotInlineResult(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_botInlineMediaResult) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDbotInlineResult::Flags) inline MTPbotInlineResult MTP_botInlineResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPBotInlineMessage &_send_message) { @@ -38292,7 +36011,7 @@ inline MTPbotInlineResult MTP_botInlineMediaResult(const MTPflags()) { } inline uint32 MTPmessages_botResults::innerLength() const { @@ -38305,17 +36024,17 @@ inline mtpTypeId MTPmessages_botResults::type() const { inline void MTPmessages_botResults::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messages_botResults) throw mtpErrorUnexpected(cons, "MTPmessages_botResults"); - if (!data) setData(new MTPDmessages_botResults()); - MTPDmessages_botResults &v(_messages_botResults()); - v.vflags.read(from, end); - v.vquery_id.read(from, end); - if (v.has_next_offset()) { v.vnext_offset.read(from, end); } else { v.vnext_offset = MTPstring(); } - if (v.has_switch_pm()) { v.vswitch_pm.read(from, end); } else { v.vswitch_pm = MTPInlineBotSwitchPM(); } - v.vresults.read(from, end); - v.vcache_time.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vquery_id.read(from, end); + if (v->has_next_offset()) { v->vnext_offset.read(from, end); } else { v->vnext_offset = MTPstring(); } + if (v->has_switch_pm()) { v->vswitch_pm.read(from, end); } else { v->vswitch_pm = MTPInlineBotSwitchPM(); } + v->vresults.read(from, end); + v->vcache_time.read(from, end); + data = std::move(v); } inline void MTPmessages_botResults::write(mtpBuffer &to) const { - const MTPDmessages_botResults &v(c_messages_botResults()); + auto &v = c_messages_botResults(); v.vflags.write(to); v.vquery_id.write(to); if (v.has_next_offset()) v.vnext_offset.write(to); @@ -38323,14 +36042,18 @@ inline void MTPmessages_botResults::write(mtpBuffer &to) const { v.vresults.write(to); v.vcache_time.write(to); } -inline MTPmessages_botResults::MTPmessages_botResults(MTPDmessages_botResults *_data) : mtpDataOwner(_data) { +inline const MTPDmessages_botResults &MTPmessages_botResults::c_messages_botResults() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessages_botResults::MTPmessages_botResults(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessages_botResults::Flags) inline MTPmessages_botResults MTP_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm, const MTPVector &_results, MTPint _cache_time) { return MTP::internal::TypeCreator::new_messages_botResults(_flags, _query_id, _next_offset, _switch_pm, _results, _cache_time); } -inline MTPexportedMessageLink::MTPexportedMessageLink() : mtpDataOwner(new MTPDexportedMessageLink()) { +inline MTPexportedMessageLink::MTPexportedMessageLink() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPexportedMessageLink::innerLength() const { @@ -38343,21 +36066,25 @@ inline mtpTypeId MTPexportedMessageLink::type() const { inline void MTPexportedMessageLink::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_exportedMessageLink) throw mtpErrorUnexpected(cons, "MTPexportedMessageLink"); - if (!data) setData(new MTPDexportedMessageLink()); - MTPDexportedMessageLink &v(_exportedMessageLink()); - v.vlink.read(from, end); + auto v = std::make_shared(); + v->vlink.read(from, end); + data = std::move(v); } inline void MTPexportedMessageLink::write(mtpBuffer &to) const { - const MTPDexportedMessageLink &v(c_exportedMessageLink()); + auto &v = c_exportedMessageLink(); v.vlink.write(to); } -inline MTPexportedMessageLink::MTPexportedMessageLink(MTPDexportedMessageLink *_data) : mtpDataOwner(_data) { +inline const MTPDexportedMessageLink &MTPexportedMessageLink::c_exportedMessageLink() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPexportedMessageLink::MTPexportedMessageLink(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPexportedMessageLink MTP_exportedMessageLink(const MTPstring &_link) { return MTP::internal::TypeCreator::new_exportedMessageLink(_link); } -inline MTPmessageFwdHeader::MTPmessageFwdHeader() : mtpDataOwner(new MTPDmessageFwdHeader()) { +inline MTPmessageFwdHeader::MTPmessageFwdHeader() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessageFwdHeader::innerLength() const { @@ -38370,23 +36097,27 @@ inline mtpTypeId MTPmessageFwdHeader::type() const { inline void MTPmessageFwdHeader::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messageFwdHeader) throw mtpErrorUnexpected(cons, "MTPmessageFwdHeader"); - if (!data) setData(new MTPDmessageFwdHeader()); - MTPDmessageFwdHeader &v(_messageFwdHeader()); - v.vflags.read(from, end); - if (v.has_from_id()) { v.vfrom_id.read(from, end); } else { v.vfrom_id = MTPint(); } - v.vdate.read(from, end); - if (v.has_channel_id()) { v.vchannel_id.read(from, end); } else { v.vchannel_id = MTPint(); } - if (v.has_channel_post()) { v.vchannel_post.read(from, end); } else { v.vchannel_post = MTPint(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + if (v->has_from_id()) { v->vfrom_id.read(from, end); } else { v->vfrom_id = MTPint(); } + v->vdate.read(from, end); + if (v->has_channel_id()) { v->vchannel_id.read(from, end); } else { v->vchannel_id = MTPint(); } + if (v->has_channel_post()) { v->vchannel_post.read(from, end); } else { v->vchannel_post = MTPint(); } + data = std::move(v); } inline void MTPmessageFwdHeader::write(mtpBuffer &to) const { - const MTPDmessageFwdHeader &v(c_messageFwdHeader()); + auto &v = c_messageFwdHeader(); v.vflags.write(to); if (v.has_from_id()) v.vfrom_id.write(to); v.vdate.write(to); if (v.has_channel_id()) v.vchannel_id.write(to); if (v.has_channel_post()) v.vchannel_post.write(to); } -inline MTPmessageFwdHeader::MTPmessageFwdHeader(MTPDmessageFwdHeader *_data) : mtpDataOwner(_data) { +inline const MTPDmessageFwdHeader &MTPmessageFwdHeader::c_messageFwdHeader() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessageFwdHeader::MTPmessageFwdHeader(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessageFwdHeader::Flags) inline MTPmessageFwdHeader MTP_messageFwdHeader(const MTPflags &_flags, MTPint _from_id, MTPint _date, MTPint _channel_id, MTPint _channel_post) { @@ -38454,27 +36185,27 @@ inline mtpTypeId MTPauth_sentCodeType::type() const { return _type; } inline void MTPauth_sentCodeType::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_auth_sentCodeTypeApp: _type = cons; { - if (!data) setData(new MTPDauth_sentCodeTypeApp()); - MTPDauth_sentCodeTypeApp &v(_auth_sentCodeTypeApp()); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_auth_sentCodeTypeSms: _type = cons; { - if (!data) setData(new MTPDauth_sentCodeTypeSms()); - MTPDauth_sentCodeTypeSms &v(_auth_sentCodeTypeSms()); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_auth_sentCodeTypeCall: _type = cons; { - if (!data) setData(new MTPDauth_sentCodeTypeCall()); - MTPDauth_sentCodeTypeCall &v(_auth_sentCodeTypeCall()); - v.vlength.read(from, end); + auto v = std::make_shared(); + v->vlength.read(from, end); + data = std::move(v); } break; case mtpc_auth_sentCodeTypeFlashCall: _type = cons; { - if (!data) setData(new MTPDauth_sentCodeTypeFlashCall()); - MTPDauth_sentCodeTypeFlashCall &v(_auth_sentCodeTypeFlashCall()); - v.vpattern.read(from, end); + auto v = std::make_shared(); + v->vpattern.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPauth_sentCodeType"); } @@ -38482,39 +36213,55 @@ inline void MTPauth_sentCodeType::read(const mtpPrime *&from, const mtpPrime *en inline void MTPauth_sentCodeType::write(mtpBuffer &to) const { switch (_type) { case mtpc_auth_sentCodeTypeApp: { - const MTPDauth_sentCodeTypeApp &v(c_auth_sentCodeTypeApp()); + auto &v = c_auth_sentCodeTypeApp(); v.vlength.write(to); } break; case mtpc_auth_sentCodeTypeSms: { - const MTPDauth_sentCodeTypeSms &v(c_auth_sentCodeTypeSms()); + auto &v = c_auth_sentCodeTypeSms(); v.vlength.write(to); } break; case mtpc_auth_sentCodeTypeCall: { - const MTPDauth_sentCodeTypeCall &v(c_auth_sentCodeTypeCall()); + auto &v = c_auth_sentCodeTypeCall(); v.vlength.write(to); } break; case mtpc_auth_sentCodeTypeFlashCall: { - const MTPDauth_sentCodeTypeFlashCall &v(c_auth_sentCodeTypeFlashCall()); + auto &v = c_auth_sentCodeTypeFlashCall(); v.vpattern.write(to); } break; } } -inline MTPauth_sentCodeType::MTPauth_sentCodeType(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPauth_sentCodeType::MTPauth_sentCodeType(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_auth_sentCodeTypeApp: setData(new MTPDauth_sentCodeTypeApp()); break; - case mtpc_auth_sentCodeTypeSms: setData(new MTPDauth_sentCodeTypeSms()); break; - case mtpc_auth_sentCodeTypeCall: setData(new MTPDauth_sentCodeTypeCall()); break; - case mtpc_auth_sentCodeTypeFlashCall: setData(new MTPDauth_sentCodeTypeFlashCall()); break; + case mtpc_auth_sentCodeTypeApp: data = std::make_shared(); break; + case mtpc_auth_sentCodeTypeSms: data = std::make_shared(); break; + case mtpc_auth_sentCodeTypeCall: data = std::make_shared(); break; + case mtpc_auth_sentCodeTypeFlashCall: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPauth_sentCodeType"); } } -inline MTPauth_sentCodeType::MTPauth_sentCodeType(MTPDauth_sentCodeTypeApp *_data) : mtpDataOwner(_data), _type(mtpc_auth_sentCodeTypeApp) { +inline const MTPDauth_sentCodeTypeApp &MTPauth_sentCodeType::c_auth_sentCodeTypeApp() const { + t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeApp); + return static_cast(*data); } -inline MTPauth_sentCodeType::MTPauth_sentCodeType(MTPDauth_sentCodeTypeSms *_data) : mtpDataOwner(_data), _type(mtpc_auth_sentCodeTypeSms) { +inline MTPauth_sentCodeType::MTPauth_sentCodeType(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_auth_sentCodeTypeApp) { } -inline MTPauth_sentCodeType::MTPauth_sentCodeType(MTPDauth_sentCodeTypeCall *_data) : mtpDataOwner(_data), _type(mtpc_auth_sentCodeTypeCall) { +inline const MTPDauth_sentCodeTypeSms &MTPauth_sentCodeType::c_auth_sentCodeTypeSms() const { + t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeSms); + return static_cast(*data); } -inline MTPauth_sentCodeType::MTPauth_sentCodeType(MTPDauth_sentCodeTypeFlashCall *_data) : mtpDataOwner(_data), _type(mtpc_auth_sentCodeTypeFlashCall) { +inline MTPauth_sentCodeType::MTPauth_sentCodeType(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_auth_sentCodeTypeSms) { +} +inline const MTPDauth_sentCodeTypeCall &MTPauth_sentCodeType::c_auth_sentCodeTypeCall() const { + t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeCall); + return static_cast(*data); +} +inline MTPauth_sentCodeType::MTPauth_sentCodeType(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_auth_sentCodeTypeCall) { +} +inline const MTPDauth_sentCodeTypeFlashCall &MTPauth_sentCodeType::c_auth_sentCodeTypeFlashCall() const { + t_assert(data != nullptr && _type == mtpc_auth_sentCodeTypeFlashCall); + return static_cast(*data); +} +inline MTPauth_sentCodeType::MTPauth_sentCodeType(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_auth_sentCodeTypeFlashCall) { } inline MTPauth_sentCodeType MTP_auth_sentCodeTypeApp(MTPint _length) { return MTP::internal::TypeCreator::new_auth_sentCodeTypeApp(_length); @@ -38529,7 +36276,7 @@ inline MTPauth_sentCodeType MTP_auth_sentCodeTypeFlashCall(const MTPstring &_pat return MTP::internal::TypeCreator::new_auth_sentCodeTypeFlashCall(_pattern); } -inline MTPmessages_botCallbackAnswer::MTPmessages_botCallbackAnswer() : mtpDataOwner(new MTPDmessages_botCallbackAnswer()) { +inline MTPmessages_botCallbackAnswer::MTPmessages_botCallbackAnswer() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessages_botCallbackAnswer::innerLength() const { @@ -38542,28 +36289,32 @@ inline mtpTypeId MTPmessages_botCallbackAnswer::type() const { inline void MTPmessages_botCallbackAnswer::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messages_botCallbackAnswer) throw mtpErrorUnexpected(cons, "MTPmessages_botCallbackAnswer"); - if (!data) setData(new MTPDmessages_botCallbackAnswer()); - MTPDmessages_botCallbackAnswer &v(_messages_botCallbackAnswer()); - v.vflags.read(from, end); - if (v.has_message()) { v.vmessage.read(from, end); } else { v.vmessage = MTPstring(); } - if (v.has_url()) { v.vurl.read(from, end); } else { v.vurl = MTPstring(); } - v.vcache_time.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + if (v->has_message()) { v->vmessage.read(from, end); } else { v->vmessage = MTPstring(); } + if (v->has_url()) { v->vurl.read(from, end); } else { v->vurl = MTPstring(); } + v->vcache_time.read(from, end); + data = std::move(v); } inline void MTPmessages_botCallbackAnswer::write(mtpBuffer &to) const { - const MTPDmessages_botCallbackAnswer &v(c_messages_botCallbackAnswer()); + auto &v = c_messages_botCallbackAnswer(); v.vflags.write(to); if (v.has_message()) v.vmessage.write(to); if (v.has_url()) v.vurl.write(to); v.vcache_time.write(to); } -inline MTPmessages_botCallbackAnswer::MTPmessages_botCallbackAnswer(MTPDmessages_botCallbackAnswer *_data) : mtpDataOwner(_data) { +inline const MTPDmessages_botCallbackAnswer &MTPmessages_botCallbackAnswer::c_messages_botCallbackAnswer() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessages_botCallbackAnswer::MTPmessages_botCallbackAnswer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessages_botCallbackAnswer::Flags) inline MTPmessages_botCallbackAnswer MTP_messages_botCallbackAnswer(const MTPflags &_flags, const MTPstring &_message, const MTPstring &_url, MTPint _cache_time) { return MTP::internal::TypeCreator::new_messages_botCallbackAnswer(_flags, _message, _url, _cache_time); } -inline MTPmessages_messageEditData::MTPmessages_messageEditData() : mtpDataOwner(new MTPDmessages_messageEditData()) { +inline MTPmessages_messageEditData::MTPmessages_messageEditData() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessages_messageEditData::innerLength() const { @@ -38576,22 +36327,26 @@ inline mtpTypeId MTPmessages_messageEditData::type() const { inline void MTPmessages_messageEditData::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messages_messageEditData) throw mtpErrorUnexpected(cons, "MTPmessages_messageEditData"); - if (!data) setData(new MTPDmessages_messageEditData()); - MTPDmessages_messageEditData &v(_messages_messageEditData()); - v.vflags.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + data = std::move(v); } inline void MTPmessages_messageEditData::write(mtpBuffer &to) const { - const MTPDmessages_messageEditData &v(c_messages_messageEditData()); + auto &v = c_messages_messageEditData(); v.vflags.write(to); } -inline MTPmessages_messageEditData::MTPmessages_messageEditData(MTPDmessages_messageEditData *_data) : mtpDataOwner(_data) { +inline const MTPDmessages_messageEditData &MTPmessages_messageEditData::c_messages_messageEditData() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessages_messageEditData::MTPmessages_messageEditData(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessages_messageEditData::Flags) inline MTPmessages_messageEditData MTP_messages_messageEditData(const MTPflags &_flags) { return MTP::internal::TypeCreator::new_messages_messageEditData(_flags); } -inline MTPinputBotInlineMessageID::MTPinputBotInlineMessageID() : mtpDataOwner(new MTPDinputBotInlineMessageID()) { +inline MTPinputBotInlineMessageID::MTPinputBotInlineMessageID() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPinputBotInlineMessageID::innerLength() const { @@ -38604,25 +36359,29 @@ inline mtpTypeId MTPinputBotInlineMessageID::type() const { inline void MTPinputBotInlineMessageID::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_inputBotInlineMessageID) throw mtpErrorUnexpected(cons, "MTPinputBotInlineMessageID"); - if (!data) setData(new MTPDinputBotInlineMessageID()); - MTPDinputBotInlineMessageID &v(_inputBotInlineMessageID()); - v.vdc_id.read(from, end); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vdc_id.read(from, end); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } inline void MTPinputBotInlineMessageID::write(mtpBuffer &to) const { - const MTPDinputBotInlineMessageID &v(c_inputBotInlineMessageID()); + auto &v = c_inputBotInlineMessageID(); v.vdc_id.write(to); v.vid.write(to); v.vaccess_hash.write(to); } -inline MTPinputBotInlineMessageID::MTPinputBotInlineMessageID(MTPDinputBotInlineMessageID *_data) : mtpDataOwner(_data) { +inline const MTPDinputBotInlineMessageID &MTPinputBotInlineMessageID::c_inputBotInlineMessageID() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPinputBotInlineMessageID::MTPinputBotInlineMessageID(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPinputBotInlineMessageID MTP_inputBotInlineMessageID(MTPint _dc_id, const MTPlong &_id, const MTPlong &_access_hash) { return MTP::internal::TypeCreator::new_inputBotInlineMessageID(_dc_id, _id, _access_hash); } -inline MTPinlineBotSwitchPM::MTPinlineBotSwitchPM() : mtpDataOwner(new MTPDinlineBotSwitchPM()) { +inline MTPinlineBotSwitchPM::MTPinlineBotSwitchPM() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPinlineBotSwitchPM::innerLength() const { @@ -38635,23 +36394,27 @@ inline mtpTypeId MTPinlineBotSwitchPM::type() const { inline void MTPinlineBotSwitchPM::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_inlineBotSwitchPM) throw mtpErrorUnexpected(cons, "MTPinlineBotSwitchPM"); - if (!data) setData(new MTPDinlineBotSwitchPM()); - MTPDinlineBotSwitchPM &v(_inlineBotSwitchPM()); - v.vtext.read(from, end); - v.vstart_param.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + v->vstart_param.read(from, end); + data = std::move(v); } inline void MTPinlineBotSwitchPM::write(mtpBuffer &to) const { - const MTPDinlineBotSwitchPM &v(c_inlineBotSwitchPM()); + auto &v = c_inlineBotSwitchPM(); v.vtext.write(to); v.vstart_param.write(to); } -inline MTPinlineBotSwitchPM::MTPinlineBotSwitchPM(MTPDinlineBotSwitchPM *_data) : mtpDataOwner(_data) { +inline const MTPDinlineBotSwitchPM &MTPinlineBotSwitchPM::c_inlineBotSwitchPM() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPinlineBotSwitchPM::MTPinlineBotSwitchPM(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPinlineBotSwitchPM MTP_inlineBotSwitchPM(const MTPstring &_text, const MTPstring &_start_param) { return MTP::internal::TypeCreator::new_inlineBotSwitchPM(_text, _start_param); } -inline MTPmessages_peerDialogs::MTPmessages_peerDialogs() : mtpDataOwner(new MTPDmessages_peerDialogs()) { +inline MTPmessages_peerDialogs::MTPmessages_peerDialogs() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessages_peerDialogs::innerLength() const { @@ -38664,29 +36427,33 @@ inline mtpTypeId MTPmessages_peerDialogs::type() const { inline void MTPmessages_peerDialogs::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messages_peerDialogs) throw mtpErrorUnexpected(cons, "MTPmessages_peerDialogs"); - if (!data) setData(new MTPDmessages_peerDialogs()); - MTPDmessages_peerDialogs &v(_messages_peerDialogs()); - v.vdialogs.read(from, end); - v.vmessages.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); - v.vstate.read(from, end); + auto v = std::make_shared(); + v->vdialogs.read(from, end); + v->vmessages.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + v->vstate.read(from, end); + data = std::move(v); } inline void MTPmessages_peerDialogs::write(mtpBuffer &to) const { - const MTPDmessages_peerDialogs &v(c_messages_peerDialogs()); + auto &v = c_messages_peerDialogs(); v.vdialogs.write(to); v.vmessages.write(to); v.vchats.write(to); v.vusers.write(to); v.vstate.write(to); } -inline MTPmessages_peerDialogs::MTPmessages_peerDialogs(MTPDmessages_peerDialogs *_data) : mtpDataOwner(_data) { +inline const MTPDmessages_peerDialogs &MTPmessages_peerDialogs::c_messages_peerDialogs() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessages_peerDialogs::MTPmessages_peerDialogs(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmessages_peerDialogs MTP_messages_peerDialogs(const MTPVector &_dialogs, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_state) { return MTP::internal::TypeCreator::new_messages_peerDialogs(_dialogs, _messages, _chats, _users, _state); } -inline MTPtopPeer::MTPtopPeer() : mtpDataOwner(new MTPDtopPeer()) { +inline MTPtopPeer::MTPtopPeer() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPtopPeer::innerLength() const { @@ -38699,17 +36466,21 @@ inline mtpTypeId MTPtopPeer::type() const { inline void MTPtopPeer::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_topPeer) throw mtpErrorUnexpected(cons, "MTPtopPeer"); - if (!data) setData(new MTPDtopPeer()); - MTPDtopPeer &v(_topPeer()); - v.vpeer.read(from, end); - v.vrating.read(from, end); + auto v = std::make_shared(); + v->vpeer.read(from, end); + v->vrating.read(from, end); + data = std::move(v); } inline void MTPtopPeer::write(mtpBuffer &to) const { - const MTPDtopPeer &v(c_topPeer()); + auto &v = c_topPeer(); v.vpeer.write(to); v.vrating.write(to); } -inline MTPtopPeer::MTPtopPeer(MTPDtopPeer *_data) : mtpDataOwner(_data) { +inline const MTPDtopPeer &MTPtopPeer::c_topPeer() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPtopPeer::MTPtopPeer(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPtopPeer MTP_topPeer(const MTPPeer &_peer, const MTPdouble &_rating) { return MTP::internal::TypeCreator::new_topPeer(_peer, _rating); @@ -38760,7 +36531,7 @@ inline MTPtopPeerCategory MTP_topPeerCategoryChannels() { return MTP::internal::TypeCreator::new_topPeerCategoryChannels(); } -inline MTPtopPeerCategoryPeers::MTPtopPeerCategoryPeers() : mtpDataOwner(new MTPDtopPeerCategoryPeers()) { +inline MTPtopPeerCategoryPeers::MTPtopPeerCategoryPeers() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPtopPeerCategoryPeers::innerLength() const { @@ -38773,19 +36544,23 @@ inline mtpTypeId MTPtopPeerCategoryPeers::type() const { inline void MTPtopPeerCategoryPeers::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_topPeerCategoryPeers) throw mtpErrorUnexpected(cons, "MTPtopPeerCategoryPeers"); - if (!data) setData(new MTPDtopPeerCategoryPeers()); - MTPDtopPeerCategoryPeers &v(_topPeerCategoryPeers()); - v.vcategory.read(from, end); - v.vcount.read(from, end); - v.vpeers.read(from, end); + auto v = std::make_shared(); + v->vcategory.read(from, end); + v->vcount.read(from, end); + v->vpeers.read(from, end); + data = std::move(v); } inline void MTPtopPeerCategoryPeers::write(mtpBuffer &to) const { - const MTPDtopPeerCategoryPeers &v(c_topPeerCategoryPeers()); + auto &v = c_topPeerCategoryPeers(); v.vcategory.write(to); v.vcount.write(to); v.vpeers.write(to); } -inline MTPtopPeerCategoryPeers::MTPtopPeerCategoryPeers(MTPDtopPeerCategoryPeers *_data) : mtpDataOwner(_data) { +inline const MTPDtopPeerCategoryPeers &MTPtopPeerCategoryPeers::c_topPeerCategoryPeers() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPtopPeerCategoryPeers::MTPtopPeerCategoryPeers(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPtopPeerCategoryPeers MTP_topPeerCategoryPeers(const MTPTopPeerCategory &_category, MTPint _count, const MTPVector &_peers) { return MTP::internal::TypeCreator::new_topPeerCategoryPeers(_category, _count, _peers); @@ -38805,15 +36580,15 @@ inline mtpTypeId MTPcontacts_topPeers::type() const { return _type; } inline void MTPcontacts_topPeers::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_contacts_topPeersNotModified: _type = cons; break; case mtpc_contacts_topPeers: _type = cons; { - if (!data) setData(new MTPDcontacts_topPeers()); - MTPDcontacts_topPeers &v(_contacts_topPeers()); - v.vcategories.read(from, end); - v.vchats.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vcategories.read(from, end); + v->vchats.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPcontacts_topPeers"); } @@ -38821,21 +36596,25 @@ inline void MTPcontacts_topPeers::read(const mtpPrime *&from, const mtpPrime *en inline void MTPcontacts_topPeers::write(mtpBuffer &to) const { switch (_type) { case mtpc_contacts_topPeers: { - const MTPDcontacts_topPeers &v(c_contacts_topPeers()); + auto &v = c_contacts_topPeers(); v.vcategories.write(to); v.vchats.write(to); v.vusers.write(to); } break; } } -inline MTPcontacts_topPeers::MTPcontacts_topPeers(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPcontacts_topPeers::MTPcontacts_topPeers(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_contacts_topPeersNotModified: break; - case mtpc_contacts_topPeers: setData(new MTPDcontacts_topPeers()); break; + case mtpc_contacts_topPeers: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPcontacts_topPeers"); } } -inline MTPcontacts_topPeers::MTPcontacts_topPeers(MTPDcontacts_topPeers *_data) : mtpDataOwner(_data), _type(mtpc_contacts_topPeers) { +inline const MTPDcontacts_topPeers &MTPcontacts_topPeers::c_contacts_topPeers() const { + t_assert(data != nullptr && _type == mtpc_contacts_topPeers); + return static_cast(*data); +} +inline MTPcontacts_topPeers::MTPcontacts_topPeers(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_contacts_topPeers) { } inline MTPcontacts_topPeers MTP_contacts_topPeersNotModified() { return MTP::internal::TypeCreator::new_contacts_topPeersNotModified(); @@ -38858,17 +36637,17 @@ inline mtpTypeId MTPdraftMessage::type() const { return _type; } inline void MTPdraftMessage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_draftMessageEmpty: _type = cons; break; case mtpc_draftMessage: _type = cons; { - if (!data) setData(new MTPDdraftMessage()); - MTPDdraftMessage &v(_draftMessage()); - v.vflags.read(from, end); - if (v.has_reply_to_msg_id()) { v.vreply_to_msg_id.read(from, end); } else { v.vreply_to_msg_id = MTPint(); } - v.vmessage.read(from, end); - if (v.has_entities()) { v.ventities.read(from, end); } else { v.ventities = MTPVector(); } - v.vdate.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + if (v->has_reply_to_msg_id()) { v->vreply_to_msg_id.read(from, end); } else { v->vreply_to_msg_id = MTPint(); } + v->vmessage.read(from, end); + if (v->has_entities()) { v->ventities.read(from, end); } else { v->ventities = MTPVector(); } + v->vdate.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPdraftMessage"); } @@ -38876,7 +36655,7 @@ inline void MTPdraftMessage::read(const mtpPrime *&from, const mtpPrime *end, mt inline void MTPdraftMessage::write(mtpBuffer &to) const { switch (_type) { case mtpc_draftMessage: { - const MTPDdraftMessage &v(c_draftMessage()); + auto &v = c_draftMessage(); v.vflags.write(to); if (v.has_reply_to_msg_id()) v.vreply_to_msg_id.write(to); v.vmessage.write(to); @@ -38885,14 +36664,18 @@ inline void MTPdraftMessage::write(mtpBuffer &to) const { } break; } } -inline MTPdraftMessage::MTPdraftMessage(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPdraftMessage::MTPdraftMessage(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_draftMessageEmpty: break; - case mtpc_draftMessage: setData(new MTPDdraftMessage()); break; + case mtpc_draftMessage: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPdraftMessage"); } } -inline MTPdraftMessage::MTPdraftMessage(MTPDdraftMessage *_data) : mtpDataOwner(_data), _type(mtpc_draftMessage) { +inline const MTPDdraftMessage &MTPdraftMessage::c_draftMessage() const { + t_assert(data != nullptr && _type == mtpc_draftMessage); + return static_cast(*data); +} +inline MTPdraftMessage::MTPdraftMessage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_draftMessage) { } inline MTPdraftMessage MTP_draftMessageEmpty() { return MTP::internal::TypeCreator::new_draftMessageEmpty(); @@ -38916,15 +36699,15 @@ inline mtpTypeId MTPmessages_featuredStickers::type() const { return _type; } inline void MTPmessages_featuredStickers::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messages_featuredStickersNotModified: _type = cons; break; case mtpc_messages_featuredStickers: _type = cons; { - if (!data) setData(new MTPDmessages_featuredStickers()); - MTPDmessages_featuredStickers &v(_messages_featuredStickers()); - v.vhash.read(from, end); - v.vsets.read(from, end); - v.vunread.read(from, end); + auto v = std::make_shared(); + v->vhash.read(from, end); + v->vsets.read(from, end); + v->vunread.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_featuredStickers"); } @@ -38932,21 +36715,25 @@ inline void MTPmessages_featuredStickers::read(const mtpPrime *&from, const mtpP inline void MTPmessages_featuredStickers::write(mtpBuffer &to) const { switch (_type) { case mtpc_messages_featuredStickers: { - const MTPDmessages_featuredStickers &v(c_messages_featuredStickers()); + auto &v = c_messages_featuredStickers(); v.vhash.write(to); v.vsets.write(to); v.vunread.write(to); } break; } } -inline MTPmessages_featuredStickers::MTPmessages_featuredStickers(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessages_featuredStickers::MTPmessages_featuredStickers(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_messages_featuredStickersNotModified: break; - case mtpc_messages_featuredStickers: setData(new MTPDmessages_featuredStickers()); break; + case mtpc_messages_featuredStickers: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_featuredStickers"); } } -inline MTPmessages_featuredStickers::MTPmessages_featuredStickers(MTPDmessages_featuredStickers *_data) : mtpDataOwner(_data), _type(mtpc_messages_featuredStickers) { +inline const MTPDmessages_featuredStickers &MTPmessages_featuredStickers::c_messages_featuredStickers() const { + t_assert(data != nullptr && _type == mtpc_messages_featuredStickers); + return static_cast(*data); +} +inline MTPmessages_featuredStickers::MTPmessages_featuredStickers(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_featuredStickers) { } inline MTPmessages_featuredStickers MTP_messages_featuredStickersNotModified() { return MTP::internal::TypeCreator::new_messages_featuredStickersNotModified(); @@ -38969,14 +36756,14 @@ inline mtpTypeId MTPmessages_recentStickers::type() const { return _type; } inline void MTPmessages_recentStickers::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messages_recentStickersNotModified: _type = cons; break; case mtpc_messages_recentStickers: _type = cons; { - if (!data) setData(new MTPDmessages_recentStickers()); - MTPDmessages_recentStickers &v(_messages_recentStickers()); - v.vhash.read(from, end); - v.vstickers.read(from, end); + auto v = std::make_shared(); + v->vhash.read(from, end); + v->vstickers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_recentStickers"); } @@ -38984,20 +36771,24 @@ inline void MTPmessages_recentStickers::read(const mtpPrime *&from, const mtpPri inline void MTPmessages_recentStickers::write(mtpBuffer &to) const { switch (_type) { case mtpc_messages_recentStickers: { - const MTPDmessages_recentStickers &v(c_messages_recentStickers()); + auto &v = c_messages_recentStickers(); v.vhash.write(to); v.vstickers.write(to); } break; } } -inline MTPmessages_recentStickers::MTPmessages_recentStickers(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessages_recentStickers::MTPmessages_recentStickers(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_messages_recentStickersNotModified: break; - case mtpc_messages_recentStickers: setData(new MTPDmessages_recentStickers()); break; + case mtpc_messages_recentStickers: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_recentStickers"); } } -inline MTPmessages_recentStickers::MTPmessages_recentStickers(MTPDmessages_recentStickers *_data) : mtpDataOwner(_data), _type(mtpc_messages_recentStickers) { +inline const MTPDmessages_recentStickers &MTPmessages_recentStickers::c_messages_recentStickers() const { + t_assert(data != nullptr && _type == mtpc_messages_recentStickers); + return static_cast(*data); +} +inline MTPmessages_recentStickers::MTPmessages_recentStickers(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_recentStickers) { } inline MTPmessages_recentStickers MTP_messages_recentStickersNotModified() { return MTP::internal::TypeCreator::new_messages_recentStickersNotModified(); @@ -39006,7 +36797,7 @@ inline MTPmessages_recentStickers MTP_messages_recentStickers(MTPint _hash, cons return MTP::internal::TypeCreator::new_messages_recentStickers(_hash, _stickers); } -inline MTPmessages_archivedStickers::MTPmessages_archivedStickers() : mtpDataOwner(new MTPDmessages_archivedStickers()) { +inline MTPmessages_archivedStickers::MTPmessages_archivedStickers() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessages_archivedStickers::innerLength() const { @@ -39019,17 +36810,21 @@ inline mtpTypeId MTPmessages_archivedStickers::type() const { inline void MTPmessages_archivedStickers::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messages_archivedStickers) throw mtpErrorUnexpected(cons, "MTPmessages_archivedStickers"); - if (!data) setData(new MTPDmessages_archivedStickers()); - MTPDmessages_archivedStickers &v(_messages_archivedStickers()); - v.vcount.read(from, end); - v.vsets.read(from, end); + auto v = std::make_shared(); + v->vcount.read(from, end); + v->vsets.read(from, end); + data = std::move(v); } inline void MTPmessages_archivedStickers::write(mtpBuffer &to) const { - const MTPDmessages_archivedStickers &v(c_messages_archivedStickers()); + auto &v = c_messages_archivedStickers(); v.vcount.write(to); v.vsets.write(to); } -inline MTPmessages_archivedStickers::MTPmessages_archivedStickers(MTPDmessages_archivedStickers *_data) : mtpDataOwner(_data) { +inline const MTPDmessages_archivedStickers &MTPmessages_archivedStickers::c_messages_archivedStickers() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessages_archivedStickers::MTPmessages_archivedStickers(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmessages_archivedStickers MTP_messages_archivedStickers(MTPint _count, const MTPVector &_sets) { return MTP::internal::TypeCreator::new_messages_archivedStickers(_count, _sets); @@ -39049,13 +36844,13 @@ inline mtpTypeId MTPmessages_stickerSetInstallResult::type() const { return _type; } inline void MTPmessages_stickerSetInstallResult::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_messages_stickerSetInstallResultSuccess: _type = cons; break; case mtpc_messages_stickerSetInstallResultArchive: _type = cons; { - if (!data) setData(new MTPDmessages_stickerSetInstallResultArchive()); - MTPDmessages_stickerSetInstallResultArchive &v(_messages_stickerSetInstallResultArchive()); - v.vsets.read(from, end); + auto v = std::make_shared(); + v->vsets.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_stickerSetInstallResult"); } @@ -39063,19 +36858,23 @@ inline void MTPmessages_stickerSetInstallResult::read(const mtpPrime *&from, con inline void MTPmessages_stickerSetInstallResult::write(mtpBuffer &to) const { switch (_type) { case mtpc_messages_stickerSetInstallResultArchive: { - const MTPDmessages_stickerSetInstallResultArchive &v(c_messages_stickerSetInstallResultArchive()); + auto &v = c_messages_stickerSetInstallResultArchive(); v.vsets.write(to); } break; } } -inline MTPmessages_stickerSetInstallResult::MTPmessages_stickerSetInstallResult(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPmessages_stickerSetInstallResult::MTPmessages_stickerSetInstallResult(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_messages_stickerSetInstallResultSuccess: break; - case mtpc_messages_stickerSetInstallResultArchive: setData(new MTPDmessages_stickerSetInstallResultArchive()); break; + case mtpc_messages_stickerSetInstallResultArchive: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_stickerSetInstallResult"); } } -inline MTPmessages_stickerSetInstallResult::MTPmessages_stickerSetInstallResult(MTPDmessages_stickerSetInstallResultArchive *_data) : mtpDataOwner(_data), _type(mtpc_messages_stickerSetInstallResultArchive) { +inline const MTPDmessages_stickerSetInstallResultArchive &MTPmessages_stickerSetInstallResult::c_messages_stickerSetInstallResultArchive() const { + t_assert(data != nullptr && _type == mtpc_messages_stickerSetInstallResultArchive); + return static_cast(*data); +} +inline MTPmessages_stickerSetInstallResult::MTPmessages_stickerSetInstallResult(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_messages_stickerSetInstallResultArchive) { } inline MTPmessages_stickerSetInstallResult MTP_messages_stickerSetInstallResultSuccess() { return MTP::internal::TypeCreator::new_messages_stickerSetInstallResultSuccess(); @@ -39102,19 +36901,19 @@ inline mtpTypeId MTPstickerSetCovered::type() const { return _type; } inline void MTPstickerSetCovered::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_stickerSetCovered: _type = cons; { - if (!data) setData(new MTPDstickerSetCovered()); - MTPDstickerSetCovered &v(_stickerSetCovered()); - v.vset.read(from, end); - v.vcover.read(from, end); + auto v = std::make_shared(); + v->vset.read(from, end); + v->vcover.read(from, end); + data = std::move(v); } break; case mtpc_stickerSetMultiCovered: _type = cons; { - if (!data) setData(new MTPDstickerSetMultiCovered()); - MTPDstickerSetMultiCovered &v(_stickerSetMultiCovered()); - v.vset.read(from, end); - v.vcovers.read(from, end); + auto v = std::make_shared(); + v->vset.read(from, end); + v->vcovers.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPstickerSetCovered"); } @@ -39122,27 +36921,35 @@ inline void MTPstickerSetCovered::read(const mtpPrime *&from, const mtpPrime *en inline void MTPstickerSetCovered::write(mtpBuffer &to) const { switch (_type) { case mtpc_stickerSetCovered: { - const MTPDstickerSetCovered &v(c_stickerSetCovered()); + auto &v = c_stickerSetCovered(); v.vset.write(to); v.vcover.write(to); } break; case mtpc_stickerSetMultiCovered: { - const MTPDstickerSetMultiCovered &v(c_stickerSetMultiCovered()); + auto &v = c_stickerSetMultiCovered(); v.vset.write(to); v.vcovers.write(to); } break; } } -inline MTPstickerSetCovered::MTPstickerSetCovered(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPstickerSetCovered::MTPstickerSetCovered(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_stickerSetCovered: setData(new MTPDstickerSetCovered()); break; - case mtpc_stickerSetMultiCovered: setData(new MTPDstickerSetMultiCovered()); break; + case mtpc_stickerSetCovered: data = std::make_shared(); break; + case mtpc_stickerSetMultiCovered: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPstickerSetCovered"); } } -inline MTPstickerSetCovered::MTPstickerSetCovered(MTPDstickerSetCovered *_data) : mtpDataOwner(_data), _type(mtpc_stickerSetCovered) { +inline const MTPDstickerSetCovered &MTPstickerSetCovered::c_stickerSetCovered() const { + t_assert(data != nullptr && _type == mtpc_stickerSetCovered); + return static_cast(*data); } -inline MTPstickerSetCovered::MTPstickerSetCovered(MTPDstickerSetMultiCovered *_data) : mtpDataOwner(_data), _type(mtpc_stickerSetMultiCovered) { +inline MTPstickerSetCovered::MTPstickerSetCovered(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_stickerSetCovered) { +} +inline const MTPDstickerSetMultiCovered &MTPstickerSetCovered::c_stickerSetMultiCovered() const { + t_assert(data != nullptr && _type == mtpc_stickerSetMultiCovered); + return static_cast(*data); +} +inline MTPstickerSetCovered::MTPstickerSetCovered(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_stickerSetMultiCovered) { } inline MTPstickerSetCovered MTP_stickerSetCovered(const MTPStickerSet &_set, const MTPDocument &_cover) { return MTP::internal::TypeCreator::new_stickerSetCovered(_set, _cover); @@ -39151,7 +36958,7 @@ inline MTPstickerSetCovered MTP_stickerSetMultiCovered(const MTPStickerSet &_set return MTP::internal::TypeCreator::new_stickerSetMultiCovered(_set, _covers); } -inline MTPmaskCoords::MTPmaskCoords() : mtpDataOwner(new MTPDmaskCoords()) { +inline MTPmaskCoords::MTPmaskCoords() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmaskCoords::innerLength() const { @@ -39164,21 +36971,25 @@ inline mtpTypeId MTPmaskCoords::type() const { inline void MTPmaskCoords::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_maskCoords) throw mtpErrorUnexpected(cons, "MTPmaskCoords"); - if (!data) setData(new MTPDmaskCoords()); - MTPDmaskCoords &v(_maskCoords()); - v.vn.read(from, end); - v.vx.read(from, end); - v.vy.read(from, end); - v.vzoom.read(from, end); + auto v = std::make_shared(); + v->vn.read(from, end); + v->vx.read(from, end); + v->vy.read(from, end); + v->vzoom.read(from, end); + data = std::move(v); } inline void MTPmaskCoords::write(mtpBuffer &to) const { - const MTPDmaskCoords &v(c_maskCoords()); + auto &v = c_maskCoords(); v.vn.write(to); v.vx.write(to); v.vy.write(to); v.vzoom.write(to); } -inline MTPmaskCoords::MTPmaskCoords(MTPDmaskCoords *_data) : mtpDataOwner(_data) { +inline const MTPDmaskCoords &MTPmaskCoords::c_maskCoords() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmaskCoords::MTPmaskCoords(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmaskCoords MTP_maskCoords(MTPint _n, const MTPdouble &_x, const MTPdouble &_y, const MTPdouble &_zoom) { return MTP::internal::TypeCreator::new_maskCoords(_n, _x, _y, _zoom); @@ -39202,17 +37013,17 @@ inline mtpTypeId MTPinputStickeredMedia::type() const { return _type; } inline void MTPinputStickeredMedia::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputStickeredMediaPhoto: _type = cons; { - if (!data) setData(new MTPDinputStickeredMediaPhoto()); - MTPDinputStickeredMediaPhoto &v(_inputStickeredMediaPhoto()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; case mtpc_inputStickeredMediaDocument: _type = cons; { - if (!data) setData(new MTPDinputStickeredMediaDocument()); - MTPDinputStickeredMediaDocument &v(_inputStickeredMediaDocument()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputStickeredMedia"); } @@ -39220,25 +37031,33 @@ inline void MTPinputStickeredMedia::read(const mtpPrime *&from, const mtpPrime * inline void MTPinputStickeredMedia::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputStickeredMediaPhoto: { - const MTPDinputStickeredMediaPhoto &v(c_inputStickeredMediaPhoto()); + auto &v = c_inputStickeredMediaPhoto(); v.vid.write(to); } break; case mtpc_inputStickeredMediaDocument: { - const MTPDinputStickeredMediaDocument &v(c_inputStickeredMediaDocument()); + auto &v = c_inputStickeredMediaDocument(); v.vid.write(to); } break; } } -inline MTPinputStickeredMedia::MTPinputStickeredMedia(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputStickeredMedia::MTPinputStickeredMedia(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_inputStickeredMediaPhoto: setData(new MTPDinputStickeredMediaPhoto()); break; - case mtpc_inputStickeredMediaDocument: setData(new MTPDinputStickeredMediaDocument()); break; + case mtpc_inputStickeredMediaPhoto: data = std::make_shared(); break; + case mtpc_inputStickeredMediaDocument: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputStickeredMedia"); } } -inline MTPinputStickeredMedia::MTPinputStickeredMedia(MTPDinputStickeredMediaPhoto *_data) : mtpDataOwner(_data), _type(mtpc_inputStickeredMediaPhoto) { +inline const MTPDinputStickeredMediaPhoto &MTPinputStickeredMedia::c_inputStickeredMediaPhoto() const { + t_assert(data != nullptr && _type == mtpc_inputStickeredMediaPhoto); + return static_cast(*data); } -inline MTPinputStickeredMedia::MTPinputStickeredMedia(MTPDinputStickeredMediaDocument *_data) : mtpDataOwner(_data), _type(mtpc_inputStickeredMediaDocument) { +inline MTPinputStickeredMedia::MTPinputStickeredMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputStickeredMediaPhoto) { +} +inline const MTPDinputStickeredMediaDocument &MTPinputStickeredMedia::c_inputStickeredMediaDocument() const { + t_assert(data != nullptr && _type == mtpc_inputStickeredMediaDocument); + return static_cast(*data); +} +inline MTPinputStickeredMedia::MTPinputStickeredMedia(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputStickeredMediaDocument) { } inline MTPinputStickeredMedia MTP_inputStickeredMediaPhoto(const MTPInputPhoto &_id) { return MTP::internal::TypeCreator::new_inputStickeredMediaPhoto(_id); @@ -39247,7 +37066,7 @@ inline MTPinputStickeredMedia MTP_inputStickeredMediaDocument(const MTPInputDocu return MTP::internal::TypeCreator::new_inputStickeredMediaDocument(_id); } -inline MTPgame::MTPgame() : mtpDataOwner(new MTPDgame()) { +inline MTPgame::MTPgame() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPgame::innerLength() const { @@ -39260,19 +37079,19 @@ inline mtpTypeId MTPgame::type() const { inline void MTPgame::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_game) throw mtpErrorUnexpected(cons, "MTPgame"); - if (!data) setData(new MTPDgame()); - MTPDgame &v(_game()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vshort_name.read(from, end); - v.vtitle.read(from, end); - v.vdescription.read(from, end); - v.vphoto.read(from, end); - if (v.has_document()) { v.vdocument.read(from, end); } else { v.vdocument = MTPDocument(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vshort_name.read(from, end); + v->vtitle.read(from, end); + v->vdescription.read(from, end); + v->vphoto.read(from, end); + if (v->has_document()) { v->vdocument.read(from, end); } else { v->vdocument = MTPDocument(); } + data = std::move(v); } inline void MTPgame::write(mtpBuffer &to) const { - const MTPDgame &v(c_game()); + auto &v = c_game(); v.vflags.write(to); v.vid.write(to); v.vaccess_hash.write(to); @@ -39282,7 +37101,11 @@ inline void MTPgame::write(mtpBuffer &to) const { v.vphoto.write(to); if (v.has_document()) v.vdocument.write(to); } -inline MTPgame::MTPgame(MTPDgame *_data) : mtpDataOwner(_data) { +inline const MTPDgame &MTPgame::c_game() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPgame::MTPgame(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDgame::Flags) inline MTPgame MTP_game(const MTPflags &_flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_short_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPDocument &_document) { @@ -39307,19 +37130,19 @@ inline mtpTypeId MTPinputGame::type() const { return _type; } inline void MTPinputGame::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_inputGameID: _type = cons; { - if (!data) setData(new MTPDinputGameID()); - MTPDinputGameID &v(_inputGameID()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } break; case mtpc_inputGameShortName: _type = cons; { - if (!data) setData(new MTPDinputGameShortName()); - MTPDinputGameShortName &v(_inputGameShortName()); - v.vbot_id.read(from, end); - v.vshort_name.read(from, end); + auto v = std::make_shared(); + v->vbot_id.read(from, end); + v->vshort_name.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPinputGame"); } @@ -39327,27 +37150,35 @@ inline void MTPinputGame::read(const mtpPrime *&from, const mtpPrime *end, mtpTy inline void MTPinputGame::write(mtpBuffer &to) const { switch (_type) { case mtpc_inputGameID: { - const MTPDinputGameID &v(c_inputGameID()); + auto &v = c_inputGameID(); v.vid.write(to); v.vaccess_hash.write(to); } break; case mtpc_inputGameShortName: { - const MTPDinputGameShortName &v(c_inputGameShortName()); + auto &v = c_inputGameShortName(); v.vbot_id.write(to); v.vshort_name.write(to); } break; } } -inline MTPinputGame::MTPinputGame(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPinputGame::MTPinputGame(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_inputGameID: setData(new MTPDinputGameID()); break; - case mtpc_inputGameShortName: setData(new MTPDinputGameShortName()); break; + case mtpc_inputGameID: data = std::make_shared(); break; + case mtpc_inputGameShortName: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPinputGame"); } } -inline MTPinputGame::MTPinputGame(MTPDinputGameID *_data) : mtpDataOwner(_data), _type(mtpc_inputGameID) { +inline const MTPDinputGameID &MTPinputGame::c_inputGameID() const { + t_assert(data != nullptr && _type == mtpc_inputGameID); + return static_cast(*data); } -inline MTPinputGame::MTPinputGame(MTPDinputGameShortName *_data) : mtpDataOwner(_data), _type(mtpc_inputGameShortName) { +inline MTPinputGame::MTPinputGame(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputGameID) { +} +inline const MTPDinputGameShortName &MTPinputGame::c_inputGameShortName() const { + t_assert(data != nullptr && _type == mtpc_inputGameShortName); + return static_cast(*data); +} +inline MTPinputGame::MTPinputGame(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_inputGameShortName) { } inline MTPinputGame MTP_inputGameID(const MTPlong &_id, const MTPlong &_access_hash) { return MTP::internal::TypeCreator::new_inputGameID(_id, _access_hash); @@ -39356,7 +37187,7 @@ inline MTPinputGame MTP_inputGameShortName(const MTPInputUser &_bot_id, const MT return MTP::internal::TypeCreator::new_inputGameShortName(_bot_id, _short_name); } -inline MTPhighScore::MTPhighScore() : mtpDataOwner(new MTPDhighScore()) { +inline MTPhighScore::MTPhighScore() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPhighScore::innerLength() const { @@ -39369,25 +37200,29 @@ inline mtpTypeId MTPhighScore::type() const { inline void MTPhighScore::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_highScore) throw mtpErrorUnexpected(cons, "MTPhighScore"); - if (!data) setData(new MTPDhighScore()); - MTPDhighScore &v(_highScore()); - v.vpos.read(from, end); - v.vuser_id.read(from, end); - v.vscore.read(from, end); + auto v = std::make_shared(); + v->vpos.read(from, end); + v->vuser_id.read(from, end); + v->vscore.read(from, end); + data = std::move(v); } inline void MTPhighScore::write(mtpBuffer &to) const { - const MTPDhighScore &v(c_highScore()); + auto &v = c_highScore(); v.vpos.write(to); v.vuser_id.write(to); v.vscore.write(to); } -inline MTPhighScore::MTPhighScore(MTPDhighScore *_data) : mtpDataOwner(_data) { +inline const MTPDhighScore &MTPhighScore::c_highScore() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPhighScore::MTPhighScore(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPhighScore MTP_highScore(MTPint _pos, MTPint _user_id, MTPint _score) { return MTP::internal::TypeCreator::new_highScore(_pos, _user_id, _score); } -inline MTPmessages_highScores::MTPmessages_highScores() : mtpDataOwner(new MTPDmessages_highScores()) { +inline MTPmessages_highScores::MTPmessages_highScores() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPmessages_highScores::innerLength() const { @@ -39400,17 +37235,21 @@ inline mtpTypeId MTPmessages_highScores::type() const { inline void MTPmessages_highScores::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_messages_highScores) throw mtpErrorUnexpected(cons, "MTPmessages_highScores"); - if (!data) setData(new MTPDmessages_highScores()); - MTPDmessages_highScores &v(_messages_highScores()); - v.vscores.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vscores.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } inline void MTPmessages_highScores::write(mtpBuffer &to) const { - const MTPDmessages_highScores &v(c_messages_highScores()); + auto &v = c_messages_highScores(); v.vscores.write(to); v.vusers.write(to); } -inline MTPmessages_highScores::MTPmessages_highScores(MTPDmessages_highScores *_data) : mtpDataOwner(_data) { +inline const MTPDmessages_highScores &MTPmessages_highScores::c_messages_highScores() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPmessages_highScores::MTPmessages_highScores(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPmessages_highScores MTP_messages_highScores(const MTPVector &_scores, const MTPVector &_users) { return MTP::internal::TypeCreator::new_messages_highScores(_scores, _users); @@ -39462,56 +37301,56 @@ inline mtpTypeId MTPrichText::type() const { return _type; } inline void MTPrichText::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_textEmpty: _type = cons; break; case mtpc_textPlain: _type = cons; { - if (!data) setData(new MTPDtextPlain()); - MTPDtextPlain &v(_textPlain()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_textBold: _type = cons; { - if (!data) setData(new MTPDtextBold()); - MTPDtextBold &v(_textBold()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_textItalic: _type = cons; { - if (!data) setData(new MTPDtextItalic()); - MTPDtextItalic &v(_textItalic()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_textUnderline: _type = cons; { - if (!data) setData(new MTPDtextUnderline()); - MTPDtextUnderline &v(_textUnderline()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_textStrike: _type = cons; { - if (!data) setData(new MTPDtextStrike()); - MTPDtextStrike &v(_textStrike()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_textFixed: _type = cons; { - if (!data) setData(new MTPDtextFixed()); - MTPDtextFixed &v(_textFixed()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_textUrl: _type = cons; { - if (!data) setData(new MTPDtextUrl()); - MTPDtextUrl &v(_textUrl()); - v.vtext.read(from, end); - v.vurl.read(from, end); - v.vwebpage_id.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + v->vurl.read(from, end); + v->vwebpage_id.read(from, end); + data = std::move(v); } break; case mtpc_textEmail: _type = cons; { - if (!data) setData(new MTPDtextEmail()); - MTPDtextEmail &v(_textEmail()); - v.vtext.read(from, end); - v.vemail.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + v->vemail.read(from, end); + data = std::move(v); } break; case mtpc_textConcat: _type = cons; { - if (!data) setData(new MTPDtextConcat()); - MTPDtextConcat &v(_textConcat()); - v.vtexts.read(from, end); + auto v = std::make_shared(); + v->vtexts.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPrichText"); } @@ -39519,78 +37358,114 @@ inline void MTPrichText::read(const mtpPrime *&from, const mtpPrime *end, mtpTyp inline void MTPrichText::write(mtpBuffer &to) const { switch (_type) { case mtpc_textPlain: { - const MTPDtextPlain &v(c_textPlain()); + auto &v = c_textPlain(); v.vtext.write(to); } break; case mtpc_textBold: { - const MTPDtextBold &v(c_textBold()); + auto &v = c_textBold(); v.vtext.write(to); } break; case mtpc_textItalic: { - const MTPDtextItalic &v(c_textItalic()); + auto &v = c_textItalic(); v.vtext.write(to); } break; case mtpc_textUnderline: { - const MTPDtextUnderline &v(c_textUnderline()); + auto &v = c_textUnderline(); v.vtext.write(to); } break; case mtpc_textStrike: { - const MTPDtextStrike &v(c_textStrike()); + auto &v = c_textStrike(); v.vtext.write(to); } break; case mtpc_textFixed: { - const MTPDtextFixed &v(c_textFixed()); + auto &v = c_textFixed(); v.vtext.write(to); } break; case mtpc_textUrl: { - const MTPDtextUrl &v(c_textUrl()); + auto &v = c_textUrl(); v.vtext.write(to); v.vurl.write(to); v.vwebpage_id.write(to); } break; case mtpc_textEmail: { - const MTPDtextEmail &v(c_textEmail()); + auto &v = c_textEmail(); v.vtext.write(to); v.vemail.write(to); } break; case mtpc_textConcat: { - const MTPDtextConcat &v(c_textConcat()); + auto &v = c_textConcat(); v.vtexts.write(to); } break; } } -inline MTPrichText::MTPrichText(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPrichText::MTPrichText(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_textEmpty: break; - case mtpc_textPlain: setData(new MTPDtextPlain()); break; - case mtpc_textBold: setData(new MTPDtextBold()); break; - case mtpc_textItalic: setData(new MTPDtextItalic()); break; - case mtpc_textUnderline: setData(new MTPDtextUnderline()); break; - case mtpc_textStrike: setData(new MTPDtextStrike()); break; - case mtpc_textFixed: setData(new MTPDtextFixed()); break; - case mtpc_textUrl: setData(new MTPDtextUrl()); break; - case mtpc_textEmail: setData(new MTPDtextEmail()); break; - case mtpc_textConcat: setData(new MTPDtextConcat()); break; + case mtpc_textPlain: data = std::make_shared(); break; + case mtpc_textBold: data = std::make_shared(); break; + case mtpc_textItalic: data = std::make_shared(); break; + case mtpc_textUnderline: data = std::make_shared(); break; + case mtpc_textStrike: data = std::make_shared(); break; + case mtpc_textFixed: data = std::make_shared(); break; + case mtpc_textUrl: data = std::make_shared(); break; + case mtpc_textEmail: data = std::make_shared(); break; + case mtpc_textConcat: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPrichText"); } } -inline MTPrichText::MTPrichText(MTPDtextPlain *_data) : mtpDataOwner(_data), _type(mtpc_textPlain) { +inline const MTPDtextPlain &MTPrichText::c_textPlain() const { + t_assert(data != nullptr && _type == mtpc_textPlain); + return static_cast(*data); } -inline MTPrichText::MTPrichText(MTPDtextBold *_data) : mtpDataOwner(_data), _type(mtpc_textBold) { +inline MTPrichText::MTPrichText(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_textPlain) { } -inline MTPrichText::MTPrichText(MTPDtextItalic *_data) : mtpDataOwner(_data), _type(mtpc_textItalic) { +inline const MTPDtextBold &MTPrichText::c_textBold() const { + t_assert(data != nullptr && _type == mtpc_textBold); + return static_cast(*data); } -inline MTPrichText::MTPrichText(MTPDtextUnderline *_data) : mtpDataOwner(_data), _type(mtpc_textUnderline) { +inline MTPrichText::MTPrichText(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_textBold) { } -inline MTPrichText::MTPrichText(MTPDtextStrike *_data) : mtpDataOwner(_data), _type(mtpc_textStrike) { +inline const MTPDtextItalic &MTPrichText::c_textItalic() const { + t_assert(data != nullptr && _type == mtpc_textItalic); + return static_cast(*data); } -inline MTPrichText::MTPrichText(MTPDtextFixed *_data) : mtpDataOwner(_data), _type(mtpc_textFixed) { +inline MTPrichText::MTPrichText(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_textItalic) { } -inline MTPrichText::MTPrichText(MTPDtextUrl *_data) : mtpDataOwner(_data), _type(mtpc_textUrl) { +inline const MTPDtextUnderline &MTPrichText::c_textUnderline() const { + t_assert(data != nullptr && _type == mtpc_textUnderline); + return static_cast(*data); } -inline MTPrichText::MTPrichText(MTPDtextEmail *_data) : mtpDataOwner(_data), _type(mtpc_textEmail) { +inline MTPrichText::MTPrichText(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_textUnderline) { } -inline MTPrichText::MTPrichText(MTPDtextConcat *_data) : mtpDataOwner(_data), _type(mtpc_textConcat) { +inline const MTPDtextStrike &MTPrichText::c_textStrike() const { + t_assert(data != nullptr && _type == mtpc_textStrike); + return static_cast(*data); +} +inline MTPrichText::MTPrichText(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_textStrike) { +} +inline const MTPDtextFixed &MTPrichText::c_textFixed() const { + t_assert(data != nullptr && _type == mtpc_textFixed); + return static_cast(*data); +} +inline MTPrichText::MTPrichText(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_textFixed) { +} +inline const MTPDtextUrl &MTPrichText::c_textUrl() const { + t_assert(data != nullptr && _type == mtpc_textUrl); + return static_cast(*data); +} +inline MTPrichText::MTPrichText(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_textUrl) { +} +inline const MTPDtextEmail &MTPrichText::c_textEmail() const { + t_assert(data != nullptr && _type == mtpc_textEmail); + return static_cast(*data); +} +inline MTPrichText::MTPrichText(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_textEmail) { +} +inline const MTPDtextConcat &MTPrichText::c_textConcat() const { + t_assert(data != nullptr && _type == mtpc_textConcat); + return static_cast(*data); +} +inline MTPrichText::MTPrichText(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_textConcat) { } inline MTPrichText MTP_textEmpty() { return MTP::internal::TypeCreator::new_textEmpty(); @@ -39709,126 +37584,126 @@ inline mtpTypeId MTPpageBlock::type() const { return _type; } inline void MTPpageBlock::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_pageBlockUnsupported: _type = cons; break; case mtpc_pageBlockTitle: _type = cons; { - if (!data) setData(new MTPDpageBlockTitle()); - MTPDpageBlockTitle &v(_pageBlockTitle()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockSubtitle: _type = cons; { - if (!data) setData(new MTPDpageBlockSubtitle()); - MTPDpageBlockSubtitle &v(_pageBlockSubtitle()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockAuthorDate: _type = cons; { - if (!data) setData(new MTPDpageBlockAuthorDate()); - MTPDpageBlockAuthorDate &v(_pageBlockAuthorDate()); - v.vauthor.read(from, end); - v.vpublished_date.read(from, end); + auto v = std::make_shared(); + v->vauthor.read(from, end); + v->vpublished_date.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockHeader: _type = cons; { - if (!data) setData(new MTPDpageBlockHeader()); - MTPDpageBlockHeader &v(_pageBlockHeader()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockSubheader: _type = cons; { - if (!data) setData(new MTPDpageBlockSubheader()); - MTPDpageBlockSubheader &v(_pageBlockSubheader()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockParagraph: _type = cons; { - if (!data) setData(new MTPDpageBlockParagraph()); - MTPDpageBlockParagraph &v(_pageBlockParagraph()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockPreformatted: _type = cons; { - if (!data) setData(new MTPDpageBlockPreformatted()); - MTPDpageBlockPreformatted &v(_pageBlockPreformatted()); - v.vtext.read(from, end); - v.vlanguage.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + v->vlanguage.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockFooter: _type = cons; { - if (!data) setData(new MTPDpageBlockFooter()); - MTPDpageBlockFooter &v(_pageBlockFooter()); - v.vtext.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockDivider: _type = cons; break; case mtpc_pageBlockAnchor: _type = cons; { - if (!data) setData(new MTPDpageBlockAnchor()); - MTPDpageBlockAnchor &v(_pageBlockAnchor()); - v.vname.read(from, end); + auto v = std::make_shared(); + v->vname.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockList: _type = cons; { - if (!data) setData(new MTPDpageBlockList()); - MTPDpageBlockList &v(_pageBlockList()); - v.vordered.read(from, end); - v.vitems.read(from, end); + auto v = std::make_shared(); + v->vordered.read(from, end); + v->vitems.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockBlockquote: _type = cons; { - if (!data) setData(new MTPDpageBlockBlockquote()); - MTPDpageBlockBlockquote &v(_pageBlockBlockquote()); - v.vtext.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockPullquote: _type = cons; { - if (!data) setData(new MTPDpageBlockPullquote()); - MTPDpageBlockPullquote &v(_pageBlockPullquote()); - v.vtext.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vtext.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockPhoto: _type = cons; { - if (!data) setData(new MTPDpageBlockPhoto()); - MTPDpageBlockPhoto &v(_pageBlockPhoto()); - v.vphoto_id.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vphoto_id.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockVideo: _type = cons; { - if (!data) setData(new MTPDpageBlockVideo()); - MTPDpageBlockVideo &v(_pageBlockVideo()); - v.vflags.read(from, end); - v.vvideo_id.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vvideo_id.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockCover: _type = cons; { - if (!data) setData(new MTPDpageBlockCover()); - MTPDpageBlockCover &v(_pageBlockCover()); - v.vcover.read(from, end); + auto v = std::make_shared(); + v->vcover.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockEmbed: _type = cons; { - if (!data) setData(new MTPDpageBlockEmbed()); - MTPDpageBlockEmbed &v(_pageBlockEmbed()); - v.vflags.read(from, end); - if (v.has_url()) { v.vurl.read(from, end); } else { v.vurl = MTPstring(); } - if (v.has_html()) { v.vhtml.read(from, end); } else { v.vhtml = MTPstring(); } - if (v.has_poster_photo_id()) { v.vposter_photo_id.read(from, end); } else { v.vposter_photo_id = MTPlong(); } - v.vw.read(from, end); - v.vh.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + if (v->has_url()) { v->vurl.read(from, end); } else { v->vurl = MTPstring(); } + if (v->has_html()) { v->vhtml.read(from, end); } else { v->vhtml = MTPstring(); } + if (v->has_poster_photo_id()) { v->vposter_photo_id.read(from, end); } else { v->vposter_photo_id = MTPlong(); } + v->vw.read(from, end); + v->vh.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockEmbedPost: _type = cons; { - if (!data) setData(new MTPDpageBlockEmbedPost()); - MTPDpageBlockEmbedPost &v(_pageBlockEmbedPost()); - v.vurl.read(from, end); - v.vwebpage_id.read(from, end); - v.vauthor_photo_id.read(from, end); - v.vauthor.read(from, end); - v.vdate.read(from, end); - v.vblocks.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vurl.read(from, end); + v->vwebpage_id.read(from, end); + v->vauthor_photo_id.read(from, end); + v->vauthor.read(from, end); + v->vdate.read(from, end); + v->vblocks.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockCollage: _type = cons; { - if (!data) setData(new MTPDpageBlockCollage()); - MTPDpageBlockCollage &v(_pageBlockCollage()); - v.vitems.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vitems.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; case mtpc_pageBlockSlideshow: _type = cons; { - if (!data) setData(new MTPDpageBlockSlideshow()); - MTPDpageBlockSlideshow &v(_pageBlockSlideshow()); - v.vitems.read(from, end); - v.vcaption.read(from, end); + auto v = std::make_shared(); + v->vitems.read(from, end); + v->vcaption.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPpageBlock"); } @@ -39836,75 +37711,75 @@ inline void MTPpageBlock::read(const mtpPrime *&from, const mtpPrime *end, mtpTy inline void MTPpageBlock::write(mtpBuffer &to) const { switch (_type) { case mtpc_pageBlockTitle: { - const MTPDpageBlockTitle &v(c_pageBlockTitle()); + auto &v = c_pageBlockTitle(); v.vtext.write(to); } break; case mtpc_pageBlockSubtitle: { - const MTPDpageBlockSubtitle &v(c_pageBlockSubtitle()); + auto &v = c_pageBlockSubtitle(); v.vtext.write(to); } break; case mtpc_pageBlockAuthorDate: { - const MTPDpageBlockAuthorDate &v(c_pageBlockAuthorDate()); + auto &v = c_pageBlockAuthorDate(); v.vauthor.write(to); v.vpublished_date.write(to); } break; case mtpc_pageBlockHeader: { - const MTPDpageBlockHeader &v(c_pageBlockHeader()); + auto &v = c_pageBlockHeader(); v.vtext.write(to); } break; case mtpc_pageBlockSubheader: { - const MTPDpageBlockSubheader &v(c_pageBlockSubheader()); + auto &v = c_pageBlockSubheader(); v.vtext.write(to); } break; case mtpc_pageBlockParagraph: { - const MTPDpageBlockParagraph &v(c_pageBlockParagraph()); + auto &v = c_pageBlockParagraph(); v.vtext.write(to); } break; case mtpc_pageBlockPreformatted: { - const MTPDpageBlockPreformatted &v(c_pageBlockPreformatted()); + auto &v = c_pageBlockPreformatted(); v.vtext.write(to); v.vlanguage.write(to); } break; case mtpc_pageBlockFooter: { - const MTPDpageBlockFooter &v(c_pageBlockFooter()); + auto &v = c_pageBlockFooter(); v.vtext.write(to); } break; case mtpc_pageBlockAnchor: { - const MTPDpageBlockAnchor &v(c_pageBlockAnchor()); + auto &v = c_pageBlockAnchor(); v.vname.write(to); } break; case mtpc_pageBlockList: { - const MTPDpageBlockList &v(c_pageBlockList()); + auto &v = c_pageBlockList(); v.vordered.write(to); v.vitems.write(to); } break; case mtpc_pageBlockBlockquote: { - const MTPDpageBlockBlockquote &v(c_pageBlockBlockquote()); + auto &v = c_pageBlockBlockquote(); v.vtext.write(to); v.vcaption.write(to); } break; case mtpc_pageBlockPullquote: { - const MTPDpageBlockPullquote &v(c_pageBlockPullquote()); + auto &v = c_pageBlockPullquote(); v.vtext.write(to); v.vcaption.write(to); } break; case mtpc_pageBlockPhoto: { - const MTPDpageBlockPhoto &v(c_pageBlockPhoto()); + auto &v = c_pageBlockPhoto(); v.vphoto_id.write(to); v.vcaption.write(to); } break; case mtpc_pageBlockVideo: { - const MTPDpageBlockVideo &v(c_pageBlockVideo()); + auto &v = c_pageBlockVideo(); v.vflags.write(to); v.vvideo_id.write(to); v.vcaption.write(to); } break; case mtpc_pageBlockCover: { - const MTPDpageBlockCover &v(c_pageBlockCover()); + auto &v = c_pageBlockCover(); v.vcover.write(to); } break; case mtpc_pageBlockEmbed: { - const MTPDpageBlockEmbed &v(c_pageBlockEmbed()); + auto &v = c_pageBlockEmbed(); v.vflags.write(to); if (v.has_url()) v.vurl.write(to); if (v.has_html()) v.vhtml.write(to); @@ -39914,7 +37789,7 @@ inline void MTPpageBlock::write(mtpBuffer &to) const { v.vcaption.write(to); } break; case mtpc_pageBlockEmbedPost: { - const MTPDpageBlockEmbedPost &v(c_pageBlockEmbedPost()); + auto &v = c_pageBlockEmbedPost(); v.vurl.write(to); v.vwebpage_id.write(to); v.vauthor_photo_id.write(to); @@ -39924,80 +37799,156 @@ inline void MTPpageBlock::write(mtpBuffer &to) const { v.vcaption.write(to); } break; case mtpc_pageBlockCollage: { - const MTPDpageBlockCollage &v(c_pageBlockCollage()); + auto &v = c_pageBlockCollage(); v.vitems.write(to); v.vcaption.write(to); } break; case mtpc_pageBlockSlideshow: { - const MTPDpageBlockSlideshow &v(c_pageBlockSlideshow()); + auto &v = c_pageBlockSlideshow(); v.vitems.write(to); v.vcaption.write(to); } break; } } -inline MTPpageBlock::MTPpageBlock(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPpageBlock::MTPpageBlock(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { case mtpc_pageBlockUnsupported: break; - case mtpc_pageBlockTitle: setData(new MTPDpageBlockTitle()); break; - case mtpc_pageBlockSubtitle: setData(new MTPDpageBlockSubtitle()); break; - case mtpc_pageBlockAuthorDate: setData(new MTPDpageBlockAuthorDate()); break; - case mtpc_pageBlockHeader: setData(new MTPDpageBlockHeader()); break; - case mtpc_pageBlockSubheader: setData(new MTPDpageBlockSubheader()); break; - case mtpc_pageBlockParagraph: setData(new MTPDpageBlockParagraph()); break; - case mtpc_pageBlockPreformatted: setData(new MTPDpageBlockPreformatted()); break; - case mtpc_pageBlockFooter: setData(new MTPDpageBlockFooter()); break; + case mtpc_pageBlockTitle: data = std::make_shared(); break; + case mtpc_pageBlockSubtitle: data = std::make_shared(); break; + case mtpc_pageBlockAuthorDate: data = std::make_shared(); break; + case mtpc_pageBlockHeader: data = std::make_shared(); break; + case mtpc_pageBlockSubheader: data = std::make_shared(); break; + case mtpc_pageBlockParagraph: data = std::make_shared(); break; + case mtpc_pageBlockPreformatted: data = std::make_shared(); break; + case mtpc_pageBlockFooter: data = std::make_shared(); break; case mtpc_pageBlockDivider: break; - case mtpc_pageBlockAnchor: setData(new MTPDpageBlockAnchor()); break; - case mtpc_pageBlockList: setData(new MTPDpageBlockList()); break; - case mtpc_pageBlockBlockquote: setData(new MTPDpageBlockBlockquote()); break; - case mtpc_pageBlockPullquote: setData(new MTPDpageBlockPullquote()); break; - case mtpc_pageBlockPhoto: setData(new MTPDpageBlockPhoto()); break; - case mtpc_pageBlockVideo: setData(new MTPDpageBlockVideo()); break; - case mtpc_pageBlockCover: setData(new MTPDpageBlockCover()); break; - case mtpc_pageBlockEmbed: setData(new MTPDpageBlockEmbed()); break; - case mtpc_pageBlockEmbedPost: setData(new MTPDpageBlockEmbedPost()); break; - case mtpc_pageBlockCollage: setData(new MTPDpageBlockCollage()); break; - case mtpc_pageBlockSlideshow: setData(new MTPDpageBlockSlideshow()); break; + case mtpc_pageBlockAnchor: data = std::make_shared(); break; + case mtpc_pageBlockList: data = std::make_shared(); break; + case mtpc_pageBlockBlockquote: data = std::make_shared(); break; + case mtpc_pageBlockPullquote: data = std::make_shared(); break; + case mtpc_pageBlockPhoto: data = std::make_shared(); break; + case mtpc_pageBlockVideo: data = std::make_shared(); break; + case mtpc_pageBlockCover: data = std::make_shared(); break; + case mtpc_pageBlockEmbed: data = std::make_shared(); break; + case mtpc_pageBlockEmbedPost: data = std::make_shared(); break; + case mtpc_pageBlockCollage: data = std::make_shared(); break; + case mtpc_pageBlockSlideshow: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPpageBlock"); } } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockTitle *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockTitle) { +inline const MTPDpageBlockTitle &MTPpageBlock::c_pageBlockTitle() const { + t_assert(data != nullptr && _type == mtpc_pageBlockTitle); + return static_cast(*data); } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockSubtitle *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockSubtitle) { +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockTitle) { } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockAuthorDate *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockAuthorDate) { +inline const MTPDpageBlockSubtitle &MTPpageBlock::c_pageBlockSubtitle() const { + t_assert(data != nullptr && _type == mtpc_pageBlockSubtitle); + return static_cast(*data); } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockHeader *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockHeader) { +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockSubtitle) { } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockSubheader *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockSubheader) { +inline const MTPDpageBlockAuthorDate &MTPpageBlock::c_pageBlockAuthorDate() const { + t_assert(data != nullptr && _type == mtpc_pageBlockAuthorDate); + return static_cast(*data); } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockParagraph *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockParagraph) { +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockAuthorDate) { } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockPreformatted *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockPreformatted) { +inline const MTPDpageBlockHeader &MTPpageBlock::c_pageBlockHeader() const { + t_assert(data != nullptr && _type == mtpc_pageBlockHeader); + return static_cast(*data); } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockFooter *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockFooter) { +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockHeader) { } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockAnchor *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockAnchor) { +inline const MTPDpageBlockSubheader &MTPpageBlock::c_pageBlockSubheader() const { + t_assert(data != nullptr && _type == mtpc_pageBlockSubheader); + return static_cast(*data); } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockList *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockList) { +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockSubheader) { } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockBlockquote *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockBlockquote) { +inline const MTPDpageBlockParagraph &MTPpageBlock::c_pageBlockParagraph() const { + t_assert(data != nullptr && _type == mtpc_pageBlockParagraph); + return static_cast(*data); } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockPullquote *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockPullquote) { +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockParagraph) { } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockPhoto *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockPhoto) { +inline const MTPDpageBlockPreformatted &MTPpageBlock::c_pageBlockPreformatted() const { + t_assert(data != nullptr && _type == mtpc_pageBlockPreformatted); + return static_cast(*data); } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockVideo *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockVideo) { +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockPreformatted) { } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockCover *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockCover) { +inline const MTPDpageBlockFooter &MTPpageBlock::c_pageBlockFooter() const { + t_assert(data != nullptr && _type == mtpc_pageBlockFooter); + return static_cast(*data); } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockEmbed *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockEmbed) { +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockFooter) { } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockEmbedPost *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockEmbedPost) { +inline const MTPDpageBlockAnchor &MTPpageBlock::c_pageBlockAnchor() const { + t_assert(data != nullptr && _type == mtpc_pageBlockAnchor); + return static_cast(*data); } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockCollage *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockCollage) { +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockAnchor) { } -inline MTPpageBlock::MTPpageBlock(MTPDpageBlockSlideshow *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockSlideshow) { +inline const MTPDpageBlockList &MTPpageBlock::c_pageBlockList() const { + t_assert(data != nullptr && _type == mtpc_pageBlockList); + return static_cast(*data); +} +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockList) { +} +inline const MTPDpageBlockBlockquote &MTPpageBlock::c_pageBlockBlockquote() const { + t_assert(data != nullptr && _type == mtpc_pageBlockBlockquote); + return static_cast(*data); +} +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockBlockquote) { +} +inline const MTPDpageBlockPullquote &MTPpageBlock::c_pageBlockPullquote() const { + t_assert(data != nullptr && _type == mtpc_pageBlockPullquote); + return static_cast(*data); +} +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockPullquote) { +} +inline const MTPDpageBlockPhoto &MTPpageBlock::c_pageBlockPhoto() const { + t_assert(data != nullptr && _type == mtpc_pageBlockPhoto); + return static_cast(*data); +} +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockPhoto) { +} +inline const MTPDpageBlockVideo &MTPpageBlock::c_pageBlockVideo() const { + t_assert(data != nullptr && _type == mtpc_pageBlockVideo); + return static_cast(*data); +} +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockVideo) { +} +inline const MTPDpageBlockCover &MTPpageBlock::c_pageBlockCover() const { + t_assert(data != nullptr && _type == mtpc_pageBlockCover); + return static_cast(*data); +} +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockCover) { +} +inline const MTPDpageBlockEmbed &MTPpageBlock::c_pageBlockEmbed() const { + t_assert(data != nullptr && _type == mtpc_pageBlockEmbed); + return static_cast(*data); +} +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockEmbed) { +} +inline const MTPDpageBlockEmbedPost &MTPpageBlock::c_pageBlockEmbedPost() const { + t_assert(data != nullptr && _type == mtpc_pageBlockEmbedPost); + return static_cast(*data); +} +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockEmbedPost) { +} +inline const MTPDpageBlockCollage &MTPpageBlock::c_pageBlockCollage() const { + t_assert(data != nullptr && _type == mtpc_pageBlockCollage); + return static_cast(*data); +} +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockCollage) { +} +inline const MTPDpageBlockSlideshow &MTPpageBlock::c_pageBlockSlideshow() const { + t_assert(data != nullptr && _type == mtpc_pageBlockSlideshow); + return static_cast(*data); +} +inline MTPpageBlock::MTPpageBlock(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageBlockSlideshow) { } inline MTPpageBlock MTP_pageBlockUnsupported() { return MTP::internal::TypeCreator::new_pageBlockUnsupported(); @@ -40083,21 +38034,21 @@ inline mtpTypeId MTPpage::type() const { return _type; } inline void MTPpage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_pagePart: _type = cons; { - if (!data) setData(new MTPDpagePart()); - MTPDpagePart &v(_pagePart()); - v.vblocks.read(from, end); - v.vphotos.read(from, end); - v.vvideos.read(from, end); + auto v = std::make_shared(); + v->vblocks.read(from, end); + v->vphotos.read(from, end); + v->vvideos.read(from, end); + data = std::move(v); } break; case mtpc_pageFull: _type = cons; { - if (!data) setData(new MTPDpageFull()); - MTPDpageFull &v(_pageFull()); - v.vblocks.read(from, end); - v.vphotos.read(from, end); - v.vvideos.read(from, end); + auto v = std::make_shared(); + v->vblocks.read(from, end); + v->vphotos.read(from, end); + v->vvideos.read(from, end); + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPpage"); } @@ -40105,29 +38056,37 @@ inline void MTPpage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId inline void MTPpage::write(mtpBuffer &to) const { switch (_type) { case mtpc_pagePart: { - const MTPDpagePart &v(c_pagePart()); + auto &v = c_pagePart(); v.vblocks.write(to); v.vphotos.write(to); v.vvideos.write(to); } break; case mtpc_pageFull: { - const MTPDpageFull &v(c_pageFull()); + auto &v = c_pageFull(); v.vblocks.write(to); v.vphotos.write(to); v.vvideos.write(to); } break; } } -inline MTPpage::MTPpage(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPpage::MTPpage(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_pagePart: setData(new MTPDpagePart()); break; - case mtpc_pageFull: setData(new MTPDpageFull()); break; + case mtpc_pagePart: data = std::make_shared(); break; + case mtpc_pageFull: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPpage"); } } -inline MTPpage::MTPpage(MTPDpagePart *_data) : mtpDataOwner(_data), _type(mtpc_pagePart) { +inline const MTPDpagePart &MTPpage::c_pagePart() const { + t_assert(data != nullptr && _type == mtpc_pagePart); + return static_cast(*data); } -inline MTPpage::MTPpage(MTPDpageFull *_data) : mtpDataOwner(_data), _type(mtpc_pageFull) { +inline MTPpage::MTPpage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pagePart) { +} +inline const MTPDpageFull &MTPpage::c_pageFull() const { + t_assert(data != nullptr && _type == mtpc_pageFull); + return static_cast(*data); +} +inline MTPpage::MTPpage(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_pageFull) { } inline MTPpage MTP_pagePart(const MTPVector &_blocks, const MTPVector &_photos, const MTPVector &_videos) { return MTP::internal::TypeCreator::new_pagePart(_blocks, _photos, _videos); @@ -40136,7 +38095,7 @@ inline MTPpage MTP_pageFull(const MTPVector &_blocks, const MTPVec return MTP::internal::TypeCreator::new_pageFull(_blocks, _photos, _videos); } -inline MTPinputPhoneCall::MTPinputPhoneCall() : mtpDataOwner(new MTPDinputPhoneCall()) { +inline MTPinputPhoneCall::MTPinputPhoneCall() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPinputPhoneCall::innerLength() const { @@ -40149,17 +38108,21 @@ inline mtpTypeId MTPinputPhoneCall::type() const { inline void MTPinputPhoneCall::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_inputPhoneCall) throw mtpErrorUnexpected(cons, "MTPinputPhoneCall"); - if (!data) setData(new MTPDinputPhoneCall()); - MTPDinputPhoneCall &v(_inputPhoneCall()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + data = std::move(v); } inline void MTPinputPhoneCall::write(mtpBuffer &to) const { - const MTPDinputPhoneCall &v(c_inputPhoneCall()); + auto &v = c_inputPhoneCall(); v.vid.write(to); v.vaccess_hash.write(to); } -inline MTPinputPhoneCall::MTPinputPhoneCall(MTPDinputPhoneCall *_data) : mtpDataOwner(_data) { +inline const MTPDinputPhoneCall &MTPinputPhoneCall::c_inputPhoneCall() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPinputPhoneCall::MTPinputPhoneCall(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPinputPhoneCall MTP_inputPhoneCall(const MTPlong &_id, const MTPlong &_access_hash) { return MTP::internal::TypeCreator::new_inputPhoneCall(_id, _access_hash); @@ -40195,58 +38158,58 @@ inline mtpTypeId MTPphoneCall::type() const { return _type; } inline void MTPphoneCall::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); + data.reset(); switch (cons) { case mtpc_phoneCallEmpty: _type = cons; { - if (!data) setData(new MTPDphoneCallEmpty()); - MTPDphoneCallEmpty &v(_phoneCallEmpty()); - v.vid.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + data = std::move(v); } break; case mtpc_phoneCallWaiting: _type = cons; { - if (!data) setData(new MTPDphoneCallWaiting()); - MTPDphoneCallWaiting &v(_phoneCallWaiting()); - v.vflags.read(from, end); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vdate.read(from, end); - v.vadmin_id.read(from, end); - v.vparticipant_id.read(from, end); - v.vprotocol.read(from, end); - if (v.has_receive_date()) { v.vreceive_date.read(from, end); } else { v.vreceive_date = MTPint(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vdate.read(from, end); + v->vadmin_id.read(from, end); + v->vparticipant_id.read(from, end); + v->vprotocol.read(from, end); + if (v->has_receive_date()) { v->vreceive_date.read(from, end); } else { v->vreceive_date = MTPint(); } + data = std::move(v); } break; case mtpc_phoneCallRequested: _type = cons; { - if (!data) setData(new MTPDphoneCallRequested()); - MTPDphoneCallRequested &v(_phoneCallRequested()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vdate.read(from, end); - v.vadmin_id.read(from, end); - v.vparticipant_id.read(from, end); - v.vg_a.read(from, end); - v.vprotocol.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vdate.read(from, end); + v->vadmin_id.read(from, end); + v->vparticipant_id.read(from, end); + v->vg_a.read(from, end); + v->vprotocol.read(from, end); + data = std::move(v); } break; case mtpc_phoneCall: _type = cons; { - if (!data) setData(new MTPDphoneCall()); - MTPDphoneCall &v(_phoneCall()); - v.vid.read(from, end); - v.vaccess_hash.read(from, end); - v.vdate.read(from, end); - v.vadmin_id.read(from, end); - v.vparticipant_id.read(from, end); - v.vg_a_or_b.read(from, end); - v.vkey_fingerprint.read(from, end); - v.vprotocol.read(from, end); - v.vconnection.read(from, end); - v.valternative_connections.read(from, end); - v.vstart_date.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vaccess_hash.read(from, end); + v->vdate.read(from, end); + v->vadmin_id.read(from, end); + v->vparticipant_id.read(from, end); + v->vg_a_or_b.read(from, end); + v->vkey_fingerprint.read(from, end); + v->vprotocol.read(from, end); + v->vconnection.read(from, end); + v->valternative_connections.read(from, end); + v->vstart_date.read(from, end); + data = std::move(v); } break; case mtpc_phoneCallDiscarded: _type = cons; { - if (!data) setData(new MTPDphoneCallDiscarded()); - MTPDphoneCallDiscarded &v(_phoneCallDiscarded()); - v.vflags.read(from, end); - v.vid.read(from, end); - if (v.has_reason()) { v.vreason.read(from, end); } else { v.vreason = MTPPhoneCallDiscardReason(); } - if (v.has_duration()) { v.vduration.read(from, end); } else { v.vduration = MTPint(); } + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vid.read(from, end); + if (v->has_reason()) { v->vreason.read(from, end); } else { v->vreason = MTPPhoneCallDiscardReason(); } + if (v->has_duration()) { v->vduration.read(from, end); } else { v->vduration = MTPint(); } + data = std::move(v); } break; default: throw mtpErrorUnexpected(cons, "MTPphoneCall"); } @@ -40254,11 +38217,11 @@ inline void MTPphoneCall::read(const mtpPrime *&from, const mtpPrime *end, mtpTy inline void MTPphoneCall::write(mtpBuffer &to) const { switch (_type) { case mtpc_phoneCallEmpty: { - const MTPDphoneCallEmpty &v(c_phoneCallEmpty()); + auto &v = c_phoneCallEmpty(); v.vid.write(to); } break; case mtpc_phoneCallWaiting: { - const MTPDphoneCallWaiting &v(c_phoneCallWaiting()); + auto &v = c_phoneCallWaiting(); v.vflags.write(to); v.vid.write(to); v.vaccess_hash.write(to); @@ -40269,7 +38232,7 @@ inline void MTPphoneCall::write(mtpBuffer &to) const { if (v.has_receive_date()) v.vreceive_date.write(to); } break; case mtpc_phoneCallRequested: { - const MTPDphoneCallRequested &v(c_phoneCallRequested()); + auto &v = c_phoneCallRequested(); v.vid.write(to); v.vaccess_hash.write(to); v.vdate.write(to); @@ -40279,7 +38242,7 @@ inline void MTPphoneCall::write(mtpBuffer &to) const { v.vprotocol.write(to); } break; case mtpc_phoneCall: { - const MTPDphoneCall &v(c_phoneCall()); + auto &v = c_phoneCall(); v.vid.write(to); v.vaccess_hash.write(to); v.vdate.write(to); @@ -40293,7 +38256,7 @@ inline void MTPphoneCall::write(mtpBuffer &to) const { v.vstart_date.write(to); } break; case mtpc_phoneCallDiscarded: { - const MTPDphoneCallDiscarded &v(c_phoneCallDiscarded()); + auto &v = c_phoneCallDiscarded(); v.vflags.write(to); v.vid.write(to); if (v.has_reason()) v.vreason.write(to); @@ -40301,25 +38264,45 @@ inline void MTPphoneCall::write(mtpBuffer &to) const { } break; } } -inline MTPphoneCall::MTPphoneCall(mtpTypeId type) : mtpDataOwner(0), _type(type) { +inline MTPphoneCall::MTPphoneCall(mtpTypeId type) : mtpDataOwner(nullptr), _type(type) { switch (type) { - case mtpc_phoneCallEmpty: setData(new MTPDphoneCallEmpty()); break; - case mtpc_phoneCallWaiting: setData(new MTPDphoneCallWaiting()); break; - case mtpc_phoneCallRequested: setData(new MTPDphoneCallRequested()); break; - case mtpc_phoneCall: setData(new MTPDphoneCall()); break; - case mtpc_phoneCallDiscarded: setData(new MTPDphoneCallDiscarded()); break; + case mtpc_phoneCallEmpty: data = std::make_shared(); break; + case mtpc_phoneCallWaiting: data = std::make_shared(); break; + case mtpc_phoneCallRequested: data = std::make_shared(); break; + case mtpc_phoneCall: data = std::make_shared(); break; + case mtpc_phoneCallDiscarded: data = std::make_shared(); break; default: throw mtpErrorBadTypeId(type, "MTPphoneCall"); } } -inline MTPphoneCall::MTPphoneCall(MTPDphoneCallEmpty *_data) : mtpDataOwner(_data), _type(mtpc_phoneCallEmpty) { +inline const MTPDphoneCallEmpty &MTPphoneCall::c_phoneCallEmpty() const { + t_assert(data != nullptr && _type == mtpc_phoneCallEmpty); + return static_cast(*data); } -inline MTPphoneCall::MTPphoneCall(MTPDphoneCallWaiting *_data) : mtpDataOwner(_data), _type(mtpc_phoneCallWaiting) { +inline MTPphoneCall::MTPphoneCall(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_phoneCallEmpty) { } -inline MTPphoneCall::MTPphoneCall(MTPDphoneCallRequested *_data) : mtpDataOwner(_data), _type(mtpc_phoneCallRequested) { +inline const MTPDphoneCallWaiting &MTPphoneCall::c_phoneCallWaiting() const { + t_assert(data != nullptr && _type == mtpc_phoneCallWaiting); + return static_cast(*data); } -inline MTPphoneCall::MTPphoneCall(MTPDphoneCall *_data) : mtpDataOwner(_data), _type(mtpc_phoneCall) { +inline MTPphoneCall::MTPphoneCall(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_phoneCallWaiting) { } -inline MTPphoneCall::MTPphoneCall(MTPDphoneCallDiscarded *_data) : mtpDataOwner(_data), _type(mtpc_phoneCallDiscarded) { +inline const MTPDphoneCallRequested &MTPphoneCall::c_phoneCallRequested() const { + t_assert(data != nullptr && _type == mtpc_phoneCallRequested); + return static_cast(*data); +} +inline MTPphoneCall::MTPphoneCall(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_phoneCallRequested) { +} +inline const MTPDphoneCall &MTPphoneCall::c_phoneCall() const { + t_assert(data != nullptr && _type == mtpc_phoneCall); + return static_cast(*data); +} +inline MTPphoneCall::MTPphoneCall(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_phoneCall) { +} +inline const MTPDphoneCallDiscarded &MTPphoneCall::c_phoneCallDiscarded() const { + t_assert(data != nullptr && _type == mtpc_phoneCallDiscarded); + return static_cast(*data); +} +inline MTPphoneCall::MTPphoneCall(std::shared_ptr &&data) : mtpDataOwner(std::move(data)), _type(mtpc_phoneCallDiscarded) { } inline MTPphoneCall MTP_phoneCallEmpty(const MTPlong &_id) { return MTP::internal::TypeCreator::new_phoneCallEmpty(_id); @@ -40339,7 +38322,7 @@ inline MTPphoneCall MTP_phoneCallDiscarded(const MTPflags()) { } inline uint32 MTPphoneConnection::innerLength() const { @@ -40352,29 +38335,33 @@ inline mtpTypeId MTPphoneConnection::type() const { inline void MTPphoneConnection::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_phoneConnection) throw mtpErrorUnexpected(cons, "MTPphoneConnection"); - if (!data) setData(new MTPDphoneConnection()); - MTPDphoneConnection &v(_phoneConnection()); - v.vid.read(from, end); - v.vip.read(from, end); - v.vipv6.read(from, end); - v.vport.read(from, end); - v.vpeer_tag.read(from, end); + auto v = std::make_shared(); + v->vid.read(from, end); + v->vip.read(from, end); + v->vipv6.read(from, end); + v->vport.read(from, end); + v->vpeer_tag.read(from, end); + data = std::move(v); } inline void MTPphoneConnection::write(mtpBuffer &to) const { - const MTPDphoneConnection &v(c_phoneConnection()); + auto &v = c_phoneConnection(); v.vid.write(to); v.vip.write(to); v.vipv6.write(to); v.vport.write(to); v.vpeer_tag.write(to); } -inline MTPphoneConnection::MTPphoneConnection(MTPDphoneConnection *_data) : mtpDataOwner(_data) { +inline const MTPDphoneConnection &MTPphoneConnection::c_phoneConnection() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPphoneConnection::MTPphoneConnection(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPphoneConnection MTP_phoneConnection(const MTPlong &_id, const MTPstring &_ip, const MTPstring &_ipv6, MTPint _port, const MTPbytes &_peer_tag) { return MTP::internal::TypeCreator::new_phoneConnection(_id, _ip, _ipv6, _port, _peer_tag); } -inline MTPphoneCallProtocol::MTPphoneCallProtocol() : mtpDataOwner(new MTPDphoneCallProtocol()) { +inline MTPphoneCallProtocol::MTPphoneCallProtocol() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPphoneCallProtocol::innerLength() const { @@ -40387,26 +38374,30 @@ inline mtpTypeId MTPphoneCallProtocol::type() const { inline void MTPphoneCallProtocol::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_phoneCallProtocol) throw mtpErrorUnexpected(cons, "MTPphoneCallProtocol"); - if (!data) setData(new MTPDphoneCallProtocol()); - MTPDphoneCallProtocol &v(_phoneCallProtocol()); - v.vflags.read(from, end); - v.vmin_layer.read(from, end); - v.vmax_layer.read(from, end); + auto v = std::make_shared(); + v->vflags.read(from, end); + v->vmin_layer.read(from, end); + v->vmax_layer.read(from, end); + data = std::move(v); } inline void MTPphoneCallProtocol::write(mtpBuffer &to) const { - const MTPDphoneCallProtocol &v(c_phoneCallProtocol()); + auto &v = c_phoneCallProtocol(); v.vflags.write(to); v.vmin_layer.write(to); v.vmax_layer.write(to); } -inline MTPphoneCallProtocol::MTPphoneCallProtocol(MTPDphoneCallProtocol *_data) : mtpDataOwner(_data) { +inline const MTPDphoneCallProtocol &MTPphoneCallProtocol::c_phoneCallProtocol() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPphoneCallProtocol::MTPphoneCallProtocol(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDphoneCallProtocol::Flags) inline MTPphoneCallProtocol MTP_phoneCallProtocol(const MTPflags &_flags, MTPint _min_layer, MTPint _max_layer) { return MTP::internal::TypeCreator::new_phoneCallProtocol(_flags, _min_layer, _max_layer); } -inline MTPphone_phoneCall::MTPphone_phoneCall() : mtpDataOwner(new MTPDphone_phoneCall()) { +inline MTPphone_phoneCall::MTPphone_phoneCall() : mtpDataOwner(std::make_shared()) { } inline uint32 MTPphone_phoneCall::innerLength() const { @@ -40419,17 +38410,21 @@ inline mtpTypeId MTPphone_phoneCall::type() const { inline void MTPphone_phoneCall::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { if (cons != mtpc_phone_phoneCall) throw mtpErrorUnexpected(cons, "MTPphone_phoneCall"); - if (!data) setData(new MTPDphone_phoneCall()); - MTPDphone_phoneCall &v(_phone_phoneCall()); - v.vphone_call.read(from, end); - v.vusers.read(from, end); + auto v = std::make_shared(); + v->vphone_call.read(from, end); + v->vusers.read(from, end); + data = std::move(v); } inline void MTPphone_phoneCall::write(mtpBuffer &to) const { - const MTPDphone_phoneCall &v(c_phone_phoneCall()); + auto &v = c_phone_phoneCall(); v.vphone_call.write(to); v.vusers.write(to); } -inline MTPphone_phoneCall::MTPphone_phoneCall(MTPDphone_phoneCall *_data) : mtpDataOwner(_data) { +inline const MTPDphone_phoneCall &MTPphone_phoneCall::c_phone_phoneCall() const { + t_assert(data != nullptr); + return static_cast(*data); +} +inline MTPphone_phoneCall::MTPphone_phoneCall(std::shared_ptr &&data) : mtpDataOwner(std::move(data)) { } inline MTPphone_phoneCall MTP_phone_phoneCall(const MTPPhoneCall &_phone_call, const MTPVector &_users) { return MTP::internal::TypeCreator::new_phone_phoneCall(_phone_call, _users); diff --git a/Telegram/SourceFiles/mtproto/session.cpp b/Telegram/SourceFiles/mtproto/session.cpp index dbffacfa6..a6019fcf1 100644 --- a/Telegram/SourceFiles/mtproto/session.cpp +++ b/Telegram/SourceFiles/mtproto/session.cpp @@ -206,13 +206,15 @@ void Session::sendPong(quint64 msgId, quint64 pingId) { } void Session::sendMsgsStateInfo(quint64 msgId, QByteArray data) { - MTPMsgsStateInfo req(MTP_msgs_state_info(MTP_long(msgId), MTPstring())); - auto &info = req._msgs_state_info().vinfo._string().v; - info.resize(data.size()); + auto info = std::string(); if (!data.isEmpty()) { - memcpy(&info[0], data.constData(), data.size()); + info.resize(data.size()); + auto src = gsl::as_bytes(gsl::make_span(data)); +// auto dst = gsl::as_writeable_bytes(gsl::make_span(info)); + auto dst = gsl::as_writeable_bytes(gsl::make_span(&info[0], info.size())); + base::copy_bytes(dst, src); } - send(req); + send(MTPMsgsStateInfo(MTP_msgs_state_info(MTP_long(msgId), MTP_string(std::move(info))))); } void Session::checkRequestsByTimer() { diff --git a/Telegram/SourceFiles/ui/text/text_entity.cpp b/Telegram/SourceFiles/ui/text/text_entity.cpp index aa86fe23f..e314d1b48 100644 --- a/Telegram/SourceFiles/ui/text/text_entity.cpp +++ b/Telegram/SourceFiles/ui/text/text_entity.cpp @@ -1400,9 +1400,9 @@ EntitiesInText entitiesFromMTP(const QVector &entities) { } MTPVector linksToMTP(const EntitiesInText &links, bool sending) { - MTPVector result(MTP_vector(0)); - auto &v = result._vector().v; - for_const (const auto &link, links) { + auto v = QVector(); + v.reserve(links.size()); + for_const (auto &link, links) { if (link.length() <= 0) continue; if (sending && link.type() != EntityInTextCode @@ -1441,7 +1441,7 @@ MTPVector linksToMTP(const EntitiesInText &links, bool sending case EntityInTextPre: v.push_back(MTP_messageEntityPre(offset, length, MTP_string(link.data()))); break; } } - return result; + return MTP_vector(std::move(v)); } // Some code is duplicated in flattextarea.cpp!