| Index: compiled/RegExpFilter.h | 
| =================================================================== | 
| new file mode 100644 | 
| --- /dev/null | 
| +++ b/compiled/RegExpFilter.h | 
| @@ -0,0 +1,101 @@ | 
| +#ifndef ADBLOCK_PLUS_REG_EXP_FILTER_H | 
| +#define ADBLOCK_PLUS_REG_EXP_FILTER_H | 
| + | 
| +#include "Filter.h" | 
| +#include "ActiveFilter.h" | 
| + | 
| +enum class TrippleState {YES, NO, ANY}; | 
| + | 
| +struct RegExpFilterData | 
| +{ | 
| + mutable String::size_type mPatternStart; | 
| + union | 
| + { | 
| + mutable int mRegexpId; | 
| + mutable String::size_type mPatternEnd; | 
| + }; | 
| + mutable String::size_type mDomainsStart; | 
| + mutable String::size_type mDomainsEnd; | 
| + mutable String::size_type mSitekeysStart; | 
| + mutable String::size_type mSitekeysEnd; | 
| + int mContentType; | 
| + bool mMatchCase; | 
| + TrippleState mThirdParty; | 
| + TrippleState mCollapse; | 
| + | 
| + bool RegExpParsingDone() const | 
| + { | 
| + return mPatternStart == String::npos; | 
| + } | 
| + | 
| + void SetRegExp(int regexpId) const | 
| + { | 
| + mRegexpId = regexpId; | 
| + mPatternStart = String::npos; | 
| + } | 
| + | 
| + bool HasRegExp() const | 
| + { | 
| + return RegExpParsingDone() && mRegexpId; | 
| + } | 
| + | 
| + const String GetRegExpSource(const String& text) const | 
| + { | 
| + return String(text, mPatternStart, mPatternEnd - mPatternStart); | 
| + } | 
| + | 
| + bool DomainsParsingDone() const | 
| + { | 
| + return mDomainsStart == String::npos; | 
| + } | 
| + | 
| + void SetDomainsParsingDone() const | 
| + { | 
| + mDomainsStart = String::npos; | 
| + } | 
| + | 
| + const String GetDomainsSource(const String& text) const | 
| + { | 
| + return String(text, mDomainsStart, mDomainsEnd - mDomainsStart); | 
| + } | 
| + | 
| + bool SitekeyParsingDone() const | 
| + { | 
| + return mSitekeysStart == String::npos; | 
| + } | 
| + | 
| + void SetSitekeysParsingDone() const | 
| + { | 
| + mSitekeysStart = String::npos; | 
| + } | 
| + | 
| + const String GetSitekeysSource(const String& text) const | 
| + { | 
| + return String(text, mSitekeysStart, mSitekeysEnd - mSitekeysStart); | 
| + } | 
| +}; | 
| + | 
| +class RegExpFilter : public ActiveFilter, protected RegExpFilterData | 
| +{ | 
| +private: | 
| + static void ParseOptions(String& text, String& error, RegExpFilterData& data, | 
| + String::size_type optionsStart); | 
| + static void ParseOption(String& text, String& error, RegExpFilterData& data, | 
| + int optionStart, int optionEnd, int valueStart, int valueEnd); | 
| + void ParseSitekeys(const String& sitekeys) const; | 
| + | 
| +protected: | 
| + virtual DomainMap* GetDomains() const; | 
| + virtual SitekeySet* GetSitekeys() const; | 
| +public: | 
| + RegExpFilter(const String& text, const RegExpFilterData& data); | 
| + ~RegExpFilter(); | 
| + static Type Parse(String& text, String& error, RegExpFilterData& data); | 
| + EMSCRIPTEN_KEEPALIVE static void InitJSTypes(); | 
| + static String RegExpFromSource(const String& source); | 
| + Type GetType() const; | 
| + EMSCRIPTEN_KEEPALIVE bool Matches(const String& location, int typeMask, | 
| + String& docDomain, bool thirdParty, const String& sitekey) const; | 
| +}; | 
| + | 
| +#endif |