Index: include/AdblockPlus/FilterEngine.h |
=================================================================== |
--- a/include/AdblockPlus/FilterEngine.h |
+++ b/include/AdblockPlus/FilterEngine.h |
@@ -85,18 +85,34 @@ |
* Wrapper for a subscription object. |
* There are no accessors for most |
* [subscription properties](https://adblockplus.org/jsdoc/adblockpluscore/Subscription.html), |
* use `GetProperty()` to retrieve them by name. |
*/ |
class Subscription : public JsValue, |
public std::enable_shared_from_this<Subscription> |
{ |
+ friend class FilterEngine; |
public: |
/** |
+ * Copy constructor |
+ */ |
+ Subscription(const Subscription& src); |
+ |
+ /** |
+ * Move constructor |
+ */ |
+ Subscription(Subscription&& src); |
+ |
+ /** |
+ * Assignment operator |
+ */ |
+ Subscription& operator=(const Subscription& src); |
+ |
+ /** |
* Checks if this subscription has been added to the list of subscriptions. |
* @return `true` if this subscription has been added. |
*/ |
bool IsListed() const; |
/** |
* Adds this subscription to the list of subscriptions. |
*/ |
@@ -122,36 +138,32 @@ |
/** |
* Indicates whether the subscription is the Acceptable Ads subscription. |
* @return `true` if this subscription is the Acceptable Ads subscription. |
*/ |
bool IsAA() const; |
bool operator==(const Subscription& subscription) const; |
+ protected: |
/** |
* Creates a wrapper for an existing JavaScript subscription object. |
* Normally you shouldn't call this directly, but use |
* FilterEngine::GetSubscription() instead. |
* @param value JavaScript subscription object. |
*/ |
Subscription(JsValue&& value); |
}; |
/** |
* Shared smart pointer to a `Filter` instance. |
*/ |
typedef std::unique_ptr<Filter> FilterPtr; |
/** |
- * Shared smart pointer to a `Subscription` instance. |
- */ |
- typedef std::shared_ptr<Subscription> SubscriptionPtr; |
- |
- /** |
* Main component of libadblockplus. |
* It handles: |
* - Filter management and matching. |
* - Subscription management and synchronization. |
* - Update checks for the application. |
*/ |
class FilterEngine |
{ |
@@ -287,35 +299,35 @@ |
*/ |
Filter GetFilter(const std::string& text) const; |
/** |
* Retrieves a subscription object for the supplied URL. |
* @param url Subscription URL. |
* @return New `Subscription` instance. |
*/ |
- SubscriptionPtr GetSubscription(const std::string& url) const; |
+ Subscription GetSubscription(const std::string& url) const; |
/** |
* Retrieves the list of custom filters. |
* @return List of custom filters. |
*/ |
std::vector<Filter> GetListedFilters() const; |
/** |
* Retrieves all subscriptions. |
* @return List of subscriptions. |
*/ |
- std::vector<SubscriptionPtr> GetListedSubscriptions() const; |
+ std::vector<Subscription> GetListedSubscriptions() const; |
/** |
* Retrieves all recommended subscriptions. |
* @return List of recommended subscriptions. |
*/ |
- std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const; |
+ std::vector<Subscription> FetchAvailableSubscriptions() const; |
/** |
* Ensures that the Acceptable Ads subscription is enabled or disabled. |
* @param enabled |
* - if the value is `true` |
* - ensure that the filter set includes an enabled AA subscription, |
* adding it if needed and enabling it if disabled. |
* - if the value is `false` |