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

Unified Diff: compiled/tools.h

Issue 29333474: Issue 4125 - [emscripten] Convert filter classes to C++ (Closed)
Patch Set: Created Jan. 14, 2016, 4:40 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/pre.js ('k') | compiled/tools.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/tools.h
===================================================================
new file mode 100644
--- /dev/null
+++ b/compiled/tools.h
@@ -0,0 +1,40 @@
+#ifndef ADBLOCKPLUS_TOOLS_H
+#define ADBLOCKPLUS_TOOLS_H
+
+#include <emscripten.h>
+#include <cstddef>
+#include <string>
+
+#define PROPERTY(classprefix, type, name) \
+ private:\
+ type name;\
+ public:\
+ type get_##name()\
+ {\
+ return name;\
+ }\
+ void set_##name(type value)\
+ {\
+ if (name != value)\
+ {\
+ type oldvalue = value;\
+ name = value;\
+ /* TODO FilterNotifier.triggerListeners(#classprefix "." #name, this, value, oldValue); */\
+ }\
+ }
+
+#define EXPOSE_PROPERTY(class, t, name) \
+ t EMSCRIPTEN_KEEPALIVE class##_get_##name(class* obj)\
+ {\
+ return obj->get_##name();\
+ }\
+ void EMSCRIPTEN_KEEPALIVE class##_set_##name(class* obj, t value)\
+ {\
+ obj->set_##name(value);\
+ }
+
+#define FILTER_PROPERTY(type, name) PROPERTY(filter, type, name)
+
+char16_t* stringToBuffer(const std::u16string& str, size_t* resultLen);
+
+#endif
« no previous file with comments | « compiled/pre.js ('k') | compiled/tools.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld