| Index: compiled/subscription/Subscription.h |
| =================================================================== |
| --- a/compiled/subscription/Subscription.h |
| +++ b/compiled/subscription/Subscription.h |
| @@ -12,17 +12,16 @@ |
| * GNU General Public License for more details. |
| * |
| * You should have received a copy of the GNU General Public License |
| * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| */ |
| #pragma once |
| -#include <type_traits> |
| #include <vector> |
| #include "../filter/Filter.h" |
| #include "../String.h" |
| #include "../FilterNotifier.h" |
| #include "../intrusive_ptr.h" |
| #include "../debug.h" |
| #include "../bindings/runtime.h" |
| @@ -95,12 +94,27 @@ public: |
| Filter* BINDINGS_EXPORTED FilterAt(Filters::size_type index); |
| int BINDINGS_EXPORTED IndexOfFilter(const Filter& filter); |
| OwnedString BINDINGS_EXPORTED Serialize() const; |
| OwnedString BINDINGS_EXPORTED SerializeFilters() const; |
| static Subscription* BINDINGS_EXPORTED FromID(const String& id); |
| template<typename T> |
| - T* As(); |
| + T* As() |
| + { |
| + if (mType != T::classType) |
| + return nullptr; |
| + |
| + return static_cast<T*>(this); |
| + } |
| + |
| + template<typename T> |
| + const T* As() const |
| + { |
| + if (mType != T::classType) |
| + return nullptr; |
| + |
| + return static_cast<const T*>(this); |
| + } |
| }; |
| typedef intrusive_ptr<Subscription> SubscriptionPtr; |