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: Got rid of extra output in bindings.js file Created June 9, 2016, 1:35 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
Index: compiled/Filter.h
===================================================================
new file mode 100644
--- /dev/null
+++ b/compiled/Filter.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#include <vector>
+
+#include "String.h"
+#include "intrusive_ptr.h"
+#include "debug.h"
+
+class Filter : public ref_counted
+{
+protected:
+ OwnedString mText;
+
+public:
+ explicit Filter(const String& text);
+ virtual ~Filter();
+
+ /* TODO
+ std::vector<Subscription> subscriptions;
sergei 2016/06/16 21:16:36 May be it makes sense to remove this comment from
Wladimir Palant 2016/12/06 10:47:28 This is merely a reverse mapping meant to speed up
+ */
+
+ EMSCRIPTEN_KEEPALIVE const String& GetText() const
+ {
+ return mText;
+ }
+
+ enum Type
+ {
+ UNKNOWN = 0,
+ INVALID = 1,
+ COMMENT = 2,
+ BLOCKING = 3,
+ WHITELIST = 4,
+ ELEMHIDE = 5,
+ ELEMHIDEEXCEPTION = 6,
+ CSSPROPERTY = 7,
+ };
+
+ virtual Type GetType() const = 0;
sergei 2016/06/16 21:16:34 Can we set filter type in constructor and make thi
Wladimir Palant 2016/12/06 10:47:26 Actually, if we do that then we can just read out
+
+ EMSCRIPTEN_KEEPALIVE OwnedString Serialize() const;
+
+ static EMSCRIPTEN_KEEPALIVE Type GetType(Filter* filter)
+ {
+ return filter->GetType();
+ }
+
+ static EMSCRIPTEN_KEEPALIVE Filter* FromText(DependentString& text);
+ static EMSCRIPTEN_KEEPALIVE Filter* GetKnownFilter(const String& text);
+};
+
+typedef intrusive_ptr<Filter> FilterPtr;

Powered by Google App Engine
This is Rietveld