diff options
author | ConfuSomu | 2023-08-03 17:23:33 +0200 |
---|---|---|
committer | ConfuSomu | 2023-08-03 17:23:33 +0200 |
commit | bf73a19e11e5cccd22f58a5c97e1346dab5587c8 (patch) | |
tree | 64654503131a2eb77c5e9cbf25478330e8ce261b /src/archive/base_archive.h | |
parent | 1500681405804b932761db7a0182d498894ad81c (diff) | |
download | ActorViewer-bf73a19e11e5cccd22f58a5c97e1346dab5587c8.tar ActorViewer-bf73a19e11e5cccd22f58a5c97e1346dab5587c8.tar.gz ActorViewer-bf73a19e11e5cccd22f58a5c97e1346dab5587c8.zip |
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.
Diffstat (limited to 'src/archive/base_archive.h')
-rw-r--r-- | src/archive/base_archive.h | 36 |
1 files changed, 36 insertions, 0 deletions
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 <QString> +#include <QListWidget> +#include <variant> +#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<QString, InitError> 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; +}; |