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

Side by Side Diff: compiled/filter/Filter.h

Issue 29574591: Issue 5258 - Implement Filter::As<>() method to make working with filters easier from C++ code (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Created Oct. 12, 2017, 12:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 17 matching lines...) Expand all
28 { 28 {
29 protected: 29 protected:
30 OwnedString mText; 30 OwnedString mText;
31 31
32 public: 32 public:
33 enum Type 33 enum Type
34 { 34 {
35 UNKNOWN = 0, 35 UNKNOWN = 0,
36 INVALID = 1, 36 INVALID = 1,
37 COMMENT = 2, 37 COMMENT = 2,
38 BLOCKING = 3, 38 ACTIVE = 4,
39 WHITELIST = 4, 39 REGEXP = ACTIVE | 8,
40 ELEMHIDE = 5, 40 BLOCKING = REGEXP | 16,
41 ELEMHIDEEXCEPTION = 6, 41 WHITELIST = REGEXP | 32,
42 ELEMHIDEEMULATION = 7, 42 ELEMHIDEBASE = ACTIVE | 64,
43 VALUE_COUNT = 8 43 ELEMHIDE = ELEMHIDEBASE | 128,
44 ELEMHIDEEXCEPTION = ELEMHIDEBASE | 256,
45 ELEMHIDEEMULATION = ELEMHIDEBASE | 512
44 }; 46 };
45 47
46 explicit Filter(Type type, const String& text); 48 explicit Filter(Type type, const String& text);
47 ~Filter(); 49 ~Filter();
48 50
49 Type mType; 51 Type mType;
50 52
51 const String& BINDINGS_EXPORTED GetText() const 53 const String& BINDINGS_EXPORTED GetText() const
52 { 54 {
53 return mText; 55 return mText;
54 } 56 }
55 57
56 OwnedString BINDINGS_EXPORTED Serialize() const; 58 OwnedString BINDINGS_EXPORTED Serialize() const;
57 59
58 static Filter* BINDINGS_EXPORTED FromText(DependentString& text); 60 static Filter* BINDINGS_EXPORTED FromText(DependentString& text);
61
62 template<typename T>
63 T* As();
59 }; 64 };
60 65
61 typedef intrusive_ptr<Filter> FilterPtr; 66 typedef intrusive_ptr<Filter> FilterPtr;
OLDNEW

Powered by Google App Engine
This is Rietveld