summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-01-20 17:18:19 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-01-20 17:18:19 (GMT)
commitf4f05b40c8c464daf1e11df6fcdb63d05766ed1f (patch)
treea513019b456be25248212ab9d722e9c7bb5fdbc2 /src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h
parentb5c33505b3345795811b4aba7e5fda961068f369 (diff)
downloaduscxml-f4f05b40c8c464daf1e11df6fcdb63d05766ed1f.zip
uscxml-f4f05b40c8c464daf1e11df6fcdb63d05766ed1f.tar.gz
uscxml-f4f05b40c8c464daf1e11df6fcdb63d05766ed1f.tar.bz2
Completed V8 IDL to DOM generator
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h')
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h59
1 files changed, 42 insertions, 17 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h
index 9fbe0e4..45b2e6a 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h
@@ -3,26 +3,21 @@
#include "uscxml/Interpreter.h"
#include <v8.h>
+#include <XPath/XPath.hpp>
#define V8_DESTRUCTOR(type) \
static void jsDestructor(v8::Persistent<v8::Value> object, void* data) { \
-v8::HandleScope handleScope; \
-type* thing = static_cast<type*>(v8::Local<v8::External>::Cast(object->ToObject()->GetInternalField(0))->Value()); \
-delete thing; \
-object.Dispose(); \
-object.Clear(); \
+ v8::HandleScope handleScope; \
+ std::cout << "Deleting type" << std::endl; \
+ type* thing = static_cast<type*>(v8::Local<v8::External>::Cast(object->ToObject()->GetInternalField(0))->Value()); \
+ delete thing->arabicaThis; \
+ delete thing; \
+ object.Dispose(); \
+ object.Clear(); \
}
-#define ASSERT_ARGS1(args, type1) \
-assert(args.Length() == 1); \
-assert(args[0]->type1());
-
-#define ASSERT_ARGS2(args, type1, type2) \
-assert(args.Length() == 2); \
-assert(args[0]->type1()); \
-assert(args[1]->type2());
-
-namespace uscxml {
+namespace Arabica {
+namespace DOM {
class V8DOM {
public:
@@ -44,10 +39,40 @@ public:
return scope.Close(v8::External::New(pointer));
}
- Interpreter* interpreter;
Arabica::XPath::XPath<std::string>* xpath;
};
-}
+class V8Exception : public std::runtime_error
+{
+public:
+
+ V8Exception(const std::string& reason) :
+ std::runtime_error("DOMException")
+ {
+ } // V8Exception
+
+ V8Exception(const V8Exception& rhs) :
+ std::runtime_error(rhs),
+ reason_(rhs.reason_)
+ {
+ } // DOMException
+
+ virtual ~V8Exception() throw()
+ {
+ } // DOMBadCast
+
+ virtual const char* what() const throw()
+ {
+ return reason_.c_str();
+ } // what
+
+private:
+ DOMBadCast& operator=(const DOMBadCast&);
+ bool operator==(const DOMBadCast&) const;
+
+ std::string reason_;
+}; // class DOMException
+}
+}
#endif /* end of include guard: V8DOM_H_LKE1HKJK */