Index: include/AdblockPlus/FilterEngine.h |
=================================================================== |
--- a/include/AdblockPlus/FilterEngine.h |
+++ b/include/AdblockPlus/FilterEngine.h |
@@ -85,16 +85,17 @@ |
* 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: |
/** |
* Checks if this subscription has been added to the list of subscriptions. |
* @return `true` if this subscription has been added. |
*/ |
bool IsListed() const; |
/** |
@@ -122,36 +123,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 +284,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` |