From e515ca109faa897e84be8a97a1240c59df612dd4 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Wed, 5 Jul 2023 15:14:46 +0200 Subject: Implement a small library of ActivityPub objects These objects allow, and will allow us, to move HTML rendering out of the archive parser and into separate classes. Each of the derived classes specialise HTML rendering for their specific requirements. Furthermore, these ActivityPub objects will be able to be expanded upon and have support to be written to disk, in a database, for instance. Separating ActivityPub object retrieving from rendering allows us to implement other retrieving sources and methods, such as downloading posts from a configured remote instance. --- src/activitypub/apobject.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/activitypub/apobject.cpp (limited to 'src/activitypub/apobject.cpp') diff --git a/src/activitypub/apobject.cpp b/src/activitypub/apobject.cpp new file mode 100644 index 0000000..28d01b4 --- /dev/null +++ b/src/activitypub/apobject.cpp @@ -0,0 +1,23 @@ +#include "apobject.h" +#include "apbase.h" + +APObject::APObject() {} + +APObject::APObject(const QString& url) { + load_object_url(url); +} + +void APObject::load_object_url(const QString& url) { + object_url = url; + // TODO: retrieve URL to build APObject. + // is it possible to change an object/class from one class type to another? (yeah, i can find a way with a member pointer of type APObject* that points to the right child class and have get_html_render call its get_html_render method when it's time to render) + // retriveving would have to be done async and disk/memory cache will have to be checked +} + +const QString APObject::get_object_url() { + return object_url; +} + +QString APObject::get_html_render(HtmlRenderDetails render_info) { + return QString("Note: object (%1) isn't ready to be rendered as it hasn't been retrieved and built.").arg(object_url); +} -- cgit v1.2.3-54-g00ecf