From 4e59eadba3b0d4586a9122e6a825ea030a139c9a Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Wed, 20 Mar 2024 13:28:19 -0400 Subject: Use smart pointers with AP classes and Instance --- src/net/instance.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/net/instance.h') diff --git a/src/net/instance.h b/src/net/instance.h index 2b7eec7..79c0b12 100644 --- a/src/net/instance.h +++ b/src/net/instance.h @@ -1,6 +1,11 @@ #pragma once #include "src/activitypub/appost.h" #include "src/settings_interface.h" +#include +#include + +class Instance; +typedef std::shared_ptr InstancePtr; class Instance { public: @@ -10,7 +15,7 @@ public: }; virtual ~Instance() {}; - virtual APPost* get_post_from_url(const QString &url) = 0; + virtual APPostPtr get_post_from_url(const QString &url) = 0; // Returns the URI the user has to visit in their browser virtual QString oauth2_step1(); // auth_code is the code given by the user through the URI @@ -18,7 +23,7 @@ public: virtual OAuth2Step2 oauth2_step2(const QString &auth_code); bool supports_oauth2 = false; // Creates an instance by reading the type from settings - static Instance* create_instance(); + static InstancePtr create_instance(); // Creates a specific type of instance, for use with SettingsDialog - static Instance* create_instance(AppSettingsTypes::InstanceType type); + static InstancePtr create_instance(AppSettingsTypes::InstanceType type); }; -- cgit v1.2.3-54-g00ecf