Index: compiled/subscription/DownloadableSubscription.h |
=================================================================== |
--- a/compiled/subscription/DownloadableSubscription.h |
+++ b/compiled/subscription/DownloadableSubscription.h |
@@ -13,19 +13,26 @@ |
* |
* 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 <cstdint> |
+#include <vector> |
+#include "../bindings/runtime.h" |
+#include "../filter/Filter.h" |
+#include "../Md5.h" |
+#include "../StringMap.h" |
#include "Subscription.h" |
-#include "../bindings/runtime.h" |
+ |
+class String; |
+class DownloadableSubscription_Parser; |
class DownloadableSubscription : public Subscription |
{ |
public: |
static constexpr Type classType = Type::DOWNLOADABLE; |
explicit DownloadableSubscription(const String& id); |
SUBSCRIPTION_PROPERTY(bool, mFixedTitle, SUBSCRIPTION_FIXEDTITLE, |
@@ -48,12 +55,34 @@ |
GetErrorCount, SetErrorCount); |
SUBSCRIPTION_PROPERTY(uint64_t, mDataRevision, NONE, |
GetDataRevision, SetDataRevision); |
SUBSCRIPTION_STRING_PROPERTY(mRequiredVersion, NONE, |
GetRequiredVersion, SetRequiredVersion); |
SUBSCRIPTION_PROPERTY(int, mDownloadCount, NONE, |
GetDownloadCount, SetDownloadCount); |
+ static DownloadableSubscription_Parser* BINDINGS_EXPORTED ParseDownload(); |
OwnedString BINDINGS_EXPORTED Serialize() const; |
}; |
typedef intrusive_ptr<DownloadableSubscription> DownloadableSubscriptionPtr; |
+ |
+class DownloadableSubscription_Parser : public ref_counted |
+{ |
+ std::vector<OwnedString> mFiltersText; |
+ OwnedStringMap<OwnedString> mParams; |
+ bool mFirstLine; |
+public: |
+ DownloadableSubscription_Parser(); |
+ void BINDINGS_EXPORTED Process(const String& line); |
+ bool BINDINGS_EXPORTED VerifyChecksum(); |
+ // return the expiration interval. |
+ int64_t BINDINGS_EXPORTED Finalize(DownloadableSubscription&); |
+ const String& BINDINGS_EXPORTED GetRedirect() const; |
+ const String& BINDINGS_EXPORTED GetHomepage() const; |
+ const String& BINDINGS_EXPORTED GetVersion() const; |
+private: |
+ MD5 mChecksum; |
+ OwnedString mB64Checksum; |
+ static int64_t ParseExpires(const String& expires); |
+}; |
+ |