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

Unified Diff: compiled/Filter.h

Issue 29333474: Issue 4125 - [emscripten] Convert filter classes to C++ (Closed)
Patch Set: Minor improvements Created Jan. 20, 2016, 2:41 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « compiled/ElemHideFilter.cpp ('k') | compiled/Filter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/Filter.h
===================================================================
new file mode 100644
--- /dev/null
+++ b/compiled/Filter.h
@@ -0,0 +1,52 @@
+#ifndef ADBLOCK_PLUS_FILTER_H
+#define ADBLOCK_PLUS_FILTER_H
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "debug.h"
+
+class Filter;
+
+typedef std::shared_ptr<Filter> FilterPtr;
+
+class Filter : public std::enable_shared_from_this<Filter>
+{
+private:
+ std::u16string text;
+
+public:
+ explicit Filter(const std::u16string& text);
+ virtual ~Filter() {}
+
+ /* TODO
+ std::vector<Subscription> subscriptions;
+ */
+
+ const std::u16string GetText() const
+ {
+ return text;
+ }
+
+ enum Type
+ {
+ UNKNOWN = 0,
+ INVALID = 1,
+ COMMENT = 2,
+ BLOCKING = 3,
+ WHITELIST = 4,
+ ELEMHIDE = 5,
+ ELEMHIDEEXCEPTION = 6,
+ CSSPROPERTY = 7,
+ };
+
+ virtual Type GetType() const = 0;
+
+ virtual const std::u16string Serialize();
+
+ static FilterPtr FromText(const std::u16string& text);
+ static const std::u16string Normalize(const std::u16string& text);
+};
+
+#endif
« no previous file with comments | « compiled/ElemHideFilter.cpp ('k') | compiled/Filter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld