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 |