tdesktop/Telegram/SourceFiles/export/output/export_output_abstract.h

93 lines
2.1 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include <QtCore/QString>
namespace Export {
namespace Data {
struct PersonalInfo;
struct UserpicsInfo;
struct UserpicsSlice;
struct ContactsList;
struct SessionsList;
2018-06-12 20:09:21 +02:00
struct DialogsInfo;
struct DialogInfo;
struct MessagesSlice;
2018-06-24 02:33:47 +02:00
struct File;
} // namespace Data
struct Settings;
2018-06-24 04:06:11 +02:00
struct Environment;
namespace Output {
2018-07-23 15:11:56 +02:00
QString NormalizePath(const Settings &settings);
2018-06-23 22:27:41 +02:00
struct Result;
class Stats;
enum class Format {
2018-06-23 22:27:41 +02:00
Html,
Json,
2022-02-12 23:23:09 +01:00
Both,
};
class AbstractWriter {
public:
2018-06-23 22:27:41 +02:00
[[nodiscard]] virtual Format format() = 0;
[[nodiscard]] virtual Result start(
const Settings &settings,
2018-06-24 04:06:11 +02:00
const Environment &environment,
Stats *stats) = 0;
[[nodiscard]] virtual Result writePersonal(
const Data::PersonalInfo &data) = 0;
[[nodiscard]] virtual Result writeUserpicsStart(
const Data::UserpicsInfo &data) = 0;
[[nodiscard]] virtual Result writeUserpicsSlice(
const Data::UserpicsSlice &data) = 0;
[[nodiscard]] virtual Result writeUserpicsEnd() = 0;
[[nodiscard]] virtual Result writeContactsList(
const Data::ContactsList &data) = 0;
[[nodiscard]] virtual Result writeSessionsList(
const Data::SessionsList &data) = 0;
2018-06-24 02:33:47 +02:00
[[nodiscard]] virtual Result writeOtherData(
const Data::File &data) = 0;
[[nodiscard]] virtual Result writeDialogsStart(
const Data::DialogsInfo &data) = 0;
[[nodiscard]] virtual Result writeDialogStart(
const Data::DialogInfo &data) = 0;
[[nodiscard]] virtual Result writeDialogSlice(
const Data::MessagesSlice &data) = 0;
[[nodiscard]] virtual Result writeDialogEnd() = 0;
[[nodiscard]] virtual Result writeDialogsEnd() = 0;
[[nodiscard]] virtual Result finish() = 0;
[[nodiscard]] virtual QString mainFilePath() = 0;
virtual ~AbstractWriter() = default;
Stats produceTestExample(
const QString &path,
const Environment &environment);
2018-06-23 22:27:41 +02:00
};
std::unique_ptr<AbstractWriter> CreateWriter(Format format);
} // namespace Output
} // namespace Export