Use final instead of override.

This commit is contained in:
levlam 2021-07-03 23:51:36 +03:00
parent 3ead565d67
commit edfa5d1d98
191 changed files with 2356 additions and 2379 deletions

View File

@ -31,7 +31,7 @@ class RingBench : public td::Benchmark {
td::ConcurrentScheduler *scheduler_ = nullptr;
public:
std::string get_description() const override {
std::string get_description() const final {
static const char *types[] = {"later", "immediate", "raw", "tail", "lambda"};
static_assert(0 <= type && type < 5, "");
return PSTRING() << "Ring (send_" << types[type] << ") (threads_n = " << thread_n_ << ")";
@ -68,14 +68,14 @@ class RingBench : public td::Benchmark {
}
}
void raw_event(const td::Event::Raw &raw) override {
void raw_event(const td::Event::Raw &raw) final {
pass(static_cast<int>(raw.u32));
}
void start_up() override {
void start_up() final {
yield();
}
void wakeup() override {
void wakeup() final {
if (start_n != 0) {
int n = start_n;
start_n = 0;
@ -87,7 +87,7 @@ class RingBench : public td::Benchmark {
RingBench(int actor_n, int thread_n) : actor_n_(actor_n), thread_n_(thread_n) {
}
void start_up() override {
void start_up() final {
scheduler_ = new td::ConcurrentScheduler();
scheduler_->init(thread_n_);
@ -103,7 +103,7 @@ class RingBench : public td::Benchmark {
scheduler_->start();
}
void run(int n) override {
void run(int n) final {
// first actor is on main_thread
actor_array_[0].get_actor_unsafe()->start_n = td::max(n, 100);
while (scheduler_->run_main(10)) {
@ -111,7 +111,7 @@ class RingBench : public td::Benchmark {
}
}
void tear_down() override {
void tear_down() final {
scheduler_->finish();
delete scheduler_;
}
@ -120,7 +120,7 @@ class RingBench : public td::Benchmark {
template <int type>
class QueryBench : public td::Benchmark {
public:
std::string get_description() const override {
std::string get_description() const final {
static const char *types[] = {"callback", "immediate future", "delayed future", "dummy", "lambda", "lambda_future"};
static_assert(0 <= type && type < 6, "");
return PSTRING() << "QueryBench: " << types[type];
@ -163,14 +163,14 @@ class QueryBench : public td::Benchmark {
public:
explicit ClientCallback(td::ActorId<ServerActor> server) : server_(server) {
}
void on_result(int x) override {
void on_result(int x) final {
send_closure(server_, &ServerActor::on_result, x);
}
private:
td::ActorId<ServerActor> server_;
};
void start_up() override {
void start_up() final {
client_ = td::create_actor<ClientActor>("Client", td::make_unique<ClientCallback>(actor_id(this))).release();
}
@ -179,7 +179,7 @@ class QueryBench : public td::Benchmark {
wakeup();
}
void wakeup() override {
void wakeup() final {
while (true) {
if (n_ < 0) {
td::Scheduler::instance()->finish();
@ -222,7 +222,7 @@ class QueryBench : public td::Benchmark {
wakeup();
}
void raw_event(const td::Event::Raw &event) override {
void raw_event(const td::Event::Raw &event) final {
int val = future_.move_as_ok();
CHECK(val == n_ * n_);
wakeup();
@ -238,7 +238,7 @@ class QueryBench : public td::Benchmark {
td::FutureActor<int> future_;
};
void start_up() override {
void start_up() final {
scheduler_ = new td::ConcurrentScheduler();
scheduler_->init(0);
@ -246,7 +246,7 @@ class QueryBench : public td::Benchmark {
scheduler_->start();
}
void run(int n) override {
void run(int n) final {
// first actor is on main_thread
{
auto guard = scheduler_->get_main_guard();
@ -257,7 +257,7 @@ class QueryBench : public td::Benchmark {
}
}
void tear_down() override {
void tear_down() final {
server_.release();
scheduler_->finish();
delete scheduler_;

View File

@ -33,18 +33,18 @@ class SHA1Bench : public td::Benchmark {
public:
alignas(64) unsigned char data[DATA_SIZE];
std::string get_description() const override {
std::string get_description() const final {
return PSTRING() << "SHA1 OpenSSL [" << (DATA_SIZE >> 10) << "KB]";
}
void start_up() override {
void start_up() final {
for (int i = 0; i < DATA_SIZE; i++) {
data[i] = 123;
data[i] = 0;
}
}
void run(int n) override {
void run(int n) final {
for (int i = 0; i < n; i++) {
unsigned char md[20];
SHA1(data, DATA_SIZE, md);
@ -59,11 +59,11 @@ class AesEcbBench : public td::Benchmark {
td::UInt256 key;
td::UInt256 iv;
std::string get_description() const override {
std::string get_description() const final {
return PSTRING() << "AES ECB OpenSSL [" << (DATA_SIZE >> 10) << "KB]";
}
void start_up() override {
void start_up() final {
for (int i = 0; i < DATA_SIZE; i++) {
data[i] = 123;
}
@ -71,7 +71,7 @@ class AesEcbBench : public td::Benchmark {
td::Random::secure_bytes(iv.raw, sizeof(iv));
}
void run(int n) override {
void run(int n) final {
td::AesState state;
state.init(td::as_slice(key), true);
td::MutableSlice data_slice(data, DATA_SIZE);
@ -90,11 +90,11 @@ class AesIgeEncryptBench : public td::Benchmark {
td::UInt256 key;
td::UInt256 iv;
std::string get_description() const override {
std::string get_description() const final {
return PSTRING() << "AES IGE OpenSSL encrypt [" << (DATA_SIZE >> 10) << "KB]";
}
void start_up() override {
void start_up() final {
for (int i = 0; i < DATA_SIZE; i++) {
data[i] = 123;
}
@ -102,7 +102,7 @@ class AesIgeEncryptBench : public td::Benchmark {
td::Random::secure_bytes(iv.raw, sizeof(iv));
}
void run(int n) override {
void run(int n) final {
td::MutableSlice data_slice(data, DATA_SIZE);
td::AesIgeState state;
state.init(as_slice(key), as_slice(iv), true);
@ -118,11 +118,11 @@ class AesIgeDecryptBench : public td::Benchmark {
td::UInt256 key;
td::UInt256 iv;
std::string get_description() const override {
std::string get_description() const final {
return PSTRING() << "AES IGE OpenSSL decrypt [" << (DATA_SIZE >> 10) << "KB]";
}
void start_up() override {
void start_up() final {
for (int i = 0; i < DATA_SIZE; i++) {
data[i] = 123;
}
@ -130,7 +130,7 @@ class AesIgeDecryptBench : public td::Benchmark {
td::Random::secure_bytes(iv.raw, sizeof(iv));
}
void run(int n) override {
void run(int n) final {
td::MutableSlice data_slice(data, DATA_SIZE);
td::AesIgeState state;
state.init(as_slice(key), as_slice(iv), false);
@ -146,11 +146,11 @@ class AesCtrBench : public td::Benchmark {
td::UInt256 key;
td::UInt128 iv;
std::string get_description() const override {
std::string get_description() const final {
return PSTRING() << "AES CTR OpenSSL [" << (DATA_SIZE >> 10) << "KB]";
}
void start_up() override {
void start_up() final {
for (int i = 0; i < DATA_SIZE; i++) {
data[i] = 123;
}
@ -158,7 +158,7 @@ class AesCtrBench : public td::Benchmark {
td::Random::secure_bytes(iv.raw, sizeof(iv));
}
void run(int n) override {
void run(int n) final {
td::MutableSlice data_slice(data, DATA_SIZE);
td::AesCtrState state;
state.init(as_slice(key), as_slice(iv));
@ -175,11 +175,11 @@ class AesCtrOpenSSLBench : public td::Benchmark {
td::UInt256 key;
td::UInt128 iv;
std::string get_description() const override {
std::string get_description() const final {
return PSTRING() << "AES CTR RAW OpenSSL [" << (DATA_SIZE >> 10) << "KB]";
}
void start_up() override {
void start_up() final {
for (int i = 0; i < DATA_SIZE; i++) {
data[i] = 123;
}
@ -187,7 +187,7 @@ class AesCtrOpenSSLBench : public td::Benchmark {
td::Random::secure_bytes(iv.raw, sizeof(iv));
}
void run(int n) override {
void run(int n) final {
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
EVP_EncryptInit_ex(ctx, EVP_aes_256_ctr(), nullptr, key.raw, iv.raw);
@ -211,11 +211,11 @@ class AesCbcDecryptBench : public td::Benchmark {
td::UInt256 key;
td::UInt128 iv;
std::string get_description() const override {
std::string get_description() const final {
return PSTRING() << "AES CBC Decrypt OpenSSL [" << (DATA_SIZE >> 10) << "KB]";
}
void start_up() override {
void start_up() final {
for (int i = 0; i < DATA_SIZE; i++) {
data[i] = 123;
}
@ -223,7 +223,7 @@ class AesCbcDecryptBench : public td::Benchmark {
td::Random::secure_bytes(as_slice(iv));
}
void run(int n) override {
void run(int n) final {
td::MutableSlice data_slice(data, DATA_SIZE);
for (int i = 0; i < n; i++) {
td::aes_cbc_decrypt(as_slice(key), as_slice(iv), data_slice, data_slice);
@ -237,11 +237,11 @@ class AesCbcEncryptBench : public td::Benchmark {
td::UInt256 key;
td::UInt128 iv;
std::string get_description() const override {
std::string get_description() const final {
return PSTRING() << "AES CBC Encrypt OpenSSL [" << (DATA_SIZE >> 10) << "KB]";
}
void start_up() override {
void start_up() final {
for (int i = 0; i < DATA_SIZE; i++) {
data[i] = 123;
}
@ -249,7 +249,7 @@ class AesCbcEncryptBench : public td::Benchmark {
td::Random::secure_bytes(as_slice(iv));
}
void run(int n) override {
void run(int n) final {
td::MutableSlice data_slice(data, DATA_SIZE);
for (int i = 0; i < n; i++) {
td::aes_cbc_encrypt(as_slice(key), as_slice(iv), data_slice, data_slice);
@ -264,11 +264,11 @@ class AesIgeShortBench : public td::Benchmark {
td::UInt256 key;
td::UInt256 iv;
std::string get_description() const override {
std::string get_description() const final {
return PSTRING() << "AES IGE OpenSSL " << (use_state ? "EVP" : "C ") << "[" << SHORT_DATA_SIZE << "B]";
}
void start_up() override {
void start_up() final {
for (int i = 0; i < SHORT_DATA_SIZE; i++) {
data[i] = 123;
}
@ -276,7 +276,7 @@ class AesIgeShortBench : public td::Benchmark {
td::Random::secure_bytes(as_slice(iv));
}
void run(int n) override {
void run(int n) final {
td::MutableSlice data_slice(data, SHORT_DATA_SIZE);
for (int i = 0; i < n; i++) {
if (use_state) {
@ -367,18 +367,18 @@ class Crc32Bench : public td::Benchmark {
public:
alignas(64) unsigned char data[DATA_SIZE];
std::string get_description() const override {
std::string get_description() const final {
return PSTRING() << "Crc32 zlib [" << (DATA_SIZE >> 10) << "KB]";
}
void start_up() override {
void start_up() final {
for (int i = 0; i < DATA_SIZE; i++) {
data[i] = 123;
data[i] = 0;
}
}
void run(int n) override {
void run(int n) final {
td::uint64 res = 0;
for (int i = 0; i < n; i++) {
res += td::crc32(td::Slice(data, DATA_SIZE));
@ -391,18 +391,18 @@ class Crc64Bench : public td::Benchmark {
public:
alignas(64) unsigned char data[DATA_SIZE];
std::string get_description() const override {
std::string get_description() const final {
return PSTRING() << "Crc64 Anton [" << (DATA_SIZE >> 10) << "KB]";
}
void start_up() override {
void start_up() final {
for (int i = 0; i < DATA_SIZE; i++) {
data[i] = 123;
data[i] = 0;
}
}
void run(int n) override {
void run(int n) final {
td::uint64 res = 0;
for (int i = 0; i < n; i++) {
res += td::crc64(td::Slice(data, DATA_SIZE));

View File

@ -37,7 +37,7 @@ class TdKvBench : public td::Benchmark {
name_ = std::move(name);
}
td::string get_description() const override {
td::string get_description() const final {
return name_;
}
@ -47,7 +47,7 @@ class TdKvBench : public td::Benchmark {
}
private:
void loop() override {
void loop() final {
KeyValueT::destroy("test_tddb").ignore();
class Worker : public Actor {
@ -57,7 +57,7 @@ class TdKvBench : public td::Benchmark {
}
private:
void loop() override {
void loop() final {
for (int i = 0; i < n_; i++) {
kv_.set(td::to_string(i % 10), td::to_string(i));
}
@ -71,12 +71,12 @@ class TdKvBench : public td::Benchmark {
int n_;
};
void start_up_n(int n) override {
void start_up_n(int n) final {
sched.init(1);
sched.create_actor_unsafe<Main>(1, "Main", n).release();
}
void run(int n) override {
void run(int n) final {
sched.start();
while (sched.run_main(10)) {
// empty
@ -84,17 +84,17 @@ class TdKvBench : public td::Benchmark {
sched.finish();
}
void tear_down() override {
void tear_down() final {
}
};
template <bool is_encrypted = false>
class SqliteKVBench : public td::Benchmark {
td::SqliteDb db;
td::string get_description() const override {
td::string get_description() const final {
return PSTRING() << "SqliteKV " << td::tag("is_encrypted", is_encrypted);
}
void start_up() override {
void start_up() final {
td::string path = "testdb.sqlite";
td::SqliteDb::destroy(path).ignore();
if (is_encrypted) {
@ -110,7 +110,7 @@ class SqliteKVBench : public td::Benchmark {
db.exec("DROP TABLE IF EXISTS KV").ensure();
db.exec("CREATE TABLE IF NOT EXISTS KV (k BLOB PRIMARY KEY, v BLOB)").ensure();
}
void run(int n) override {
void run(int n) final {
auto stmt = db.get_statement("REPLACE INTO KV (k, v) VALUES(?1, ?2)").move_as_ok();
db.exec("BEGIN TRANSACTION").ensure();
for (int i = 0; i < n; i++) {
@ -144,14 +144,14 @@ static td::Status init_db(td::SqliteDb &db) {
class SqliteKeyValueAsyncBench : public td::Benchmark {
public:
td::string get_description() const override {
td::string get_description() const final {
return "SqliteKeyValueAsync";
}
void start_up() override {
void start_up() final {
do_start_up().ensure();
scheduler_->start();
}
void run(int n) override {
void run(int n) final {
auto guard = scheduler_->get_main_guard();
for (int i = 0; i < n; i++) {
@ -160,7 +160,7 @@ class SqliteKeyValueAsyncBench : public td::Benchmark {
sqlite_kv_async_->set(key, value, td::Auto());
}
}
void tear_down() override {
void tear_down() final {
scheduler_->run_main(0.1);
{
auto guard = scheduler_->get_main_guard();
@ -200,12 +200,12 @@ class SqliteKeyValueAsyncBench : public td::Benchmark {
};
class SeqKvBench : public td::Benchmark {
td::string get_description() const override {
td::string get_description() const final {
return "SeqKvBench";
}
td::SeqKeyValue kv;
void run(int n) override {
void run(int n) final {
for (int i = 0; i < n; i++) {
kv.set(PSLICE() << i % 10, PSLICE() << i);
}
@ -214,16 +214,16 @@ class SeqKvBench : public td::Benchmark {
template <bool is_encrypted = false>
class BinlogKeyValueBench : public td::Benchmark {
td::string get_description() const override {
td::string get_description() const final {
return PSTRING() << "BinlogKeyValue " << td::tag("is_encrypted", is_encrypted);
}
td::BinlogKeyValue<td::Binlog> kv;
void start_up() override {
void start_up() final {
td::SqliteDb::destroy("test_binlog").ignore();
kv.init("test_binlog", is_encrypted ? td::DbKey::password("cucumber") : td::DbKey::empty()).ensure();
}
void run(int n) override {
void run(int n) final {
for (int i = 0; i < n; i++) {
kv.set(td::to_string(i % 10), td::to_string(i));
}

View File

@ -29,29 +29,29 @@ static string prime_base64 =
"w";
class HandshakeBench : public Benchmark {
std::string get_description() const override {
std::string get_description() const final {
return "Handshake";
}
class FakeDhCallback : public DhCallback {
public:
int is_good_prime(Slice prime_str) const override {
int is_good_prime(Slice prime_str) const final {
auto it = cache.find(prime_str.str());
if (it == cache.end()) {
return -1;
}
return it->second;
}
void add_good_prime(Slice prime_str) const override {
void add_good_prime(Slice prime_str) const final {
cache[prime_str.str()] = 1;
}
void add_bad_prime(Slice prime_str) const override {
void add_bad_prime(Slice prime_str) const final {
cache[prime_str.str()] = 0;
}
mutable std::map<string, int> cache;
} dh_callback;
void run(int n) override {
void run(int n) final {
DhHandshake a;
DhHandshake b;
auto prime = base64url_decode(prime_base64).move_as_ok();

View File

@ -25,7 +25,7 @@ namespace td {
std::atomic<int> counter;
class HttpClient : public HttpOutboundConnection::Callback {
void start_up() override {
void start_up() final {
IPAddress addr;
addr.init_ipv4_port("127.0.0.1", 8082).ensure();
auto fd = SocketFd::open(addr);
@ -37,12 +37,12 @@ class HttpClient : public HttpOutboundConnection::Callback {
cnt_ = 100000;
counter++;
}
void tear_down() override {
void tear_down() final {
if (--counter == 0) {
Scheduler::instance()->finish();
}
}
void loop() override {
void loop() final {
if (cnt_-- < 0) {
return stop();
}
@ -50,10 +50,10 @@ class HttpClient : public HttpOutboundConnection::Callback {
send_closure(connection_, &HttpOutboundConnection::write_ok);
LOG(INFO) << "SEND";
}
void handle(unique_ptr<HttpQuery> result) override {
void handle(unique_ptr<HttpQuery> result) final {
loop();
}
void on_connection_error(Status error) override {
void on_connection_error(Status error) final {
LOG(ERROR) << "ERROR: " << error;
}

View File

@ -17,11 +17,11 @@ static std::string http_query = "GET / HTTP/1.1\r\nConnection:keep-alive\r\nhost
static const size_t block_size = 2500;
class HttpReaderBench : public td::Benchmark {
std::string get_description() const override {
std::string get_description() const final {
return "HttpReaderBench";
}
void run(int n) override {
void run(int n) final {
int cnt = static_cast<int>(block_size / http_query.size());
td::HttpQuery q;
int parsed = 0;
@ -46,18 +46,18 @@ class HttpReaderBench : public td::Benchmark {
td::ChainBufferReader reader_;
td::HttpReader http_reader_;
void start_up() override {
void start_up() final {
reader_ = writer_.extract_reader();
http_reader_.init(&reader_, 10000, 0);
}
};
class BufferBench : public td::Benchmark {
std::string get_description() const override {
std::string get_description() const final {
return "BufferBench";
}
void run(int n) override {
void run(int n) final {
int cnt = static_cast<int>(block_size / http_query.size());
for (int i = 0; i < n; i += cnt) {
for (int j = 0; j < cnt; j++) {
@ -73,17 +73,17 @@ class BufferBench : public td::Benchmark {
td::ChainBufferReader reader_;
td::HttpReader http_reader_;
void start_up() override {
void start_up() final {
reader_ = writer_.extract_reader();
}
};
class FindBoundaryBench : public td::Benchmark {
std::string get_description() const override {
std::string get_description() const final {
return "FindBoundaryBench";
}
void run(int n) override {
void run(int n) final {
int cnt = static_cast<int>(block_size / http_query.size());
for (int i = 0; i < n; i += cnt) {
for (int j = 0; j < cnt; j++) {
@ -103,7 +103,7 @@ class FindBoundaryBench : public td::Benchmark {
td::ChainBufferReader reader_;
td::HttpReader http_reader_;
void start_up() override {
void start_up() final {
reader_ = writer_.extract_reader();
}
};

View File

@ -23,7 +23,7 @@ static int cnt = 0;
class HelloWorld : public HttpInboundConnection::Callback {
public:
void handle(unique_ptr<HttpQuery> query, ActorOwn<HttpInboundConnection> connection) override {
void handle(unique_ptr<HttpQuery> query, ActorOwn<HttpInboundConnection> connection) final {
// LOG(ERROR) << *query;
HttpHeaderCreator hc;
Slice content = "hello world";
@ -40,7 +40,7 @@ class HelloWorld : public HttpInboundConnection::Callback {
send_closure(connection, &HttpInboundConnection::write_next, BufferSlice(res.ok()));
send_closure(connection.release(), &HttpInboundConnection::write_ok);
}
void hangup() override {
void hangup() final {
LOG(ERROR) << "CLOSE " << cnt--;
stop();
}
@ -49,10 +49,10 @@ class HelloWorld : public HttpInboundConnection::Callback {
const int N = 0;
class Server : public TcpListener::Callback {
public:
void start_up() override {
void start_up() final {
listener_ = create_actor<TcpListener>("Listener", 8082, ActorOwn<TcpListener::Callback>(actor_id(this)));
}
void accept(SocketFd fd) override {
void accept(SocketFd fd) final {
LOG(ERROR) << "ACCEPT " << cnt++;
pos_++;
auto scheduler_id = pos_ % (N != 0 ? N : 1) + (N != 0);
@ -61,7 +61,7 @@ class Server : public TcpListener::Callback {
create_actor_on_scheduler<HelloWorld>("HelloWorld", scheduler_id))
.release();
}
void hangup() override {
void hangup() final {
// may be it should be default?..
LOG(ERROR) << "Hanging up..";
stop();

View File

@ -39,7 +39,7 @@ class HelloWorld : public Actor {
std::string write_buf_;
size_t write_pos_{0};
void start_up() override {
void start_up() final {
Scheduler::subscribe(socket_fd_.get_poll_info().extract_pollable_fd(this));
HttpHeaderCreator hc;
Slice content = "hello world";
@ -53,7 +53,7 @@ class HelloWorld : public Actor {
hello_ = hc.finish(content).ok().str();
}
void loop() override {
void loop() final {
auto status = do_loop();
if (status.is_error()) {
Scheduler::unsubscribe(socket_fd_.get_poll_info().get_pollable_fd_ref());
@ -100,16 +100,16 @@ class HelloWorld : public Actor {
const int N = 0;
class Server : public TcpListener::Callback {
public:
void start_up() override {
void start_up() final {
listener_ = create_actor<TcpListener>("Listener", 8082, ActorOwn<TcpListener::Callback>(actor_id(this)));
}
void accept(SocketFd fd) override {
void accept(SocketFd fd) final {
LOG(ERROR) << "ACCEPT " << cnt++;
pos_++;
auto scheduler_id = pos_ % (N != 0 ? N : 1) + (N != 0);
create_actor_on_scheduler<HelloWorld>("HttpInboundConnection", scheduler_id, std::move(fd)).release();
}
void hangup() override {
void hangup() final {
// may be it should be default?..
LOG(ERROR) << "Hanging up..";
stop();

View File

@ -31,11 +31,11 @@ class HttpEchoConnection : public Actor {
BufferedFd<SocketFd> fd_;
HttpReader reader_;
HttpQuery query_;
void start_up() override {
void start_up() final {
Scheduler::subscribe(fd_.get_poll_info().extract_pollable_fd(this));
reader_.init(&fd_.input_buffer(), 1024 * 1024, 0);
}
void tear_down() override {
void tear_down() final {
Scheduler::unsubscribe_before_close(fd_.get_poll_info().get_pollable_fd_ref());
fd_.close();
}
@ -55,7 +55,7 @@ class HttpEchoConnection : public Actor {
fd_.output_buffer().append(res.ok());
}
void loop() override {
void loop() final {
sync_with_poll(fd_);
auto status = [&] {
TRY_STATUS(loop_read());
@ -87,15 +87,15 @@ class HttpEchoConnection : public Actor {
const int N = 8;
class Server : public TcpListener::Callback {
public:
void start_up() override {
void start_up() final {
listener_ = create_actor<TcpListener>("Listener", 8082, ActorOwn<TcpListener::Callback>(actor_id(this)));
}
void accept(SocketFd fd) override {
void accept(SocketFd fd) final {
pos_++;
auto scheduler_id = pos_ % (N != 0 ? N : 1) + (N != 0);
create_actor_on_scheduler<HttpEchoConnection>("HttpInboundConnection", scheduler_id, std::move(fd)).release();
}
void hangup() override {
void hangup() final {
LOG(ERROR) << "Hanging up..";
stop();
}

View File

@ -44,24 +44,24 @@ class IostreamWriteBench : public td::Benchmark {
char buffer[BUFFER_SIZE];
public:
std::string get_description() const override {
std::string get_description() const final {
return "ostream (to file, no buf, no flush)";
}
void start_up() override {
void start_up() final {
file_name_ = create_tmp_file();
stream.open(file_name_.c_str());
CHECK(stream.is_open());
// stream.rdbuf()->pubsetbuf(buffer, BUFFER_SIZE);
}
void run(int n) override {
void run(int n) final {
for (int i = 0; i < n; i++) {
stream << "This is just for test" << 987654321 << '\n';
}
}
void tear_down() override {
void tear_down() final {
stream.close();
unlink(file_name_.c_str());
}
@ -75,24 +75,24 @@ class FILEWriteBench : public td::Benchmark {
char buffer[BUFFER_SIZE];
public:
std::string get_description() const override {
std::string get_description() const final {
return "std::fprintf (to file, no buf, no flush)";
}
void start_up() override {
void start_up() final {
file_name_ = create_tmp_file();
file = fopen(file_name_.c_str(), "w");
// setvbuf(file, buffer, _IOFBF, BUFFER_SIZE);
}
void run(int n) override {
void run(int n) final {
for (int i = 0; i < n; i++) {
std::fprintf(file, "This is just for test%d\n", 987654321);
// std::fflush(file);
}
}
void tear_down() override {
void tear_down() final {
std::fclose(file);
unlink(file_name_.c_str());
}
@ -103,17 +103,17 @@ class FILEWriteBench : public td::Benchmark {
#define ALOG(...) __android_log_print(ANDROID_LOG_VERBOSE, "XXX", __VA_ARGS__)
class ALogWriteBench : public td::Benchmark {
public:
std::string get_description() const override {
std::string get_description() const final {
return "android_log";
}
void start_up() override {
void start_up() final {
}
void run(int n) override {
void run(int n) final {
for (int i = 0; i < n; i++) {
ALOG("This is just for test%d\n", 987654321);
}
}
void tear_down() override {
void tear_down() final {
}
};
#endif
@ -127,24 +127,24 @@ class LogWriteBench : public td::Benchmark {
char buffer[BUFFER_SIZE];
public:
std::string get_description() const override {
std::string get_description() const final {
return "td_log (slow in debug mode)";
}
void start_up() override {
void start_up() final {
file_name_ = create_tmp_file();
stream.open(file_name_.c_str());
CHECK(stream.is_open());
old_buf = std::cerr.rdbuf(stream.rdbuf());
}
void run(int n) override {
void run(int n) final {
for (int i = 0; i < n; i++) {
LOG(DEBUG) << "This is just for test" << 987654321;
}
}
void tear_down() override {
void tear_down() final {
stream.close();
unlink(file_name_.c_str());
std::cerr.rdbuf(old_buf);

View File

@ -123,16 +123,16 @@ class PipeBench : public Benchmark {
public:
int p[2];
string get_description() const override {
string get_description() const final {
return "pipe write + read int32";
}
void start_up() override {
void start_up() final {
int res = pipe(p);
CHECK(res == 0);
}
void run(int n) override {
void run(int n) final {
int res = 0;
for (int i = 0; i < n; i++) {
int val = 1;
@ -145,7 +145,7 @@ class PipeBench : public Benchmark {
do_not_optimize_away(res);
}
void tear_down() override {
void tear_down() final {
close(p[0]);
close(p[1]);
}
@ -157,23 +157,23 @@ class SemBench : public Benchmark {
sem_t sem;
public:
string get_description() const override {
string get_description() const final {
return "sem post + wait";
}
void start_up() override {
void start_up() final {
int err = sem_init(&sem, 0, 0);
CHECK(err != -1);
}
void run(int n) override {
void run(int n) final {
for (int i = 0; i < n; i++) {
sem_post(&sem);
sem_wait(&sem);
}
}
void tear_down() override {
void tear_down() final {
sem_destroy(&sem);
}
};
@ -182,13 +182,13 @@ class SemBench : public Benchmark {
#if !TD_WINDOWS
class UtimeBench : public Benchmark {
public:
void start_up() override {
void start_up() final {
FileFd::open("test", FileFd::Flags::Create | FileFd::Flags::Write).move_as_ok().close();
}
string get_description() const override {
string get_description() const final {
return "utime";
}
void run(int n) override {
void run(int n) final {
for (int i = 0; i < n; i++) {
int err = utime("test", nullptr);
CHECK(err >= 0);
@ -211,18 +211,18 @@ BENCH(Pwrite, "pwrite") {
}
class CreateFileBench : public Benchmark {
string get_description() const override {
string get_description() const final {
return "create_file";
}
void start_up() override {
void start_up() final {
mkdir("A").ensure();
}
void run(int n) override {
void run(int n) final {
for (int i = 0; i < n; i++) {
FileFd::open(PSLICE() << "A/" << i, FileFd::Flags::Write | FileFd::Flags::Create).move_as_ok().close();
}
}
void tear_down() override {
void tear_down() final {
td::walk_path("A/", [&](CSlice path, auto type) {
if (type == td::WalkPath::Type::ExitDir) {
rmdir(path).ignore();
@ -234,16 +234,16 @@ class CreateFileBench : public Benchmark {
};
class WalkPathBench : public Benchmark {
string get_description() const override {
string get_description() const final {
return "walk_path";
}
void start_up_n(int n) override {
void start_up_n(int n) final {
mkdir("A").ensure();
for (int i = 0; i < n; i++) {
FileFd::open(PSLICE() << "A/" << i, FileFd::Flags::Write | FileFd::Flags::Create).move_as_ok().close();
}
}
void run(int n) override {
void run(int n) final {
int cnt = 0;
td::walk_path("A/", [&](CSlice path, auto type) {
if (type == td::WalkPath::Type::EnterDir) {
@ -253,7 +253,7 @@ class WalkPathBench : public Benchmark {
cnt++;
}).ignore();
}
void tear_down() override {
void tear_down() final {
td::walk_path("A/", [&](CSlice path, auto type) {
if (type == td::WalkPath::Type::ExitDir) {
rmdir(path).ignore();
@ -267,12 +267,12 @@ class WalkPathBench : public Benchmark {
#if !TD_THREAD_UNSUPPORTED
template <int ThreadN = 2>
class AtomicReleaseIncBench : public Benchmark {
string get_description() const override {
string get_description() const final {
return PSTRING() << "AtomicReleaseInc" << ThreadN;
}
static std::atomic<uint64> a_;
void run(int n) override {
void run(int n) final {
std::vector<thread> threads;
for (int i = 0; i < ThreadN; i++) {
threads.emplace_back([&] {
@ -291,12 +291,12 @@ std::atomic<uint64> AtomicReleaseIncBench<ThreadN>::a_;
template <int ThreadN = 2>
class AtomicReleaseCasIncBench : public Benchmark {
string get_description() const override {
string get_description() const final {
return PSTRING() << "AtomicReleaseCasInc" << ThreadN;
}
static std::atomic<uint64> a_;
void run(int n) override {
void run(int n) final {
std::vector<thread> threads;
for (int i = 0; i < ThreadN; i++) {
threads.emplace_back([&] {
@ -317,11 +317,11 @@ std::atomic<uint64> AtomicReleaseCasIncBench<ThreadN>::a_;
template <int ThreadN = 2>
class RwMutexReadBench : public Benchmark {
string get_description() const override {
string get_description() const final {
return PSTRING() << "RwMutexRead" << ThreadN;
}
RwMutex mutex_;
void run(int n) override {
void run(int n) final {
std::vector<thread> threads;
for (int i = 0; i < ThreadN; i++) {
threads.emplace_back([&] {
@ -337,11 +337,11 @@ class RwMutexReadBench : public Benchmark {
};
template <int ThreadN = 2>
class RwMutexWriteBench : public Benchmark {
string get_description() const override {
string get_description() const final {
return PSTRING() << "RwMutexWrite" << ThreadN;
}
RwMutex mutex_;
void run(int n) override {
void run(int n) final {
std::vector<thread> threads;
for (int i = 0; i < ThreadN; i++) {
threads.emplace_back([&] {

View File

@ -575,16 +575,16 @@ class QueueBenchmark2 : public td::Benchmark {
explicit QueueBenchmark2(int connections_n = 1) : connections_n(connections_n) {
}
std::string get_description() const override {
std::string get_description() const final {
return "QueueBenchmark2";
}
void start_up() override {
void start_up() final {
client.init();
server.init();
}
void tear_down() override {
void tear_down() final {
client.destroy();
server.destroy();
}
@ -689,7 +689,7 @@ class QueueBenchmark2 : public td::Benchmark {
return static_cast<QueueBenchmark2 *>(arg)->server_run(nullptr);
}
void run(int n) override {
void run(int n) final {
pthread_t client_thread_id;
pthread_t server_thread_id;
@ -713,16 +713,16 @@ class QueueBenchmark : public td::Benchmark {
explicit QueueBenchmark(int connections_n = 1) : connections_n(connections_n) {
}
std::string get_description() const override {
std::string get_description() const final {
return "QueueBenchmark";
}
void start_up() override {
void start_up() final {
client.init();
server.init();
}
void tear_down() override {
void tear_down() final {
client.destroy();
server.destroy();
}
@ -821,7 +821,7 @@ class QueueBenchmark : public td::Benchmark {
return static_cast<QueueBenchmark *>(arg)->server_run(nullptr);
}
void run(int n) override {
void run(int n) final {
pthread_t client_thread_id;
pthread_t server_thread_id;
@ -869,7 +869,7 @@ class RingBenchmark : public td::Benchmark {
return static_cast<Thread *>(arg)->run();
}
void start_up() override {
void start_up() final {
for (int i = 0; i < QN; i++) {
q[i].int_id = i;
q[i].queue.init();
@ -877,13 +877,13 @@ class RingBenchmark : public td::Benchmark {
}
}
void tear_down() override {
void tear_down() final {
for (int i = 0; i < QN; i++) {
q[i].queue.destroy();
}
}
void run(int n) override {
void run(int n) final {
for (int i = 0; i < QN; i++) {
pthread_create(&q[i].id, nullptr, run_gateway, &q[i]);
}

View File

@ -39,15 +39,15 @@ static Status init_db(SqliteDb &db) {
class MessagesDbBench : public Benchmark {
public:
string get_description() const override {
string get_description() const final {
return "MessagesDb";
}
void start_up() override {
void start_up() final {
LOG(ERROR) << "START UP";
do_start_up().ensure();
scheduler_->start();
}
void run(int n) override {
void run(int n) final {
auto guard = scheduler_->get_main_guard();
for (int i = 0; i < n; i += 20) {
auto dialog_id = DialogId{UserId{Random::fast(1, 100)}};
@ -67,7 +67,7 @@ class MessagesDbBench : public Benchmark {
}
}
}
void tear_down() override {
void tear_down() final {
scheduler_->run_main(0.1);
{
auto guard = scheduler_->get_main_guard();

View File

@ -24,47 +24,47 @@ class TlWriterCCommon : public tl::TL_writer {
: TL_writer(name), is_header_(is_header), prefix_(prefix) {
}
int get_max_arity() const override {
int get_max_arity() const final {
return 0;
}
bool is_built_in_simple_type(const std::string &name) const override {
bool is_built_in_simple_type(const std::string &name) const final {
return name == "Bool" || name == "Int32" || name == "Int53" || name == "Int64" || name == "Double" ||
name == "String" || name == "Bytes";
}
bool is_built_in_complex_type(const std::string &name) const override {
bool is_built_in_complex_type(const std::string &name) const final {
return name == "Vector";
}
bool is_type_bare(const tl::tl_type *t) const override {
bool is_type_bare(const tl::tl_type *t) const final {
return t->simple_constructors <= 1 || (is_built_in_simple_type(t->name) && t->name != "Bool") ||
is_built_in_complex_type(t->name);
}
std::vector<std::string> get_parsers() const override {
std::vector<std::string> get_parsers() const final {
return {};
}
int get_parser_type(const tl::tl_combinator *t, const std::string &name) const override {
int get_parser_type(const tl::tl_combinator *t, const std::string &name) const final {
return 0;
}
std::vector<std::string> get_storers() const override {
std::vector<std::string> get_storers() const final {
return {};
}
std::vector<std::string> get_additional_functions() const override {
std::vector<std::string> get_additional_functions() const final {
return {"TdConvertToInternal", "TdConvertFromInternal", "TdSerialize", "TdToString",
"TdDestroyObject", "TdStackStorer", "TdStackFetcher", "enum"};
}
int get_storer_type(const tl::tl_combinator *t, const std::string &name) const override {
int get_storer_type(const tl::tl_combinator *t, const std::string &name) const final {
return name == "to_string" || name == "to_cpp_string";
}
std::string gen_base_tl_class_name() const override {
std::string gen_base_tl_class_name() const final {
return "Object";
}
std::string gen_base_type_class_name(int arity) const override {
std::string gen_base_type_class_name(int arity) const final {
assert(arity == 0);
return "Object";
}
std::string gen_base_function_class_name() const override {
std::string gen_base_function_class_name() const final {
return "Function";
}
@ -118,13 +118,13 @@ class TlWriterCCommon : public tl::TL_writer {
return name;
}
std::string gen_class_name(std::string name) const override {
std::string gen_class_name(std::string name) const final {
if (name == "Object" || name == "#") {
assert(false);
}
return to_CamelCase(name);
}
std::string gen_field_name(std::string name) const override {
std::string gen_field_name(std::string name) const final {
return gen_native_field_name(name);
}
@ -220,10 +220,10 @@ class TlWriterCCommon : public tl::TL_writer {
return !force ? ("struct Td" + gen_main_class_name(t) + " *") : gen_main_class_name(t);
}
std::string gen_type_name(const tl::tl_tree_type *tree_type) const override {
std::string gen_type_name(const tl::tl_tree_type *tree_type) const final {
return gen_type_name(tree_type, false);
}
std::string gen_output_begin() const override {
std::string gen_output_begin() const final {
if (is_header_ == 1) {
return "#pragma once\n"
"#ifdef __cplusplus\n"
@ -279,7 +279,7 @@ class TlWriterCCommon : public tl::TL_writer {
"#include \"td/utils/tl_storers.h\"\n"
"\n";
}
std::string gen_output_end() const override {
std::string gen_output_end() const final {
if (is_header_ == 1) {
return "#ifdef __cplusplus\n"
"}\n"
@ -290,7 +290,7 @@ class TlWriterCCommon : public tl::TL_writer {
return "";
}
std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const override {
std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const final {
if (is_header_ != 1 || class_name == "") {
return "";
}
@ -304,7 +304,7 @@ class TlWriterCCommon : public tl::TL_writer {
}
std::string gen_class_begin(const std::string &class_name, const std::string &base_class_name,
bool is_proxy) const override {
bool is_proxy) const final {
if (is_header_ != 1 || class_name == "") {
return "";
}
@ -315,12 +315,12 @@ class TlWriterCCommon : public tl::TL_writer {
}
return "struct Td" + class_name + " {\n" + " int ID;\n int refcnt;\n" + tail;
}
std::string gen_class_end() const override {
std::string gen_class_end() const final {
return "";
}
std::string gen_field_definition(const std::string &class_name, const std::string &type_name,
const std::string &field_name) const override {
const std::string &field_name) const final {
if (is_header_ != 1 || class_name == "") {
return "";
}
@ -328,14 +328,14 @@ class TlWriterCCommon : public tl::TL_writer {
}
std::string gen_store_function_begin(const std::string &storer_name, const std::string &class_name, int arity,
std::vector<tl::var_description> &vars, int storer_type) const override {
std::vector<tl::var_description> &vars, int storer_type) const final {
return "";
}
std::string gen_store_function_end(const std::vector<tl::var_description> &vars, int storer_type) const override {
std::string gen_store_function_end(const std::vector<tl::var_description> &vars, int storer_type) const final {
return "";
}
std::string gen_constructor_begin(int field_count, const std::string &class_name, bool is_default) const override {
std::string gen_constructor_begin(int field_count, const std::string &class_name, bool is_default) const final {
if (!is_default || is_header_ == -1 || class_name == "") {
return "";
}
@ -348,7 +348,7 @@ class TlWriterCCommon : public tl::TL_writer {
return ss.str();
}
std::string gen_constructor_parameter(int field_num, const std::string &class_name, const tl::arg &a,
bool is_default) const override {
bool is_default) const final {
if (!is_default || is_header_ == -1) {
return "";
}
@ -359,10 +359,10 @@ class TlWriterCCommon : public tl::TL_writer {
return ss.str();
}
std::string gen_constructor_field_init(int field_num, const std::string &class_name, const tl::arg &a,
bool is_default) const override {
bool is_default) const final {
return "";
}
std::string gen_constructor_end(const tl::tl_combinator *t, int field_count, bool is_default) const override {
std::string gen_constructor_end(const tl::tl_combinator *t, int field_count, bool is_default) const final {
if (!is_default || is_header_ == -1) {
return "";
}
@ -389,7 +389,7 @@ class TlWriterCCommon : public tl::TL_writer {
return ss.str();
}
std::string gen_additional_function(const std::string &function_name, const tl::tl_combinator *t,
bool is_function) const override {
bool is_function) const final {
std::stringstream ss;
if (function_name == "enum") {
return ss.str();
@ -551,7 +551,7 @@ class TlWriterCCommon : public tl::TL_writer {
explicit file_store_methods_to_td(const class TlWriterCCommon *cl) : cl(cl) {
}
void store_simple_type(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string type_name) const override {
std::string type_name) const final {
if (type_name == "String") {
ss << offset << res_var << " = (" << var << ") ? " << var << ": \"\";\n";
} else if (type_name == "Bytes") {
@ -563,35 +563,35 @@ class TlWriterCCommon : public tl::TL_writer {
}
}
void store_common_type(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string type_name) const override {
std::string type_name) const final {
ss << offset << res_var << " = TdConvertToInternal (" << var << ");\n";
}
void store_array_start(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
}
void store_array_el(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string idx) const override {
std::string idx) const final {
ss << offset << res_var << ".push_back (std::move (" << var << "));\n";
}
void store_array_finish(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
}
void store_nil(std::stringstream &ss, std::string offset) const override {
void store_nil(std::stringstream &ss, std::string offset) const final {
ss << offset << "return nullptr;\n";
}
std::string store_field_start(std::stringstream &ss, std::string offset, int depth,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
std::string res_var = "v" + int_to_string(depth);
ss << offset << cl->gen_native_type_name(tree_type, true) << " " << res_var << ";\n";
return res_var;
}
void store_field_finish(std::stringstream &ss, std::string offset, std::string res_var) const override {
void store_field_finish(std::stringstream &ss, std::string offset, std::string res_var) const final {
}
void store_arg_finish(std::stringstream &ss, std::string offset, std::string arg_name,
std::string res_var) const override {
std::string res_var) const final {
}
void store_constructor_finish(std::stringstream &ss, std::string offset, const tl::tl_combinator *t,
std::vector<std::string> res_var) const override {
std::vector<std::string> res_var) const final {
auto native_class_name = cl->gen_native_class_name(t->name);
ss << offset << "return td::td_api::make_object<td::td_api::" << native_class_name << ">(";
bool is_first = true;
@ -613,7 +613,7 @@ class TlWriterCCommon : public tl::TL_writer {
explicit file_store_methods_destroy(const class TlWriterCCommon *cl) : cl(cl) {
}
void store_simple_type(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string type_name) const override {
std::string type_name) const final {
if (type_name == "String") {
ss << offset << "free (" << var << ");\n";
} else if (type_name == "Bytes") {
@ -621,32 +621,32 @@ class TlWriterCCommon : public tl::TL_writer {
}
}
void store_common_type(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string type_name) const override {
std::string type_name) const final {
ss << offset << "TdDestroyObject (" << var << ");\n";
}
void store_array_start(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
}
void store_array_el(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string idx) const override {
std::string idx) const final {
}
void store_array_finish(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
ss << offset << "delete[] " << var << "->data;\n" << offset << "delete " << var << ";\n";
}
void store_nil(std::stringstream &ss, std::string offset) const override {
void store_nil(std::stringstream &ss, std::string offset) const final {
ss << offset << "return;\n";
}
std::string store_field_start(std::stringstream &ss, std::string offset, int depth,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
return "";
}
void store_field_finish(std::stringstream &ss, std::string offset, std::string res_var) const override {
void store_field_finish(std::stringstream &ss, std::string offset, std::string res_var) const final {
}
void store_arg_finish(std::stringstream &ss, std::string offset, std::string arg_name,
std::string res_var) const override {
std::string res_var) const final {
}
void store_constructor_start(std::stringstream &ss, std::string offset, const tl::tl_combinator *t) const override {
void store_constructor_start(std::stringstream &ss, std::string offset, const tl::tl_combinator *t) const final {
ss << "#if TD_MSVC\n";
ss << offset << "static_assert (sizeof (long) == sizeof (var->refcnt), \"Illegal InterlockedDecrement\");\n";
ss << offset << "int ref = InterlockedDecrement (reinterpret_cast<long *>(&var->refcnt));\n";
@ -661,7 +661,7 @@ class TlWriterCCommon : public tl::TL_writer {
ss << offset << "}\n";
}
void store_constructor_finish(std::stringstream &ss, std::string offset, const tl::tl_combinator *t,
std::vector<std::string> res_var) const override {
std::vector<std::string> res_var) const final {
ss << offset << "delete var;\n";
}
const class TlWriterCCommon *cl;
@ -670,7 +670,7 @@ class TlWriterCCommon : public tl::TL_writer {
explicit file_store_methods_stack(const class TlWriterCCommon *cl) : cl(cl) {
}
void store_simple_type(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string type_name) const override {
std::string type_name) const final {
if (type_name == "String") {
ss << offset << "M->pack_string (" << var << ");\n";
} else if (type_name == "Bytes") {
@ -686,41 +686,41 @@ class TlWriterCCommon : public tl::TL_writer {
}
}
void store_common_type(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string type_name) const override {
std::string type_name) const final {
ss << offset << "TdStackStorer (" << var << ", M);\n";
}
void store_array_start(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
ss << offset << "M->new_array ();\n";
}
void store_array_el(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string idx) const override {
std::string idx) const final {
ss << offset << "M->new_arr_field (" << idx << ");\n";
}
void store_array_finish(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
}
void store_nil(std::stringstream &ss, std::string offset) const override {
void store_nil(std::stringstream &ss, std::string offset) const final {
ss << offset << "M->pack_bool (0);\n" << offset << "return;\n";
}
std::string store_field_start(std::stringstream &ss, std::string offset, int depth,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
return "";
}
void store_field_finish(std::stringstream &ss, std::string offset, std::string res_var) const override {
void store_field_finish(std::stringstream &ss, std::string offset, std::string res_var) const final {
}
void store_arg_finish(std::stringstream &ss, std::string offset, std::string arg_name,
std::string res_var) const override {
std::string res_var) const final {
ss << offset << "M->new_field (\"" << arg_name << "\");\n";
}
void store_constructor_start(std::stringstream &ss, std::string offset, const tl::tl_combinator *t) const override {
void store_constructor_start(std::stringstream &ss, std::string offset, const tl::tl_combinator *t) const final {
ss << offset << "M->new_table ();\n";
auto class_name = cl->gen_class_name(t->name);
ss << offset << "M->pack_string (\"" << class_name << "\");\n";
ss << offset << "M->new_field (\"ID\");\n";
}
void store_constructor_finish(std::stringstream &ss, std::string offset, const tl::tl_combinator *t,
std::vector<std::string> res_var) const override {
std::vector<std::string> res_var) const final {
}
const class TlWriterCCommon *cl;
};
@ -771,11 +771,11 @@ class TlWriterCCommon : public tl::TL_writer {
explicit file_fetch_methods_from_td(const class TlWriterCCommon *cl) : cl(cl) {
}
std::string fetch_field_start(std::stringstream &ss, std::string offset, int depth,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
return "";
}
void fetch_simple_type(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string type_name) const override {
std::string type_name) const final {
if (type_name == "String") {
ss << offset << res_var << " = (" << var << ".length ()) ? td::str_dup (" << var << ") : nullptr;\n";
} else if (type_name == "Bytes") {
@ -791,7 +791,7 @@ class TlWriterCCommon : public tl::TL_writer {
}
}
void fetch_common_type(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
auto native_type_name = cl->gen_native_type_name(tree_type, false);
ss << offset << "if (!" << var << ") {\n"
<< offset << " " << res_var << " = nullptr;\n"
@ -801,19 +801,19 @@ class TlWriterCCommon : public tl::TL_writer {
<< offset << "}\n";
}
void fetch_array_size(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
ss << offset << res_var << " = (int)" << var << ".size ();\n";
}
std::string fetch_array_field_start(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string idx, const tl::tl_tree_type *tree_type) const override {
std::string idx, const tl::tl_tree_type *tree_type) const final {
return var + "[" + idx + "]";
}
std::string fetch_dict_field_start(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string key, const tl::tl_tree_type *tree_type) const override {
std::string key, const tl::tl_tree_type *tree_type) const final {
return var + "." + key;
}
void fetch_field_finish(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
}
const class TlWriterCCommon *cl;
};
@ -822,11 +822,11 @@ class TlWriterCCommon : public tl::TL_writer {
explicit file_fetch_methods_stack(const class TlWriterCCommon *cl) : cl(cl) {
}
std::string fetch_field_start(std::stringstream &ss, std::string offset, int depth,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
return "";
}
void fetch_simple_type(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string type_name) const override {
std::string type_name) const final {
if (type_name == "String") {
ss << offset << res_var << " = M->get_string ();\n";
} else if (type_name == "Bytes") {
@ -842,7 +842,7 @@ class TlWriterCCommon : public tl::TL_writer {
}
}
void fetch_common_type(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
auto class_name = cl->gen_main_class_name(tree_type->type);
ss << offset << "if (M->is_nil ()) {\n"
<< offset << " " << res_var << " = nullptr;\n"
@ -851,21 +851,21 @@ class TlWriterCCommon : public tl::TL_writer {
<< offset << "}\n";
}
void fetch_array_size(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
ss << offset << res_var << " = M->get_arr_size ();\n";
}
std::string fetch_array_field_start(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string idx, const tl::tl_tree_type *tree_type) const override {
std::string idx, const tl::tl_tree_type *tree_type) const final {
ss << offset << " M->get_arr_field (" << idx << ");\n";
return "";
}
std::string fetch_dict_field_start(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
std::string key, const tl::tl_tree_type *tree_type) const override {
std::string key, const tl::tl_tree_type *tree_type) const final {
ss << offset << "M->get_field (\"" << key << "\");\n";
return "";
}
void fetch_field_finish(std::stringstream &ss, std::string offset, std::string res_var, std::string var,
const tl::tl_tree_type *tree_type) const override {
const tl::tl_tree_type *tree_type) const final {
ss << offset << "M->pop ();\n";
}
const class TlWriterCCommon *cl;
@ -949,74 +949,74 @@ class TlWriterCCommon : public tl::TL_writer {
<< "}\n";
}
std::string gen_array_type_name(const tl::tl_tree_array *arr, const std::string &field_name) const override {
std::string gen_array_type_name(const tl::tl_tree_array *arr, const std::string &field_name) const final {
assert(false);
return std::string();
}
std::string gen_var_type_name() const override {
std::string gen_var_type_name() const final {
assert(false);
return std::string();
}
std::string gen_int_const(const tl::tl_tree *tree_c, const std::vector<tl::var_description> &vars) const override {
std::string gen_int_const(const tl::tl_tree *tree_c, const std::vector<tl::var_description> &vars) const final {
assert(false);
return std::string();
}
std::string gen_var_name(const tl::var_description &desc) const override {
std::string gen_var_name(const tl::var_description &desc) const final {
assert(false);
return "";
}
std::string gen_parameter_name(int index) const override {
std::string gen_parameter_name(int index) const final {
assert(false);
return "";
}
std::string gen_class_alias(const std::string &class_name, const std::string &alias_name) const override {
std::string gen_class_alias(const std::string &class_name, const std::string &alias_name) const final {
return "";
}
std::string gen_vars(const tl::tl_combinator *t, const tl::tl_tree_type *result_type,
std::vector<tl::var_description> &vars) const override {
std::vector<tl::var_description> &vars) const final {
assert(vars.empty());
return "";
}
std::string gen_function_vars(const tl::tl_combinator *t, std::vector<tl::var_description> &vars) const override {
std::string gen_function_vars(const tl::tl_combinator *t, std::vector<tl::var_description> &vars) const final {
assert(vars.empty());
return "";
}
std::string gen_uni(const tl::tl_tree_type *result_type, std::vector<tl::var_description> &vars,
bool check_negative) const override {
bool check_negative) const final {
assert(result_type->children.empty());
return "";
}
std::string gen_constructor_id_store(std::int32_t id, int storer_type) const override {
std::string gen_constructor_id_store(std::int32_t id, int storer_type) const final {
return "";
}
std::string gen_field_fetch(int field_num, const tl::arg &a, std::vector<tl::var_description> &vars, bool flat,
int parser_type) const override {
int parser_type) const final {
return "";
}
std::string gen_field_store(const tl::arg &a, std::vector<tl::var_description> &vars, bool flat,
int storer_type) const override {
int storer_type) const final {
return "";
}
std::string gen_type_fetch(const std::string &field_name, const tl::tl_tree_type *tree_type,
const std::vector<tl::var_description> &vars, int parser_type) const override {
const std::vector<tl::var_description> &vars, int parser_type) const final {
assert(vars.empty());
return "";
}
std::string gen_type_store(const std::string &field_name, const tl::tl_tree_type *tree_type,
const std::vector<tl::var_description> &vars, int storer_type) const override {
const std::vector<tl::var_description> &vars, int storer_type) const final {
return "";
}
std::string gen_var_type_fetch(const tl::arg &a) const override {
std::string gen_var_type_fetch(const tl::arg &a) const final {
assert(false);
return "";
}
std::string gen_get_id(const std::string &class_name, std::int32_t id, bool is_proxy) const override {
std::string gen_get_id(const std::string &class_name, std::int32_t id, bool is_proxy) const final {
if (is_proxy || is_header_ != 1) {
return "";
}
@ -1024,47 +1024,47 @@ class TlWriterCCommon : public tl::TL_writer {
return "";
}
std::string gen_function_result_type(const tl::tl_tree *result) const override {
std::string gen_function_result_type(const tl::tl_tree *result) const final {
return "";
}
std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name,
const std::string &parent_class_name, int arity, int field_count,
std::vector<tl::var_description> &vars, int parser_type) const override {
std::vector<tl::var_description> &vars, int parser_type) const final {
return "";
}
std::string gen_fetch_function_end(bool has_parent, int field_count, const std::vector<tl::var_description> &vars,
int parser_type) const override {
int parser_type) const final {
return "";
}
std::string gen_fetch_function_result_begin(const std::string &parser_name, const std::string &class_name,
const tl::tl_tree *result) const override {
const tl::tl_tree *result) const final {
return "";
}
std::string gen_fetch_function_result_end() const override {
std::string gen_fetch_function_result_end() const final {
return "";
}
std::string gen_fetch_function_result_any_begin(const std::string &parser_name, const std::string &class_name,
bool is_proxy) const override {
bool is_proxy) const final {
return "";
}
std::string gen_fetch_function_result_any_end(bool is_proxy) const override {
std::string gen_fetch_function_result_any_end(bool is_proxy) const final {
return "";
}
std::string gen_fetch_switch_begin() const override {
std::string gen_fetch_switch_begin() const final {
return "";
}
std::string gen_fetch_switch_case(const tl::tl_combinator *t, int arity) const override {
std::string gen_fetch_switch_case(const tl::tl_combinator *t, int arity) const final {
return "";
}
std::string gen_fetch_switch_end() const override {
std::string gen_fetch_switch_end() const final {
return "";
}
std::string gen_additional_proxy_function_begin(const std::string &function_name, const tl::tl_type *type,
const std::string &name, int arity, bool is_function) const override {
const std::string &name, int arity, bool is_function) const final {
std::stringstream ss;
std::string class_name;
std::string native_class_name;
@ -1208,7 +1208,7 @@ class TlWriterCCommon : public tl::TL_writer {
}
std::string gen_additional_proxy_function_case(const std::string &function_name, const tl::tl_type *type,
const std::string &class_name, int arity) const override {
const std::string &class_name, int arity) const final {
if (is_header_ != (function_name == "enum" ? 1 : 0)) {
return "";
}
@ -1243,8 +1243,7 @@ class TlWriterCCommon : public tl::TL_writer {
}
std::string gen_additional_proxy_function_case(const std::string &function_name, const tl::tl_type *type,
const tl::tl_combinator *t, int arity,
bool is_function) const override {
const tl::tl_combinator *t, int arity, bool is_function) const final {
if (is_header_ != (function_name == "enum" ? 1 : 0)) {
return "";
}
@ -1321,7 +1320,7 @@ class TlWriterCCommon : public tl::TL_writer {
}
}
std::string gen_additional_proxy_function_end(const std::string &function_name, const tl::tl_type *type,
bool is_function) const override {
bool is_function) const final {
if (is_header_ != (function_name == "enum" ? 1 : 0)) {
return "";
}
@ -1352,7 +1351,7 @@ class TlWriterCCommon : public tl::TL_writer {
}
}
int get_additional_function_type(const std::string &additional_function_name) const override {
int get_additional_function_type(const std::string &additional_function_name) const final {
return 2;
}
};

View File

@ -24,52 +24,52 @@ class TlWriterDotNet : public TL_writer {
TlWriterDotNet(const std::string &name, bool is_header, const std::string &prefix = "")
: TL_writer(name), is_header_(is_header), prefix_(prefix) {
}
int get_max_arity(void) const override {
int get_max_arity(void) const final {
return 0;
}
bool is_built_in_simple_type(const std::string &name) const override {
bool is_built_in_simple_type(const std::string &name) const final {
return name == "Bool" || name == "Int32" || name == "Int53" || name == "Int64" || name == "Double" ||
name == "String" || name == "Bytes";
}
bool is_built_in_complex_type(const std::string &name) const override {
bool is_built_in_complex_type(const std::string &name) const final {
return name == "Vector";
}
bool is_type_bare(const tl_type *t) const override {
bool is_type_bare(const tl_type *t) const final {
return t->simple_constructors <= 1 || (is_built_in_simple_type(t->name) && t->name != "Bool") ||
is_built_in_complex_type(t->name);
}
std::vector<std::string> get_parsers(void) const override {
std::vector<std::string> get_parsers(void) const final {
return {"FromUnmanaged"};
}
int get_parser_type(const tl_combinator *t, const std::string &name) const override {
int get_parser_type(const tl_combinator *t, const std::string &name) const final {
return 0;
}
Mode get_parser_mode(int type) const override {
Mode get_parser_mode(int type) const final {
return All; // Server;
}
std::vector<std::string> get_storers(void) const override {
std::vector<std::string> get_storers(void) const final {
return {"ToUnmanaged", "ToString"};
}
std::vector<std::string> get_additional_functions(void) const override {
std::vector<std::string> get_additional_functions(void) const final {
return {"ToUnmanaged", "FromUnmanaged"};
}
int get_storer_type(const tl_combinator *t, const std::string &name) const override {
int get_storer_type(const tl_combinator *t, const std::string &name) const final {
return name == "ToString";
}
Mode get_storer_mode(int type) const override {
Mode get_storer_mode(int type) const final {
return type <= 1 ? All : Server;
}
std::string gen_base_tl_class_name(void) const override {
std::string gen_base_tl_class_name(void) const final {
return "BaseObject";
}
std::string gen_base_type_class_name(int arity) const override {
std::string gen_base_type_class_name(int arity) const final {
assert(arity == 0);
return "Object";
}
std::string gen_base_function_class_name(void) const override {
std::string gen_base_function_class_name(void) const final {
return "Function";
}
@ -123,19 +123,19 @@ class TlWriterDotNet : public TL_writer {
return name;
}
std::string gen_class_name(std::string name) const override {
std::string gen_class_name(std::string name) const final {
if (name == "Object" || name == "#") {
assert(0);
}
return to_CamelCase(name);
}
std::string gen_field_name(std::string name) const override {
std::string gen_field_name(std::string name) const final {
assert(name.size() > 0);
assert(is_alnum(name.back()));
return to_CamelCase(name);
}
std::string gen_type_name(const tl_tree_type *tree_type) const override {
std::string gen_type_name(const tl_tree_type *tree_type) const final {
const tl_type *t = tree_type->type;
const std::string &name = t->name;
@ -178,20 +178,20 @@ class TlWriterDotNet : public TL_writer {
return gen_main_class_name(t) + "^";
}
std::string gen_output_begin(void) const override {
std::string gen_output_begin(void) const final {
return prefix_ +
"#include \"td/tl/tl_dotnet_object.h\"\n\n"
"namespace Telegram {\n"
"namespace Td {\n"
"namespace Api {\n";
}
std::string gen_output_end() const override {
std::string gen_output_end() const final {
return "}\n"
"}\n"
"}\n";
}
std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const override {
std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const final {
if (!is_header_) {
return "";
}
@ -201,7 +201,7 @@ class TlWriterDotNet : public TL_writer {
}
std::string gen_class_begin(const std::string &class_name, const std::string &base_class_name,
bool is_proxy) const override {
bool is_proxy) const final {
if (!is_header_) {
return "";
}
@ -212,12 +212,12 @@ class TlWriterDotNet : public TL_writer {
<< " public:\n";
return ss.str();
}
std::string gen_class_end(void) const override {
std::string gen_class_end(void) const final {
return "";
}
std::string gen_field_definition(const std::string &class_name, const std::string &type_name,
const std::string &field_name) const override {
const std::string &field_name) const final {
if (!is_header_) {
return "";
}
@ -245,7 +245,7 @@ class TlWriterDotNet : public TL_writer {
}
std::string gen_store_function_begin(const std::string &storer_name, const std::string &class_name, int arity,
std::vector<var_description> &vars, int storer_type) const override {
std::vector<var_description> &vars, int storer_type) const final {
if (storer_type < 0) {
return "";
}
@ -266,18 +266,18 @@ class TlWriterDotNet : public TL_writer {
}
return ss.str();
}
std::string gen_store_function_end(const std::vector<var_description> &vars, int storer_type) const override {
std::string gen_store_function_end(const std::vector<var_description> &vars, int storer_type) const final {
return "";
}
std::string gen_constructor_begin(int field_count, const std::string &class_name, bool is_default) const override {
std::string gen_constructor_begin(int field_count, const std::string &class_name, bool is_default) const final {
std::stringstream ss;
ss << "\n";
ss << (is_header_ ? " " : gen_class_name(class_name) + "::") << gen_class_name(class_name) << "(";
return ss.str();
}
std::string gen_constructor_parameter(int field_num, const std::string &class_name, const arg &a,
bool is_default) const override {
bool is_default) const final {
if (is_default) {
return "";
}
@ -296,7 +296,7 @@ class TlWriterDotNet : public TL_writer {
return ss.str();
}
std::string gen_constructor_field_init(int field_num, const std::string &class_name, const arg &a,
bool is_default) const override {
bool is_default) const final {
if (is_default || is_header_) {
return "";
}
@ -313,7 +313,7 @@ class TlWriterDotNet : public TL_writer {
return ss.str();
}
std::string gen_constructor_end(const tl_combinator *t, int field_count, bool is_default) const override {
std::string gen_constructor_end(const tl_combinator *t, int field_count, bool is_default) const final {
if (is_header_) {
return ");\n";
}
@ -325,7 +325,7 @@ class TlWriterDotNet : public TL_writer {
return ss.str();
}
std::string gen_additional_function(const std::string &function_name, const tl_combinator *t,
bool is_function) const override {
bool is_function) const final {
std::stringstream ss;
if (is_header_ && function_name == "ToUnmanaged") {
ss << "};\n";
@ -390,124 +390,124 @@ class TlWriterDotNet : public TL_writer {
ss << ");\n}\n";
}
std::string gen_array_type_name(const tl_tree_array *arr, const std::string &field_name) const override {
std::string gen_array_type_name(const tl_tree_array *arr, const std::string &field_name) const final {
assert(0);
return std::string();
}
std::string gen_var_type_name(void) const override {
std::string gen_var_type_name(void) const final {
assert(0);
return std::string();
}
std::string gen_int_const(const tl_tree *tree_c, const std::vector<var_description> &vars) const override {
std::string gen_int_const(const tl_tree *tree_c, const std::vector<var_description> &vars) const final {
assert(0);
return std::string();
}
std::string gen_var_name(const var_description &desc) const override {
std::string gen_var_name(const var_description &desc) const final {
assert(0);
return "";
}
std::string gen_parameter_name(int index) const override {
std::string gen_parameter_name(int index) const final {
assert(0);
return "";
}
std::string gen_class_alias(const std::string &class_name, const std::string &alias_name) const override {
std::string gen_class_alias(const std::string &class_name, const std::string &alias_name) const final {
return "";
}
std::string gen_vars(const tl_combinator *t, const tl_tree_type *result_type,
std::vector<var_description> &vars) const override {
std::vector<var_description> &vars) const final {
assert(vars.empty());
return "";
}
std::string gen_function_vars(const tl_combinator *t, std::vector<var_description> &vars) const override {
std::string gen_function_vars(const tl_combinator *t, std::vector<var_description> &vars) const final {
assert(vars.empty());
return "";
}
std::string gen_uni(const tl_tree_type *result_type, std::vector<var_description> &vars,
bool check_negative) const override {
bool check_negative) const final {
assert(result_type->children.empty());
return "";
}
std::string gen_constructor_id_store(std::int32_t id, int storer_type) const override {
std::string gen_constructor_id_store(std::int32_t id, int storer_type) const final {
return "";
}
std::string gen_field_fetch(int field_num, const arg &a, std::vector<var_description> &vars, bool flat,
int parser_type) const override {
int parser_type) const final {
return "";
// std::stringstream ss;
// ss << gen_field_name(a.name) << " = from_unmanaged(from->" <<
// gen_native_field_name(a.name) << ");\n"; return ss.str();
}
std::string gen_field_store(const arg &a, std::vector<var_description> &vars, bool flat,
int storer_type) const override {
int storer_type) const final {
return "";
// std::stringstream ss;
// ss << "to_unmanaged(" << gen_field_name(a.name) << ")";
// return ss.str();
}
std::string gen_type_fetch(const std::string &field_name, const tl_tree_type *tree_type,
const std::vector<var_description> &vars, int parser_type) const override {
const std::vector<var_description> &vars, int parser_type) const final {
assert(vars.empty());
return "";
}
std::string gen_type_store(const std::string &field_name, const tl_tree_type *tree_type,
const std::vector<var_description> &vars, int storer_type) const override {
const std::vector<var_description> &vars, int storer_type) const final {
return "";
}
std::string gen_var_type_fetch(const arg &a) const override {
std::string gen_var_type_fetch(const arg &a) const final {
assert(0);
return "";
}
std::string gen_get_id(const std::string &class_name, std::int32_t id, bool is_proxy) const override {
std::string gen_get_id(const std::string &class_name, std::int32_t id, bool is_proxy) const final {
return "";
}
std::string gen_function_result_type(const tl_tree *result) const override {
std::string gen_function_result_type(const tl_tree *result) const final {
return "";
}
std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name,
const std::string &parent_class_name, int arity, int field_count,
std::vector<var_description> &vars, int parser_type) const override {
std::vector<var_description> &vars, int parser_type) const final {
return "";
}
std::string gen_fetch_function_end(bool has_parent, int field_count, const std::vector<var_description> &vars,
int parser_type) const override {
int parser_type) const final {
return "";
}
std::string gen_fetch_function_result_begin(const std::string &parser_name, const std::string &class_name,
const tl_tree *result) const override {
const tl_tree *result) const final {
return "";
}
std::string gen_fetch_function_result_end(void) const override {
std::string gen_fetch_function_result_end(void) const final {
return "";
}
std::string gen_fetch_function_result_any_begin(const std::string &parser_name, const std::string &class_name,
bool is_proxy) const override {
bool is_proxy) const final {
return "";
}
std::string gen_fetch_function_result_any_end(bool is_proxy) const override {
std::string gen_fetch_function_result_any_end(bool is_proxy) const final {
return "";
}
std::string gen_fetch_switch_begin(void) const override {
std::string gen_fetch_switch_begin(void) const final {
return "";
}
std::string gen_fetch_switch_case(const tl_combinator *t, int arity) const override {
std::string gen_fetch_switch_case(const tl_combinator *t, int arity) const final {
return "";
}
std::string gen_fetch_switch_end(void) const override {
std::string gen_fetch_switch_end(void) const final {
return "";
}
std::string gen_additional_proxy_function_begin(const std::string &function_name, const tl_type *type,
const std::string &name, int arity, bool is_function) const override {
const std::string &name, int arity, bool is_function) const final {
std::stringstream ss;
if (is_header_ && function_name == "ToUnmanaged") {
ss << "};\n";
@ -542,15 +542,15 @@ class TlWriterDotNet : public TL_writer {
return ss.str();
}
std::string gen_additional_proxy_function_case(const std::string &function_name, const tl_type *type,
const std::string &class_name, int arity) const override {
const std::string &class_name, int arity) const final {
return "";
}
std::string gen_additional_proxy_function_case(const std::string &function_name, const tl_type *type,
const tl_combinator *t, int arity, bool is_function) const override {
const tl_combinator *t, int arity, bool is_function) const final {
return "";
}
std::string gen_additional_proxy_function_end(const std::string &function_name, const tl_type *type,
bool is_function) const override {
bool is_function) const final {
return "";
}
};

View File

@ -20,89 +20,88 @@ class TD_TL_writer_hpp : public TD_TL_writer {
: TD_TL_writer(tl_name, string_type, bytes_type) {
}
bool is_documentation_generated() const override;
bool is_documentation_generated() const final;
int get_additional_function_type(const std::string &additional_function_name) const override;
std::vector<std::string> get_additional_functions() const override;
int get_additional_function_type(const std::string &additional_function_name) const final;
std::vector<std::string> get_additional_functions() const final;
std::string gen_base_type_class_name(int arity) const override;
std::string gen_base_tl_class_name() const override;
std::string gen_base_type_class_name(int arity) const final;
std::string gen_base_tl_class_name() const final;
std::string gen_output_begin() const override;
std::string gen_output_end() const override;
std::string gen_output_begin() const final;
std::string gen_output_end() const final;
std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const override;
std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const final;
std::string gen_class_begin(const std::string &class_name, const std::string &base_class_name,
bool is_proxy) const override;
std::string gen_class_end() const override;
bool is_proxy) const final;
std::string gen_class_end() const final;
std::string gen_class_alias(const std::string &class_name, const std::string &alias_name) const override;
std::string gen_class_alias(const std::string &class_name, const std::string &alias_name) const final;
std::string gen_field_definition(const std::string &class_name, const std::string &type_name,
const std::string &field_name) const override;
const std::string &field_name) const final;
std::string gen_vars(const tl::tl_combinator *t, const tl::tl_tree_type *result_type,
std::vector<tl::var_description> &vars) const override;
std::string gen_function_vars(const tl::tl_combinator *t, std::vector<tl::var_description> &vars) const override;
std::vector<tl::var_description> &vars) const final;
std::string gen_function_vars(const tl::tl_combinator *t, std::vector<tl::var_description> &vars) const final;
std::string gen_uni(const tl::tl_tree_type *result_type, std::vector<tl::var_description> &vars,
bool check_negative) const override;
std::string gen_constructor_id_store(std::int32_t id, int storer_type) const override;
bool check_negative) const final;
std::string gen_constructor_id_store(std::int32_t id, int storer_type) const final;
std::string gen_field_fetch(int field_num, const tl::arg &a, std::vector<tl::var_description> &vars, bool flat,
int parser_type) const override;
int parser_type) const final;
std::string gen_field_store(const tl::arg &a, std::vector<tl::var_description> &vars, bool flat,
int storer_type) const override;
int storer_type) const final;
std::string gen_type_fetch(const std::string &field_name, const tl::tl_tree_type *tree_type,
const std::vector<tl::var_description> &vars, int parser_type) const override;
const std::vector<tl::var_description> &vars, int parser_type) const final;
std::string gen_type_store(const std::string &field_name, const tl::tl_tree_type *tree_type,
const std::vector<tl::var_description> &vars, int storer_type) const override;
std::string gen_var_type_fetch(const tl::arg &a) const override;
const std::vector<tl::var_description> &vars, int storer_type) const final;
std::string gen_var_type_fetch(const tl::arg &a) const final;
std::string gen_get_id(const std::string &class_name, std::int32_t id, bool is_proxy) const override;
std::string gen_get_id(const std::string &class_name, std::int32_t id, bool is_proxy) const final;
std::string gen_function_result_type(const tl::tl_tree *result) const override;
std::string gen_function_result_type(const tl::tl_tree *result) const final;
std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name,
const std::string &parent_class_name, int arity, int field_count,
std::vector<tl::var_description> &vars, int parser_type) const override;
std::vector<tl::var_description> &vars, int parser_type) const final;
std::string gen_fetch_function_end(bool has_parent, int field_count, const std::vector<tl::var_description> &vars,
int parser_type) const override;
int parser_type) const final;
std::string gen_fetch_function_result_begin(const std::string &parser_name, const std::string &class_name,
const tl::tl_tree *result) const override;
std::string gen_fetch_function_result_end() const override;
const tl::tl_tree *result) const final;
std::string gen_fetch_function_result_end() const final;
std::string gen_fetch_function_result_any_begin(const std::string &parser_name, const std::string &class_name,
bool is_proxy) const override;
std::string gen_fetch_function_result_any_end(bool is_proxy) const override;
bool is_proxy) const final;
std::string gen_fetch_function_result_any_end(bool is_proxy) const final;
std::string gen_store_function_begin(const std::string &storer_name, const std::string &class_name, int arity,
std::vector<tl::var_description> &vars, int storer_type) const override;
std::string gen_store_function_end(const std::vector<tl::var_description> &vars, int storer_type) const override;
std::vector<tl::var_description> &vars, int storer_type) const final;
std::string gen_store_function_end(const std::vector<tl::var_description> &vars, int storer_type) const final;
std::string gen_fetch_switch_begin() const override;
std::string gen_fetch_switch_case(const tl::tl_combinator *t, int arity) const override;
std::string gen_fetch_switch_end() const override;
std::string gen_fetch_switch_begin() const final;
std::string gen_fetch_switch_case(const tl::tl_combinator *t, int arity) const final;
std::string gen_fetch_switch_end() const final;
std::string gen_constructor_begin(int field_count, const std::string &class_name, bool is_default) const override;
std::string gen_constructor_begin(int field_count, const std::string &class_name, bool is_default) const final;
std::string gen_constructor_parameter(int field_num, const std::string &class_name, const tl::arg &a,
bool is_default) const override;
bool is_default) const final;
std::string gen_constructor_field_init(int field_num, const std::string &class_name, const tl::arg &a,
bool is_default) const override;
std::string gen_constructor_end(const tl::tl_combinator *t, int field_count, bool is_default) const override;
bool is_default) const final;
std::string gen_constructor_end(const tl::tl_combinator *t, int field_count, bool is_default) const final;
std::string gen_additional_function(const std::string &function_name, const tl::tl_combinator *t,
bool is_function) const override;
bool is_function) const final;
std::string gen_additional_proxy_function_begin(const std::string &function_name, const tl::tl_type *type,
const std::string &class_name, int arity,
bool is_function) const override;
bool is_function) const final;
std::string gen_additional_proxy_function_case(const std::string &function_name, const tl::tl_type *type,
const std::string &class_name, int arity) const override;
const std::string &class_name, int arity) const final;
std::string gen_additional_proxy_function_case(const std::string &function_name, const tl::tl_type *type,
const tl::tl_combinator *t, int arity,
bool is_function) const override;
const tl::tl_combinator *t, int arity, bool is_function) const final;
std::string gen_additional_proxy_function_end(const std::string &function_name, const tl::tl_type *type,
bool is_function) const override;
bool is_function) const final;
};
} // namespace td

View File

@ -28,92 +28,92 @@ class TD_TL_writer_java : public tl::TL_writer {
: TL_writer(tl_name), package_name(package_name) {
}
int get_max_arity() const override;
int get_max_arity() const final;
bool is_built_in_simple_type(const std::string &name) const override;
bool is_built_in_complex_type(const std::string &name) const override;
bool is_type_bare(const tl::tl_type *t) const override;
bool is_combinator_supported(const tl::tl_combinator *constructor) const override;
bool is_built_in_simple_type(const std::string &name) const final;
bool is_built_in_complex_type(const std::string &name) const final;
bool is_type_bare(const tl::tl_type *t) const final;
bool is_combinator_supported(const tl::tl_combinator *constructor) const final;
int get_parser_type(const tl::tl_combinator *t, const std::string &parser_name) const override;
int get_storer_type(const tl::tl_combinator *t, const std::string &storer_name) const override;
std::vector<std::string> get_parsers() const override;
std::vector<std::string> get_storers() const override;
int get_parser_type(const tl::tl_combinator *t, const std::string &parser_name) const final;
int get_storer_type(const tl::tl_combinator *t, const std::string &storer_name) const final;
std::vector<std::string> get_parsers() const final;
std::vector<std::string> get_storers() const final;
std::string gen_base_tl_class_name() const override;
std::string gen_base_type_class_name(int arity) const override;
std::string gen_base_function_class_name() const override;
std::string gen_class_name(std::string name) const override;
std::string gen_field_name(std::string name) const override;
std::string gen_var_name(const tl::var_description &desc) const override;
std::string gen_parameter_name(int index) const override;
std::string gen_type_name(const tl::tl_tree_type *tree_type) const override;
std::string gen_array_type_name(const tl::tl_tree_array *arr, const std::string &field_name) const override;
std::string gen_var_type_name() const override;
std::string gen_base_tl_class_name() const final;
std::string gen_base_type_class_name(int arity) const final;
std::string gen_base_function_class_name() const final;
std::string gen_class_name(std::string name) const final;
std::string gen_field_name(std::string name) const final;
std::string gen_var_name(const tl::var_description &desc) const final;
std::string gen_parameter_name(int index) const final;
std::string gen_type_name(const tl::tl_tree_type *tree_type) const final;
std::string gen_array_type_name(const tl::tl_tree_array *arr, const std::string &field_name) const final;
std::string gen_var_type_name() const final;
std::string gen_int_const(const tl::tl_tree *tree_c, const std::vector<tl::var_description> &vars) const override;
std::string gen_int_const(const tl::tl_tree *tree_c, const std::vector<tl::var_description> &vars) const final;
std::string gen_output_begin() const override;
std::string gen_output_end() const override;
std::string gen_output_begin() const final;
std::string gen_output_end() const final;
std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const override;
std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const final;
std::string gen_class_begin(const std::string &class_name, const std::string &base_class_name,
bool is_proxy) const override;
std::string gen_class_end() const override;
bool is_proxy) const final;
std::string gen_class_end() const final;
std::string gen_class_alias(const std::string &class_name, const std::string &alias_name) const override;
std::string gen_class_alias(const std::string &class_name, const std::string &alias_name) const final;
std::string gen_field_definition(const std::string &class_name, const std::string &type_name,
const std::string &field_name) const override;
const std::string &field_name) const final;
std::string gen_vars(const tl::tl_combinator *t, const tl::tl_tree_type *result_type,
std::vector<tl::var_description> &vars) const override;
std::string gen_function_vars(const tl::tl_combinator *t, std::vector<tl::var_description> &vars) const override;
std::vector<tl::var_description> &vars) const final;
std::string gen_function_vars(const tl::tl_combinator *t, std::vector<tl::var_description> &vars) const final;
std::string gen_uni(const tl::tl_tree_type *result_type, std::vector<tl::var_description> &vars,
bool check_negative) const override;
std::string gen_constructor_id_store(std::int32_t id, int storer_type) const override;
bool check_negative) const final;
std::string gen_constructor_id_store(std::int32_t id, int storer_type) const final;
std::string gen_field_fetch(int field_num, const tl::arg &a, std::vector<tl::var_description> &vars, bool flat,
int parser_type) const override;
int parser_type) const final;
std::string gen_field_store(const tl::arg &a, std::vector<tl::var_description> &vars, bool flat,
int storer_type) const override;
int storer_type) const final;
std::string gen_type_fetch(const std::string &field_name, const tl::tl_tree_type *tree_type,
const std::vector<tl::var_description> &vars, int parser_type) const override;
const std::vector<tl::var_description> &vars, int parser_type) const final;
std::string gen_type_store(const std::string &field_name, const tl::tl_tree_type *tree_type,
const std::vector<tl::var_description> &vars, int storer_type) const override;
std::string gen_var_type_fetch(const tl::arg &a) const override;
const std::vector<tl::var_description> &vars, int storer_type) const final;
std::string gen_var_type_fetch(const tl::arg &a) const final;
std::string gen_get_id(const std::string &class_name, std::int32_t id, bool is_proxy) const override;
std::string gen_get_id(const std::string &class_name, std::int32_t id, bool is_proxy) const final;
std::string gen_function_result_type(const tl::tl_tree *result) const override;
std::string gen_function_result_type(const tl::tl_tree *result) const final;
std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name,
const std::string &parent_class_name, int arity, int field_count,
std::vector<tl::var_description> &vars, int parser_type) const override;
std::vector<tl::var_description> &vars, int parser_type) const final;
std::string gen_fetch_function_end(bool has_parent, int field_count, const std::vector<tl::var_description> &vars,
int parser_type) const override;
int parser_type) const final;
std::string gen_fetch_function_result_begin(const std::string &parser_name, const std::string &class_name,
const tl::tl_tree *result) const override;
std::string gen_fetch_function_result_end() const override;
const tl::tl_tree *result) const final;
std::string gen_fetch_function_result_end() const final;
std::string gen_fetch_function_result_any_begin(const std::string &parser_name, const std::string &class_name,
bool is_proxy) const override;
std::string gen_fetch_function_result_any_end(bool is_proxy) const override;
bool is_proxy) const final;
std::string gen_fetch_function_result_any_end(bool is_proxy) const final;
std::string gen_store_function_begin(const std::string &storer_name, const std::string &class_name, int arity,
std::vector<tl::var_description> &vars, int storer_type) const override;
std::string gen_store_function_end(const std::vector<tl::var_description> &vars, int storer_type) const override;
std::vector<tl::var_description> &vars, int storer_type) const final;
std::string gen_store_function_end(const std::vector<tl::var_description> &vars, int storer_type) const final;
std::string gen_fetch_switch_begin() const override;
std::string gen_fetch_switch_case(const tl::tl_combinator *t, int arity) const override;
std::string gen_fetch_switch_end() const override;
std::string gen_fetch_switch_begin() const final;
std::string gen_fetch_switch_case(const tl::tl_combinator *t, int arity) const final;
std::string gen_fetch_switch_end() const final;
std::string gen_constructor_begin(int field_count, const std::string &class_name, bool is_default) const override;
std::string gen_constructor_begin(int field_count, const std::string &class_name, bool is_default) const final;
std::string gen_constructor_parameter(int field_num, const std::string &class_name, const tl::arg &a,
bool is_default) const override;
bool is_default) const final;
std::string gen_constructor_field_init(int field_num, const std::string &class_name, const tl::arg &a,
bool is_default) const override;
std::string gen_constructor_end(const tl::tl_combinator *t, int field_count, bool is_default) const override;
bool is_default) const final;
std::string gen_constructor_end(const tl::tl_combinator *t, int field_count, bool is_default) const final;
};
} // namespace td

View File

@ -32,9 +32,9 @@ class TD_TL_writer_jni_cpp : public TD_TL_writer_cpp {
std::string gen_type_signature(const tl::tl_tree_type *tree_type) const;
std::string get_pretty_field_name(std::string field_name) const override;
std::string get_pretty_field_name(std::string field_name) const final;
std::string get_pretty_class_name(std::string class_name) const override;
std::string get_pretty_class_name(std::string class_name) const final;
public:
TD_TL_writer_jni_cpp(const std::string &tl_name, const std::string &string_type, const std::string &bytes_type,
@ -42,69 +42,68 @@ class TD_TL_writer_jni_cpp : public TD_TL_writer_cpp {
: TD_TL_writer_cpp(tl_name, string_type, bytes_type, ext_include) {
}
bool is_built_in_simple_type(const std::string &name) const override;
bool is_built_in_complex_type(const std::string &name) const override;
bool is_built_in_simple_type(const std::string &name) const final;
bool is_built_in_complex_type(const std::string &name) const final;
int get_parser_type(const tl::tl_combinator *t, const std::string &parser_name) const override;
int get_additional_function_type(const std::string &additional_function_name) const override;
std::vector<std::string> get_parsers() const override;
std::vector<std::string> get_storers() const override;
std::vector<std::string> get_additional_functions() const override;
int get_parser_type(const tl::tl_combinator *t, const std::string &parser_name) const final;
int get_additional_function_type(const std::string &additional_function_name) const final;
std::vector<std::string> get_parsers() const final;
std::vector<std::string> get_storers() const final;
std::vector<std::string> get_additional_functions() const final;
std::string gen_base_type_class_name(int arity) const override;
std::string gen_base_tl_class_name() const override;
std::string gen_base_type_class_name(int arity) const final;
std::string gen_base_tl_class_name() const final;
std::string gen_class_begin(const std::string &class_name, const std::string &base_class_name,
bool is_proxy) const override;
bool is_proxy) const final;
std::string gen_field_definition(const std::string &class_name, const std::string &type_name,
const std::string &field_name) const override;
const std::string &field_name) const final;
std::string gen_constructor_id_store(std::int32_t id, int storer_type) const override;
std::string gen_constructor_id_store(std::int32_t id, int storer_type) const final;
std::string gen_field_fetch(int field_num, const tl::arg &a, std::vector<tl::var_description> &vars, bool flat,
int parser_type) const override;
int parser_type) const final;
std::string gen_field_store(const tl::arg &a, std::vector<tl::var_description> &vars, bool flat,
int storer_type) const override;
int storer_type) const final;
std::string gen_type_fetch(const std::string &field_name, const tl::tl_tree_type *tree_type,
const std::vector<tl::var_description> &vars, int parser_type) const override;
const std::vector<tl::var_description> &vars, int parser_type) const final;
std::string gen_type_store(const std::string &field_name, const tl::tl_tree_type *tree_type,
const std::vector<tl::var_description> &vars, int storer_type) const override;
const std::vector<tl::var_description> &vars, int storer_type) const final;
std::string gen_get_id(const std::string &class_name, std::int32_t id, bool is_proxy) const override;
std::string gen_get_id(const std::string &class_name, std::int32_t id, bool is_proxy) const final;
std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name,
const std::string &parent_class_name, int arity, int field_count,
std::vector<tl::var_description> &vars, int parser_type) const override;
std::vector<tl::var_description> &vars, int parser_type) const final;
std::string gen_fetch_function_end(bool has_parent, int field_count, const std::vector<tl::var_description> &vars,
int parser_type) const override;
int parser_type) const final;
std::string gen_fetch_function_result_begin(const std::string &parser_name, const std::string &class_name,
const tl::tl_tree *result) const override;
std::string gen_fetch_function_result_end() const override;
const tl::tl_tree *result) const final;
std::string gen_fetch_function_result_end() const final;
std::string gen_fetch_function_result_any_begin(const std::string &parser_name, const std::string &class_name,
bool is_proxy) const override;
std::string gen_fetch_function_result_any_end(bool is_proxy) const override;
bool is_proxy) const final;
std::string gen_fetch_function_result_any_end(bool is_proxy) const final;
std::string gen_store_function_begin(const std::string &storer_name, const std::string &class_name, int arity,
std::vector<tl::var_description> &vars, int storer_type) const override;
std::vector<tl::var_description> &vars, int storer_type) const final;
std::string gen_fetch_switch_begin() const override;
std::string gen_fetch_switch_case(const tl::tl_combinator *t, int arity) const override;
std::string gen_fetch_switch_end() const override;
std::string gen_fetch_switch_begin() const final;
std::string gen_fetch_switch_case(const tl::tl_combinator *t, int arity) const final;
std::string gen_fetch_switch_end() const final;
std::string gen_additional_function(const std::string &function_name, const tl::tl_combinator *t,
bool is_function) const override;
bool is_function) const final;
std::string gen_additional_proxy_function_begin(const std::string &function_name, const tl::tl_type *type,
const std::string &class_name, int arity,
bool is_function) const override;
bool is_function) const final;
std::string gen_additional_proxy_function_case(const std::string &function_name, const tl::tl_type *type,
const std::string &class_name, int arity) const override;
const std::string &class_name, int arity) const final;
std::string gen_additional_proxy_function_case(const std::string &function_name, const tl::tl_type *type,
const tl::tl_combinator *t, int arity,
bool is_function) const override;
const tl::tl_combinator *t, int arity, bool is_function) const final;
std::string gen_additional_proxy_function_end(const std::string &function_name, const tl::tl_type *type,
bool is_function) const override;
bool is_function) const final;
};
} // namespace td

View File

@ -20,38 +20,37 @@ class TD_TL_writer_jni_h : public TD_TL_writer_h {
: TD_TL_writer_h(tl_name, string_type, bytes_type, ext_include) {
}
bool is_built_in_simple_type(const std::string &name) const override;
bool is_built_in_complex_type(const std::string &name) const override;
bool is_built_in_simple_type(const std::string &name) const final;
bool is_built_in_complex_type(const std::string &name) const final;
int get_parser_type(const tl::tl_combinator *t, const std::string &parser_name) const override;
int get_additional_function_type(const std::string &additional_function_name) const override;
std::vector<std::string> get_parsers() const override;
std::vector<std::string> get_storers() const override;
std::vector<std::string> get_additional_functions() const override;
int get_parser_type(const tl::tl_combinator *t, const std::string &parser_name) const final;
int get_additional_function_type(const std::string &additional_function_name) const final;
std::vector<std::string> get_parsers() const final;
std::vector<std::string> get_storers() const final;
std::vector<std::string> get_additional_functions() const final;
std::string gen_base_type_class_name(int arity) const override;
std::string gen_base_tl_class_name() const override;
std::string gen_base_type_class_name(int arity) const final;
std::string gen_base_tl_class_name() const final;
std::string gen_output_begin() const override;
std::string gen_output_begin() const final;
std::string gen_class_begin(const std::string &class_name, const std::string &base_class_name,
bool is_proxy) const override;
bool is_proxy) const final;
std::string gen_field_definition(const std::string &class_name, const std::string &type_name,
const std::string &field_name) const override;
const std::string &field_name) const final;
std::string gen_additional_function(const std::string &function_name, const tl::tl_combinator *t,
bool is_function) const override;
bool is_function) const final;
std::string gen_additional_proxy_function_begin(const std::string &function_name, const tl::tl_type *type,
const std::string &class_name, int arity,
bool is_function) const override;
bool is_function) const final;
std::string gen_additional_proxy_function_case(const std::string &function_name, const tl::tl_type *type,
const std::string &class_name, int arity) const override;
const std::string &class_name, int arity) const final;
std::string gen_additional_proxy_function_case(const std::string &function_name, const tl::tl_type *type,
const tl::tl_combinator *t, int arity,
bool is_function) const override;
const tl::tl_combinator *t, int arity, bool is_function) const final;
std::string gen_additional_proxy_function_end(const std::string &function_name, const tl::tl_type *type,
bool is_function) const override;
bool is_function) const final;
};
} // namespace td

View File

@ -35,19 +35,19 @@ class HandshakeActor : public Actor {
Promise<unique_ptr<RawConnection>> raw_connection_promise_;
Promise<unique_ptr<AuthKeyHandshake>> handshake_promise_;
void start_up() override;
void tear_down() override {
void start_up() final;
void tear_down() final {
finish(Status::OK());
}
void hangup() override {
void hangup() final {
finish(Status::Error(1, "Canceled"));
stop();
}
void timeout_expired() override {
void timeout_expired() final {
finish(Status::Error("Timeout expired"));
stop();
}
void loop() override;
void loop() final;
void finish(Status status) {
// NB: order may be important for parent

View File

@ -60,11 +60,11 @@ class HandshakeConnection
AuthKeyHandshake *handshake_;
unique_ptr<AuthKeyHandshakeContext> context_;
void send_no_crypto(const Storer &storer) override {
void send_no_crypto(const Storer &storer) final {
raw_connection_->send_no_crypto(PacketStorer<NoCryptoImpl>(0, storer));
}
Status on_raw_packet(const PacketInfo &packet_info, BufferSlice packet) override {
Status on_raw_packet(const PacketInfo &packet_info, BufferSlice packet) final {
if (packet_info.no_crypto_flag == false) {
return Status::Error("Expected not encrypted packet");
}

View File

@ -26,24 +26,24 @@ class Transport : public IStreamTransport {
explicit Transport(string secret) : secret_(std::move(secret)) {
}
Result<size_t> read_next(BufferSlice *message, uint32 *quick_ack) override TD_WARN_UNUSED_RESULT;
bool support_quick_ack() const override {
Result<size_t> read_next(BufferSlice *message, uint32 *quick_ack) final TD_WARN_UNUSED_RESULT;
bool support_quick_ack() const final {
return false;
}
void write(BufferWriter &&message, bool quick_ack) override;
bool can_read() const override;
bool can_write() const override;
void init(ChainBufferReader *input, ChainBufferWriter *output) override {
void write(BufferWriter &&message, bool quick_ack) final;
bool can_read() const final;
bool can_write() const final;
void init(ChainBufferReader *input, ChainBufferWriter *output) final {
reader_.init(input);
output_ = output;
}
size_t max_prepend_size() const override;
size_t max_append_size() const override;
TransportType get_type() const override {
size_t max_prepend_size() const final;
size_t max_append_size() const final;
TransportType get_type() const final {
return {TransportType::Http, 0, ProxySecret::from_raw(secret_)};
}
bool use_random_padding() const override;
bool use_random_padding() const final;
private:
string secret_;

View File

@ -19,7 +19,7 @@ class PacketStorer
: public Storer
, public Impl {
public:
size_t size() const override {
size_t size() const final {
if (size_ != std::numeric_limits<size_t>::max()) {
return size_;
}
@ -28,7 +28,7 @@ class PacketStorer
return size_ = storer.get_length();
}
size_t store(uint8 *ptr) const override {
size_t store(uint8 *ptr) const final {
TlStorerUnsafe storer(ptr);
this->do_store(storer);
return static_cast<size_t>(storer.get_buf() - ptr);

View File

@ -38,22 +38,22 @@ ActorOwn<> create_ping_actor(string debug, unique_ptr<RawConnection> raw_connect
Promise<unique_ptr<RawConnection>> promise_;
ActorShared<> parent_;
void start_up() override {
void start_up() final {
Scheduler::subscribe(ping_connection_->get_poll_info().extract_pollable_fd(this));
set_timeout_in(10);
yield();
}
void hangup() override {
void hangup() final {
finish(Status::Error("Canceled"));
stop();
}
void tear_down() override {
void tear_down() final {
finish(Status::OK());
}
void loop() override {
void loop() final {
auto status = ping_connection_->flush();
if (status.is_error()) {
finish(std::move(status));
@ -65,7 +65,7 @@ ActorOwn<> create_ping_actor(string debug, unique_ptr<RawConnection> raw_connect
}
}
void timeout_expired() override {
void timeout_expired() final {
finish(Status::Error("Pong timeout expired"));
stop();
}

View File

@ -35,15 +35,15 @@ class PingConnectionReqPQ
: raw_connection_(std::move(raw_connection)), ping_count_(ping_count) {
}
PollableFdInfo &get_poll_info() override {
PollableFdInfo &get_poll_info() final {
return raw_connection_->get_poll_info();
}
unique_ptr<RawConnection> move_as_raw_connection() override {
unique_ptr<RawConnection> move_as_raw_connection() final {
return std::move(raw_connection_);
}
Status flush() override {
Status flush() final {
if (!was_ping_) {
UInt128 nonce;
Random::secure_bytes(nonce.raw, sizeof(nonce));
@ -55,14 +55,14 @@ class PingConnectionReqPQ
}
return raw_connection_->flush(AuthKey(), *this);
}
bool was_pong() const override {
bool was_pong() const final {
return finish_time_ > 0;
}
double rtt() const override {
double rtt() const final {
return finish_time_ - start_time_;
}
Status on_raw_packet(const PacketInfo &packet_info, BufferSlice packet) override {
Status on_raw_packet(const PacketInfo &packet_info, BufferSlice packet) final {
if (packet.size() < 12) {
return Status::Error("Result is too small");
}
@ -105,31 +105,31 @@ class PingConnectionPingPong
double rtt_;
bool is_closed_{false};
Status status_;
void on_connected() override {
void on_connected() final {
}
void on_closed(Status status) override {
void on_closed(Status status) final {
is_closed_ = true;
CHECK(status.is_error());
status_ = std::move(status);
}
void on_auth_key_updated() override {
void on_auth_key_updated() final {
}
void on_tmp_auth_key_updated() override {
void on_tmp_auth_key_updated() final {
}
void on_server_salt_updated() override {
void on_server_salt_updated() final {
}
void on_server_time_difference_updated() override {
void on_server_time_difference_updated() final {
}
void on_session_created(uint64 unique_id, uint64 first_id) override {
void on_session_created(uint64 unique_id, uint64 first_id) final {
}
void on_session_failed(Status status) override {
void on_session_failed(Status status) final {
}
void on_container_sent(uint64 container_id, vector<uint64> msgs_id) override {
void on_container_sent(uint64 container_id, vector<uint64> msgs_id) final {
}
Status on_pong() override {
Status on_pong() final {
pong_cnt_++;
if (pong_cnt_ == 1) {
rtt_ = Time::now();
@ -140,30 +140,30 @@ class PingConnectionPingPong
return Status::OK();
}
void on_message_ack(uint64 id) override {
void on_message_ack(uint64 id) final {
}
Status on_message_result_ok(uint64 id, BufferSlice packet, size_t original_size) override {
Status on_message_result_ok(uint64 id, BufferSlice packet, size_t original_size) final {
LOG(ERROR) << "Unexpected message";
return Status::OK();
}
void on_message_result_error(uint64 id, int code, BufferSlice descr) override {
void on_message_result_error(uint64 id, int code, BufferSlice descr) final {
}
void on_message_failed(uint64 id, Status status) override {
void on_message_failed(uint64 id, Status status) final {
}
void on_message_info(uint64 id, int32 state, uint64 answer_id, int32 answer_size) override {
void on_message_info(uint64 id, int32 state, uint64 answer_id, int32 answer_size) final {
}
Status on_destroy_auth_key() override {
Status on_destroy_auth_key() final {
LOG(ERROR) << "Destroy auth key";
return Status::OK();
}
PollableFdInfo &get_poll_info() override {
PollableFdInfo &get_poll_info() final {
return connection_->get_poll_info();
}
unique_ptr<RawConnection> move_as_raw_connection() override {
unique_ptr<RawConnection> move_as_raw_connection() final {
return connection_->move_as_raw_connection();
}
Status flush() override {
Status flush() final {
if (was_pong()) {
return Status::OK();
}
@ -175,10 +175,10 @@ class PingConnectionPingPong
}
return Status::OK();
}
bool was_pong() const override {
bool was_pong() const final {
return pong_cnt_ >= 2;
}
double rtt() const override {
double rtt() const final {
return rtt_;
}
};

View File

@ -42,18 +42,18 @@ class RawConnectionDefault : public RawConnection {
transport_->init(&socket_fd_.input_buffer(), &socket_fd_.output_buffer());
}
void set_connection_token(StateManager::ConnectionToken connection_token) override {
void set_connection_token(StateManager::ConnectionToken connection_token) final {
connection_token_ = std::move(connection_token);
}
bool can_send() const override {
bool can_send() const final {
return transport_->can_write();
}
TransportType get_transport_type() const override {
TransportType get_transport_type() const final {
return transport_->get_type();
}
void send_crypto(const Storer &storer, int64 session_id, int64 salt, const AuthKey &auth_key,
uint64 quick_ack_token) override {
uint64 quick_ack_token) final {
PacketInfo info;
info.version = 2;
info.no_crypto_flag = false;
@ -78,7 +78,7 @@ class RawConnectionDefault : public RawConnection {
transport_->write(std::move(packet), use_quick_ack);
}
uint64 send_no_crypto(const Storer &storer) override {
uint64 send_no_crypto(const Storer &storer) final {
PacketInfo info;
info.no_crypto_flag = true;
@ -90,16 +90,16 @@ class RawConnectionDefault : public RawConnection {
return info.message_id;
}
PollableFdInfo &get_poll_info() override {
PollableFdInfo &get_poll_info() final {
return socket_fd_.get_poll_info();
}
StatsCallback *stats_callback() override {
StatsCallback *stats_callback() final {
return stats_callback_.get();
}
// NB: After first returned error, all subsequent calls will return error too.
Status flush(const AuthKey &auth_key, Callback &callback) override {
Status flush(const AuthKey &auth_key, Callback &callback) final {
auto status = do_flush(auth_key, callback);
if (status.is_error()) {
if (stats_callback_ && status.code() != 2) {
@ -110,19 +110,19 @@ class RawConnectionDefault : public RawConnection {
return status;
}
bool has_error() const override {
bool has_error() const final {
return has_error_;
}
void close() override {
void close() final {
transport_.reset();
socket_fd_.close();
}
PublicFields &extra() override {
PublicFields &extra() final {
return extra_;
}
const PublicFields &extra() const override {
const PublicFields &extra() const final {
return extra_;
}
@ -268,18 +268,18 @@ class RawConnectionHttp : public RawConnection {
answers_->init();
}
void set_connection_token(StateManager::ConnectionToken connection_token) override {
void set_connection_token(StateManager::ConnectionToken connection_token) final {
connection_token_ = std::move(connection_token);
}
bool can_send() const override {
bool can_send() const final {
return mode_ == Send;
}
TransportType get_transport_type() const override {
TransportType get_transport_type() const final {
return mtproto::TransportType{mtproto::TransportType::Http, 0, mtproto::ProxySecret()};
}
void send_crypto(const Storer &storer, int64 session_id, int64 salt, const AuthKey &auth_key,
uint64 quick_ack_token) override {
uint64 quick_ack_token) final {
PacketInfo info;
info.version = 2;
info.no_crypto_flag = false;
@ -293,7 +293,7 @@ class RawConnectionHttp : public RawConnection {
send_packet(packet.as_buffer_slice());
}
uint64 send_no_crypto(const Storer &storer) override {
uint64 send_no_crypto(const Storer &storer) final {
PacketInfo info;
info.no_crypto_flag = true;
@ -304,16 +304,16 @@ class RawConnectionHttp : public RawConnection {
return info.message_id;
}
PollableFdInfo &get_poll_info() override {
PollableFdInfo &get_poll_info() final {
return answers_->reader_get_event_fd().get_poll_info();
}
StatsCallback *stats_callback() override {
StatsCallback *stats_callback() final {
return stats_callback_.get();
}
// NB: After first returned error, all subsequent calls will return error too.
Status flush(const AuthKey &auth_key, Callback &callback) override {
Status flush(const AuthKey &auth_key, Callback &callback) final {
auto status = do_flush(auth_key, callback);
if (status.is_error()) {
if (stats_callback_ && status.code() != 2) {
@ -324,17 +324,17 @@ class RawConnectionHttp : public RawConnection {
return status;
}
bool has_error() const override {
bool has_error() const final {
return has_error_;
}
void close() override {
void close() final {
}
PublicFields &extra() override {
PublicFields &extra() final {
return extra_;
}
const PublicFields &extra() const override {
const PublicFields &extra() const final {
return extra_;
}

View File

@ -264,10 +264,10 @@ class SessionConnection
Status init() TD_WARN_UNUSED_RESULT;
Status do_flush() TD_WARN_UNUSED_RESULT;
Status before_write() override TD_WARN_UNUSED_RESULT;
Status on_raw_packet(const PacketInfo &info, BufferSlice packet) override;
Status on_quick_ack(uint64 quick_ack_token) override;
void on_read(size_t size) override;
Status before_write() final TD_WARN_UNUSED_RESULT;
Status on_raw_packet(const PacketInfo &info, BufferSlice packet) final;
Status on_quick_ack(uint64 quick_ack_token) final;
void on_read(size_t size) final;
};
} // namespace mtproto

View File

@ -51,10 +51,10 @@ class ITransport {
class AbridgedTransport : public ITransport {
public:
size_t read_from_stream(ChainBufferReader *stream, BufferSlice *message, uint32 *quick_ack) override;
void write_prepare_inplace(BufferWriter *message, bool quick_ack) override;
void init_output_stream(ChainBufferWriter *stream) override;
bool support_quick_ack() const override {
size_t read_from_stream(ChainBufferReader *stream, BufferSlice *message, uint32 *quick_ack) final;
void write_prepare_inplace(BufferWriter *message, bool quick_ack) final;
void init_output_stream(ChainBufferWriter *stream) final;
bool support_quick_ack() const final {
return false;
}
};
@ -63,10 +63,10 @@ class IntermediateTransport : ITransport {
public:
explicit IntermediateTransport(bool with_padding) : with_padding_(with_padding) {
}
size_t read_from_stream(ChainBufferReader *stream, BufferSlice *message, uint32 *quick_ack) override;
void write_prepare_inplace(BufferWriter *message, bool quick_ack) override;
void init_output_stream(ChainBufferWriter *stream) override;
bool support_quick_ack() const override {
size_t read_from_stream(ChainBufferReader *stream, BufferSlice *message, uint32 *quick_ack) final;
void write_prepare_inplace(BufferWriter *message, bool quick_ack) final;
void init_output_stream(ChainBufferWriter *stream) final;
bool support_quick_ack() const final {
return true;
}
bool with_padding() const {
@ -82,41 +82,41 @@ using TransportImpl = IntermediateTransport;
class OldTransport : public IStreamTransport {
public:
OldTransport() = default;
Result<size_t> read_next(BufferSlice *message, uint32 *quick_ack) override TD_WARN_UNUSED_RESULT {
Result<size_t> read_next(BufferSlice *message, uint32 *quick_ack) final TD_WARN_UNUSED_RESULT {
return impl_.read_from_stream(input_, message, quick_ack);
}
bool support_quick_ack() const override {
bool support_quick_ack() const final {
return impl_.support_quick_ack();
}
void write(BufferWriter &&message, bool quick_ack) override {
void write(BufferWriter &&message, bool quick_ack) final {
impl_.write_prepare_inplace(&message, quick_ack);
output_->append(message.as_buffer_slice());
}
void init(ChainBufferReader *input, ChainBufferWriter *output) override {
void init(ChainBufferReader *input, ChainBufferWriter *output) final {
input_ = input;
output_ = output;
impl_.init_output_stream(output_);
}
bool can_read() const override {
bool can_read() const final {
return true;
}
bool can_write() const override {
bool can_write() const final {
return true;
}
size_t max_prepend_size() const override {
size_t max_prepend_size() const final {
return 4;
}
size_t max_append_size() const override {
size_t max_append_size() const final {
return 15;
}
TransportType get_type() const override {
TransportType get_type() const final {
return TransportType{TransportType::Tcp, 0, ProxySecret()};
}
bool use_random_padding() const override {
bool use_random_padding() const final {
return false;
}
@ -132,25 +132,25 @@ class ObfuscatedTransport : public IStreamTransport {
: dc_id_(dc_id), secret_(secret), impl_(secret_.use_random_padding()) {
}
Result<size_t> read_next(BufferSlice *message, uint32 *quick_ack) override TD_WARN_UNUSED_RESULT;
Result<size_t> read_next(BufferSlice *message, uint32 *quick_ack) final TD_WARN_UNUSED_RESULT;
bool support_quick_ack() const override {
bool support_quick_ack() const final {
return impl_.support_quick_ack();
}
void write(BufferWriter &&message, bool quick_ack) override;
void write(BufferWriter &&message, bool quick_ack) final;
void init(ChainBufferReader *input, ChainBufferWriter *output) override;
void init(ChainBufferReader *input, ChainBufferWriter *output) final;
bool can_read() const override {
bool can_read() const final {
return true;
}
bool can_write() const override {
bool can_write() const final {
return true;
}
size_t max_prepend_size() const override {
size_t max_prepend_size() const final {
size_t res = 4;
if (secret_.emulate_tls()) {
res += 5;
@ -165,14 +165,14 @@ class ObfuscatedTransport : public IStreamTransport {
return res;
}
size_t max_append_size() const override {
size_t max_append_size() const final {
return 15;
}
TransportType get_type() const override {
TransportType get_type() const final {
return TransportType{TransportType::ObfuscatedTcp, dc_id_, secret_};
}
bool use_random_padding() const override {
bool use_random_padding() const final {
return secret_.use_random_padding();
}

View File

@ -43,7 +43,7 @@ class TlsInit : public TransparentProxy {
void send_hello();
Status wait_hello_response();
Status loop_impl() override;
Status loop_impl() final;
};
} // namespace mtproto

View File

@ -13,7 +13,7 @@ namespace mtproto {
class TlsReaderByteFlow final : public ByteFlowBase {
public:
bool loop() override;
bool loop() final;
};
} // namespace mtproto

View File

@ -26,7 +26,7 @@ class TLObjectStorer : public Storer {
explicit TLObjectStorer(const T &object) : object_(object) {
}
size_t size() const override {
size_t size() const final {
if (size_ == std::numeric_limits<size_t>::max()) {
TlStorerCalcLength storer;
storer.store_binary(object_.get_id());
@ -35,7 +35,7 @@ class TLObjectStorer : public Storer {
}
return size_;
}
size_t store(uint8 *ptr) const override {
size_t store(uint8 *ptr) const final {
TlStorerUnsafe storer(ptr);
storer.store_binary(object_.get_id());
object_.store(storer);

View File

@ -48,7 +48,7 @@ class GetSavedGifsQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_getSavedGifs(hash)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getSavedGifs>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -58,7 +58,7 @@ class GetSavedGifsQuery : public Td::ResultHandler {
td->animations_manager_->on_get_saved_animations(is_repair_, std::move(ptr));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for get saved animations: " << status;
}
@ -86,7 +86,7 @@ class SaveGifQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_saveGif(std::move(input_document), unsave)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_saveGif>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -101,7 +101,7 @@ class SaveGifQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) {
VLOG(file_references) << "Receive " << status << " for " << file_id_;
td->file_manager_->delete_file_reference(file_id_, file_reference_);

View File

@ -138,7 +138,7 @@ class AnimationsManager : public Actor {
void save_saved_animations_to_database();
void tear_down() override;
void tear_down() final;
class AnimationListLogEvent;

View File

@ -238,14 +238,14 @@ class AuthManager : public NetActor {
void on_get_login_token(tl_object_ptr<telegram_api::auth_LoginToken> login_token);
void on_get_authorization(tl_object_ptr<telegram_api::auth_Authorization> auth_ptr);
void on_result(NetQueryPtr result) override;
void on_result(NetQueryPtr result) final;
void update_state(State new_state, bool force = false, bool should_save_state = true);
tl_object_ptr<td_api::AuthorizationState> get_authorization_state_object(State authorization_state) const;
void send_ok(uint64 query_id);
void start_up() override;
void tear_down() override;
void start_up() final;
void tear_down() final;
};
} // namespace td

View File

@ -42,7 +42,7 @@ class GetAutoDownloadSettingsQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::account_getAutoDownloadSettings()));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_getAutoDownloadSettings>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -54,7 +54,7 @@ class GetAutoDownloadSettingsQuery : public Td::ResultHandler {
convert_auto_download_settings(settings->high_)));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -98,7 +98,7 @@ class SaveAutoDownloadSettingsQuery : public Td::ResultHandler {
flags, false /*ignored*/, false /*ignored*/, get_input_auto_download_settings(settings))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_saveAutoDownloadSettings>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -108,7 +108,7 @@ class SaveAutoDownloadSettingsQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};

View File

@ -57,7 +57,7 @@ class GetBackgroundQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::account_getWallPaper(std::move(input_wallpaper))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_getWallPaper>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -68,7 +68,7 @@ class GetBackgroundQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
LOG(INFO) << "Receive error for GetBackgroundQuery for " << background_id_ << "/" << background_name_ << ": "
<< status;
promise_.set_error(std::move(status));
@ -87,7 +87,7 @@ class GetBackgroundsQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::account_getWallPapers(0)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_getWallPapers>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -96,7 +96,7 @@ class GetBackgroundsQuery : public Td::ResultHandler {
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -113,7 +113,7 @@ class InstallBackgroundQuery : public Td::ResultHandler {
telegram_api::account_installWallPaper(std::move(input_wallpaper), type.get_input_wallpaper_settings())));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_installWallPaper>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -123,7 +123,7 @@ class InstallBackgroundQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -148,7 +148,7 @@ class UploadBackgroundQuery : public Td::ResultHandler {
std::move(input_file), type_.get_mime_type(), type.get_input_wallpaper_settings())));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_uploadWallPaper>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -158,7 +158,7 @@ class UploadBackgroundQuery : public Td::ResultHandler {
std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
CHECK(status.is_error());
CHECK(file_id_.is_valid());
if (begins_with(status.message(), "FILE_PART_") && ends_with(status.message(), "_MISSING")) {
@ -186,7 +186,7 @@ class UnsaveBackgroundQuery : public Td::ResultHandler {
std::move(input_wallpaper), true, telegram_api::make_object<telegram_api::wallPaperSettings>())));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_saveWallPaper>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -197,7 +197,7 @@ class UnsaveBackgroundQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for save background: " << status;
}
@ -216,7 +216,7 @@ class ResetBackgroundsQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::account_resetWallPapers()));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_resetWallPapers>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -227,7 +227,7 @@ class ResetBackgroundsQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for reset backgrounds: " << status;
}
@ -237,20 +237,20 @@ class ResetBackgroundsQuery : public Td::ResultHandler {
class BackgroundManager::UploadBackgroundFileCallback : public FileManager::UploadCallback {
public:
void on_upload_ok(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file) override {
void on_upload_ok(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file) final {
send_closure_later(G()->background_manager(), &BackgroundManager::on_upload_background_file, file_id,
std::move(input_file));
}
void on_upload_encrypted_ok(FileId file_id, tl_object_ptr<telegram_api::InputEncryptedFile> input_file) override {
void on_upload_encrypted_ok(FileId file_id, tl_object_ptr<telegram_api::InputEncryptedFile> input_file) final {
UNREACHABLE();
}
void on_upload_secure_ok(FileId file_id, tl_object_ptr<telegram_api::InputSecureFile> input_file) override {
void on_upload_secure_ok(FileId file_id, tl_object_ptr<telegram_api::InputSecureFile> input_file) final {
UNREACHABLE();
}
void on_upload_error(FileId file_id, Status error) override {
void on_upload_error(FileId file_id, Status error) final {
send_closure_later(G()->background_manager(), &BackgroundManager::on_upload_background_file_error, file_id,
std::move(error));
}

View File

@ -91,9 +91,9 @@ class BackgroundManager : public Actor {
class UploadBackgroundFileCallback;
void start_up() override;
void start_up() final;
void tear_down() override;
void tear_down() final;
static string get_background_database_key(bool for_dark_theme);

View File

@ -35,7 +35,7 @@ class SetBotCommandsQuery : public Td::ResultHandler {
transform(commands, [](const BotCommand &command) { return command.get_input_bot_command(); }))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::bots_setBotCommands>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -47,7 +47,7 @@ class SetBotCommandsQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -64,7 +64,7 @@ class ResetBotCommandsQuery : public Td::ResultHandler {
telegram_api::bots_resetBotCommands(scope.get_input_bot_command_scope(td), language_code)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::bots_resetBotCommands>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -73,7 +73,7 @@ class ResetBotCommandsQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -91,7 +91,7 @@ class GetBotCommandsQuery : public Td::ResultHandler {
telegram_api::bots_getBotCommands(scope.get_input_bot_command_scope(td), language_code)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::bots_getBotCommands>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -101,7 +101,7 @@ class GetBotCommandsQuery : public Td::ResultHandler {
promise_.set_value(commands.get_bot_commands_object(td));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};

View File

@ -191,15 +191,15 @@ class CallActor : public NetQueryCallback {
static vector<string> get_emojis_fingerprint(const string &key, const string &g_a);
void start_up() override;
void loop() override;
void start_up() final;
void loop() final;
Container<Promise<NetQueryPtr>> container_;
void on_result(NetQueryPtr query) override;
void on_result(NetQueryPtr query) final;
void send_with_promise(NetQueryPtr query, Promise<NetQueryPtr> promise);
void timeout_expired() override;
void hangup() override;
void timeout_expired() final;
void hangup() final;
void on_error(Status status);
};

View File

@ -55,7 +55,7 @@ class CallManager : public Actor {
CallId create_call_actor();
void set_call_id(CallId call_id, Result<int64> r_server_call_id);
void hangup() override;
void hangup_shared() override;
void hangup() final;
void hangup_shared() final;
};
} // namespace td

View File

@ -75,7 +75,7 @@ class GetBotCallbackAnswerQuery : public Td::ResultHandler {
send_query(std::move(net_query));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getBotCallbackAnswer>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -85,7 +85,7 @@ class GetBotCallbackAnswerQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (status.message() == "DATA_INVALID") {
td->messages_manager_->get_message_from_server({dialog_id_, message_id_}, Auto());
} else if (status.message() == "BOT_RESPONSE_TIMEOUT") {
@ -109,7 +109,7 @@ class SetBotCallbackAnswerQuery : public Td::ResultHandler {
flags, false /*ignored*/, callback_query_id, text, url, cache_time)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_setBotCallbackAnswer>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -122,7 +122,7 @@ class SetBotCallbackAnswerQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};

View File

@ -51,17 +51,17 @@ class TdReceiver {
public:
Callback(ClientManager::ClientId client_id, TdReceiver *impl) : client_id_(client_id), impl_(impl) {
}
void on_result(uint64 id, td_api::object_ptr<td_api::Object> result) override {
void on_result(uint64 id, td_api::object_ptr<td_api::Object> result) final {
impl_->responses_.push({client_id_, id, std::move(result)});
}
void on_error(uint64 id, td_api::object_ptr<td_api::error> error) override {
void on_error(uint64 id, td_api::object_ptr<td_api::error> error) final {
impl_->responses_.push({client_id_, id, std::move(error)});
}
Callback(const Callback &) = delete;
Callback &operator=(const Callback &) = delete;
Callback(Callback &&) = delete;
Callback &operator=(Callback &&) = delete;
~Callback() override {
~Callback() final {
impl_->responses_.push({client_id_, 0, nullptr});
}
@ -292,17 +292,17 @@ class TdReceiver {
explicit Callback(ClientManager::ClientId client_id, std::shared_ptr<OutputQueue> output_queue)
: client_id_(client_id), output_queue_(std::move(output_queue)) {
}
void on_result(uint64 id, td_api::object_ptr<td_api::Object> result) override {
void on_result(uint64 id, td_api::object_ptr<td_api::Object> result) final {
output_queue_->writer_put({client_id_, id, std::move(result)});
}
void on_error(uint64 id, td_api::object_ptr<td_api::error> error) override {
void on_error(uint64 id, td_api::object_ptr<td_api::error> error) final {
output_queue_->writer_put({client_id_, id, std::move(error)});
}
Callback(const Callback &) = delete;
Callback &operator=(const Callback &) = delete;
Callback(Callback &&) = delete;
Callback &operator=(Callback &&) = delete;
~Callback() override {
~Callback() final {
output_queue_->writer_put({client_id_, 0, nullptr});
}

View File

@ -421,13 +421,13 @@ ActorOwn<> get_full_config(DcOption option, Promise<FullConfig> promise, ActorSh
public:
explicit SimpleAuthData(DcId dc_id) : dc_id_(dc_id) {
}
DcId dc_id() const override {
DcId dc_id() const final {
return dc_id_;
}
const std::shared_ptr<PublicRsaKeyShared> &public_rsa_key() override {
const std::shared_ptr<PublicRsaKeyShared> &public_rsa_key() final {
return public_rsa_key_;
}
mtproto::AuthKey get_auth_key() override {
mtproto::AuthKey get_auth_key() final {
string dc_key = G()->td_db()->get_binlog_pmc()->get(auth_key_key());
mtproto::AuthKey res;
@ -436,31 +436,31 @@ ActorOwn<> get_full_config(DcOption option, Promise<FullConfig> promise, ActorSh
}
return res;
}
AuthKeyState get_auth_key_state() override {
AuthKeyState get_auth_key_state() final {
return AuthDataShared::get_auth_key_state(get_auth_key());
}
void set_auth_key(const mtproto::AuthKey &auth_key) override {
void set_auth_key(const mtproto::AuthKey &auth_key) final {
G()->td_db()->get_binlog_pmc()->set(auth_key_key(), serialize(auth_key));
//notify();
}
void update_server_time_difference(double diff) override {
void update_server_time_difference(double diff) final {
G()->update_server_time_difference(diff);
}
double get_server_time_difference() override {
double get_server_time_difference() final {
return G()->get_server_time_difference();
}
void add_auth_key_listener(unique_ptr<Listener> listener) override {
void add_auth_key_listener(unique_ptr<Listener> listener) final {
if (listener->notify()) {
auth_key_listeners_.push_back(std::move(listener));
}
}
void set_future_salts(const std::vector<mtproto::ServerSalt> &future_salts) override {
void set_future_salts(const std::vector<mtproto::ServerSalt> &future_salts) final {
G()->td_db()->get_binlog_pmc()->set(future_salts_key(), serialize(future_salts));
}
std::vector<mtproto::ServerSalt> get_future_salts() override {
std::vector<mtproto::ServerSalt> get_future_salts() final {
string future_salts = G()->td_db()->get_binlog_pmc()->get(future_salts_key());
std::vector<mtproto::ServerSalt> res;
if (!future_salts.empty()) {
@ -494,7 +494,7 @@ ActorOwn<> get_full_config(DcOption option, Promise<FullConfig> promise, ActorSh
}
private:
void start_up() override {
void start_up() final {
auto auth_data = std::make_shared<SimpleAuthData>(option_.get_dc_id());
int32 raw_dc_id = option_.get_dc_id().get_raw_id();
auto session_callback = make_unique<SessionCallback>(actor_shared(this, 1), std::move(option_));
@ -514,10 +514,10 @@ ActorOwn<> get_full_config(DcOption option, Promise<FullConfig> promise, ActorSh
send_closure(session_, &Session::send, std::move(query));
set_timeout_in(10);
}
void on_result(NetQueryPtr query) override {
void on_result(NetQueryPtr query) final {
promise_.set_result(fetch_result<telegram_api::help_getConfig>(std::move(query)));
}
void hangup_shared() override {
void hangup_shared() final {
if (get_link_token() == 1) {
if (promise_) {
promise_.set_error(Status::Error("Failed"));
@ -525,10 +525,10 @@ ActorOwn<> get_full_config(DcOption option, Promise<FullConfig> promise, ActorSh
stop();
}
}
void hangup() override {
void hangup() final {
session_.reset();
}
void timeout_expired() override {
void timeout_expired() final {
promise_.set_error(Status::Error("Timeout expired"));
session_.reset();
}
@ -732,11 +732,11 @@ class ConfigRecoverer : public Actor {
ActorShared<> parent_;
void hangup_shared() override {
void hangup_shared() final {
ref_cnt_--;
try_stop();
}
void hangup() override {
void hangup() final {
ref_cnt_--;
close_flag_ = true;
full_config_query_.reset();
@ -753,7 +753,7 @@ class ConfigRecoverer : public Actor {
double max_connecting_delay() const {
return expect_blocking() ? 5 : 20;
}
void loop() override {
void loop() final {
if (close_flag_) {
return;
}
@ -839,20 +839,20 @@ class ConfigRecoverer : public Actor {
}
}
void start_up() override {
void start_up() final {
class StateCallback : public StateManager::Callback {
public:
explicit StateCallback(ActorId<ConfigRecoverer> parent) : parent_(std::move(parent)) {
}
bool on_state(StateManager::State state) override {
bool on_state(StateManager::State state) final {
send_closure(parent_, &ConfigRecoverer::on_connecting, state == StateManager::State::Connecting);
return parent_.is_alive();
}
bool on_network(NetType network_type, uint32 network_generation) override {
bool on_network(NetType network_type, uint32 network_generation) final {
send_closure(parent_, &ConfigRecoverer::on_network, network_type != NetType::None, network_generation);
return parent_.is_alive();
}
bool on_online(bool online_flag) override {
bool on_online(bool online_flag) final {
send_closure(parent_, &ConfigRecoverer::on_online, online_flag);
return parent_.is_alive();
}

View File

@ -136,13 +136,13 @@ class ConfigManager : public NetQueryCallback {
static constexpr uint64 REFCNT_TOKEN = std::numeric_limits<uint64>::max() - 2;
void start_up() override;
void hangup_shared() override;
void hangup() override;
void loop() override;
void start_up() final;
void hangup_shared() final;
void hangup() final;
void loop() final;
void try_stop();
void on_result(NetQueryPtr res) override;
void on_result(NetQueryPtr res) final;
void request_config_from_dc_impl(DcId dc_id);
void process_config(tl_object_ptr<telegram_api::config> config);

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,7 @@ class ContactsManager : public Actor {
ContactsManager &operator=(const ContactsManager &) = delete;
ContactsManager(ContactsManager &&) = delete;
ContactsManager &operator=(ContactsManager &&) = delete;
~ContactsManager() override;
~ContactsManager() final;
static UserId load_my_id();
@ -1550,7 +1550,7 @@ class ContactsManager : public Actor {
void on_channel_participant_cache_timeout(ChannelId channel_id);
void tear_down() override;
void tear_down() final;
Td *td_;
ActorShared<> parent_;

View File

@ -36,7 +36,7 @@ class GetNearestDcQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create_unauth(telegram_api::help_getNearestDc()));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::help_getNearestDc>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -46,7 +46,7 @@ class GetNearestDcQuery : public Td::ResultHandler {
promise_.set_value(std::move(result->country_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status) && status.message() != "BOT_METHOD_INVALID") {
LOG(ERROR) << "GetNearestDc returned " << status;
}
@ -67,7 +67,7 @@ class GetCountriesListQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create_unauth(telegram_api::help_getCountriesList(language_code, hash)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::help_getCountriesList>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -76,7 +76,7 @@ class GetCountriesListQuery : public Td::ResultHandler {
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "GetCountriesList returned " << status;
}

View File

@ -36,10 +36,10 @@ class CountryInfoManager : public Actor {
CountryInfoManager &operator=(const CountryInfoManager &) = delete;
CountryInfoManager(CountryInfoManager &&) = delete;
CountryInfoManager &operator=(CountryInfoManager &&) = delete;
~CountryInfoManager() override;
~CountryInfoManager() final;
private:
void tear_down() override;
void tear_down() final;
struct CallingCodeInfo;
struct CountryInfo;

View File

@ -38,8 +38,8 @@ class DelayDispatcher : public Actor {
double default_delay_;
ActorShared<> parent_;
void loop() override;
void tear_down() override;
void loop() final;
void tear_down() final;
};
} // namespace td

View File

@ -76,15 +76,15 @@ class DeviceTokenManager : public NetQueryCallback {
std::array<TokenInfo, TokenType::SIZE> tokens_;
int32 sync_cnt_{0};
void start_up() override;
void start_up() final;
static string get_database_key(int32 token_type);
void save_info(int32 token_type);
void dec_sync_cnt();
void loop() override;
void on_result(NetQueryPtr net_query) override;
void loop() final;
void on_result(NetQueryPtr net_query) final;
};
} // namespace td

View File

@ -14,9 +14,9 @@ namespace td {
class DhCache : public DhCallback {
public:
int is_good_prime(Slice prime_str) const override;
void add_good_prime(Slice prime_str) const override;
void add_bad_prime(Slice prime_str) const override;
int is_good_prime(Slice prime_str) const final;
void add_good_prime(Slice prime_str) const final;
void add_bad_prime(Slice prime_str) const final;
static DhCallback *instance() {
static DhCache res;

View File

@ -162,7 +162,7 @@ class DialogDbImpl : public DialogDbSyncInterface {
}
Status add_dialog(DialogId dialog_id, FolderId folder_id, int64 order, BufferSlice data,
vector<NotificationGroupKey> notification_groups) override {
vector<NotificationGroupKey> notification_groups) final {
SCOPE_EXIT {
add_dialog_stmt_.reset();
};
@ -201,7 +201,7 @@ class DialogDbImpl : public DialogDbSyncInterface {
return Status::OK();
}
Result<BufferSlice> get_dialog(DialogId dialog_id) override {
Result<BufferSlice> get_dialog(DialogId dialog_id) final {
SCOPE_EXIT {
get_dialog_stmt_.reset();
};
@ -214,7 +214,7 @@ class DialogDbImpl : public DialogDbSyncInterface {
return BufferSlice(get_dialog_stmt_.view_blob(0));
}
Result<NotificationGroupKey> get_notification_group(NotificationGroupId notification_group_id) override {
Result<NotificationGroupKey> get_notification_group(NotificationGroupId notification_group_id) final {
SCOPE_EXIT {
get_notification_group_stmt_.reset();
};
@ -227,7 +227,7 @@ class DialogDbImpl : public DialogDbSyncInterface {
get_last_notification_date(get_notification_group_stmt_, 1));
}
Result<int32> get_secret_chat_count(FolderId folder_id) override {
Result<int32> get_secret_chat_count(FolderId folder_id) final {
SCOPE_EXIT {
get_secret_chat_count_stmt_.reset();
};
@ -237,8 +237,7 @@ class DialogDbImpl : public DialogDbSyncInterface {
return get_secret_chat_count_stmt_.view_int32(0);
}
Result<DialogDbGetDialogsResult> get_dialogs(FolderId folder_id, int64 order, DialogId dialog_id,
int32 limit) override {
Result<DialogDbGetDialogsResult> get_dialogs(FolderId folder_id, int64 order, DialogId dialog_id, int32 limit) final {
SCOPE_EXIT {
get_dialogs_stmt_.reset();
};
@ -263,7 +262,7 @@ class DialogDbImpl : public DialogDbSyncInterface {
}
Result<vector<NotificationGroupKey>> get_notification_groups_by_last_notification_date(
NotificationGroupKey notification_group_key, int32 limit) override {
NotificationGroupKey notification_group_key, int32 limit) final {
auto &stmt = get_notification_groups_by_last_notification_date_stmt_;
SCOPE_EXIT {
stmt.reset();
@ -285,10 +284,10 @@ class DialogDbImpl : public DialogDbSyncInterface {
return std::move(notification_groups);
}
Status begin_transaction() override {
Status begin_transaction() final {
return db_.begin_transaction();
}
Status commit_transaction() override {
Status commit_transaction() final {
return db_.commit_transaction();
}
@ -321,7 +320,7 @@ std::shared_ptr<DialogDbSyncSafeInterface> create_dialog_db_sync(
return make_unique<DialogDbImpl>(safe_connection->get().clone());
}) {
}
DialogDbSyncInterface &get() override {
DialogDbSyncInterface &get() final {
return *lsls_db_.get();
}
@ -338,36 +337,35 @@ class DialogDbAsync : public DialogDbAsyncInterface {
}
void add_dialog(DialogId dialog_id, FolderId folder_id, int64 order, BufferSlice data,
vector<NotificationGroupKey> notification_groups, Promise<> promise) override {
vector<NotificationGroupKey> notification_groups, Promise<> promise) final {
send_closure(impl_, &Impl::add_dialog, dialog_id, folder_id, order, std::move(data), std::move(notification_groups),
std::move(promise));
}
void get_notification_groups_by_last_notification_date(NotificationGroupKey notification_group_key, int32 limit,
Promise<vector<NotificationGroupKey>> promise) override {
Promise<vector<NotificationGroupKey>> promise) final {
send_closure(impl_, &Impl::get_notification_groups_by_last_notification_date, notification_group_key, limit,
std::move(promise));
}
void get_notification_group(NotificationGroupId notification_group_id,
Promise<NotificationGroupKey> promise) override {
void get_notification_group(NotificationGroupId notification_group_id, Promise<NotificationGroupKey> promise) final {
send_closure(impl_, &Impl::get_notification_group, notification_group_id, std::move(promise));
}
void get_secret_chat_count(FolderId folder_id, Promise<int32> promise) override {
void get_secret_chat_count(FolderId folder_id, Promise<int32> promise) final {
send_closure(impl_, &Impl::get_secret_chat_count, folder_id, std::move(promise));
}
void get_dialog(DialogId dialog_id, Promise<BufferSlice> promise) override {
void get_dialog(DialogId dialog_id, Promise<BufferSlice> promise) final {
send_closure_later(impl_, &Impl::get_dialog, dialog_id, std::move(promise));
}
void get_dialogs(FolderId folder_id, int64 order, DialogId dialog_id, int32 limit,
Promise<DialogDbGetDialogsResult> promise) override {
Promise<DialogDbGetDialogsResult> promise) final {
send_closure_later(impl_, &Impl::get_dialogs, folder_id, order, dialog_id, limit, std::move(promise));
}
void close(Promise<> promise) override {
void close(Promise<> promise) final {
send_closure_later(impl_, &Impl::close, std::move(promise));
}
@ -474,11 +472,11 @@ class DialogDbAsync : public DialogDbAsyncInterface {
cancel_timeout();
}
void timeout_expired() override {
void timeout_expired() final {
do_flush();
}
void start_up() override {
void start_up() final {
sync_db_ = &sync_db_safe_->get();
}
};

View File

@ -63,14 +63,14 @@ namespace td {
class Global : public ActorContext {
public:
Global();
~Global() override;
~Global() final;
Global(const Global &) = delete;
Global &operator=(const Global &) = delete;
Global(Global &&other) = delete;
Global &operator=(Global &&other) = delete;
static constexpr int32 ID = -572104940;
int32 get_id() const override {
int32 get_id() const final {
return ID;
}

View File

@ -49,7 +49,7 @@ class GetGroupCallStreamQuery : public Td::ResultHandler {
send_query(std::move(query));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::upload_getFile>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -64,7 +64,7 @@ class GetGroupCallStreamQuery : public Td::ResultHandler {
promise_.set_value(file->bytes_.as_slice().str());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -87,7 +87,7 @@ class GetGroupCallJoinAsQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::phone_getGroupCallJoinAs(std::move(input_peer))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_getGroupCallJoinAs>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -117,7 +117,7 @@ class GetGroupCallJoinAsQuery : public Td::ResultHandler {
std::move(participant_aliaces)));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "GetGroupCallJoinAsQuery");
promise_.set_error(std::move(status));
}
@ -141,7 +141,7 @@ class SaveDefaultGroupCallJoinAsQuery : public Td::ResultHandler {
telegram_api::phone_saveDefaultGroupCallJoinAs(std::move(input_peer), std::move(as_input_peer))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_saveDefaultGroupCallJoinAs>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -153,7 +153,7 @@ class SaveDefaultGroupCallJoinAsQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
// td->messages_manager_->on_get_dialog_error(dialog_id_, status, "GetGroupCallJoinAsQuery");
promise_.set_error(std::move(status));
}
@ -184,7 +184,7 @@ class CreateGroupCallQuery : public Td::ResultHandler {
telegram_api::phone_createGroupCall(flags, std::move(input_peer), Random::secure_int32(), title, start_date)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_createGroupCall>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -212,7 +212,7 @@ class CreateGroupCallQuery : public Td::ResultHandler {
}));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "CreateGroupCallQuery");
promise_.set_error(std::move(status));
}
@ -231,7 +231,7 @@ class GetGroupCallQuery : public Td::ResultHandler {
G()->net_query_creator().create(telegram_api::phone_getGroupCall(input_group_call_id.get_input_group_call())));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_getGroupCall>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -243,7 +243,7 @@ class GetGroupCallQuery : public Td::ResultHandler {
promise_.set_value(std::move(ptr));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -264,7 +264,7 @@ class GetGroupCallParticipantQuery : public Td::ResultHandler {
input_group_call_id.get_input_group_call(), std::move(input_peers), std::move(source_ids), string(), limit)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_getGroupParticipants>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -276,7 +276,7 @@ class GetGroupCallParticipantQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -298,7 +298,7 @@ class GetGroupCallParticipantsQuery : public Td::ResultHandler {
offset_, limit)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_getGroupParticipants>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -310,7 +310,7 @@ class GetGroupCallParticipantsQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -327,7 +327,7 @@ class StartScheduledGroupCallQuery : public Td::ResultHandler {
telegram_api::phone_startScheduledGroupCall(input_group_call_id.get_input_group_call())));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_startScheduledGroupCall>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -338,7 +338,7 @@ class StartScheduledGroupCallQuery : public Td::ResultHandler {
td->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (status.message() == "GROUPCALL_NOT_MODIFIED") {
promise_.set_value(Unit());
return;
@ -389,7 +389,7 @@ class JoinGroupCallQuery : public Td::ResultHandler {
return join_query_ref;
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_joinGroupCall>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -401,7 +401,7 @@ class JoinGroupCallQuery : public Td::ResultHandler {
std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -422,7 +422,7 @@ class JoinGroupCallPresentationQuery : public Td::ResultHandler {
return join_query_ref;
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_joinGroupCallPresentation>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -435,7 +435,7 @@ class JoinGroupCallPresentationQuery : public Td::ResultHandler {
std::move(ptr), Status::OK());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
td->group_call_manager_->process_join_group_call_presentation_response(input_group_call_id_, generation_, nullptr,
std::move(status));
}
@ -453,7 +453,7 @@ class LeaveGroupCallPresentationQuery : public Td::ResultHandler {
telegram_api::phone_leaveGroupCallPresentation(input_group_call_id.get_input_group_call())));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_editGroupCallTitle>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -464,7 +464,7 @@ class LeaveGroupCallPresentationQuery : public Td::ResultHandler {
td->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (status.message() == "PARTICIPANT_PRESENTATION_MISSING") {
promise_.set_value(Unit());
return;
@ -485,7 +485,7 @@ class EditGroupCallTitleQuery : public Td::ResultHandler {
telegram_api::phone_editGroupCallTitle(input_group_call_id.get_input_group_call(), title)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_editGroupCallTitle>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -496,7 +496,7 @@ class EditGroupCallTitleQuery : public Td::ResultHandler {
td->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (status.message() == "GROUPCALL_NOT_MODIFIED") {
promise_.set_value(Unit());
return;
@ -517,7 +517,7 @@ class ToggleGroupCallStartSubscriptionQuery : public Td::ResultHandler {
input_group_call_id.get_input_group_call(), start_subscribed)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_toggleGroupCallStartSubscription>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -528,7 +528,7 @@ class ToggleGroupCallStartSubscriptionQuery : public Td::ResultHandler {
td->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (status.message() == "GROUPCALL_NOT_MODIFIED") {
promise_.set_value(Unit());
return;
@ -549,7 +549,7 @@ class ToggleGroupCallSettingsQuery : public Td::ResultHandler {
flags, false /*ignored*/, input_group_call_id.get_input_group_call(), join_muted)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_toggleGroupCallSettings>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -560,7 +560,7 @@ class ToggleGroupCallSettingsQuery : public Td::ResultHandler {
td->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (status.message() == "GROUPCALL_NOT_MODIFIED") {
promise_.set_value(Unit());
return;
@ -581,7 +581,7 @@ class InviteToGroupCallQuery : public Td::ResultHandler {
telegram_api::phone_inviteToGroupCall(input_group_call_id.get_input_group_call(), std::move(input_users))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_inviteToGroupCall>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -592,7 +592,7 @@ class InviteToGroupCallQuery : public Td::ResultHandler {
td->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -613,7 +613,7 @@ class ExportGroupCallInviteQuery : public Td::ResultHandler {
flags, false /*ignored*/, input_group_call_id.get_input_group_call())));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_exportGroupCallInvite>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -623,7 +623,7 @@ class ExportGroupCallInviteQuery : public Td::ResultHandler {
promise_.set_value(std::move(ptr->link_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -647,7 +647,7 @@ class ToggleGroupCallRecordQuery : public Td::ResultHandler {
flags, false /*ignored*/, input_group_call_id.get_input_group_call(), title)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_toggleGroupCallRecord>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -658,7 +658,7 @@ class ToggleGroupCallRecordQuery : public Td::ResultHandler {
td->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (status.message() == "GROUPCALL_NOT_MODIFIED") {
promise_.set_value(Unit());
return;
@ -703,7 +703,7 @@ class EditGroupCallParticipantQuery : public Td::ResultHandler {
video_is_stopped, video_is_paused, presentation_is_paused)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_editGroupCallParticipant>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -714,7 +714,7 @@ class EditGroupCallParticipantQuery : public Td::ResultHandler {
td->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -734,7 +734,7 @@ class CheckGroupCallQuery : public Td::ResultHandler {
telegram_api::phone_checkGroupCall(input_group_call_id.get_input_group_call(), std::move(audio_sources))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_checkGroupCall>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -750,7 +750,7 @@ class CheckGroupCallQuery : public Td::ResultHandler {
}
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -767,7 +767,7 @@ class LeaveGroupCallQuery : public Td::ResultHandler {
telegram_api::phone_leaveGroupCall(input_group_call_id.get_input_group_call(), audio_source)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_leaveGroupCall>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -778,7 +778,7 @@ class LeaveGroupCallQuery : public Td::ResultHandler {
td->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -795,7 +795,7 @@ class DiscardGroupCallQuery : public Td::ResultHandler {
telegram_api::phone_discardGroupCall(input_group_call_id.get_input_group_call())));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::phone_discardGroupCall>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -806,7 +806,7 @@ class DiscardGroupCallQuery : public Td::ResultHandler {
td->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};

View File

@ -36,7 +36,7 @@ class GroupCallManager : public Actor {
GroupCallManager &operator=(const GroupCallManager &) = delete;
GroupCallManager(GroupCallManager &&) = delete;
GroupCallManager &operator=(GroupCallManager &&) = delete;
~GroupCallManager() override;
~GroupCallManager() final;
DialogId get_group_call_participant_id(const td_api::object_ptr<td_api::MessageSender> &message_sender);
@ -147,7 +147,7 @@ class GroupCallManager : public Actor {
static constexpr int32 CHECK_GROUP_CALL_IS_JOINED_TIMEOUT = 10;
static constexpr size_t MAX_TITLE_LENGTH = 64; // server side limit for group call/call record title length
void tear_down() override;
void tear_down() final;
static void on_update_group_call_participant_order_timeout_callback(void *group_call_manager_ptr,
int64 group_call_id_int);

View File

@ -35,7 +35,7 @@ class HashtagHints : public Actor {
string get_key() const;
void start_up() override;
void start_up() final;
void hashtag_used_impl(const string &hashtag);
void from_db(Result<string> data, bool dummy);

View File

@ -92,7 +92,7 @@ class GetInlineBotResultsQuery : public Td::ResultHandler {
return result;
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getInlineBotResults>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -103,7 +103,7 @@ class GetInlineBotResultsQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (status.code() == NetQuery::Canceled) {
status = Status::Error(406, "Request canceled");
} else if (status.message() == "BOT_RESPONSE_TIMEOUT") {
@ -146,7 +146,7 @@ class SetInlineBotResultsQuery : public Td::ResultHandler {
std::move(inline_bot_switch_pm))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_setInlineBotResults>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -159,7 +159,7 @@ class SetInlineBotResultsQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};

View File

@ -109,9 +109,9 @@ class InlineQueriesManager : public Actor {
static void on_drop_inline_query_result_timeout_callback(void *inline_queries_manager_ptr, int64 query_hash);
void loop() override;
void loop() final;
void tear_down() override;
void tear_down() final;
int32 recently_used_bots_loaded_ = 0; // 0 - not loaded, 1 - load request was sent, 2 - loaded
MultiPromiseActor resolve_recent_inline_bots_multipromise_{"ResolveRecentInlineBotsMultiPromiseActor"};

View File

@ -35,7 +35,7 @@ class LanguagePackManager : public NetQueryCallback {
LanguagePackManager &operator=(const LanguagePackManager &) = delete;
LanguagePackManager(LanguagePackManager &&) = delete;
LanguagePackManager &operator=(LanguagePackManager &&) = delete;
~LanguagePackManager() override;
~LanguagePackManager() final;
static bool check_language_pack_name(Slice name);
@ -188,11 +188,11 @@ class LanguagePackManager : public NetQueryCallback {
Status do_delete_language(string language_code);
void on_result(NetQueryPtr query) override;
void on_result(NetQueryPtr query) final;
void start_up() override;
void hangup() override;
void tear_down() override;
void start_up() final;
void hangup() final;
void tear_down() final;
Container<Promise<NetQueryPtr>> container_;
void send_with_promise(NetQueryPtr query, Promise<NetQueryPtr> promise);

View File

@ -355,7 +355,7 @@ class RequestUrlAuthQuery : public Td::ResultHandler {
url_)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_requestUrlAuth>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -389,7 +389,7 @@ class RequestUrlAuthQuery : public Td::ResultHandler {
}
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!dialog_id_.is_valid() ||
!td->messages_manager_->on_get_dialog_error(dialog_id_, status, "RequestUrlAuthQuery")) {
LOG(INFO) << "RequestUrlAuthQuery returned " << status;
@ -427,7 +427,7 @@ class AcceptUrlAuthQuery : public Td::ResultHandler {
button_id, url_)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_acceptUrlAuth>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -450,7 +450,7 @@ class AcceptUrlAuthQuery : public Td::ResultHandler {
}
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!dialog_id_.is_valid() ||
!td->messages_manager_->on_get_dialog_error(dialog_id_, status, "AcceptUrlAuthQuery")) {
LOG(INFO) << "AcceptUrlAuthQuery returned " << status;

View File

@ -31,7 +31,7 @@ class LinkManager : public Actor {
LinkManager &operator=(const LinkManager &) = delete;
LinkManager(LinkManager &&) = delete;
LinkManager &operator=(LinkManager &&) = delete;
~LinkManager() override;
~LinkManager() final;
class InternalLink {
public:

View File

@ -97,7 +97,7 @@ class MessageText : public MessageContent {
MessageText(FormattedText text, WebPageId web_page_id) : text(std::move(text)), web_page_id(web_page_id) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Text;
}
};
@ -112,7 +112,7 @@ class MessageAnimation : public MessageContent {
MessageAnimation(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Animation;
}
};
@ -127,7 +127,7 @@ class MessageAudio : public MessageContent {
MessageAudio(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Audio;
}
};
@ -142,7 +142,7 @@ class MessageDocument : public MessageContent {
MessageDocument(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Document;
}
};
@ -157,7 +157,7 @@ class MessagePhoto : public MessageContent {
MessagePhoto(Photo &&photo, FormattedText &&caption) : photo(std::move(photo)), caption(std::move(caption)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Photo;
}
};
@ -170,7 +170,7 @@ class MessageSticker : public MessageContent {
explicit MessageSticker(FileId file_id) : file_id(file_id) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Sticker;
}
};
@ -185,7 +185,7 @@ class MessageVideo : public MessageContent {
MessageVideo(FileId file_id, FormattedText &&caption) : file_id(file_id), caption(std::move(caption)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Video;
}
};
@ -202,7 +202,7 @@ class MessageVoiceNote : public MessageContent {
: file_id(file_id), caption(std::move(caption)), is_listened(is_listened) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::VoiceNote;
}
};
@ -215,7 +215,7 @@ class MessageContact : public MessageContent {
explicit MessageContact(Contact &&contact) : contact(std::move(contact)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Contact;
}
};
@ -228,7 +228,7 @@ class MessageLocation : public MessageContent {
explicit MessageLocation(Location &&location) : location(std::move(location)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Location;
}
};
@ -241,7 +241,7 @@ class MessageVenue : public MessageContent {
explicit MessageVenue(Venue &&venue) : venue(std::move(venue)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Venue;
}
};
@ -256,7 +256,7 @@ class MessageChatCreate : public MessageContent {
: title(std::move(title)), participant_user_ids(std::move(participant_user_ids)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChatCreate;
}
};
@ -269,7 +269,7 @@ class MessageChatChangeTitle : public MessageContent {
explicit MessageChatChangeTitle(string &&title) : title(std::move(title)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChatChangeTitle;
}
};
@ -282,21 +282,21 @@ class MessageChatChangePhoto : public MessageContent {
explicit MessageChatChangePhoto(Photo &&photo) : photo(std::move(photo)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChatChangePhoto;
}
};
class MessageChatDeletePhoto : public MessageContent {
public:
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChatDeletePhoto;
}
};
class MessageChatDeleteHistory : public MessageContent {
public:
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChatDeleteHistory;
}
};
@ -309,14 +309,14 @@ class MessageChatAddUsers : public MessageContent {
explicit MessageChatAddUsers(vector<UserId> &&user_ids) : user_ids(std::move(user_ids)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChatAddUsers;
}
};
class MessageChatJoinedByLink : public MessageContent {
public:
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChatJoinedByLink;
}
};
@ -329,7 +329,7 @@ class MessageChatDeleteUser : public MessageContent {
explicit MessageChatDeleteUser(UserId user_id) : user_id(user_id) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChatDeleteUser;
}
};
@ -342,7 +342,7 @@ class MessageChatMigrateTo : public MessageContent {
explicit MessageChatMigrateTo(ChannelId migrated_to_channel_id) : migrated_to_channel_id(migrated_to_channel_id) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChatMigrateTo;
}
};
@ -355,7 +355,7 @@ class MessageChannelCreate : public MessageContent {
explicit MessageChannelCreate(string &&title) : title(std::move(title)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChannelCreate;
}
};
@ -370,7 +370,7 @@ class MessageChannelMigrateFrom : public MessageContent {
: title(std::move(title)), migrated_from_chat_id(migrated_from_chat_id) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChannelMigrateFrom;
}
};
@ -383,7 +383,7 @@ class MessagePinMessage : public MessageContent {
explicit MessagePinMessage(MessageId message_id) : message_id(message_id) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::PinMessage;
}
};
@ -396,7 +396,7 @@ class MessageGame : public MessageContent {
explicit MessageGame(Game &&game) : game(std::move(game)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Game;
}
};
@ -412,14 +412,14 @@ class MessageGameScore : public MessageContent {
: game_message_id(game_message_id), game_id(game_id), score(score) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::GameScore;
}
};
class MessageScreenshotTaken : public MessageContent {
public:
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ScreenshotTaken;
}
};
@ -432,7 +432,7 @@ class MessageChatSetTtl : public MessageContent {
explicit MessageChatSetTtl(int32 ttl) : ttl(ttl) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ChatSetTtl;
}
};
@ -446,7 +446,7 @@ class MessageUnsupported : public MessageContent {
explicit MessageUnsupported(int32 version) : version(version) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Unsupported;
}
};
@ -463,7 +463,7 @@ class MessageCall : public MessageContent {
: call_id(call_id), duration(duration), discard_reason(discard_reason), is_video(is_video) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Call;
}
};
@ -476,7 +476,7 @@ class MessageInvoice : public MessageContent {
explicit MessageInvoice(InputInvoice &&input_invoice) : input_invoice(std::move(input_invoice)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Invoice;
}
};
@ -504,7 +504,7 @@ class MessagePaymentSuccessful : public MessageContent {
, total_amount(total_amount) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::PaymentSuccessful;
}
};
@ -519,14 +519,14 @@ class MessageVideoNote : public MessageContent {
MessageVideoNote(FileId file_id, bool is_viewed) : file_id(file_id), is_viewed(is_viewed) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::VideoNote;
}
};
class MessageContactRegistered : public MessageContent {
public:
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ContactRegistered;
}
};
@ -535,7 +535,7 @@ class MessageExpiredPhoto : public MessageContent {
public:
MessageExpiredPhoto() = default;
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ExpiredPhoto;
}
};
@ -544,7 +544,7 @@ class MessageExpiredVideo : public MessageContent {
public:
MessageExpiredVideo() = default;
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ExpiredVideo;
}
};
@ -574,7 +574,7 @@ class MessageLiveLocation : public MessageContent {
}
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::LiveLocation;
}
};
@ -587,7 +587,7 @@ class MessageCustomServiceAction : public MessageContent {
explicit MessageCustomServiceAction(string &&message) : message(std::move(message)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::CustomServiceAction;
}
};
@ -600,7 +600,7 @@ class MessageWebsiteConnected : public MessageContent {
explicit MessageWebsiteConnected(string &&domain_name) : domain_name(std::move(domain_name)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::WebsiteConnected;
}
};
@ -613,7 +613,7 @@ class MessagePassportDataSent : public MessageContent {
explicit MessagePassportDataSent(vector<SecureValueType> &&types) : types(std::move(types)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::PassportDataSent;
}
};
@ -628,7 +628,7 @@ class MessagePassportDataReceived : public MessageContent {
: values(std::move(values)), credentials(std::move(credentials)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::PassportDataReceived;
}
};
@ -641,7 +641,7 @@ class MessagePoll : public MessageContent {
explicit MessagePoll(PollId poll_id) : poll_id(poll_id) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Poll;
}
};
@ -659,7 +659,7 @@ class MessageDice : public MessageContent {
, dice_value(dice_value) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::Dice;
}
@ -687,7 +687,7 @@ class MessageProximityAlertTriggered : public MessageContent {
: traveler_dialog_id(traveler_dialog_id), watcher_dialog_id(watcher_dialog_id), distance(distance) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::ProximityAlertTriggered;
}
};
@ -703,7 +703,7 @@ class MessageGroupCall : public MessageContent {
: input_group_call_id(input_group_call_id), duration(duration), schedule_date(schedule_date) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::GroupCall;
}
};
@ -718,7 +718,7 @@ class MessageInviteToGroupCall : public MessageContent {
: input_group_call_id(input_group_call_id), user_ids(std::move(user_ids)) {
}
MessageContentType get_type() const override {
MessageContentType get_type() const final {
return MessageContentType::InviteToGroupCall;
}
};

View File

@ -279,7 +279,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
Status add_message(FullMessageId full_message_id, ServerMessageId unique_message_id, UserId sender_user_id,
int64 random_id, int32 ttl_expires_at, int32 index_mask, int64 search_id, string text,
NotificationId notification_id, MessageId top_thread_message_id, BufferSlice data) override {
NotificationId notification_id, MessageId top_thread_message_id, BufferSlice data) final {
LOG(INFO) << "Add " << full_message_id << " to database";
auto dialog_id = full_message_id.get_dialog_id();
auto message_id = full_message_id.get_message_id();
@ -358,7 +358,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return Status::OK();
}
Status add_scheduled_message(FullMessageId full_message_id, BufferSlice data) override {
Status add_scheduled_message(FullMessageId full_message_id, BufferSlice data) final {
LOG(INFO) << "Add " << full_message_id << " to database";
auto dialog_id = full_message_id.get_dialog_id();
auto message_id = full_message_id.get_message_id();
@ -383,7 +383,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return Status::OK();
}
Status delete_message(FullMessageId full_message_id) override {
Status delete_message(FullMessageId full_message_id) final {
LOG(INFO) << "Delete " << full_message_id << " from database";
auto dialog_id = full_message_id.get_dialog_id();
auto message_id = full_message_id.get_message_id();
@ -407,7 +407,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return Status::OK();
}
Status delete_all_dialog_messages(DialogId dialog_id, MessageId from_message_id) override {
Status delete_all_dialog_messages(DialogId dialog_id, MessageId from_message_id) final {
LOG(INFO) << "Delete all messages in " << dialog_id << " up to " << from_message_id << " from database";
CHECK(dialog_id.is_valid());
CHECK(from_message_id.is_valid());
@ -423,7 +423,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return status;
}
Status delete_dialog_messages_from_user(DialogId dialog_id, UserId sender_user_id) override {
Status delete_dialog_messages_from_user(DialogId dialog_id, UserId sender_user_id) final {
LOG(INFO) << "Delete all messages in " << dialog_id << " sent by " << sender_user_id << " from database";
CHECK(dialog_id.is_valid());
CHECK(sender_user_id.is_valid());
@ -436,7 +436,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return Status::OK();
}
Result<BufferSlice> get_message(FullMessageId full_message_id) override {
Result<BufferSlice> get_message(FullMessageId full_message_id) final {
auto dialog_id = full_message_id.get_dialog_id();
auto message_id = full_message_id.get_message_id();
CHECK(dialog_id.is_valid());
@ -462,8 +462,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return BufferSlice(stmt.view_blob(0));
}
Result<std::pair<DialogId, BufferSlice>> get_message_by_unique_message_id(
ServerMessageId unique_message_id) override {
Result<std::pair<DialogId, BufferSlice>> get_message_by_unique_message_id(ServerMessageId unique_message_id) final {
if (!unique_message_id.is_valid()) {
return Status::Error("Invalid unique_message_id");
}
@ -479,7 +478,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return std::make_pair(dialog_id, BufferSlice(get_message_by_unique_message_id_stmt_.view_blob(1)));
}
Result<BufferSlice> get_message_by_random_id(DialogId dialog_id, int64 random_id) override {
Result<BufferSlice> get_message_by_random_id(DialogId dialog_id, int64 random_id) final {
SCOPE_EXIT {
get_message_by_random_id_stmt_.reset();
};
@ -493,7 +492,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
}
Result<BufferSlice> get_dialog_message_by_date(DialogId dialog_id, MessageId first_message_id,
MessageId last_message_id, int32 date) override {
MessageId last_message_id, int32 date) final {
int64 left_message_id = first_message_id.get();
int64 right_message_id = last_message_id.get();
LOG_CHECK(left_message_id <= right_message_id) << first_message_id << " " << last_message_id;
@ -557,7 +556,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
Result<std::pair<std::vector<std::pair<DialogId, BufferSlice>>, int32>> get_expiring_messages(int32 expires_from,
int32 expires_till,
int32 limit) override {
int32 limit) final {
SCOPE_EXIT {
get_expiring_messages_stmt_.reset();
get_expiring_messages_helper_stmt_.reset();
@ -591,7 +590,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return std::make_pair(std::move(messages), next_expires_till);
}
Result<std::vector<BufferSlice>> get_messages(MessagesDbMessagesQuery query) override {
Result<std::vector<BufferSlice>> get_messages(MessagesDbMessagesQuery query) final {
if (query.index_mask != 0) {
return get_messages_from_index(query.dialog_id, query.from_message_id, query.index_mask, query.offset,
query.limit);
@ -599,12 +598,12 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return get_messages_impl(get_messages_stmt_, query.dialog_id, query.from_message_id, query.offset, query.limit);
}
Result<std::vector<BufferSlice>> get_scheduled_messages(DialogId dialog_id, int32 limit) override {
Result<std::vector<BufferSlice>> get_scheduled_messages(DialogId dialog_id, int32 limit) final {
return get_messages_inner(get_scheduled_messages_stmt_, dialog_id, std::numeric_limits<int64>::max(), limit);
}
Result<vector<BufferSlice>> get_messages_from_notification_id(DialogId dialog_id, NotificationId from_notification_id,
int32 limit) override {
int32 limit) final {
auto &stmt = get_messages_from_notification_id_stmt_;
SCOPE_EXIT {
stmt.reset();
@ -672,7 +671,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return sb.as_cslice().str();
}
Result<MessagesDbFtsResult> get_messages_fts(MessagesDbFtsQuery query) override {
Result<MessagesDbFtsResult> get_messages_fts(MessagesDbFtsQuery query) final {
SCOPE_EXIT {
get_messages_fts_stmt_.reset();
};
@ -745,7 +744,7 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return get_messages_impl(stmt, dialog_id, from_message_id, offset, limit);
}
Result<MessagesDbCallsResult> get_calls(MessagesDbCallsQuery query) override {
Result<MessagesDbCallsResult> get_calls(MessagesDbCallsQuery query) final {
CHECK(query.index_mask != 0);
LOG_CHECK(query.index_mask < (1 << MESSAGES_DB_INDEX_COUNT)) << tag("index_mask", query.index_mask);
int index_i = -1;
@ -786,10 +785,10 @@ class MessagesDbImpl : public MessagesDbSyncInterface {
return std::move(result);
}
Status begin_transaction() override {
Status begin_transaction() final {
return db_.begin_transaction();
}
Status commit_transaction() override {
Status commit_transaction() final {
return db_.commit_transaction();
}
@ -933,7 +932,7 @@ std::shared_ptr<MessagesDbSyncSafeInterface> create_messages_db_sync(
return make_unique<MessagesDbImpl>(safe_connection->get().clone());
}) {
}
MessagesDbSyncInterface &get() override {
MessagesDbSyncInterface &get() final {
return *lsls_db_.get();
}
@ -952,69 +951,68 @@ class MessagesDbAsync : public MessagesDbAsyncInterface {
void add_message(FullMessageId full_message_id, ServerMessageId unique_message_id, UserId sender_user_id,
int64 random_id, int32 ttl_expires_at, int32 index_mask, int64 search_id, string text,
NotificationId notification_id, MessageId top_thread_message_id, BufferSlice data,
Promise<> promise) override {
Promise<> promise) final {
send_closure_later(impl_, &Impl::add_message, full_message_id, unique_message_id, sender_user_id, random_id,
ttl_expires_at, index_mask, search_id, std::move(text), notification_id, top_thread_message_id,
std::move(data), std::move(promise));
}
void add_scheduled_message(FullMessageId full_message_id, BufferSlice data, Promise<> promise) override {
void add_scheduled_message(FullMessageId full_message_id, BufferSlice data, Promise<> promise) final {
send_closure_later(impl_, &Impl::add_scheduled_message, full_message_id, std::move(data), std::move(promise));
}
void delete_message(FullMessageId full_message_id, Promise<> promise) override {
void delete_message(FullMessageId full_message_id, Promise<> promise) final {
send_closure_later(impl_, &Impl::delete_message, full_message_id, std::move(promise));
}
void delete_all_dialog_messages(DialogId dialog_id, MessageId from_message_id, Promise<> promise) override {
void delete_all_dialog_messages(DialogId dialog_id, MessageId from_message_id, Promise<> promise) final {
send_closure_later(impl_, &Impl::delete_all_dialog_messages, dialog_id, from_message_id, std::move(promise));
}
void delete_dialog_messages_from_user(DialogId dialog_id, UserId sender_user_id, Promise<> promise) override {
void delete_dialog_messages_from_user(DialogId dialog_id, UserId sender_user_id, Promise<> promise) final {
send_closure_later(impl_, &Impl::delete_dialog_messages_from_user, dialog_id, sender_user_id, std::move(promise));
}
void get_message(FullMessageId full_message_id, Promise<BufferSlice> promise) override {
void get_message(FullMessageId full_message_id, Promise<BufferSlice> promise) final {
send_closure_later(impl_, &Impl::get_message, full_message_id, std::move(promise));
}
void get_message_by_unique_message_id(ServerMessageId unique_message_id,
Promise<std::pair<DialogId, BufferSlice>> promise) override {
Promise<std::pair<DialogId, BufferSlice>> promise) final {
send_closure_later(impl_, &Impl::get_message_by_unique_message_id, unique_message_id, std::move(promise));
}
void get_message_by_random_id(DialogId dialog_id, int64 random_id, Promise<BufferSlice> promise) override {
void get_message_by_random_id(DialogId dialog_id, int64 random_id, Promise<BufferSlice> promise) final {
send_closure_later(impl_, &Impl::get_message_by_random_id, dialog_id, random_id, std::move(promise));
}
void get_dialog_message_by_date(DialogId dialog_id, MessageId first_message_id, MessageId last_message_id, int32 date,
Promise<BufferSlice> promise) override {
Promise<BufferSlice> promise) final {
send_closure_later(impl_, &Impl::get_dialog_message_by_date, dialog_id, first_message_id, last_message_id, date,
std::move(promise));
}
void get_messages(MessagesDbMessagesQuery query, Promise<std::vector<BufferSlice>> promise) override {
void get_messages(MessagesDbMessagesQuery query, Promise<std::vector<BufferSlice>> promise) final {
send_closure_later(impl_, &Impl::get_messages, std::move(query), std::move(promise));
}
void get_scheduled_messages(DialogId dialog_id, int32 limit, Promise<std::vector<BufferSlice>> promise) override {
void get_scheduled_messages(DialogId dialog_id, int32 limit, Promise<std::vector<BufferSlice>> promise) final {
send_closure_later(impl_, &Impl::get_scheduled_messages, dialog_id, limit, std::move(promise));
}
void get_messages_from_notification_id(DialogId dialog_id, NotificationId from_notification_id, int32 limit,
Promise<vector<BufferSlice>> promise) override {
Promise<vector<BufferSlice>> promise) final {
send_closure_later(impl_, &Impl::get_messages_from_notification_id, dialog_id, from_notification_id, limit,
std::move(promise));
}
void get_calls(MessagesDbCallsQuery query, Promise<MessagesDbCallsResult> promise) override {
void get_calls(MessagesDbCallsQuery query, Promise<MessagesDbCallsResult> promise) final {
send_closure_later(impl_, &Impl::get_calls, std::move(query), std::move(promise));
}
void get_messages_fts(MessagesDbFtsQuery query, Promise<MessagesDbFtsResult> promise) override {
void get_messages_fts(MessagesDbFtsQuery query, Promise<MessagesDbFtsResult> promise) final {
send_closure_later(impl_, &Impl::get_messages_fts, std::move(query), std::move(promise));
}
void get_expiring_messages(
int32 expires_from, int32 expires_till, int32 limit,
Promise<std::pair<std::vector<std::pair<DialogId, BufferSlice>>, int32>> promise) override {
void get_expiring_messages(int32 expires_from, int32 expires_till, int32 limit,
Promise<std::pair<std::vector<std::pair<DialogId, BufferSlice>>, int32>> promise) final {
send_closure_later(impl_, &Impl::get_expiring_messages, expires_from, expires_till, limit, std::move(promise));
}
void close(Promise<> promise) override {
void close(Promise<> promise) final {
send_closure_later(impl_, &Impl::close, std::move(promise));
}
void force_flush() override {
void force_flush() final {
send_closure_later(impl_, &Impl::force_flush);
}
@ -1163,11 +1161,11 @@ class MessagesDbAsync : public MessagesDbAsyncInterface {
pending_write_results_.clear();
cancel_timeout();
}
void timeout_expired() override {
void timeout_expired() final {
do_flush();
}
void start_up() override {
void start_up() final {
sync_db_ = &sync_db_safe_->get();
}
};

File diff suppressed because it is too large Load Diff

View File

@ -136,7 +136,7 @@ class MessagesManager : public Actor {
MessagesManager &operator=(const MessagesManager &) = delete;
MessagesManager(MessagesManager &&) = delete;
MessagesManager &operator=(MessagesManager &&) = delete;
~MessagesManager() override;
~MessagesManager() final;
td_api::object_ptr<td_api::MessageSender> get_message_sender_object_const(UserId user_id, DialogId dialog_id) const;
@ -2601,9 +2601,9 @@ class MessagesManager : public Actor {
void on_message_ttl_expired(Dialog *d, Message *m);
void on_message_ttl_expired_impl(Dialog *d, Message *m);
void start_up() override;
void loop() override;
void tear_down() override;
void start_up() final;
void loop() final;
void tear_down() final;
void create_folders();
void init();

View File

@ -8,9 +8,8 @@
namespace td {
Result<NewPasswordState> get_new_password_state(
tl_object_ptr<telegram_api::PasswordKdfAlgo> new_algo,
tl_object_ptr<telegram_api::SecurePasswordKdfAlgo> new_secure_algo) {
Result<NewPasswordState> get_new_password_state(tl_object_ptr<telegram_api::PasswordKdfAlgo> new_algo,
tl_object_ptr<telegram_api::SecurePasswordKdfAlgo> new_secure_algo) {
NewPasswordState state;
CHECK(new_algo != nullptr);
switch (new_algo->get_id()) {

View File

@ -21,8 +21,7 @@ struct NewPasswordState {
int32 srp_g = 0;
};
Result<NewPasswordState> get_new_password_state(
tl_object_ptr<telegram_api::PasswordKdfAlgo> new_algo,
tl_object_ptr<telegram_api::SecurePasswordKdfAlgo> new_secure_algo);
Result<NewPasswordState> get_new_password_state(tl_object_ptr<telegram_api::PasswordKdfAlgo> new_algo,
tl_object_ptr<telegram_api::SecurePasswordKdfAlgo> new_secure_algo);
} // namespace td

View File

@ -78,7 +78,7 @@ class SetContactSignUpNotificationQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::account_setContactSignUpNotification(is_disabled)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_setContactSignUpNotification>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -87,7 +87,7 @@ class SetContactSignUpNotificationQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for set contact sign up notification: " << status;
}
@ -106,7 +106,7 @@ class GetContactSignUpNotificationQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::account_getContactSignUpNotification()));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_getContactSignUpNotification>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -116,7 +116,7 @@ class GetContactSignUpNotificationQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for get contact sign up notification: " << status;
}
@ -292,7 +292,7 @@ void NotificationManager::init() {
public:
explicit StateCallback(ActorId<NotificationManager> parent) : parent_(std::move(parent)) {
}
bool on_online(bool is_online) override {
bool on_online(bool is_online) final {
if (is_online) {
send_closure(parent_, &NotificationManager::flush_all_pending_notifications);
}

View File

@ -209,8 +209,8 @@ class NotificationManager : public Actor {
bool is_disabled() const;
void start_up() override;
void tear_down() override;
void start_up() final;
void tear_down() final;
void add_update(int32 group_id, td_api::object_ptr<td_api::Update> update);

View File

@ -25,23 +25,23 @@
namespace td {
class NotificationTypeMessage : public NotificationType {
bool can_be_delayed() const override {
bool can_be_delayed() const final {
return message_id_.is_valid() && message_id_.is_server();
}
bool is_temporary() const override {
bool is_temporary() const final {
return false;
}
MessageId get_message_id() const override {
MessageId get_message_id() const final {
return message_id_;
}
vector<FileId> get_file_ids(const Td *td) const override {
vector<FileId> get_file_ids(const Td *td) const final {
return {};
}
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const override {
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const final {
auto message_object = G()->td().get_actor_unsafe()->messages_manager_->get_message_object({dialog_id, message_id_});
if (message_object == nullptr) {
return nullptr;
@ -49,7 +49,7 @@ class NotificationTypeMessage : public NotificationType {
return td_api::make_object<td_api::notificationTypeNewMessage>(std::move(message_object));
}
StringBuilder &to_string_builder(StringBuilder &string_builder) const override {
StringBuilder &to_string_builder(StringBuilder &string_builder) const final {
return string_builder << "NewMessageNotification[" << message_id_ << ']';
}
@ -61,27 +61,27 @@ class NotificationTypeMessage : public NotificationType {
};
class NotificationTypeSecretChat : public NotificationType {
bool can_be_delayed() const override {
bool can_be_delayed() const final {
return false;
}
bool is_temporary() const override {
bool is_temporary() const final {
return false;
}
MessageId get_message_id() const override {
MessageId get_message_id() const final {
return MessageId();
}
vector<FileId> get_file_ids(const Td *td) const override {
vector<FileId> get_file_ids(const Td *td) const final {
return {};
}
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const override {
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const final {
return td_api::make_object<td_api::notificationTypeNewSecretChat>();
}
StringBuilder &to_string_builder(StringBuilder &string_builder) const override {
StringBuilder &to_string_builder(StringBuilder &string_builder) const final {
return string_builder << "NewSecretChatNotification[]";
}
@ -91,27 +91,27 @@ class NotificationTypeSecretChat : public NotificationType {
};
class NotificationTypeCall : public NotificationType {
bool can_be_delayed() const override {
bool can_be_delayed() const final {
return false;
}
bool is_temporary() const override {
bool is_temporary() const final {
return false;
}
MessageId get_message_id() const override {
MessageId get_message_id() const final {
return MessageId::max();
}
vector<FileId> get_file_ids(const Td *td) const override {
vector<FileId> get_file_ids(const Td *td) const final {
return {};
}
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const override {
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const final {
return td_api::make_object<td_api::notificationTypeNewCall>(call_id_.get());
}
StringBuilder &to_string_builder(StringBuilder &string_builder) const override {
StringBuilder &to_string_builder(StringBuilder &string_builder) const final {
return string_builder << "NewCallNotification[" << call_id_ << ']';
}
@ -123,19 +123,19 @@ class NotificationTypeCall : public NotificationType {
};
class NotificationTypePushMessage : public NotificationType {
bool can_be_delayed() const override {
bool can_be_delayed() const final {
return false;
}
bool is_temporary() const override {
bool is_temporary() const final {
return true;
}
MessageId get_message_id() const override {
MessageId get_message_id() const final {
return message_id_;
}
vector<FileId> get_file_ids(const Td *td) const override {
vector<FileId> get_file_ids(const Td *td) const final {
if (!document_.empty()) {
return document_.get_file_ids(td);
}
@ -327,7 +327,7 @@ class NotificationTypePushMessage : public NotificationType {
UNREACHABLE();
}
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const override {
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const final {
auto sender =
G()->td().get_actor_unsafe()->messages_manager_->get_message_sender_object(sender_user_id_, sender_dialog_id_);
return td_api::make_object<td_api::notificationTypeNewPushMessage>(
@ -335,7 +335,7 @@ class NotificationTypePushMessage : public NotificationType {
get_push_message_content_object(key_, arg_, photo_, document_));
}
StringBuilder &to_string_builder(StringBuilder &string_builder) const override {
StringBuilder &to_string_builder(StringBuilder &string_builder) const final {
return string_builder << "NewPushMessageNotification[" << sender_user_id_ << "/" << sender_dialog_id_ << "/\""
<< sender_name_ << "\", " << message_id_ << ", " << key_ << ", " << arg_ << ", " << photo_
<< ", " << document_ << ']';

View File

@ -195,11 +195,11 @@ class PasswordManager : public NetQueryCallback {
Promise<TempPasswordState> promise);
void on_finish_create_temp_password(Result<TempPasswordState> result, bool dummy);
void on_result(NetQueryPtr query) override;
void on_result(NetQueryPtr query) final;
void start_up() override;
void timeout_expired() override;
void hangup() override;
void start_up() final;
void timeout_expired() final;
void hangup() final;
Container<Promise<NetQueryPtr>> container_;
void send_with_promise(NetQueryPtr query, Promise<NetQueryPtr> promise);

View File

@ -51,7 +51,7 @@ class SetBotShippingAnswerQuery : public Td::ResultHandler {
flags, shipping_query_id, error_message, std::move(shipping_options))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_setBotShippingResults>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -64,7 +64,7 @@ class SetBotShippingAnswerQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -88,7 +88,7 @@ class SetBotPreCheckoutAnswerQuery : public Td::ResultHandler {
flags, false /*ignored*/, pre_checkout_query_id, error_message)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_setBotPrecheckoutResults>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -101,7 +101,7 @@ class SetBotPreCheckoutAnswerQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -283,7 +283,7 @@ class GetPaymentFormQuery : public Td::ResultHandler {
flags, std::move(input_peer), server_message_id.get(), std::move(theme_parameters))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::payments_getPaymentForm>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -316,7 +316,7 @@ class GetPaymentFormQuery : public Td::ResultHandler {
convert_saved_credentials(std::move(payment_form->saved_credentials_)), can_save_credentials, need_password));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "GetPaymentFormQuery");
promise_.set_error(std::move(status));
}
@ -351,7 +351,7 @@ class ValidateRequestedInfoQuery : public Td::ResultHandler {
flags, false /*ignored*/, std::move(input_peer), server_message_id.get(), std::move(requested_info))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::payments_validateRequestedInfo>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -365,7 +365,7 @@ class ValidateRequestedInfoQuery : public Td::ResultHandler {
transform(std::move(validated_order_info->shipping_options_), convert_shipping_option)));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "ValidateRequestedInfoQuery");
promise_.set_error(std::move(status));
}
@ -406,7 +406,7 @@ class SendPaymentFormQuery : public Td::ResultHandler {
std::move(input_credentials), tip_amount)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::payments_sendPaymentForm>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -434,7 +434,7 @@ class SendPaymentFormQuery : public Td::ResultHandler {
}
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "SendPaymentFormQuery");
promise_.set_error(std::move(status));
}
@ -460,7 +460,7 @@ class GetPaymentReceiptQuery : public Td::ResultHandler {
telegram_api::payments_getPaymentReceipt(std::move(input_peer), server_message_id.get())));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::payments_getPaymentReceipt>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -492,7 +492,7 @@ class GetPaymentReceiptQuery : public Td::ResultHandler {
payment_receipt->tip_amount_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "GetPaymentReceiptQuery");
promise_.set_error(std::move(status));
}
@ -509,7 +509,7 @@ class GetSavedInfoQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::payments_getSavedInfo()));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::payments_getSavedInfo>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -520,7 +520,7 @@ class GetSavedInfoQuery : public Td::ResultHandler {
promise_.set_value(convert_order_info(std::move(saved_info->saved_info_)));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -545,7 +545,7 @@ class ClearSavedInfoQuery : public Td::ResultHandler {
telegram_api::payments_clearSavedInfo(flags, false /*ignored*/, false /*ignored*/)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::payments_clearSavedInfo>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -554,7 +554,7 @@ class ClearSavedInfoQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -572,7 +572,7 @@ class GetBankCardInfoQuery : public Td::ResultHandler {
G()->get_webfile_dc_id()));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::payments_getBankCardData>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -585,7 +585,7 @@ class GetBankCardInfoQuery : public Td::ResultHandler {
promise_.set_value(td_api::make_object<td_api::bankCardInfo>(response->title_, std::move(actions)));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};

View File

@ -62,8 +62,8 @@ class PhoneNumberManager : public NetActor {
void on_check_code_result(NetQueryPtr &result);
void on_send_code_result(NetQueryPtr &result);
void on_result(NetQueryPtr result) override;
void tear_down() override;
void on_result(NetQueryPtr result) final;
void tear_down() final;
};
} // namespace td

View File

@ -71,7 +71,7 @@ class GetPollResultsQuery : public Td::ResultHandler {
G()->net_query_creator().create(telegram_api::messages_getPollResults(std::move(input_peer), message_id)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getPollResults>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -80,7 +80,7 @@ class GetPollResultsQuery : public Td::ResultHandler {
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!td->messages_manager_->on_get_dialog_error(dialog_id_, status, "GetPollResultsQuery") &&
status.message() != "MESSAGE_ID_INVALID") {
LOG(ERROR) << "Receive " << status << ", while trying to get results of " << poll_id_;
@ -119,7 +119,7 @@ class GetPollVotersQuery : public Td::ResultHandler {
flags, std::move(input_peer), message_id, std::move(option), offset, limit)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getPollVotes>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -128,7 +128,7 @@ class GetPollVotersQuery : public Td::ResultHandler {
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!td->messages_manager_->on_get_dialog_error(dialog_id_, status, "GetPollVotersQuery") &&
status.message() != "MESSAGE_ID_INVALID") {
LOG(ERROR) << "Receive " << status << ", while trying to get voters of " << poll_id_;
@ -162,7 +162,7 @@ class SetPollAnswerActor : public NetActorOnce {
std::move(query), actor_shared(this), sequence_id);
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_sendVote>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -173,7 +173,7 @@ class SetPollAnswerActor : public NetActorOnce {
promise_.set_value(std::move(result));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
td->messages_manager_->on_get_dialog_error(dialog_id_, status, "SetPollAnswerActor");
promise_.set_error(std::move(status));
}
@ -218,7 +218,7 @@ class StopPollActor : public NetActorOnce {
}
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_editMessage>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -229,7 +229,7 @@ class StopPollActor : public NetActorOnce {
td->updates_manager_->on_get_updates(std::move(result), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!td->auth_manager_->is_bot() && status.message() == "MESSAGE_NOT_MODIFIED") {
return promise_.set_value(Unit());
}
@ -251,7 +251,7 @@ void PollManager::start_up() {
public:
explicit StateCallback(ActorId<PollManager> parent) : parent_(std::move(parent)) {
}
bool on_online(bool is_online) override {
bool on_online(bool is_online) final {
if (is_online) {
send_closure(parent_, &PollManager::on_online);
}

View File

@ -41,7 +41,7 @@ class PollManager : public Actor {
PollManager &operator=(const PollManager &) = delete;
PollManager(PollManager &&) = delete;
PollManager &operator=(PollManager &&) = delete;
~PollManager() override;
~PollManager() final;
static bool is_local_poll_id(PollId poll_id);
@ -138,8 +138,8 @@ class PollManager : public Actor {
class SetPollAnswerLogEvent;
class StopPollLogEvent;
void start_up() override;
void tear_down() override;
void start_up() final;
void tear_down() final;
static void on_update_poll_timeout_callback(void *poll_manager_ptr, int64 poll_id_int);

View File

@ -155,11 +155,11 @@ class PrivacyManager : public NetQueryCallback {
void do_update_privacy(UserPrivacySetting user_privacy_setting, UserPrivacySettingRules &&privacy_rules,
bool from_update);
void on_result(NetQueryPtr query) override;
void on_result(NetQueryPtr query) final;
Container<Promise<NetQueryPtr>> container_;
void send_with_promise(NetQueryPtr query, Promise<NetQueryPtr> promise);
void hangup() override;
void hangup() final;
};
} // namespace td

View File

@ -45,7 +45,7 @@ class QueryCombiner : public Actor {
void on_get_query_result(int64 query_id, Result<Unit> &&result);
void loop() override;
void loop() final;
};
} // namespace td

View File

@ -60,7 +60,7 @@ class RequestActor : public Actor {
}
}
void raw_event(const Event::Raw &event) override {
void raw_event(const Event::Raw &event) final {
if (future_.is_error()) {
auto error = future_.move_as_error();
if (error == Status::Error<FutureActor<T>::HANGUP_ERROR_CODE>()) {
@ -84,10 +84,10 @@ class RequestActor : public Actor {
}
}
void on_start_migrate(int32 /*sched_id*/) override {
void on_start_migrate(int32 /*sched_id*/) final {
UNREACHABLE();
}
void on_finish_migrate() override {
void on_finish_migrate() final {
UNREACHABLE();
}
@ -127,7 +127,7 @@ class RequestActor : public Actor {
CHECK((std::is_same<T, Unit>::value)); // all other results should be implicitly handled by overriding this method
}
void hangup() override {
void hangup() final {
do_send_error(Status::Error(500, "Request aborted"));
stop();
}
@ -144,7 +144,7 @@ class RequestOnceActor : public RequestActor<> {
RequestOnceActor(ActorShared<Td> td_id, uint64 request_id) : RequestActor(std::move(td_id), request_id) {
}
void loop() override {
void loop() final {
if (get_tries() < 2) {
do_send_result();
stop();

View File

@ -659,12 +659,12 @@ class SecretChatActor : public NetQueryCallback {
void ask_on_binlog_replay_finish();
void check_status(Status status);
void start_up() override;
void loop() override;
void start_up() final;
void loop() final;
Status do_loop();
void tear_down() override;
void tear_down() final;
void on_result_resendable(NetQueryPtr net_query, Promise<NetQueryPtr> promise) override;
void on_result_resendable(NetQueryPtr net_query, Promise<NetQueryPtr> promise) final;
Status run_auth();
void run_pfs();

View File

@ -86,7 +86,7 @@ void SecretChatsManager::start_up() {
public:
explicit StateCallback(ActorId<SecretChatsManager> parent) : parent_(std::move(parent)) {
}
bool on_online(bool online_flag) override {
bool on_online(bool online_flag) final {
send_closure(parent_, &SecretChatsManager::on_online, online_flag);
return parent_.is_alive();
}
@ -301,29 +301,29 @@ unique_ptr<SecretChatActor::Context> SecretChatsManager::make_secret_chat_contex
Context &operator=(const Context &other) = delete;
Context(Context &&other) = delete;
Context &operator=(Context &&other) = delete;
~Context() override {
~Context() final {
send_closure(std::move(sequence_dispatcher_), &SequenceDispatcher::close_silent);
}
DhCallback *dh_callback() override {
DhCallback *dh_callback() final {
return DhCache::instance();
}
NetQueryCreator &net_query_creator() override {
NetQueryCreator &net_query_creator() final {
return G()->net_query_creator();
}
BinlogInterface *binlog() override {
BinlogInterface *binlog() final {
return G()->td_db()->get_binlog();
}
SecretChatDb *secret_chat_db() override {
SecretChatDb *secret_chat_db() final {
return secret_chat_db_.get();
}
std::shared_ptr<DhConfig> dh_config() override {
std::shared_ptr<DhConfig> dh_config() final {
return G()->get_dh_config();
}
void set_dh_config(std::shared_ptr<DhConfig> dh_config) override {
void set_dh_config(std::shared_ptr<DhConfig> dh_config) final {
G()->set_dh_config(std::move(dh_config));
}
void send_net_query(NetQueryPtr query, ActorShared<NetQueryCallback> callback, bool ordered) override {
void send_net_query(NetQueryPtr query, ActorShared<NetQueryCallback> callback, bool ordered) final {
if (ordered) {
send_closure(sequence_dispatcher_, &SequenceDispatcher::send_with_callback, std::move(query),
std::move(callback));
@ -332,63 +332,63 @@ unique_ptr<SecretChatActor::Context> SecretChatsManager::make_secret_chat_contex
}
}
bool get_config_option_boolean(const string &name) const override {
bool get_config_option_boolean(const string &name) const final {
return G()->shared_config().get_option_boolean(name);
}
int32 unix_time() override {
int32 unix_time() final {
return G()->unix_time();
}
bool close_flag() override {
bool close_flag() final {
return G()->close_flag();
}
void on_update_secret_chat(int64 access_hash, UserId user_id, SecretChatState state, bool is_outbound, int32 ttl,
int32 date, string key_hash, int32 layer, FolderId initial_folder_id) override {
int32 date, string key_hash, int32 layer, FolderId initial_folder_id) final {
send_closure(G()->contacts_manager(), &ContactsManager::on_update_secret_chat, secret_chat_id_, access_hash,
user_id, state, is_outbound, ttl, date, key_hash, layer, initial_folder_id);
}
void on_inbound_message(UserId user_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::encryptedFile> file,
tl_object_ptr<secret_api::decryptedMessage> message, Promise<> promise) override {
tl_object_ptr<secret_api::decryptedMessage> message, Promise<> promise) final {
send_closure_later(G()->messages_manager(), &MessagesManager::on_get_secret_message, secret_chat_id_, user_id,
message_id, date, std::move(file), std::move(message), std::move(promise));
}
void on_send_message_error(int64 random_id, Status error, Promise<> promise) override {
void on_send_message_error(int64 random_id, Status error, Promise<> promise) final {
send_closure_later(G()->messages_manager(), &MessagesManager::on_send_secret_message_error, random_id,
std::move(error), std::move(promise));
}
void on_send_message_ack(int64 random_id) override {
void on_send_message_ack(int64 random_id) final {
send_closure_later(G()->messages_manager(), &MessagesManager::on_send_message_get_quick_ack, random_id);
}
void on_send_message_ok(int64 random_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::EncryptedFile> file, Promise<> promise) override {
tl_object_ptr<telegram_api::EncryptedFile> file, Promise<> promise) final {
send_closure_later(G()->messages_manager(), &MessagesManager::on_send_secret_message_success, random_id,
message_id, date, std::move(file), std::move(promise));
}
void on_delete_messages(std::vector<int64> random_ids, Promise<> promise) override {
void on_delete_messages(std::vector<int64> random_ids, Promise<> promise) final {
send_closure_later(G()->messages_manager(), &MessagesManager::delete_secret_messages, secret_chat_id_,
std::move(random_ids), std::move(promise));
}
void on_flush_history(bool remove_from_dialog_list, MessageId message_id, Promise<> promise) override {
void on_flush_history(bool remove_from_dialog_list, MessageId message_id, Promise<> promise) final {
send_closure_later(G()->messages_manager(), &MessagesManager::delete_secret_chat_history, secret_chat_id_,
remove_from_dialog_list, message_id, std::move(promise));
}
void on_read_message(int64 random_id, Promise<> promise) override {
void on_read_message(int64 random_id, Promise<> promise) final {
send_closure_later(G()->messages_manager(), &MessagesManager::open_secret_message, secret_chat_id_, random_id,
std::move(promise));
}
void on_screenshot_taken(UserId user_id, MessageId message_id, int32 date, int64 random_id,
Promise<> promise) override {
Promise<> promise) final {
send_closure_later(G()->messages_manager(), &MessagesManager::on_secret_chat_screenshot_taken, secret_chat_id_,
user_id, message_id, date, random_id, std::move(promise));
}
void on_set_ttl(UserId user_id, MessageId message_id, int32 date, int32 ttl, int64 random_id,
Promise<> promise) override {
Promise<> promise) final {
send_closure_later(G()->messages_manager(), &MessagesManager::on_secret_chat_ttl_changed, secret_chat_id_,
user_id, message_id, date, ttl, random_id, std::move(promise));
}

View File

@ -75,10 +75,10 @@ class SecretChatsManager : public Actor {
ActorId<SecretChatActor> create_chat_actor(int32 id);
ActorId<SecretChatActor> create_chat_actor_impl(int32 id, bool can_be_empty);
void start_up() override;
void hangup() override;
void hangup_shared() override;
void timeout_expired() override;
void start_up() final;
void hangup() final;
void hangup_shared() final;
void timeout_expired() final;
void on_online(bool is_online);
};

View File

@ -44,10 +44,10 @@ class GetSecureValue : public NetQueryCallback {
void on_error(Status error);
void on_secret(Result<secure_storage::Secret> r_secret, bool dummy);
void loop() override;
void start_up() override;
void loop() final;
void start_up() final;
void on_result(NetQueryPtr query) override;
void on_result(NetQueryPtr query) final;
};
class GetAllSecureValues : public NetQueryCallback {
@ -63,10 +63,10 @@ class GetAllSecureValues : public NetQueryCallback {
void on_error(Status error);
void on_secret(Result<secure_storage::Secret> r_secret, bool dummy);
void loop() override;
void start_up() override;
void loop() final;
void start_up() final;
void on_result(NetQueryPtr query) override;
void on_result(NetQueryPtr query) final;
};
class SetSecureValue : public NetQueryCallback {
@ -101,10 +101,10 @@ class SetSecureValue : public NetQueryCallback {
private:
ActorId<SetSecureValue> actor_id_;
uint32 upload_generation_;
void on_upload_ok(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file) override;
void on_upload_encrypted_ok(FileId file_id, tl_object_ptr<telegram_api::InputEncryptedFile> input_file) override;
void on_upload_secure_ok(FileId file_id, tl_object_ptr<telegram_api::InputSecureFile> input_file) override;
void on_upload_error(FileId file_id, Status status) override;
void on_upload_ok(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file) final;
void on_upload_encrypted_ok(FileId file_id, tl_object_ptr<telegram_api::InputEncryptedFile> input_file) final;
void on_upload_secure_ok(FileId file_id, tl_object_ptr<telegram_api::InputSecureFile> input_file) final;
void on_upload_error(FileId file_id, Status status) final;
};
void on_upload_ok(FileId file_id, tl_object_ptr<telegram_api::InputSecureFile> input_file, uint32 upload_generation);
@ -114,12 +114,12 @@ class SetSecureValue : public NetQueryCallback {
void on_secret(Result<secure_storage::Secret> r_secret, bool x);
void start_up() override;
void hangup() override;
void tear_down() override;
void start_up() final;
void hangup() final;
void tear_down() final;
void loop() override;
void on_result(NetQueryPtr query) override;
void loop() final;
void on_result(NetQueryPtr query) final;
void load_secret();
void cancel_upload();
@ -141,7 +141,7 @@ class SetSecureValueErrorsQuery : public Td::ResultHandler {
telegram_api::users_setSecureValueErrors(std::move(input_user), std::move(input_errors))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::users_setSecureValueErrors>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -152,7 +152,7 @@ class SetSecureValueErrorsQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (status.code() != 0) {
promise_.set_error(std::move(status));
} else {
@ -663,14 +663,14 @@ class DeleteSecureValue : public NetQueryCallback {
SecureValueType type_;
Promise<Unit> promise_;
void start_up() override {
void start_up() final {
std::vector<telegram_api::object_ptr<telegram_api::SecureValueType>> types;
types.push_back(get_input_secure_value_type(type_));
auto query = G()->net_query_creator().create(telegram_api::account_deleteSecureValue(std::move(types)));
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this));
}
void on_result(NetQueryPtr query) override {
void on_result(NetQueryPtr query) final {
auto r_result = fetch_result<telegram_api::account_deleteSecureValue>(std::move(query));
if (r_result.is_error()) {
promise_.set_error(r_result.move_as_error());
@ -708,14 +708,14 @@ class GetPassportAuthorizationForm : public NetQueryCallback {
stop();
}
void start_up() override {
void start_up() final {
auto account_get_authorization_form =
telegram_api::account_getAuthorizationForm(bot_user_id_.get(), std::move(scope_), std::move(public_key_));
auto query = G()->net_query_creator().create(account_get_authorization_form);
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this));
}
void on_result(NetQueryPtr query) override {
void on_result(NetQueryPtr query) final {
auto r_result = fetch_result<telegram_api::account_getAuthorizationForm>(std::move(query));
if (r_result.is_error()) {
return on_error(r_result.move_as_error());
@ -764,12 +764,12 @@ class GetPassportConfig : public NetQueryCallback {
string country_code_;
Promise<td_api::object_ptr<td_api::text>> promise_;
void start_up() override {
void start_up() final {
auto query = G()->net_query_creator().create(telegram_api::help_getPassportConfig(0));
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this));
}
void on_result(NetQueryPtr query) override {
void on_result(NetQueryPtr query) final {
auto r_result = fetch_result<telegram_api::help_getPassportConfig>(std::move(query));
if (r_result.is_error()) {
promise_.set_error(r_result.move_as_error());

View File

@ -77,8 +77,8 @@ class SecureManager : public NetQueryCallback {
std::unordered_map<int32, AuthorizationForm> authorization_forms_;
int32 max_authorization_form_id_{0};
void hangup() override;
void hangup_shared() override;
void hangup() final;
void hangup_shared() final;
void dec_refcnt();
void on_delete_secure_value(SecureValueType type, Promise<Unit> promise, Result<Unit> result);
void on_get_passport_authorization_form(
@ -88,7 +88,7 @@ class SecureManager : public NetQueryCallback {
Promise<TdApiSecureValuesWithErrors> promise,
Result<secure_storage::Secret> r_secret);
void on_result(NetQueryPtr query) override;
void on_result(NetQueryPtr query) final;
Container<Promise<NetQueryPtr>> container_;
void send_with_promise(NetQueryPtr query, Promise<NetQueryPtr> promise);
};

View File

@ -94,8 +94,8 @@ class FileDataView : public DataView {
public:
FileDataView(FileFd &fd, int64 size);
int64 size() const override;
Result<BufferSlice> pread(int64 offset, int64 size) const override;
int64 size() const final;
Result<BufferSlice> pread(int64 offset, int64 size) const final;
private:
FileFd &fd_;

View File

@ -77,8 +77,8 @@ class DataView {
class BufferSliceDataView : public DataView {
public:
explicit BufferSliceDataView(BufferSlice buffer_slice);
int64 size() const override;
Result<BufferSlice> pread(int64 offset, int64 size) const override;
int64 size() const final;
Result<BufferSlice> pread(int64 offset, int64 size) const final;
private:
BufferSlice buffer_slice_;
@ -87,8 +87,8 @@ class BufferSliceDataView : public DataView {
class ConcatDataView : public DataView {
public:
ConcatDataView(const DataView &left, const DataView &right);
int64 size() const override;
Result<BufferSlice> pread(int64 offset, int64 size) const override;
int64 size() const final;
Result<BufferSlice> pread(int64 offset, int64 size) const final;
private:
const DataView &left_;
@ -164,8 +164,8 @@ class Decryptor {
class Encryptor : public DataView {
public:
Encryptor(AesCbcState aes_cbc_state, const DataView &data_view);
int64 size() const override;
Result<BufferSlice> pread(int64 offset, int64 size) const override;
int64 size() const final;
Result<BufferSlice> pread(int64 offset, int64 size) const final;
private:
mutable AesCbcState aes_cbc_state_;

View File

@ -29,7 +29,7 @@ class SequenceDispatcher : public NetQueryCallback {
explicit SequenceDispatcher(ActorShared<Parent> parent) : parent_(std::move(parent)) {
}
void send_with_callback(NetQueryPtr query, ActorShared<NetQueryCallback> callback);
void on_result(NetQueryPtr query) override;
void on_result(NetQueryPtr query) final;
void close_silent();
private:
@ -65,12 +65,12 @@ class SequenceDispatcher : public NetQueryCallback {
void do_resend(Data &data);
void do_finish(Data &data);
void loop() override;
void loop() final;
void try_shrink();
void timeout_expired() override;
void hangup() override;
void tear_down() override;
void timeout_expired() final;
void hangup() final;
void tear_down() final;
};
class MultiSequenceDispatcher : public SequenceDispatcher::Parent {
@ -83,8 +83,8 @@ class MultiSequenceDispatcher : public SequenceDispatcher::Parent {
ActorOwn<SequenceDispatcher> dispatcher_;
};
std::unordered_map<uint64, Data> dispatchers_;
void on_result() override;
void ready_to_close() override;
void on_result() final;
void ready_to_close() final;
};
} // namespace td

View File

@ -130,8 +130,8 @@ class StateManager final : public Actor {
enum class Flag : int32 { Online, State, Network, LoggingOut };
void notify_flag(Flag flag);
void start_up() override;
void loop() override;
void start_up() final;
void loop() final;
void on_network_soft();
void do_on_network(NetType new_network_type, bool inc_generation);

View File

@ -74,7 +74,7 @@ class GetAllStickersQuery : public Td::ResultHandler {
}
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
static_assert(std::is_same<telegram_api::messages_getMaskStickers::ReturnType,
telegram_api::messages_getAllStickers::ReturnType>::value,
"");
@ -88,7 +88,7 @@ class GetAllStickersQuery : public Td::ResultHandler {
td->stickers_manager_->on_get_installed_sticker_sets(is_masks_, std::move(ptr));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for get all stickers: " << status;
}
@ -105,7 +105,7 @@ class SearchStickersQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_getStickers(emoji_, hash)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getStickers>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -116,7 +116,7 @@ class SearchStickersQuery : public Td::ResultHandler {
td->stickers_manager_->on_find_stickers_success(emoji_, std::move(ptr));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for search stickers: " << status;
}
@ -135,7 +135,7 @@ class GetEmojiKeywordsLanguageQuery : public Td::ResultHandler {
send_query(
G()->net_query_creator().create(telegram_api::messages_getEmojiKeywordsLanguages(std::move(language_codes))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getEmojiKeywordsLanguages>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -146,7 +146,7 @@ class GetEmojiKeywordsLanguageQuery : public Td::ResultHandler {
promise_.set_value(std::move(result));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -163,7 +163,7 @@ class GetEmojiKeywordsQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_getEmojiKeywords(language_code)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getEmojiKeywords>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -172,7 +172,7 @@ class GetEmojiKeywordsQuery : public Td::ResultHandler {
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -191,7 +191,7 @@ class GetEmojiKeywordsDifferenceQuery : public Td::ResultHandler {
G()->net_query_creator().create(telegram_api::messages_getEmojiKeywordsDifference(language_code, version)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getEmojiKeywordsDifference>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -200,7 +200,7 @@ class GetEmojiKeywordsDifferenceQuery : public Td::ResultHandler {
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -217,7 +217,7 @@ class GetEmojiUrlQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_getEmojiURL(language_code)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getEmojiURL>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -226,7 +226,7 @@ class GetEmojiUrlQuery : public Td::ResultHandler {
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -256,7 +256,7 @@ class GetArchivedStickerSetsQuery : public Td::ResultHandler {
telegram_api::messages_getArchivedStickers(flags, is_masks /*ignored*/, offset_sticker_set_id.get(), limit)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getArchivedStickers>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -270,7 +270,7 @@ class GetArchivedStickerSetsQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -282,7 +282,7 @@ class GetFeaturedStickerSetsQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_getFeaturedStickers(hash)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getFeaturedStickers>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -293,7 +293,7 @@ class GetFeaturedStickerSetsQuery : public Td::ResultHandler {
td->stickers_manager_->on_get_featured_sticker_sets(-1, -1, 0, std::move(ptr));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
td->stickers_manager_->on_get_featured_sticker_sets_failed(-1, -1, 0, std::move(status));
}
};
@ -312,7 +312,7 @@ class GetOldFeaturedStickerSetsQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_getOldFeaturedStickers(offset, limit, 0)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getOldFeaturedStickers>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -323,7 +323,7 @@ class GetOldFeaturedStickerSetsQuery : public Td::ResultHandler {
td->stickers_manager_->on_get_featured_sticker_sets(offset_, limit_, generation_, std::move(ptr));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
td->stickers_manager_->on_get_featured_sticker_sets_failed(offset_, limit_, generation_, std::move(status));
}
};
@ -345,7 +345,7 @@ class GetAttachedStickerSetsQuery : public Td::ResultHandler {
G()->net_query_creator().create(telegram_api::messages_getAttachedStickers(std::move(input_stickered_media))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getAttachedStickers>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -356,7 +356,7 @@ class GetAttachedStickerSetsQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) {
VLOG(file_references) << "Receive " << status << " for " << file_id_;
td->file_manager_->delete_file_reference(file_id_, file_reference_);
@ -394,7 +394,7 @@ class GetRecentStickersQuery : public Td::ResultHandler {
telegram_api::messages_getRecentStickers(flags, is_attached /*ignored*/, hash)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getRecentStickers>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -406,7 +406,7 @@ class GetRecentStickersQuery : public Td::ResultHandler {
td->stickers_manager_->on_get_recent_stickers(is_repair_, is_attached_, std::move(ptr));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for get recent " << (is_attached_ ? "attached " : "") << "stickers: " << status;
}
@ -443,7 +443,7 @@ class SaveRecentStickerQuery : public Td::ResultHandler {
telegram_api::messages_saveRecentSticker(flags, is_attached /*ignored*/, std::move(input_document), unsave)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_saveRecentSticker>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -458,7 +458,7 @@ class SaveRecentStickerQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) {
VLOG(file_references) << "Receive " << status << " for " << file_id_;
td->file_manager_->delete_file_reference(file_id_, file_reference_);
@ -503,7 +503,7 @@ class ClearRecentStickersQuery : public Td::ResultHandler {
G()->net_query_creator().create(telegram_api::messages_clearRecentStickers(flags, is_attached /*ignored*/)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_clearRecentStickers>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -518,7 +518,7 @@ class ClearRecentStickersQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for clear recent " << (is_attached_ ? "attached " : "") << "stickers: " << status;
}
@ -537,7 +537,7 @@ class GetFavedStickersQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_getFavedStickers(hash)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getFavedStickers>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -547,7 +547,7 @@ class GetFavedStickersQuery : public Td::ResultHandler {
td->stickers_manager_->on_get_favorite_stickers(is_repair_, std::move(ptr));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for get favorite stickers: " << status;
}
@ -576,7 +576,7 @@ class FaveStickerQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_faveSticker(std::move(input_document), unsave)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_faveSticker>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -591,7 +591,7 @@ class FaveStickerQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) {
VLOG(file_references) << "Receive " << status << " for " << file_id_;
td->file_manager_->delete_file_reference(file_id_, file_reference_);
@ -630,7 +630,7 @@ class ReorderStickerSetsQuery : public Td::ResultHandler {
flags, is_masks /*ignored*/, StickersManager::convert_sticker_set_ids(sticker_set_ids))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_reorderStickerSets>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -642,7 +642,7 @@ class ReorderStickerSetsQuery : public Td::ResultHandler {
}
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for ReorderStickerSetsQuery: " << status;
}
@ -669,7 +669,7 @@ class GetStickerSetQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_getStickerSet(std::move(input_sticker_set))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getStickerSet>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -692,7 +692,7 @@ class GetStickerSetQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
LOG(INFO) << "Receive error for GetStickerSetQuery: " << status;
td->stickers_manager_->on_load_sticker_set_fail(sticker_set_id_, status);
promise_.set_error(std::move(status));
@ -708,7 +708,7 @@ class ReloadSpecialStickerSetQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_getStickerSet(type_.get_input_sticker_set())));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getStickerSet>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -723,7 +723,7 @@ class ReloadSpecialStickerSetQuery : public Td::ResultHandler {
}
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
LOG(WARNING) << "Receive error for ReloadSpecialStickerSetQuery: " << status;
td->stickers_manager_->on_load_special_sticker_set(type_, std::move(status));
}
@ -739,7 +739,7 @@ class SearchStickerSetsQuery : public Td::ResultHandler {
G()->net_query_creator().create(telegram_api::messages_searchStickerSets(0, false /*ignored*/, query_, 0)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_searchStickerSets>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -750,7 +750,7 @@ class SearchStickerSetsQuery : public Td::ResultHandler {
td->stickers_manager_->on_find_sticker_sets_success(query_, std::move(ptr));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for search sticker sets: " << status;
}
@ -774,7 +774,7 @@ class InstallStickerSetQuery : public Td::ResultHandler {
G()->net_query_creator().create(telegram_api::messages_installStickerSet(std::move(input_set), is_archived)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_installStickerSet>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -785,7 +785,7 @@ class InstallStickerSetQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
CHECK(status.is_error());
promise_.set_error(std::move(status));
}
@ -804,7 +804,7 @@ class UninstallStickerSetQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_uninstallStickerSet(std::move(input_set))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_uninstallStickerSet>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -820,7 +820,7 @@ class UninstallStickerSetQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
CHECK(status.is_error());
promise_.set_error(std::move(status));
}
@ -834,7 +834,7 @@ class ReadFeaturedStickerSetsQuery : public Td::ResultHandler {
telegram_api::messages_readFeaturedStickers(StickersManager::convert_sticker_set_ids(sticker_set_ids))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_readFeaturedStickers>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -844,7 +844,7 @@ class ReadFeaturedStickerSetsQuery : public Td::ResultHandler {
(void)result;
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for ReadFeaturedStickerSetsQuery: " << status;
}
@ -871,7 +871,7 @@ class UploadStickerFileQuery : public Td::ResultHandler {
telegram_api::messages_uploadMedia(std::move(input_peer), std::move(input_media))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_uploadMedia>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -880,7 +880,7 @@ class UploadStickerFileQuery : public Td::ResultHandler {
td->stickers_manager_->on_uploaded_sticker_file(file_id_, result_ptr.move_as_ok(), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
CHECK(status.is_error());
if (was_uploaded_) {
CHECK(file_id_.is_valid());
@ -910,7 +910,7 @@ class SuggestStickerSetShortNameQuery : public Td::ResultHandler {
void send(const string &title) {
send_query(G()->net_query_creator().create(telegram_api::stickers_suggestShortName(title)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::stickers_suggestShortName>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -920,7 +920,7 @@ class SuggestStickerSetShortNameQuery : public Td::ResultHandler {
promise_.set_value(std::move(ptr->short_name_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
if (status.message() == "TITLE_INVALID") {
return promise_.set_value(string());
}
@ -939,7 +939,7 @@ class CheckStickerSetShortNameQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::stickers_checkShortName(short_name)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::stickers_checkShortName>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -948,7 +948,7 @@ class CheckStickerSetShortNameQuery : public Td::ResultHandler {
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -981,7 +981,7 @@ class CreateNewStickerSetQuery : public Td::ResultHandler {
title, short_name, nullptr, std::move(input_stickers), software)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::stickers_createStickerSet>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -993,7 +993,7 @@ class CreateNewStickerSetQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
CHECK(status.is_error());
promise_.set_error(std::move(status));
}
@ -1011,7 +1011,7 @@ class AddStickerToSetQuery : public Td::ResultHandler {
make_tl_object<telegram_api::inputStickerSetShortName>(short_name), std::move(input_sticker))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::stickers_addStickerToSet>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -1023,7 +1023,7 @@ class AddStickerToSetQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
CHECK(status.is_error());
promise_.set_error(std::move(status));
}
@ -1041,7 +1041,7 @@ class SetStickerSetThumbnailQuery : public Td::ResultHandler {
make_tl_object<telegram_api::inputStickerSetShortName>(short_name), std::move(input_document))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::stickers_setStickerSetThumb>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -1053,7 +1053,7 @@ class SetStickerSetThumbnailQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
CHECK(status.is_error());
promise_.set_error(std::move(status));
}
@ -1071,7 +1071,7 @@ class SetStickerPositionQuery : public Td::ResultHandler {
telegram_api::stickers_changeStickerPosition(std::move(input_document), position)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::stickers_changeStickerPosition>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -1083,7 +1083,7 @@ class SetStickerPositionQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
CHECK(status.is_error());
promise_.set_error(std::move(status));
}
@ -1100,7 +1100,7 @@ class DeleteStickerFromSetQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::stickers_removeStickerFromSet(std::move(input_document))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::stickers_removeStickerFromSet>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -1112,7 +1112,7 @@ class DeleteStickerFromSetQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
CHECK(status.is_error());
promise_.set_error(std::move(status));
}
@ -1169,20 +1169,20 @@ class StickersManager::StickerSetListLogEvent {
class StickersManager::UploadStickerFileCallback : public FileManager::UploadCallback {
public:
void on_upload_ok(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file) override {
void on_upload_ok(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file) final {
send_closure_later(G()->stickers_manager(), &StickersManager::on_upload_sticker_file, file_id,
std::move(input_file));
}
void on_upload_encrypted_ok(FileId file_id, tl_object_ptr<telegram_api::InputEncryptedFile> input_file) override {
void on_upload_encrypted_ok(FileId file_id, tl_object_ptr<telegram_api::InputEncryptedFile> input_file) final {
UNREACHABLE();
}
void on_upload_secure_ok(FileId file_id, tl_object_ptr<telegram_api::InputSecureFile> input_file) override {
void on_upload_secure_ok(FileId file_id, tl_object_ptr<telegram_api::InputSecureFile> input_file) final {
UNREACHABLE();
}
void on_upload_error(FileId file_id, Status error) override {
void on_upload_error(FileId file_id, Status error) final {
send_closure_later(G()->stickers_manager(), &StickersManager::on_upload_sticker_file_error, file_id,
std::move(error));
}

View File

@ -576,9 +576,9 @@ class StickersManager : public Actor {
td_api::object_ptr<td_api::updateDiceEmojis> get_update_dice_emojis_object() const;
void start_up() override;
void start_up() final;
void tear_down() override;
void tear_down() final;
SpecialStickerSet &add_special_sticker_set(const string &type);

View File

@ -77,9 +77,9 @@ class StorageManager : public Actor {
int32 ref_cnt_{1};
bool is_closed_{false};
ActorShared<> create_reference();
void start_up() override;
void hangup_shared() override;
void hangup() override;
void start_up() final;
void hangup_shared() final;
void hangup() final;
// Gc
ActorOwn<FileGcWorker> gc_worker_;
@ -99,7 +99,7 @@ class StorageManager : public Actor {
void save_last_gc_timestamp();
void schedule_next_gc();
void timeout_expired() override;
void timeout_expired() final;
};
} // namespace td

File diff suppressed because it is too large Load Diff

View File

@ -96,7 +96,7 @@ class Td final : public NetQueryCallback {
Td(Td &&) = delete;
Td &operator=(const Td &) = delete;
Td &operator=(Td &&) = delete;
~Td() override;
~Td() final;
struct Options {
std::shared_ptr<NetQueryStats> net_query_stats;
@ -112,7 +112,7 @@ class Td final : public NetQueryCallback {
void schedule_get_promo_data(int32 expires_in);
void on_result(NetQueryPtr query) override;
void on_result(NetQueryPtr query) final;
void on_update_server_time_difference();
@ -1303,10 +1303,10 @@ class Td final : public NetQueryCallback {
}
// Actor
void start_up() override;
void tear_down() override;
void hangup_shared() override;
void hangup() override;
void start_up() final;
void tear_down() final;
void hangup_shared() final;
void hangup() final;
};
} // namespace td

View File

@ -30,7 +30,7 @@ class GetTermsOfServiceUpdateQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::help_getTermsOfServiceUpdate()));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::help_getTermsOfServiceUpdate>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -53,7 +53,7 @@ class GetTermsOfServiceUpdateQuery : public Td::ResultHandler {
}
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -70,7 +70,7 @@ class AcceptTermsOfServiceQuery : public Td::ResultHandler {
telegram_api::make_object<telegram_api::dataJSON>(std::move(terms_of_service_id)))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::help_acceptTermsOfService>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -83,7 +83,7 @@ class AcceptTermsOfServiceQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};

View File

@ -106,12 +106,12 @@ class TopDialogManager : public NetQueryCallback {
void on_first_sync();
void on_result(NetQueryPtr net_query) override;
void on_result(NetQueryPtr net_query) final;
void init();
void start_up() override;
void loop() override;
void start_up() final;
void loop() final;
};
} // namespace td

View File

@ -98,7 +98,7 @@ class GetUpdatesStateQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::updates_getState()));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::updates_getState>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -107,7 +107,7 @@ class GetUpdatesStateQuery : public Td::ResultHandler {
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -124,7 +124,7 @@ class PingServerQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::updates_getState()));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::updates_getState>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -133,7 +133,7 @@ class PingServerQuery : public Td::ResultHandler {
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};
@ -150,7 +150,7 @@ class GetDifferenceQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::updates_getDifference(0, pts, 0, date, qts)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
VLOG(get_difference) << "Receive getDifference result of size " << packet.size();
auto result_ptr = fetch_result<telegram_api::updates_getDifference>(packet);
if (result_ptr.is_error()) {
@ -160,7 +160,7 @@ class GetDifferenceQuery : public Td::ResultHandler {
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};

View File

@ -36,19 +36,19 @@ class Td;
class dummyUpdate : public telegram_api::Update {
public:
static constexpr int32 ID = 1234567891;
int32 get_id() const override {
int32 get_id() const final {
return ID;
}
void store(TlStorerUnsafe &s) const override {
void store(TlStorerUnsafe &s) const final {
UNREACHABLE();
}
void store(TlStorerCalcLength &s) const override {
void store(TlStorerCalcLength &s) const final {
UNREACHABLE();
}
void store(TlStorerToString &s, const char *field_name) const override {
void store(TlStorerToString &s, const char *field_name) const final {
s.store_class_begin(field_name, "dummyUpdate");
s.store_class_end();
}
@ -66,19 +66,19 @@ class updateSentMessage : public telegram_api::Update {
}
static constexpr int32 ID = 1234567890;
int32 get_id() const override {
int32 get_id() const final {
return ID;
}
void store(TlStorerUnsafe &s) const override {
void store(TlStorerUnsafe &s) const final {
UNREACHABLE();
}
void store(TlStorerCalcLength &s) const override {
void store(TlStorerCalcLength &s) const final {
UNREACHABLE();
}
void store(TlStorerToString &s, const char *field_name) const override {
void store(TlStorerToString &s, const char *field_name) const final {
s.store_class_begin(field_name, "updateSentMessage");
s.store_field("random_id", random_id_);
s.store_field("message_id", message_id_.get());
@ -200,7 +200,7 @@ class UpdatesManager : public Actor {
int32 min_postponed_update_pts_ = 0;
int32 min_postponed_update_qts_ = 0;
void tear_down() override;
void tear_down() final;
int32 get_pts() const {
return pts_manager_.mem_pts();

View File

@ -441,15 +441,15 @@ class WebPageBlockTitle : public WebPageBlock {
explicit WebPageBlockTitle(RichText &&title) : title(std::move(title)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Title;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
title.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockTitle>(title.get_rich_text_object(context));
}
@ -474,15 +474,15 @@ class WebPageBlockSubtitle : public WebPageBlock {
explicit WebPageBlockSubtitle(RichText &&subtitle) : subtitle(std::move(subtitle)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Subtitle;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
subtitle.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockSubtitle>(subtitle.get_rich_text_object(context));
}
@ -508,15 +508,15 @@ class WebPageBlockAuthorDate : public WebPageBlock {
WebPageBlockAuthorDate(RichText &&author, int32 date) : author(std::move(author)), date(max(date, 0)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::AuthorDate;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
author.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockAuthorDate>(author.get_rich_text_object(context), date);
}
@ -543,15 +543,15 @@ class WebPageBlockHeader : public WebPageBlock {
explicit WebPageBlockHeader(RichText &&header) : header(std::move(header)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Header;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
header.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockHeader>(header.get_rich_text_object(context));
}
@ -576,15 +576,15 @@ class WebPageBlockSubheader : public WebPageBlock {
explicit WebPageBlockSubheader(RichText &&subheader) : subheader(std::move(subheader)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Subheader;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
subheader.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockSubheader>(subheader.get_rich_text_object(context));
}
@ -609,15 +609,15 @@ class WebPageBlockKicker : public WebPageBlock {
explicit WebPageBlockKicker(RichText &&kicker) : kicker(std::move(kicker)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Kicker;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
kicker.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockKicker>(kicker.get_rich_text_object(context));
}
@ -642,15 +642,15 @@ class WebPageBlockParagraph : public WebPageBlock {
explicit WebPageBlockParagraph(RichText &&text) : text(std::move(text)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Paragraph;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
text.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockParagraph>(text.get_rich_text_object(context));
}
@ -676,15 +676,15 @@ class WebPageBlockPreformatted : public WebPageBlock {
WebPageBlockPreformatted(RichText &&text, string &&language) : text(std::move(text)), language(std::move(language)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Preformatted;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
text.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockPreformatted>(text.get_rich_text_object(context), language);
}
@ -711,15 +711,15 @@ class WebPageBlockFooter : public WebPageBlock {
explicit WebPageBlockFooter(RichText &&footer) : footer(std::move(footer)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Footer;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
footer.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockFooter>(footer.get_rich_text_object(context));
}
@ -738,14 +738,14 @@ class WebPageBlockFooter : public WebPageBlock {
class WebPageBlockDivider : public WebPageBlock {
public:
Type get_type() const override {
Type get_type() const final {
return Type::Divider;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockDivider>();
}
@ -766,14 +766,14 @@ class WebPageBlockAnchor : public WebPageBlock {
explicit WebPageBlockAnchor(string &&name) : name(std::move(name)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Anchor;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
if (context->is_first_pass_) {
context->anchors_.emplace(name, nullptr);
}
@ -829,11 +829,11 @@ class WebPageBlockList : public WebPageBlock {
explicit WebPageBlockList(vector<Item> &&items) : items(std::move(items)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::List;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
for (auto &item : items) {
for (auto &page_block : item.page_blocks) {
page_block->append_file_ids(td, file_ids);
@ -841,7 +841,7 @@ class WebPageBlockList : public WebPageBlock {
}
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return td_api::make_object<td_api::pageBlockList>(
transform(items, [context](const Item &item) { return get_page_block_list_item_object(item, context); }));
}
@ -892,16 +892,16 @@ class WebPageBlockBlockQuote : public WebPageBlock {
WebPageBlockBlockQuote(RichText &&text, RichText &&credit) : text(std::move(text)), credit(std::move(credit)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::BlockQuote;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
text.append_file_ids(td, file_ids);
credit.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockBlockQuote>(text.get_rich_text_object(context),
credit.get_rich_text_object(context));
}
@ -930,16 +930,16 @@ class WebPageBlockPullQuote : public WebPageBlock {
WebPageBlockPullQuote(RichText &&text, RichText &&credit) : text(std::move(text)), credit(std::move(credit)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::PullQuote;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
text.append_file_ids(td, file_ids);
credit.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockPullQuote>(text.get_rich_text_object(context),
credit.get_rich_text_object(context));
}
@ -970,16 +970,16 @@ class WebPageBlockAnimation : public WebPageBlock {
: animation_file_id(animation_file_id), caption(std::move(caption)), need_autoplay(need_autoplay) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Animation;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
caption.append_file_ids(td, file_ids);
Document(Document::Type::Animation, animation_file_id).append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockAnimation>(
context->td_->animations_manager_->get_animation_object(animation_file_id, "get_page_block_object"),
caption.get_page_block_caption_object(context), need_autoplay);
@ -1037,16 +1037,16 @@ class WebPageBlockPhoto : public WebPageBlock {
: photo(std::move(photo)), caption(std::move(caption)), url(std::move(url)), web_page_id(web_page_id) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Photo;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
append(file_ids, photo_get_file_ids(photo));
caption.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockPhoto>(get_photo_object(context->td_->file_manager_.get(), photo),
caption.get_page_block_caption_object(context), url);
}
@ -1087,16 +1087,16 @@ class WebPageBlockVideo : public WebPageBlock {
: video_file_id(video_file_id), caption(std::move(caption)), need_autoplay(need_autoplay), is_looped(is_looped) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Video;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
caption.append_file_ids(td, file_ids);
Document(Document::Type::Video, video_file_id).append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockVideo>(context->td_->videos_manager_->get_video_object(video_file_id),
caption.get_page_block_caption_object(context), need_autoplay,
is_looped);
@ -1152,15 +1152,15 @@ class WebPageBlockCover : public WebPageBlock {
explicit WebPageBlockCover(unique_ptr<WebPageBlock> &&cover) : cover(std::move(cover)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Cover;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
cover->append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockCover>(cover->get_page_block_object(context));
}
@ -1199,16 +1199,16 @@ class WebPageBlockEmbedded : public WebPageBlock {
, allow_scrolling(allow_scrolling) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Embedded;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
append(file_ids, photo_get_file_ids(poster_photo));
caption.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockEmbedded>(
url, html, get_photo_object(context->td_->file_manager_.get(), poster_photo), dimensions.width,
dimensions.height, caption.get_page_block_caption_object(context), is_full_width, allow_scrolling);
@ -1265,11 +1265,11 @@ class WebPageBlockEmbeddedPost : public WebPageBlock {
, caption(std::move(caption)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::EmbeddedPost;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
append(file_ids, photo_get_file_ids(author_photo));
for (auto &page_block : page_blocks) {
page_block->append_file_ids(td, file_ids);
@ -1277,7 +1277,7 @@ class WebPageBlockEmbeddedPost : public WebPageBlock {
caption.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockEmbeddedPost>(
url, author, get_photo_object(context->td_->file_manager_.get(), author_photo), date,
get_page_block_objects(page_blocks, context), caption.get_page_block_caption_object(context));
@ -1316,18 +1316,18 @@ class WebPageBlockCollage : public WebPageBlock {
: page_blocks(std::move(page_blocks)), caption(std::move(caption)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Collage;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
for (auto &page_block : page_blocks) {
page_block->append_file_ids(td, file_ids);
}
caption.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockCollage>(get_page_block_objects(page_blocks, context),
caption.get_page_block_caption_object(context));
}
@ -1357,18 +1357,18 @@ class WebPageBlockSlideshow : public WebPageBlock {
: page_blocks(std::move(page_blocks)), caption(std::move(caption)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Slideshow;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
for (auto &page_block : page_blocks) {
page_block->append_file_ids(td, file_ids);
}
caption.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockSlideshow>(get_page_block_objects(page_blocks, context),
caption.get_page_block_caption_object(context));
}
@ -1399,15 +1399,15 @@ class WebPageBlockChatLink : public WebPageBlock {
: title(std::move(title)), photo(std::move(photo)), username(std::move(username)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::ChatLink;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
append(file_ids, dialog_photo_get_file_ids(photo));
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockChatLink>(
title, get_chat_photo_info_object(context->td_->file_manager_.get(), &photo), username);
}
@ -1439,16 +1439,16 @@ class WebPageBlockAudio : public WebPageBlock {
: audio_file_id(audio_file_id), caption(std::move(caption)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Audio;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
Document(Document::Type::Audio, audio_file_id).append_file_ids(td, file_ids);
caption.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockAudio>(context->td_->audios_manager_->get_audio_object(audio_file_id),
caption.get_page_block_caption_object(context));
}
@ -1510,11 +1510,11 @@ class WebPageBlockTable : public WebPageBlock {
: title(std::move(title)), cells(std::move(cells)), is_bordered(is_bordered), is_striped(is_striped) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Table;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
title.append_file_ids(td, file_ids);
for (auto &row : cells) {
for (auto &cell : row) {
@ -1523,7 +1523,7 @@ class WebPageBlockTable : public WebPageBlock {
}
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
auto cell_objects = transform(cells, [&](const vector<WebPageBlockTableCell> &row) {
return transform(
row, [&](const WebPageBlockTableCell &cell) { return cell.get_page_block_table_cell_object(context); });
@ -1567,18 +1567,18 @@ class WebPageBlockDetails : public WebPageBlock {
: header(std::move(header)), page_blocks(std::move(page_blocks)), is_open(is_open) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Details;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
header.append_file_ids(td, file_ids);
for (auto &page_block : page_blocks) {
page_block->append_file_ids(td, file_ids);
}
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockDetails>(header.get_rich_text_object(context),
get_page_block_objects(page_blocks, context), is_open);
}
@ -1614,11 +1614,11 @@ class WebPageBlockRelatedArticles : public WebPageBlock {
: header(std::move(header)), related_articles(std::move(related_articles)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::RelatedArticles;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
header.append_file_ids(td, file_ids);
for (auto &article : related_articles) {
if (!article.photo.is_empty()) {
@ -1627,7 +1627,7 @@ class WebPageBlockRelatedArticles : public WebPageBlock {
}
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
auto related_article_objects = transform(related_articles, [context](const RelatedArticle &article) {
return td_api::make_object<td_api::pageBlockRelatedArticle>(
article.url, article.title, article.description,
@ -1664,15 +1664,15 @@ class WebPageBlockMap : public WebPageBlock {
: location(std::move(location)), zoom(zoom), dimensions(dimensions), caption(std::move(caption)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::Map;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
caption.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockMap>(location.get_location_object(), zoom, dimensions.width,
dimensions.height, caption.get_page_block_caption_object(context));
}
@ -1706,16 +1706,16 @@ class WebPageBlockVoiceNote : public WebPageBlock {
: voice_note_file_id(voice_note_file_id), caption(std::move(caption)) {
}
Type get_type() const override {
Type get_type() const final {
return Type::VoiceNote;
}
void append_file_ids(const Td *td, vector<FileId> &file_ids) const override {
void append_file_ids(const Td *td, vector<FileId> &file_ids) const final {
Document(Document::Type::VoiceNote, voice_note_file_id).append_file_ids(td, file_ids);
caption.append_file_ids(td, file_ids);
}
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const override {
td_api::object_ptr<td_api::PageBlock> get_page_block_object(Context *context) const final {
return make_tl_object<td_api::pageBlockVoiceNote>(
context->td_->voice_notes_manager_->get_voice_note_object(voice_note_file_id),
caption.get_page_block_caption_object(context));

View File

@ -76,7 +76,7 @@ class GetWebPagePreviewQuery : public Td::ResultHandler {
G()->net_query_creator().create(telegram_api::messages_getWebPagePreview(flags, text, std::move(entities))));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getWebPagePreview>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -87,7 +87,7 @@ class GetWebPagePreviewQuery : public Td::ResultHandler {
td->web_pages_manager_->on_get_web_page_preview_success(request_id_, url_, std::move(ptr), std::move(promise_));
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
td->web_pages_manager_->on_get_web_page_preview_fail(request_id_, url_, std::move(status), std::move(promise_));
}
};
@ -107,7 +107,7 @@ class GetWebPageQuery : public Td::ResultHandler {
send_query(G()->net_query_creator().create(telegram_api::messages_getWebPage(url, hash)));
}
void on_result(uint64 id, BufferSlice packet) override {
void on_result(uint64 id, BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_getWebPage>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
@ -133,7 +133,7 @@ class GetWebPageQuery : public Td::ResultHandler {
promise_.set_value(Unit());
}
void on_error(uint64 id, Status status) override {
void on_error(uint64 id, Status status) final {
promise_.set_error(std::move(status));
}
};

View File

@ -41,7 +41,7 @@ class WebPagesManager : public Actor {
WebPagesManager &operator=(const WebPagesManager &) = delete;
WebPagesManager(WebPagesManager &&) = delete;
WebPagesManager &operator=(WebPagesManager &&) = delete;
~WebPagesManager() override;
~WebPagesManager() final;
WebPageId on_get_web_page(tl_object_ptr<telegram_api::WebPage> &&web_page_ptr, DialogId owner_dialog_id);
@ -166,7 +166,7 @@ class WebPagesManager : public Actor {
void on_load_web_page_by_url_from_database(WebPageId web_page_id, const string &url, Promise<Unit> &&promise,
Result<> result);
void tear_down() override;
void tear_down() final;
FileSourceId get_web_page_file_source_id(WebPage *web_page);

View File

@ -236,7 +236,7 @@ class CliClient final : public Actor {
}
private:
void start_up() override {
void start_up() final {
yield();
}
@ -919,17 +919,17 @@ class CliClient final : public Actor {
public:
TdCallbackImpl(CliClient *client, uint64 generation) : client_(client), generation_(generation) {
}
void on_result(uint64 id, td_api::object_ptr<td_api::Object> result) override {
void on_result(uint64 id, td_api::object_ptr<td_api::Object> result) final {
client_->on_result(generation_, id, std::move(result));
}
void on_error(uint64 id, td_api::object_ptr<td_api::error> error) override {
void on_error(uint64 id, td_api::object_ptr<td_api::error> error) final {
client_->on_error(generation_, id, std::move(error));
}
TdCallbackImpl(const TdCallbackImpl &) = delete;
TdCallbackImpl &operator=(const TdCallbackImpl &) = delete;
TdCallbackImpl(TdCallbackImpl &&) = delete;
TdCallbackImpl &operator=(TdCallbackImpl &&) = delete;
~TdCallbackImpl() override {
~TdCallbackImpl() final {
client_->on_closed(generation_);
}
@ -4349,7 +4349,7 @@ class CliClient final : public Actor {
}
bool is_inited_ = false;
void loop() override {
void loop() final {
if (!is_inited_) {
is_inited_ = true;
init();
@ -4385,7 +4385,7 @@ class CliClient final : public Actor {
}
}
void timeout_expired() override {
void timeout_expired() final {
if (close_flag_) {
return;
}
@ -4426,12 +4426,12 @@ class CliClient final : public Actor {
}
}
void notify() override {
void notify() final {
auto guard = scheduler_->get_send_guard();
send_event_later(actor_id(), Event::yield());
}
void hangup_shared() override {
void hangup_shared() final {
CHECK(get_link_token() == 1);
LOG(INFO) << "StdinReader stopped";
is_stdin_reader_stopped_ = true;
@ -4607,7 +4607,7 @@ void main(int argc, char **argv) {
}
private:
void start_up() override {
void start_up() final {
create_actor<CliClient>("CliClient", scheduler_, use_test_dc_, get_chat_list_, disable_network_, api_id_,
api_hash_)
.release();

Some files were not shown because too many files have changed in this diff Show More