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

Unified Diff: include/AdblockPlus/FilterEngine.h

Issue 5163715573841920: Issue 768 - Switch from TR1 to C++11 (Closed)
Patch Set: Created July 11, 2014, 2:24 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
Index: include/AdblockPlus/FilterEngine.h
===================================================================
--- a/include/AdblockPlus/FilterEngine.h
+++ b/include/AdblockPlus/FilterEngine.h
@@ -15,66 +15,65 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ADBLOCK_PLUS_FILTER_ENGINE_H
#define ADBLOCK_PLUS_FILTER_ENGINE_H
#include <functional>
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include <AdblockPlus/JsEngine.h>
#include <AdblockPlus/JsValue.h>
-#include "tr1_memory.h"
-
namespace AdblockPlus
{
class FilterEngine;
class Filter : public JsValue,
- public std::tr1::enable_shared_from_this<Filter>
+ public std::enable_shared_from_this<Filter>
{
public:
enum Type {TYPE_BLOCKING, TYPE_EXCEPTION,
TYPE_ELEMHIDE, TYPE_ELEMHIDE_EXCEPTION,
TYPE_COMMENT, TYPE_INVALID};
Type GetType();
bool IsListed();
void AddToList();
void RemoveFromList();
bool operator==(const Filter& filter) const;
Filter(JsValuePtr value);
};
class Subscription : public JsValue,
- public std::tr1::enable_shared_from_this<Subscription>
+ public std::enable_shared_from_this<Subscription>
{
public:
bool IsListed();
void AddToList();
void RemoveFromList();
void UpdateFilters();
bool IsUpdating();
bool operator==(const Subscription& subscription) const;
Subscription(JsValuePtr value);
};
- typedef std::tr1::shared_ptr<Filter> FilterPtr;
- typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr;
+ typedef std::shared_ptr<Filter> FilterPtr;
+ typedef std::shared_ptr<Subscription> SubscriptionPtr;
class FilterEngine
{
public:
- typedef std::tr1::function<void(const std::string&)> UpdaterCallback;
- typedef std::tr1::function<void(const std::string&, const JsValuePtr)> FilterChangeCallback;
+ typedef std::function<void(const std::string&)> UpdaterCallback;
+ typedef std::function<void(const std::string&, const JsValuePtr)> FilterChangeCallback;
explicit FilterEngine(JsEnginePtr jsEngine);
JsEnginePtr GetJsEngine() const { return jsEngine; }
bool IsFirstRun() const;
FilterPtr GetFilter(const std::string& text);
SubscriptionPtr GetSubscription(const std::string& url);
std::vector<FilterPtr> GetListedFilters() const;
std::vector<SubscriptionPtr> GetListedSubscriptions() const;
@@ -84,17 +83,17 @@ namespace AdblockPlus
const std::string& documentUrl) const;
FilterPtr Matches(const std::string& url,
const std::string& contentType,
const std::vector<std::string>& documentUrls) const;
std::vector<std::string> GetElementHidingSelectors(const std::string& domain) const;
JsValuePtr GetPref(const std::string& pref) const;
void SetPref(const std::string& pref, JsValuePtr value);
std::string GetHostFromURL(const std::string& url);
- void ForceUpdateCheck(UpdaterCallback callback = 0);
+ void ForceUpdateCheck(UpdaterCallback callback);
Wladimir Palant 2014/07/11 14:29:11 Actually, there is one more actual code change her
sergei 2015/01/06 13:51:39 Actually, when do we need a default value here? R
Felix Dahlke 2015/08/04 11:21:49 Probably some subtle differences between std::func
void SetFilterChangeCallback(FilterChangeCallback callback);
void RemoveFilterChangeCallback();
private:
JsEnginePtr jsEngine;
bool initialized;
bool firstRun;
int updateCheckId;

Powered by Google App Engine
This is Rietveld