2019-04-09 17:38:57 +02:00
|
|
|
//
|
2022-01-01 01:35:39 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
|
2019-04-09 17:38:57 +02:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "td/telegram/files/FileId.h"
|
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/StringBuilder.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
2019-04-09 23:55:54 +02:00
|
|
|
class Td;
|
|
|
|
|
2019-04-09 17:38:57 +02:00
|
|
|
struct Document {
|
|
|
|
// append only
|
|
|
|
enum class Type : int32 { Unknown, Animation, Audio, General, Sticker, Video, VideoNote, VoiceNote };
|
|
|
|
|
|
|
|
Type type = Type::Unknown;
|
|
|
|
FileId file_id;
|
|
|
|
|
|
|
|
Document() = default;
|
2019-04-09 17:52:53 +02:00
|
|
|
Document(Type type, FileId file_id) : type(type), file_id(file_id) {
|
2019-04-09 17:38:57 +02:00
|
|
|
}
|
2019-04-09 22:39:41 +02:00
|
|
|
|
|
|
|
bool empty() const {
|
|
|
|
return type == Type::Unknown;
|
|
|
|
}
|
2019-04-09 23:55:54 +02:00
|
|
|
|
|
|
|
vector<FileId> get_file_ids(const Td *td) const;
|
2019-08-23 17:03:06 +02:00
|
|
|
|
|
|
|
void append_file_ids(const Td *td, vector<FileId> &file_ids) const;
|
2019-04-09 17:38:57 +02:00
|
|
|
};
|
|
|
|
|
2020-01-26 02:59:19 +01:00
|
|
|
bool operator==(const Document &lhs, const Document &rhs);
|
|
|
|
|
|
|
|
bool operator!=(const Document &lhs, const Document &rhs);
|
|
|
|
|
2019-05-07 04:51:56 +02:00
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, const Document::Type &document_type);
|
|
|
|
|
2019-04-09 17:38:57 +02:00
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, const Document &document);
|
|
|
|
|
|
|
|
} // namespace td
|