Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include/AdblockPlus/FilterEngine.h

Issue 29419623: Issue 5165 - Remove SubscriptionPtr (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Added move assignment operator Created April 24, 2017, 7:08 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | shell/src/SubscriptionsCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/AdblockPlus/FilterEngine.h
===================================================================
--- a/include/AdblockPlus/FilterEngine.h
+++ b/include/AdblockPlus/FilterEngine.h
@@ -85,18 +85,39 @@
* 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);
+
+ /**
+ * Move assignment operator
+ */
+ Subscription& operator=(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 +143,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 +304,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`
« no previous file with comments | « no previous file | shell/src/SubscriptionsCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld