From bf73a19e11e5cccd22f58a5c97e1346dab5587c8 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Thu, 3 Aug 2023 17:23:33 +0200 Subject: Create an Archive base class This class is inherited by MastodonArchive to provide Mastodon (and compatible) archive reading support. A base Archive class allows implementing reading support of other archive formats that are from other services. --- src/archive/base_archive.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/archive/base_archive.h (limited to 'src/archive/base_archive.h') diff --git a/src/archive/base_archive.h b/src/archive/base_archive.h new file mode 100644 index 0000000..fcabcf1 --- /dev/null +++ b/src/archive/base_archive.h @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include +#include "src/types.h" + +enum ArchiveType { + MASTODON +}; + +class Archive { +public: + enum InitError { + NoError = 0, + FailedOpeningFile, + JsonParseError, + JsonEmpty, + JsonNull, + JsonNotObject, + JsonNotActivityStream // for ActivityPub archives + }; + + virtual ~Archive() {}; + virtual std::variant init() = 0; + + static Archive* create_archive(ArchiveType archive_type, const QString& main_filename); + + virtual void update_status_list(ViewStatusTypes allowed_types, QListWidget *parent) = 0; + virtual const QString get_html_status_info(int status_index, int text_zone_width, StatusType status_type, QLocale* locale) = 0; + virtual const QString get_html_status_text(int status_index) = 0; + +protected: + Archive(const QString& main_filename); + QString main_filename; +}; -- cgit v1.2.3-54-g00ecf