Skip to content

Commit

Permalink
Export full messages information.
Browse files Browse the repository at this point in the history
Also add some more .match() calls to MTP codegen-ed classes.
  • Loading branch information
john-preston committed Jun 14, 2018
1 parent 83786dd commit 241fee8
Show file tree
Hide file tree
Showing 16 changed files with 887 additions and 148 deletions.
29 changes: 15 additions & 14 deletions Telegram/SourceFiles/codegen/scheme/codegen_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,19 +767,20 @@ def addTextSerializeInit(lst, dct):
else:
typesText += ' = default;\n';

if (withData):
typesText += getters;
if (withType):
typesText += '\n';
typesText += '\ttemplate <typename Method, typename ...Methods>\n';
typesText += '\tdecltype(auto) match(Method &&method, Methods &&...methods) const;\n';
visitorMethods += 'template <typename Method, typename ...Methods>\n';
visitorMethods += 'decltype(auto) MTP' + restype + '::match(Method &&method, Methods &&...methods) const {\n';
visitorMethods += '\tswitch (_type) {\n';
visitorMethods += visitor;
visitorMethods += '\t}\n';
visitorMethods += '\tUnexpected("Type in MTP' + restype + '::match.");\n';
visitorMethods += '}\n\n';
typesText += getters;
typesText += '\n';
typesText += '\ttemplate <typename Method, typename ...Methods>\n';
typesText += '\tdecltype(auto) match(Method &&method, Methods &&...methods) const;\n';
visitorMethods += 'template <typename Method, typename ...Methods>\n';
visitorMethods += 'decltype(auto) MTP' + restype + '::match(Method &&method, Methods &&...methods) const {\n';
if (withType):
visitorMethods += '\tswitch (_type) {\n';
visitorMethods += visitor;
visitorMethods += '\t}\n';
visitorMethods += '\tUnexpected("Type in MTP' + restype + '::match.");\n';
else:
visitorMethods += '\treturn base::match_method(c_' + v[0][0] + '(), std::forward<Method>(method), std::forward<Methods>(methods)...);\n';
visitorMethods += '}\n\n';

typesText += '\n\tuint32 innerLength() const;\n'; # size method
methods += '\nuint32 MTP' + restype + '::innerLength() const {\n';
Expand Down Expand Up @@ -843,7 +844,7 @@ def addTextSerializeInit(lst, dct):

if (withData):
typesText += constructsText;
methods += constructsBodies;
methods += constructsBodies;

if (friendDecl):
typesText += '\n' + friendDecl;
Expand Down
9 changes: 7 additions & 2 deletions Telegram/SourceFiles/core/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ For license and copyright information please follow this link:
*/
#pragma once

#include <cmath>
#include <set>
#include "logs.h"
#include "core/basic_types.h"
#include "base/flags.h"
#include "base/algorithm.h"
#include "base/assertion.h"

#include <QtCore/QReadWriteLock>
#include <QtCore/QRegularExpression>
#include <QtNetwork/QNetworkProxy>

#include <cmath>
#include <set>

// Define specializations for QByteArray for Qt 5.3.2, because
// QByteArray in Qt 5.3.2 doesn't declare "pointer" subtype.
#ifdef OS_MAC_OLD
Expand Down
Loading

0 comments on commit 241fee8

Please sign in to comment.