2019-01-19 22:54:29 +01:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2019-01-19 22:54:29 +01: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/td_api.h"
|
|
|
|
|
2019-02-12 21:48:16 +01:00
|
|
|
#include "td/utils/common.h"
|
2019-01-19 23:59:37 +01:00
|
|
|
#include "td/utils/Slice.h"
|
2019-01-20 01:21:26 +01:00
|
|
|
#include "td/utils/StringBuilder.h"
|
2019-01-19 22:54:29 +01:00
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
2019-06-20 03:53:50 +02:00
|
|
|
enum class FileType : int32 {
|
2019-01-19 22:54:29 +01:00
|
|
|
Thumbnail,
|
|
|
|
ProfilePhoto,
|
|
|
|
Photo,
|
|
|
|
VoiceNote,
|
|
|
|
Video,
|
|
|
|
Document,
|
|
|
|
Encrypted,
|
|
|
|
Temp,
|
|
|
|
Sticker,
|
|
|
|
Audio,
|
|
|
|
Animation,
|
|
|
|
EncryptedThumbnail,
|
|
|
|
Wallpaper,
|
|
|
|
VideoNote,
|
2022-04-25 18:00:40 +02:00
|
|
|
SecureDecrypted,
|
|
|
|
SecureEncrypted,
|
2019-05-07 04:51:56 +02:00
|
|
|
Background,
|
2020-06-22 01:02:21 +02:00
|
|
|
DocumentAsFile,
|
2022-04-12 21:50:20 +02:00
|
|
|
Ringtone,
|
2022-04-21 21:34:26 +02:00
|
|
|
CallLog,
|
2023-05-25 00:26:26 +02:00
|
|
|
PhotoStory,
|
2023-05-25 13:19:54 +02:00
|
|
|
VideoStory,
|
2019-01-19 22:54:29 +01:00
|
|
|
Size,
|
|
|
|
None
|
|
|
|
};
|
|
|
|
|
2020-06-22 01:20:48 +02:00
|
|
|
enum class FileDirType : int8 { Secure, Common };
|
2019-01-19 22:54:29 +01:00
|
|
|
|
2020-06-22 01:27:58 +02:00
|
|
|
constexpr int32 MAX_FILE_TYPE = static_cast<int32>(FileType::Size);
|
2019-01-19 23:59:37 +01:00
|
|
|
|
2020-06-22 03:28:03 +02:00
|
|
|
FileType get_file_type(const td_api::FileType &file_type);
|
2019-01-19 22:54:29 +01:00
|
|
|
|
2020-06-22 03:28:03 +02:00
|
|
|
tl_object_ptr<td_api::FileType> get_file_type_object(FileType file_type);
|
2019-01-19 22:54:29 +01:00
|
|
|
|
2020-06-22 07:43:00 +02:00
|
|
|
FileType get_main_file_type(FileType file_type);
|
|
|
|
|
2020-06-22 01:20:48 +02:00
|
|
|
CSlice get_file_type_name(FileType file_type);
|
2019-01-19 22:54:29 +01:00
|
|
|
|
2023-09-11 16:02:58 +02:00
|
|
|
CSlice get_file_type_unique_name(FileType file_type);
|
|
|
|
|
2022-04-21 21:14:12 +02:00
|
|
|
enum class FileTypeClass : int32 { Photo, Document, Secure, Encrypted, Temp };
|
|
|
|
|
|
|
|
FileTypeClass get_file_type_class(FileType file_type);
|
|
|
|
|
2022-04-21 20:54:33 +02:00
|
|
|
bool is_document_file_type(FileType file_type);
|
|
|
|
|
2020-06-22 01:20:48 +02:00
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, FileType file_type);
|
2019-01-19 22:54:29 +01:00
|
|
|
|
2020-06-22 01:20:48 +02:00
|
|
|
FileDirType get_file_dir_type(FileType file_type);
|
2019-01-19 22:54:29 +01:00
|
|
|
|
2020-06-22 01:20:48 +02:00
|
|
|
bool is_file_big(FileType file_type, int64 expected_size);
|
2019-01-19 22:54:29 +01:00
|
|
|
|
2022-04-22 13:28:51 +02:00
|
|
|
bool can_reuse_remote_file(FileType file_type);
|
|
|
|
|
2023-09-11 15:34:00 +02:00
|
|
|
FileType guess_file_type_by_path(Slice file_path, FileType default_file_type = FileType::None);
|
|
|
|
|
2019-01-19 22:54:29 +01:00
|
|
|
} // namespace td
|