| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 /* | 
|  | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 
|  | 3 * Copyright (C) 2006-present eyeo GmbH | 
|  | 4 * | 
|  | 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 | 
|  | 7 * published by the Free Software Foundation. | 
|  | 8 * | 
|  | 9 * Adblock Plus is distributed in the hope that it will be useful, | 
|  | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 12 * GNU General Public License for more details. | 
|  | 13 * | 
|  | 14 * You should have received a copy of the GNU General Public License | 
|  | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 
|  | 16 */ | 
|  | 17 | 
|  | 18 #pragma once | 
|  | 19 #include "../subscription/Subscription.h" | 
|  | 20 | 
|  | 21 class Parser : public ref_counted | 
|  | 22 { | 
|  | 23   enum class State | 
|  | 24   { | 
|  | 25     Initial, SubscriptionSection, SubscriptionFiltersSection | 
|  | 26   }; | 
|  | 27   ~Parser() {} | 
|  | 28 public: | 
|  | 29   typedef std::vector<SubscriptionPtr> Subscriptions; | 
|  | 30   Parser(); | 
|  | 31   static Parser* BINDINGS_EXPORTED Create() | 
|  | 32   { | 
|  | 33     return new Parser(); | 
|  | 34   } | 
|  | 35   void BINDINGS_EXPORTED Process(const String& untrimmedLine); | 
|  | 36   void BINDINGS_EXPORTED Finalize(); | 
|  | 37 | 
|  | 38   Subscriptions::size_type BINDINGS_EXPORTED GetSubscriptionCount() const; | 
|  | 39   Subscription* BINDINGS_EXPORTED SubscriptionAt(Subscriptions::size_type index)
    ; | 
|  | 40 private: | 
|  | 41   SubscriptionPtr createSubscriptionFromProperties() const; | 
|  | 42 | 
|  | 43   void Initial_processLine(const String& line); | 
|  | 44   void SubscriptionSection_processLine(const String& line); | 
|  | 45   void SubscriptionFiltersSection_processLine(const String& line); | 
|  | 46 | 
|  | 47   void onSubscription(SubscriptionPtr subscription); | 
|  | 48 | 
|  | 49   void onFail(const char* error) | 
|  | 50   { | 
|  | 51   } | 
|  | 52 private: | 
|  | 53   // parser members: | 
|  | 54   State mCurrentState; | 
|  | 55   Subscriptions mSubscriptions; | 
|  | 56 | 
|  | 57   // State memebers: | 
|  | 58   // Initial State | 
|  | 59   // it's also the parser member | 
|  | 60   Subscription::KeyValues mFileProperties; | 
|  | 61   // [Subscription] section | 
|  | 62   Subscription::KeyValues mSubscriptionProperties; | 
|  | 63   // [Subscription filters] section | 
|  | 64   SubscriptionPtr mSubscription; | 
|  | 65 }; | 
| OLD | NEW | 
|---|