summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/plugins/datamodel')
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp4
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h2
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.cpp9
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h27
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp60
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h85
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp14
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp61
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h83
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp14
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h70
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp105
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h92
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp14
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h70
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.cpp4
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h59
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp81
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h77
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp460
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp.old59
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h220
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h.old104
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp42
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp14
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h70
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp79
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h88
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp308
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp.old24
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h195
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h.old87
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp35
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h79
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp14
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h70
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp188
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h92
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp392
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp.old23
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h318
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h.old161
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp44
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h74
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp69
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp.old60
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h94
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h.old41
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp52
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp28
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h76
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp35
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h77
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp37
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h73
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp111
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp.old30
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h143
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h.old75
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp27
60 files changed, 4583 insertions, 616 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
index 4a217be..0c82f6b 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
@@ -27,7 +27,10 @@ boost::shared_ptr<DataModelImpl> JSCDataModel::create(Interpreter* interpreter)
dm->setName(interpreter->getName());
dm->setSessionId(interpreter->getSessionId());
dm->eval("_ioprocessors = {};");
+ dm->_ctx = JSGlobalContextCreate(NULL);
+ JSObjectRef globalObject = JSContextGetGlobalObject(dm->_ctx);
+
return dm;
}
@@ -44,6 +47,7 @@ void JSCDataModel::setName(const std::string& name) {
}
JSCDataModel::~JSCDataModel() {
+// JSGlobalContextRelease(_ctx);
}
void JSCDataModel::pushContext() {
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
index aa57e0f..de82ee7 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h
@@ -58,7 +58,7 @@ protected:
std::string _name;
Event _event;
-
+ JSContextRef _ctx;
};
#ifdef BUILD_AS_PLUGINS
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.cpp
new file mode 100644
index 0000000..27546d0
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.cpp
@@ -0,0 +1,9 @@
+#include "JSCDOM.h"
+
+namespace uscxml {
+
+JSCDOM::JSCDOM() {
+
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h
new file mode 100644
index 0000000..0986408
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h
@@ -0,0 +1,27 @@
+#ifndef JSCDOM_H_1RC5LCG8
+#define JSCDOM_H_1RC5LCG8
+
+#include "uscxml/Interpreter.h"
+#include <JavaScriptCore/JavaScriptCore.h>
+
+#define JSC_DESTRUCTOR(type) \
+static void jsDestructor(JSObjectRef object) { \
+type* thing = static_cast<type*>(JSObjectGetPrivate(object)); \
+delete thing; \
+}
+
+namespace uscxml {
+
+class JSCDOM {
+public:
+ JSCDOM();
+ virtual ~JSCDOM() { };
+
+ Interpreter* interpreter;
+ Arabica::XPath::XPath<std::string>* xpath;
+};
+
+}
+
+
+#endif /* end of include guard: JSCDOM_H_1RC5LCG8 */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp
new file mode 100644
index 0000000..508a356
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp
@@ -0,0 +1,60 @@
+#include "JSCNode.h"
+#include <DOM/Node.hpp>
+
+namespace uscxml {
+
+using namespace Arabica::DOM;
+
+ JSStaticValue JSCNode::staticValues[] = {
+ { "nodeName", nodeNameAttrGetter, nodeValueAttrSetter, kJSPropertyAttributeDontDelete },
+ { "nodeValue", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "nodeType", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "parentNode", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "childNodes", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "firstChild", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "lastChild", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "previousSibling", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "nextSibling", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "attributes", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "ownerDocument", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "namespaceURI", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "prefix", nodeValueAttrGetter, prefixAttrSetter, kJSPropertyAttributeDontDelete },
+ { "localName", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "baseURI", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "textContent", nodeValueAttrGetter, textContentAttrSetter, kJSPropertyAttributeDontDelete },
+ { "parentElement", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "ELEMENT_NODE", ELEMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "ATTRIBUTE_NODE", ATTRIBUTE_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "TEXT_NODE", TEXT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "CDATA_SECTION_NODE", CDATA_SECTION_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "ENTITY_REFERENCE_NODE", ENTITY_REFERENCE_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "ENTITY_NODE", ENTITY_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "PROCESSING_INSTRUCTION_NODE", PROCESSING_INSTRUCTION_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "COMMENT_NODE", COMMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "DOCUMENT_NODE", DOCUMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "DOCUMENT_TYPE_NODE", DOCUMENT_TYPE_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "DOCUMENT_FRAGMENT_NODE", DOCUMENT_FRAGMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "NOTATION_NODE", NOTATION_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { "MAX_TYPE", MAX_TYPEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly },
+ { 0, 0, 0, 0 }
+ };
+
+ JSStaticFunction JSCNode::staticFunctions[] = {
+ { "insertBefore", insertBeforeCallback, kJSPropertyAttributeDontDelete },
+ { "replaceChild", replaceChildCallback, kJSPropertyAttributeDontDelete },
+ { "removeChild", removeChildCallback, kJSPropertyAttributeDontDelete },
+ { "appendChild", appendChildCallback, kJSPropertyAttributeDontDelete },
+ { "hasChildNodes", hasChildNodesCallback, kJSPropertyAttributeDontDelete },
+ { "cloneNode", cloneNodeCallback, kJSPropertyAttributeDontDelete },
+ { "normalize", normalizeCallback, kJSPropertyAttributeDontDelete },
+ { "isSupported", isSupportedCallback, kJSPropertyAttributeDontDelete },
+ { "hasAttributes", hasAttributesCallback, kJSPropertyAttributeDontDelete },
+ { "lookupPrefix", lookupPrefixCallback, kJSPropertyAttributeDontDelete },
+ { "isDefaultNamespace", isDefaultNamespaceCallback, kJSPropertyAttributeDontDelete },
+ { "lookupNamespaceURI", lookupNamespaceURICallback, kJSPropertyAttributeDontDelete },
+ { "addEventListener", addEventListenerCallback, kJSPropertyAttributeDontDelete },
+ { "removeEventListener", removeEventListenerCallback, kJSPropertyAttributeDontDelete },
+ { 0, 0, 0 }
+ };
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h
new file mode 100644
index 0000000..225e8a3
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h
@@ -0,0 +1,85 @@
+#ifndef JSCNODE_H_6BAK1S3C
+#define JSCNODE_H_6BAK1S3C
+
+#include "JSCDOM.h"
+
+namespace uscxml {
+
+ class JSCNode {
+ public:
+ static JSValueRef nodeNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef nodeValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef nodeTypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef parentNodeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef childNodesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef firstChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef lastChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef previousSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef nextSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef attributesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef ownerDocumentAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef namespaceURIAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef prefixAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef localNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef baseURIAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef textContentAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef parentElementAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+
+ static bool nodeValueAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { return false; }
+ static bool prefixAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { return false; }
+ static bool textContentAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { return false; }
+
+ static JSValueRef insertBeforeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef replaceChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef removeChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef appendChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef hasChildNodesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef cloneNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef normalizeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef isSupportedCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef hasAttributesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef lookupPrefixCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef isDefaultNamespaceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef lookupNamespaceURICallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef addEventListenerCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+ static JSValueRef removeEventListenerCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { assert(false); return JSValueMakeUndefined(ctx); }
+
+ static JSValueRef ELEMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ELEMENT_NODE); }
+ static JSValueRef ATTRIBUTE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ATTRIBUTE_NODE); }
+ static JSValueRef TEXT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::TEXT_NODE); }
+ static JSValueRef CDATA_SECTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::CDATA_SECTION_NODE); }
+ static JSValueRef ENTITY_REFERENCE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ENTITY_REFERENCE_NODE); }
+ static JSValueRef ENTITY_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ENTITY_NODE); }
+ static JSValueRef PROCESSING_INSTRUCTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::PROCESSING_INSTRUCTION_NODE); }
+ static JSValueRef COMMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::COMMENT_NODE); }
+ static JSValueRef DOCUMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::DOCUMENT_NODE); }
+ static JSValueRef DOCUMENT_TYPE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::DOCUMENT_TYPE_NODE); }
+ static JSValueRef DOCUMENT_FRAGMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::DOCUMENT_FRAGMENT_NODE); }
+ static JSValueRef NOTATION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::NOTATION_NODE); }
+ static JSValueRef MAX_TYPEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { assert(false); return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::MAX_TYPE); }
+
+ JSC_DESTRUCTOR(Arabica::DOM::Node<std::string>);
+
+ static JSStaticValue staticValues[];
+ static JSStaticFunction staticFunctions[];
+
+ static JSClassRef Tmpl;
+ static JSClassRef getTmpl() {
+ if (Tmpl == NULL) {
+ JSClassDefinition classDef = kJSClassDefinitionEmpty;
+ classDef.staticValues = staticValues;
+ classDef.staticFunctions = staticFunctions;
+ classDef.finalize = jsDestructor;
+
+ Tmpl = JSClassCreate(&classDef);
+ JSClassRetain(Tmpl);
+ }
+ return Tmpl;
+ }
+
+ };
+
+}
+
+
+#endif /* end of include guard: JSCNODE_H_6BAK1S3C */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
index 1aa181e..f5ff4fd 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
@@ -29,8 +29,8 @@ boost::shared_ptr<DataModelImpl> V8DataModel::create(Interpreter* interpreter) {
v8::Locker locker;
v8::HandleScope scope;
- V8DOM* dom = new V8DOM();
- dom->interpreter = interpreter;
+ Arabica::DOM::V8DOM* dom = new Arabica::DOM::V8DOM();
+// dom->interpreter = interpreter;
dom->xpath = new Arabica::XPath::XPath<std::string>();
dom->xpath->setNamespaceContext(interpreter->getNSContext());
@@ -45,10 +45,14 @@ boost::shared_ptr<DataModelImpl> V8DataModel::create(Interpreter* interpreter) {
v8::Context::Scope contextScope(context);
// instantiate the document function
- v8::Handle<v8::Function> docCtor = V8Document::getTmpl()->GetFunction();
+ v8::Handle<v8::Function> docCtor = Arabica::DOM::V8Document::getTmpl()->GetFunction();
v8::Handle<v8::Object> docObj = docCtor->NewInstance();
- docObj->SetInternalField(0, V8DOM::toExternal(&(interpreter->getDocument())));
- docObj->SetInternalField(1, V8DOM::toExternal(dom));
+
+ Arabica::DOM::V8Document::V8DocumentPrivate* privData = new Arabica::DOM::V8Document::V8DocumentPrivate();
+ privData->arabicaThis = new Arabica::DOM::Document<std::string>(interpreter->getDocument());
+ privData->dom = dom;
+ docObj->SetInternalField(0, Arabica::DOM::V8DOM::toExternal(privData));
+
context->Global()->Set(v8::String::New("document"), docObj);
dm->_contexts.push_back(context);
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
new file mode 100644
index 0000000..d1c2f8f
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp
@@ -0,0 +1,61 @@
+#include "V8Attr.h"
+#include "V8Element.h"
+#include "V8Node.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8Attr::Tmpl;
+
+
+ v8::Handle<v8::Value> V8Attr::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getName().c_str());
+ }
+
+ v8::Handle<v8::Value> V8Attr::specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+
+ return v8::Boolean::New(privData->arabicaThis->getSpecified());
+ }
+
+ v8::Handle<v8::Value> V8Attr::valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getValue().c_str());
+ }
+
+ void V8Attr::valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localValue(value);
+ privData->arabicaThis->setValue(*localValue);
+ }
+
+ v8::Handle<v8::Value> V8Attr::ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->arabicaThis->getOwnerElement());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+ bool V8Attr::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
new file mode 100644
index 0000000..2b9a6e6
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h
@@ -0,0 +1,83 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8Attr_h
+#define V8Attr_h
+
+#include "DOM/Node.hpp"
+#include "V8Node.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8Attr {
+public:
+ struct V8AttrPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Attr<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8AttrPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Attr"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("name"), V8Attr::nameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("specified"), V8Attr::specifiedAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("value"), V8Attr::valueAttrGetter, V8Attr::valueAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("ownerElement"), V8Attr::ownerElementAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8Attr_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
new file mode 100644
index 0000000..90495f4
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.cpp
@@ -0,0 +1,14 @@
+#include "V8CDATASection.h"
+#include "V8Text.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8CDATASection::Tmpl;
+
+ bool V8CDATASection::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
new file mode 100644
index 0000000..0e2e253
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h
@@ -0,0 +1,70 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8CDATASection_h
+#define V8CDATASection_h
+
+#include "DOM/Node.hpp"
+#include "V8Text.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8CDATASection {
+public:
+ struct V8CDATASectionPrivate {
+ V8DOM* dom;
+ Arabica::DOM::CDATASection<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8CDATASectionPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("CDATASection"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+
+
+
+ tmpl->Inherit(V8Text::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8CDATASection_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
new file mode 100644
index 0000000..7e1d9a3
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp
@@ -0,0 +1,105 @@
+#include "V8CharacterData.h"
+#include "V8Node.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8CharacterData::Tmpl;
+
+
+ v8::Handle<v8::Value> V8CharacterData::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getData().c_str());
+ }
+
+ void V8CharacterData::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(value);
+ privData->arabicaThis->setData(*localData);
+ }
+
+ v8::Handle<v8::Value> V8CharacterData::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+
+ return v8::Integer::New(privData->arabicaThis->getLength());
+ }
+ v8::Handle<v8::Value> V8CharacterData::substringDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in substringData");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+
+ std::string retVal = privData->arabicaThis->substringData(localOffset, localCount);
+
+ return v8::String::New(retVal.c_str());
+ }
+
+ v8::Handle<v8::Value> V8CharacterData::appendDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in appendData");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localArg(args[0]);
+
+ privData->arabicaThis->appendData(*localArg);
+
+ return v8::Undefined();
+ }
+
+ v8::Handle<v8::Value> V8CharacterData::insertDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in insertData");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ v8::String::AsciiValue localArg(args[1]);
+
+ privData->arabicaThis->insertData(localOffset, *localArg);
+
+ return v8::Undefined();
+ }
+
+ v8::Handle<v8::Value> V8CharacterData::deleteDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in deleteData");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+
+ privData->arabicaThis->deleteData(localOffset, localCount);
+
+ return v8::Undefined();
+ }
+
+ v8::Handle<v8::Value> V8CharacterData::replaceDataCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in replaceData");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+ unsigned long localCount = args[1]->ToNumber()->Uint32Value();
+ v8::String::AsciiValue localArg(args[2]);
+
+ privData->arabicaThis->replaceData(localOffset, localCount, *localArg);
+
+ return v8::Undefined();
+ }
+
+ bool V8CharacterData::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
new file mode 100644
index 0000000..0e0f0c1
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h
@@ -0,0 +1,92 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8CharacterData_h
+#define V8CharacterData_h
+
+#include "DOM/Node.hpp"
+#include "V8Node.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8CharacterData {
+public:
+ struct V8CharacterDataPrivate {
+ V8DOM* dom;
+ Arabica::DOM::CharacterData<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8CharacterDataPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> substringDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> appendDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> insertDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> deleteDataCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> replaceDataCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("CharacterData"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("data"), V8CharacterData::dataAttrGetter, V8CharacterData::dataAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8CharacterData::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("substringData"),
+ v8::FunctionTemplate::New(V8CharacterData::substringDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("appendData"),
+ v8::FunctionTemplate::New(V8CharacterData::appendDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("insertData"),
+ v8::FunctionTemplate::New(V8CharacterData::insertDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("deleteData"),
+ v8::FunctionTemplate::New(V8CharacterData::deleteDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("replaceData"),
+ v8::FunctionTemplate::New(V8CharacterData::replaceDataCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8CharacterData_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
new file mode 100644
index 0000000..e470a70
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.cpp
@@ -0,0 +1,14 @@
+#include "V8CharacterData.h"
+#include "V8Comment.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8Comment::Tmpl;
+
+ bool V8Comment::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
new file mode 100644
index 0000000..0a0e379
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h
@@ -0,0 +1,70 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8Comment_h
+#define V8Comment_h
+
+#include "DOM/Node.hpp"
+#include "V8CharacterData.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8Comment {
+public:
+ struct V8CommentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Comment<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8CommentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Comment"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+
+
+
+ tmpl->Inherit(V8CharacterData::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8Comment_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.cpp
index d1aa301..ce003d9 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.cpp
@@ -1,9 +1,11 @@
#include "V8DOM.h"
-namespace uscxml {
+namespace Arabica {
+namespace DOM {
V8DOM::V8DOM() {
}
+}
} \ No newline at end of file
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 */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
new file mode 100644
index 0000000..07b51e2
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp
@@ -0,0 +1,81 @@
+#include "V8DOMImplementation.h"
+#include "V8Document.h"
+#include "V8DocumentType.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8DOMImplementation::Tmpl;
+
+ v8::Handle<v8::Value> V8DOMImplementation::hasFeatureCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in hasFeature");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localFeature(args[0]);
+ v8::String::AsciiValue localVersion(args[1]);
+
+ bool retVal = privData->arabicaThis->hasFeature(*localFeature, *localVersion);
+
+ return v8::Boolean::New(retVal);
+ }
+
+ v8::Handle<v8::Value> V8DOMImplementation::createDocumentTypeCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in createDocumentType");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localQualifiedName(args[0]);
+ v8::String::AsciiValue localPublicId(args[1]);
+ v8::String::AsciiValue localSystemId(args[2]);
+
+ Arabica::DOM::DocumentType<std::string>* retVal = new Arabica::DOM::DocumentType<std::string>(privData->arabicaThis->createDocumentType(*localQualifiedName, *localPublicId, *localSystemId));
+ v8::Handle<v8::Function> retCtor = V8DocumentType::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8DocumentType::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8DOMImplementation::createDocumentCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in createDocument");
+ if (!(V8DocumentType::hasInstance(args[2])))
+ throw V8Exception("Parameter mismatch while calling createDocument");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
+ Arabica::DOM::DocumentType<std::string>* localDoctype = V8DOM::toClassPtr<V8DocumentType::V8DocumentTypePrivate >(args[2]->ToObject()->GetInternalField(0))->arabicaThis;
+
+ Arabica::DOM::Document<std::string>* retVal = new Arabica::DOM::Document<std::string>(privData->arabicaThis->createDocument(*localNamespaceURI, *localQualifiedName, *localDoctype));
+ v8::Handle<v8::Function> retCtor = V8Document::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Document::jsDestructor);
+ return retObj;
+
+ }
+
+ bool V8DOMImplementation::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
new file mode 100644
index 0000000..c648162
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h
@@ -0,0 +1,77 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8DOMImplementation_h
+#define V8DOMImplementation_h
+
+#include "DOM/Node.hpp"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8DOMImplementation {
+public:
+ struct V8DOMImplementationPrivate {
+ V8DOM* dom;
+ Arabica::DOM::DOMImplementation<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8DOMImplementationPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> hasFeatureCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentTypeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentCallback(const v8::Arguments&);
+
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DOMImplementation"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+
+ prototype->Set(v8::String::NewSymbol("hasFeature"),
+ v8::FunctionTemplate::New(V8DOMImplementation::hasFeatureCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocumentType"),
+ v8::FunctionTemplate::New(V8DOMImplementation::createDocumentTypeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocument"),
+ v8::FunctionTemplate::New(V8DOMImplementation::createDocumentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8DOMImplementation_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
index 31372ed..0a80873 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp
@@ -1,59 +1,405 @@
+#include "V8Attr.h"
+#include "V8CDATASection.h"
+#include "V8Comment.h"
+#include "V8DOMImplementation.h"
#include "V8Document.h"
+#include "V8DocumentFragment.h"
+#include "V8DocumentType.h"
#include "V8Element.h"
-#include "V8XPathResult.h"
-
-namespace uscxml {
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-v8::Persistent<v8::FunctionTemplate> V8Document::Tmpl;
-
-v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& args) {
- ASSERT_ARGS1(args, IsString);
- v8::String::AsciiValue tagName(args[0]);
-
- v8::Local<v8::Object> self = args.Holder();
- Document<std::string>* doc = V8DOM::toClassPtr<Document<std::string> >(self->GetInternalField(0));
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
-
- Element<std::string>* element = new Element<std::string>(doc->createElement(*tagName));
-
- v8::Handle<v8::Function> elemCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> elemObj = v8::Persistent<v8::Object>::New(elemCtor->NewInstance());
-
- elemObj->SetInternalField(0, V8DOM::toExternal(element));
- elemObj->SetInternalField(1, self->GetInternalField(1));
-
- elemObj.MakeWeak(0, V8Element::jsDestructor);
- return elemObj;
-}
-
-v8::Handle<v8::Value> V8Document::evaluateCallback(const v8::Arguments& args) {
- ASSERT_ARGS1(args, IsString);
- v8::String::AsciiValue xpathExpr(args[0]);
-
- v8::Local<v8::Object> self = args.Holder();
- Document<std::string>* doc = V8DOM::toClassPtr<Document<std::string> >(self->GetInternalField(0));
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
-
- Node<std::string>* context;
- if (args.Length() > 1) {
- context = V8DOM::toClassPtr<Node<std::string> >(args[1]->ToObject()->GetInternalField(0));
- } else {
- context = doc;
- }
-
- XPathValue<std::string>* xpathValue = new XPathValue<std::string>(dom->xpath->evaluate(*xpathExpr, *context));
-
- v8::Handle<v8::Function> xpathResultCtor = V8XPathResult::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> xpathResultObj = v8::Persistent<v8::Object>::New(xpathResultCtor->NewInstance());
-
- xpathResultObj->SetInternalField(0, V8DOM::toExternal(xpathValue));
- xpathResultObj->SetInternalField(1, self->GetInternalField(1));
-
- xpathResultObj.MakeWeak(0, V8XPathResult::jsDestructor);
- return xpathResultObj;
-}
-
-} \ No newline at end of file
+#include "V8EntityReference.h"
+#include "V8Node.h"
+#include "V8NodeList.h"
+#include "V8ProcessingInstruction.h"
+#include "V8Text.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8Document::Tmpl;
+
+
+ v8::Handle<v8::Value> V8Document::doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ Arabica::DOM::DocumentType<std::string>* arbaicaRet = new Arabica::DOM::DocumentType<std::string>(privData->arabicaThis->getDoctype());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8DocumentType::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8DocumentType::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ Arabica::DOM::DOMImplementation<std::string>* arbaicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->arabicaThis->getImplementation());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8DOMImplementation::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8DOMImplementation::V8DOMImplementationPrivate* retPrivData = new V8DOMImplementation::V8DOMImplementationPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8DOMImplementation::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->arabicaThis->getDocumentElement());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+ v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createElement");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTagName(args[0]);
+
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->arabicaThis->createElement(*localTagName));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::createDocumentFragmentCallback(const v8::Arguments& args) {
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+
+ Arabica::DOM::DocumentFragment<std::string>* retVal = new Arabica::DOM::DocumentFragment<std::string>(privData->arabicaThis->createDocumentFragment());
+ v8::Handle<v8::Function> retCtor = V8DocumentFragment::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8DocumentFragment::V8DocumentFragmentPrivate* retPrivData = new V8DocumentFragment::V8DocumentFragmentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8DocumentFragment::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::createTextNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createTextNode");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
+
+ Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->arabicaThis->createTextNode(*localData));
+ v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Text::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::createCommentCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createComment");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
+
+ Arabica::DOM::Comment<std::string>* retVal = new Arabica::DOM::Comment<std::string>(privData->arabicaThis->createComment(*localData));
+ v8::Handle<v8::Function> retCtor = V8Comment::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Comment::V8CommentPrivate* retPrivData = new V8Comment::V8CommentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Comment::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::createCDATASectionCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createCDATASection");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(args[0]);
+
+ Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->arabicaThis->createCDATASection(*localData));
+ v8::Handle<v8::Function> retCtor = V8CDATASection::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8CDATASection::V8CDATASectionPrivate* retPrivData = new V8CDATASection::V8CDATASectionPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8CDATASection::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::createProcessingInstructionCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createProcessingInstruction");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTarget(args[0]);
+ v8::String::AsciiValue localData(args[1]);
+
+ Arabica::DOM::ProcessingInstruction<std::string>* retVal = new Arabica::DOM::ProcessingInstruction<std::string>(privData->arabicaThis->createProcessingInstruction(*localTarget, *localData));
+ v8::Handle<v8::Function> retCtor = V8ProcessingInstruction::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8ProcessingInstruction::V8ProcessingInstructionPrivate* retPrivData = new V8ProcessingInstruction::V8ProcessingInstructionPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8ProcessingInstruction::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::createAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createAttribute");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->createAttribute(*localName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::createEntityReferenceCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in createEntityReference");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+
+ Arabica::DOM::EntityReference<std::string>* retVal = new Arabica::DOM::EntityReference<std::string>(privData->arabicaThis->createEntityReference(*localName));
+ v8::Handle<v8::Function> retCtor = V8EntityReference::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8EntityReference::V8EntityReferencePrivate* retPrivData = new V8EntityReference::V8EntityReferencePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8EntityReference::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::getElementsByTagNameCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementsByTagName");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localTagname(args[0]);
+
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->arabicaThis->getElementsByTagName(*localTagname));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::importNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in importNode");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling importNode");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localImportedNode = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis;
+ bool localDeep = args[1]->ToBoolean()->BooleanValue();
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->importNode(*localImportedNode, localDeep));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::createElementNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createElementNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
+
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->arabicaThis->createElementNS(*localNamespaceURI, *localQualifiedName));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::createAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in createAttributeNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
+
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->createAttributeNS(*localNamespaceURI, *localQualifiedName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::getElementsByTagNameNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
+
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->arabicaThis->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Document::getElementByIdCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementById");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localElementId(args[0]);
+
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->arabicaThis->getElementById(*localElementId));
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
+
+ }
+
+ bool V8Document::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp.old
new file mode 100644
index 0000000..31372ed
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp.old
@@ -0,0 +1,59 @@
+#include "V8Document.h"
+#include "V8Element.h"
+#include "V8XPathResult.h"
+
+namespace uscxml {
+
+using namespace Arabica::DOM;
+using namespace Arabica::XPath;
+
+v8::Persistent<v8::FunctionTemplate> V8Document::Tmpl;
+
+v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& args) {
+ ASSERT_ARGS1(args, IsString);
+ v8::String::AsciiValue tagName(args[0]);
+
+ v8::Local<v8::Object> self = args.Holder();
+ Document<std::string>* doc = V8DOM::toClassPtr<Document<std::string> >(self->GetInternalField(0));
+ V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
+
+ Element<std::string>* element = new Element<std::string>(doc->createElement(*tagName));
+
+ v8::Handle<v8::Function> elemCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> elemObj = v8::Persistent<v8::Object>::New(elemCtor->NewInstance());
+
+ elemObj->SetInternalField(0, V8DOM::toExternal(element));
+ elemObj->SetInternalField(1, self->GetInternalField(1));
+
+ elemObj.MakeWeak(0, V8Element::jsDestructor);
+ return elemObj;
+}
+
+v8::Handle<v8::Value> V8Document::evaluateCallback(const v8::Arguments& args) {
+ ASSERT_ARGS1(args, IsString);
+ v8::String::AsciiValue xpathExpr(args[0]);
+
+ v8::Local<v8::Object> self = args.Holder();
+ Document<std::string>* doc = V8DOM::toClassPtr<Document<std::string> >(self->GetInternalField(0));
+ V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
+
+ Node<std::string>* context;
+ if (args.Length() > 1) {
+ context = V8DOM::toClassPtr<Node<std::string> >(args[1]->ToObject()->GetInternalField(0));
+ } else {
+ context = doc;
+ }
+
+ XPathValue<std::string>* xpathValue = new XPathValue<std::string>(dom->xpath->evaluate(*xpathExpr, *context));
+
+ v8::Handle<v8::Function> xpathResultCtor = V8XPathResult::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> xpathResultObj = v8::Persistent<v8::Object>::New(xpathResultCtor->NewInstance());
+
+ xpathResultObj->SetInternalField(0, V8DOM::toExternal(xpathValue));
+ xpathResultObj->SetInternalField(1, self->GetInternalField(1));
+
+ xpathResultObj.MakeWeak(0, V8XPathResult::jsDestructor);
+ return xpathResultObj;
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
index 680c433..f07a5ea 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h
@@ -1,104 +1,124 @@
-#ifndef V8DOCUMENT_H_COKK9O3L
-#define V8DOCUMENT_H_COKK9O3L
-
-#include "V8DOM.h"
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8Document_h
+#define V8Document_h
+
+#include "DOM/Node.hpp"
#include "V8Node.h"
-
-namespace uscxml {
-
- class V8Document {
- public:
- static v8::Handle<v8::Value> doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
-
- static v8::Handle<v8::Value> createElementCallback(const v8::Arguments& args);
- static v8::Handle<v8::Value> createDocumentFragmentCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createTextNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createCommentCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createCDATASectionCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createProcessingInstructionCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createEntityReferenceCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> importNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createElementNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getElementByIdCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
-
- static v8::Handle<v8::Value> createEventCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
-
- static v8::Handle<v8::Value> createExpressionCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> createNSResolverCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> evaluateCallback(const v8::Arguments& args);
-
- V8_DESTRUCTOR(Arabica::DOM::Document<std::string>);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Document"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(2);
-
- instance->SetAccessor(v8::String::NewSymbol("doctype"), V8Document::doctypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("implementation"), V8Document::implementationAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("documentElement"), V8Document::documentElementAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("createElement"),
- v8::FunctionTemplate::New(V8Document::createElementCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createDocumentFragment"),
- v8::FunctionTemplate::New(V8Document::createDocumentFragmentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createTextNode"),
- v8::FunctionTemplate::New(V8Document::createTextNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createComment"),
- v8::FunctionTemplate::New(V8Document::createCommentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createCDATASection"),
- v8::FunctionTemplate::New(V8Document::createCDATASectionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createProcessingInstruction"),
- v8::FunctionTemplate::New(V8Document::createProcessingInstructionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createAttribute"),
- v8::FunctionTemplate::New(V8Document::createAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createEntityReference"),
- v8::FunctionTemplate::New(V8Document::createEntityReferenceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
- v8::FunctionTemplate::New(V8Document::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("importNode"),
- v8::FunctionTemplate::New(V8Document::importNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createElementNS"),
- v8::FunctionTemplate::New(V8Document::createElementNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createAttributeNS"),
- v8::FunctionTemplate::New(V8Document::createAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
- v8::FunctionTemplate::New(V8Document::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementById"),
- v8::FunctionTemplate::New(V8Document::getElementByIdCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createEvent"),
- v8::FunctionTemplate::New(V8Document::createEventCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createExpression"),
- v8::FunctionTemplate::New(V8Document::createExpressionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("createNSResolver"),
- v8::FunctionTemplate::New(V8Document::createNSResolverCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("evaluate"),
- v8::FunctionTemplate::New(V8Document::evaluateCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
- };
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8Document {
+public:
+ struct V8DocumentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Document<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8DocumentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> createElementCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createDocumentFragmentCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createTextNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createCommentCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createCDATASectionCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createProcessingInstructionCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createEntityReferenceCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> importNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createElementNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> createAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementByIdCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> evaluateCustomCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Document"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("doctype"), V8Document::doctypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("implementation"), V8Document::implementationAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("documentElement"), V8Document::documentElementAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("createElement"),
+ v8::FunctionTemplate::New(V8Document::createElementCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocumentFragment"),
+ v8::FunctionTemplate::New(V8Document::createDocumentFragmentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createTextNode"),
+ v8::FunctionTemplate::New(V8Document::createTextNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createComment"),
+ v8::FunctionTemplate::New(V8Document::createCommentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createCDATASection"),
+ v8::FunctionTemplate::New(V8Document::createCDATASectionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createProcessingInstruction"),
+ v8::FunctionTemplate::New(V8Document::createProcessingInstructionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createAttribute"),
+ v8::FunctionTemplate::New(V8Document::createAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createEntityReference"),
+ v8::FunctionTemplate::New(V8Document::createEntityReferenceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
+ v8::FunctionTemplate::New(V8Document::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("importNode"),
+ v8::FunctionTemplate::New(V8Document::importNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createElementNS"),
+ v8::FunctionTemplate::New(V8Document::createElementNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createAttributeNS"),
+ v8::FunctionTemplate::New(V8Document::createAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
+ v8::FunctionTemplate::New(V8Document::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementById"),
+ v8::FunctionTemplate::New(V8Document::getElementByIdCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("evaluate"),
+ v8::FunctionTemplate::New(V8Document::evaluateCustomCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
}
+}
-
-#endif /* end of include guard: V8DOCUMENT_H_COKK9O3L */
+#endif // V8Document_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h.old
new file mode 100644
index 0000000..680c433
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h.old
@@ -0,0 +1,104 @@
+#ifndef V8DOCUMENT_H_COKK9O3L
+#define V8DOCUMENT_H_COKK9O3L
+
+#include "V8DOM.h"
+#include "V8Node.h"
+
+namespace uscxml {
+
+ class V8Document {
+ public:
+ static v8::Handle<v8::Value> doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+
+ static v8::Handle<v8::Value> createElementCallback(const v8::Arguments& args);
+ static v8::Handle<v8::Value> createDocumentFragmentCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> createTextNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> createCommentCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> createCDATASectionCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> createProcessingInstructionCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> createAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> createEntityReferenceCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> importNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> createElementNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> createAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> getElementByIdCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+
+ static v8::Handle<v8::Value> createEventCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+
+ static v8::Handle<v8::Value> createExpressionCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> createNSResolverCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> evaluateCallback(const v8::Arguments& args);
+
+ V8_DESTRUCTOR(Arabica::DOM::Document<std::string>);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Document"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(2);
+
+ instance->SetAccessor(v8::String::NewSymbol("doctype"), V8Document::doctypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("implementation"), V8Document::implementationAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("documentElement"), V8Document::documentElementAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("createElement"),
+ v8::FunctionTemplate::New(V8Document::createElementCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createDocumentFragment"),
+ v8::FunctionTemplate::New(V8Document::createDocumentFragmentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createTextNode"),
+ v8::FunctionTemplate::New(V8Document::createTextNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createComment"),
+ v8::FunctionTemplate::New(V8Document::createCommentCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createCDATASection"),
+ v8::FunctionTemplate::New(V8Document::createCDATASectionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createProcessingInstruction"),
+ v8::FunctionTemplate::New(V8Document::createProcessingInstructionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createAttribute"),
+ v8::FunctionTemplate::New(V8Document::createAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createEntityReference"),
+ v8::FunctionTemplate::New(V8Document::createEntityReferenceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
+ v8::FunctionTemplate::New(V8Document::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("importNode"),
+ v8::FunctionTemplate::New(V8Document::importNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createElementNS"),
+ v8::FunctionTemplate::New(V8Document::createElementNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createAttributeNS"),
+ v8::FunctionTemplate::New(V8Document::createAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
+ v8::FunctionTemplate::New(V8Document::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementById"),
+ v8::FunctionTemplate::New(V8Document::getElementByIdCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createEvent"),
+ v8::FunctionTemplate::New(V8Document::createEventCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createExpression"),
+ v8::FunctionTemplate::New(V8Document::createExpressionCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("createNSResolver"),
+ v8::FunctionTemplate::New(V8Document::createNSResolverCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("evaluate"),
+ v8::FunctionTemplate::New(V8Document::evaluateCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+ };
+
+}
+
+
+#endif /* end of include guard: V8DOCUMENT_H_COKK9O3L */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp
new file mode 100644
index 0000000..5c1ac46
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp
@@ -0,0 +1,42 @@
+#include "V8Document.h"
+#include "V8XPathResult.h"
+
+namespace Arabica {
+namespace DOM {
+
+
+v8::Handle<v8::Value> V8Document::evaluateCustomCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in evaluate");
+// if (!((V8Node::hasInstance(args[1])) && (V8XPathResult::hasInstance(args[3]))))
+// throw V8Exception("Parameter mismatch while calling evaluate");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
+
+ v8::String::AsciiValue localExpression(args[0]);
+
+ XPath::XPathValue<std::string>* retVal;
+ if (args.Length() > 1) {
+ Arabica::DOM::Node<std::string>* localContextNode = V8DOM::toClassPtr<Arabica::DOM::Node<std::string> >(args[1]->ToObject()->GetInternalField(0));
+ retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(*localExpression, *localContextNode));
+ } else {
+ retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(*localExpression, *privData->arabicaThis));
+ }
+
+ v8::Handle<v8::Function> retCtor = V8XPathResult::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ V8XPathResult::V8XPathResultPrivate* retPrivData = new V8XPathResult::V8XPathResultPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8XPathResult::jsDestructor);
+ return retObj;
+
+}
+
+}
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
new file mode 100644
index 0000000..e6bec84
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.cpp
@@ -0,0 +1,14 @@
+#include "V8DocumentFragment.h"
+#include "V8Node.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8DocumentFragment::Tmpl;
+
+ bool V8DocumentFragment::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
new file mode 100644
index 0000000..b1d4280
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h
@@ -0,0 +1,70 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8DocumentFragment_h
+#define V8DocumentFragment_h
+
+#include "DOM/Node.hpp"
+#include "V8Node.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8DocumentFragment {
+public:
+ struct V8DocumentFragmentPrivate {
+ V8DOM* dom;
+ Arabica::DOM::DocumentFragment<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8DocumentFragmentPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DocumentFragment"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8DocumentFragment_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
new file mode 100644
index 0000000..58e4ab6
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp
@@ -0,0 +1,79 @@
+#include "V8DocumentType.h"
+#include "V8NamedNodeMap.h"
+#include "V8Node.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8DocumentType::Tmpl;
+
+
+ v8::Handle<v8::Value> V8DocumentType::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getName().c_str());
+ }
+
+ v8::Handle<v8::Value> V8DocumentType::entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->arabicaThis->getEntities());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8DocumentType::notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->arabicaThis->getNotations());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8DocumentType::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getPublicId().c_str());
+ }
+
+ v8::Handle<v8::Value> V8DocumentType::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getSystemId().c_str());
+ }
+
+ v8::Handle<v8::Value> V8DocumentType::internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getInternalSubset().c_str());
+ }
+ bool V8DocumentType::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
new file mode 100644
index 0000000..0319ac6
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h
@@ -0,0 +1,88 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8DocumentType_h
+#define V8DocumentType_h
+
+#include "DOM/Node.hpp"
+#include "V8Node.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8DocumentType {
+public:
+ struct V8DocumentTypePrivate {
+ V8DOM* dom;
+ Arabica::DOM::DocumentType<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8DocumentTypePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("DocumentType"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("name"), V8DocumentType::nameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("entities"), V8DocumentType::entitiesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("notations"), V8DocumentType::notationsAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8DocumentType::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8DocumentType::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("internalSubset"), V8DocumentType::internalSubsetAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8DocumentType_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
index 14b2eae..2dd81c8 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp
@@ -1,24 +1,302 @@
+#include "V8Attr.h"
#include "V8Element.h"
-#include <DOM/Element.hpp>
+#include "V8Node.h"
+#include "V8NodeList.h"
-namespace uscxml {
+namespace Arabica {
+namespace DOM {
-using namespace Arabica::DOM;
+ v8::Persistent<v8::FunctionTemplate> V8Element::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8Element::Tmpl;
-v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) {
- ASSERT_ARGS2(args, IsString, IsString);
- v8::String::AsciiValue key(args[0]);
- v8::String::AsciiValue value(args[1]);
+ v8::Handle<v8::Value> V8Element::tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
- v8::Local<v8::Object> self = args.Holder();
- Element<std::string>* elem = V8DOM::toClassPtr<Element<std::string> >(self->GetInternalField(0));
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
+ return v8::String::New(privData->arabicaThis->getTagName().c_str());
+ }
+ v8::Handle<v8::Value> V8Element::getAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getAttribute");
- elem->setAttribute(*key, *value);
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
- return v8::Undefined();
-}
+ std::string retVal = privData->arabicaThis->getAttribute(*localName);
-} \ No newline at end of file
+ return v8::String::New(retVal.c_str());
+ }
+
+ v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in setAttribute");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+ v8::String::AsciiValue localValue(args[1]);
+
+ privData->arabicaThis->setAttribute(*localName, *localValue);
+
+ return v8::Undefined();
+ }
+
+ v8::Handle<v8::Value> V8Element::removeAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeAttribute");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+
+ privData->arabicaThis->removeAttribute(*localName);
+
+ return v8::Undefined();
+ }
+
+ v8::Handle<v8::Value> V8Element::getAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getAttributeNode");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->getAttributeNode(*localName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setAttributeNode");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setAttributeNode");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis;
+
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->setAttributeNode(*localNewAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Element::removeAttributeNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeAttributeNode");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling removeAttributeNode");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localOldAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis;
+
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->removeAttributeNode(*localOldAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Element::getElementsByTagNameCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getElementsByTagName");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->arabicaThis->getElementsByTagName(*localName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Element::getAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getAttributeNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
+
+ std::string retVal = privData->arabicaThis->getAttributeNS(*localNamespaceURI, *localLocalName);
+
+ return v8::String::New(retVal.c_str());
+ }
+
+ v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 3)
+ throw V8Exception("Wrong number of arguments in setAttributeNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localQualifiedName(args[1]);
+ v8::String::AsciiValue localValue(args[2]);
+
+ privData->arabicaThis->setAttributeNS(*localNamespaceURI, *localQualifiedName, *localValue);
+
+ return v8::Undefined();
+ }
+
+ v8::Handle<v8::Value> V8Element::removeAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in removeAttributeNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
+
+ privData->arabicaThis->removeAttributeNS(*localNamespaceURI, *localLocalName);
+
+ return v8::Undefined();
+ }
+
+ v8::Handle<v8::Value> V8Element::getAttributeNodeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getAttributeNodeNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
+
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->getAttributeNodeNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setAttributeNodeNS");
+ if (!(V8Attr::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setAttributeNodeNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis;
+
+ Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->setAttributeNodeNS(*localNewAttr));
+ v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Attr::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Element::getElementsByTagNameNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getElementsByTagNameNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
+
+ Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->arabicaThis->getElementsByTagNameNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Element::hasAttributeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in hasAttribute");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+
+ bool retVal = privData->arabicaThis->hasAttribute(*localName);
+
+ return v8::Boolean::New(retVal);
+ }
+
+ v8::Handle<v8::Value> V8Element::hasAttributeNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in hasAttributeNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
+
+ bool retVal = privData->arabicaThis->hasAttributeNS(*localNamespaceURI, *localLocalName);
+
+ return v8::Boolean::New(retVal);
+ }
+
+ bool V8Element::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp.old
new file mode 100644
index 0000000..14b2eae
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp.old
@@ -0,0 +1,24 @@
+#include "V8Element.h"
+#include <DOM/Element.hpp>
+
+namespace uscxml {
+
+using namespace Arabica::DOM;
+
+v8::Persistent<v8::FunctionTemplate> V8Element::Tmpl;
+
+v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) {
+ ASSERT_ARGS2(args, IsString, IsString);
+ v8::String::AsciiValue key(args[0]);
+ v8::String::AsciiValue value(args[1]);
+
+ v8::Local<v8::Object> self = args.Holder();
+ Element<std::string>* elem = V8DOM::toClassPtr<Element<std::string> >(self->GetInternalField(0));
+ V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
+
+ elem->setAttribute(*key, *value);
+
+ return v8::Undefined();
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
index f610108..7bb2f61 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h
@@ -1,87 +1,118 @@
-#ifndef V8ELEMENT_H_B55C09NB
-#define V8ELEMENT_H_B55C09NB
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-#include "V8DOM.h"
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8Element_h
+#define V8Element_h
+
+#include "DOM/Node.hpp"
#include "V8Node.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
-namespace uscxml {
-
- class V8Element {
- public:
- static v8::Handle<v8::Value> tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
-
- static v8::Handle<v8::Value> getAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> setAttributeCallback(const v8::Arguments& args);
- static v8::Handle<v8::Value> removeAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getAttributeNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> setAttributeNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> removeAttributeNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> setAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> removeAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> getAttributeNodeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> setAttributeNodeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> hasAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> hasAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
-
- V8_DESTRUCTOR(Arabica::DOM::Element<std::string>);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Element"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(2);
-
- instance->SetAccessor(v8::String::NewSymbol("tagName"), V8Element::tagNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("getAttribute"),
- v8::FunctionTemplate::New(V8Element::getAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttribute"),
- v8::FunctionTemplate::New(V8Element::setAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttribute"),
- v8::FunctionTemplate::New(V8Element::removeAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNode"),
- v8::FunctionTemplate::New(V8Element::getAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNode"),
- v8::FunctionTemplate::New(V8Element::setAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttributeNode"),
- v8::FunctionTemplate::New(V8Element::removeAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
- v8::FunctionTemplate::New(V8Element::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNS"),
- v8::FunctionTemplate::New(V8Element::getAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNS"),
- v8::FunctionTemplate::New(V8Element::setAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeAttributeNS"),
- v8::FunctionTemplate::New(V8Element::removeAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
- v8::FunctionTemplate::New(V8Element::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("getAttributeNodeNS"),
- v8::FunctionTemplate::New(V8Element::getAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("setAttributeNodeNS"),
- v8::FunctionTemplate::New(V8Element::setAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttribute"),
- v8::FunctionTemplate::New(V8Element::hasAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttributeNS"),
- v8::FunctionTemplate::New(V8Element::hasAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Inherit(V8Node::getTmpl());
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
- };
-
-}
+namespace Arabica {
+namespace DOM {
+
+class V8Element {
+public:
+ struct V8ElementPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Element<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8ElementPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> getAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeAttributeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getAttributeNodeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setAttributeNodeNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributeNSCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Element"));
+ tmpl->ReadOnlyPrototype();
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("tagName"), V8Element::tagNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("getAttribute"),
+ v8::FunctionTemplate::New(V8Element::getAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttribute"),
+ v8::FunctionTemplate::New(V8Element::setAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttribute"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
+ v8::FunctionTemplate::New(V8Element::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNodeNS"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNodeNS"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
+ v8::FunctionTemplate::New(V8Element::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttribute"),
+ v8::FunctionTemplate::New(V8Element::hasAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::hasAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
-#endif /* end of include guard: V8ELEMENT_H_B55C09NB */
+#endif // V8Element_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h.old
new file mode 100644
index 0000000..f610108
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h.old
@@ -0,0 +1,87 @@
+#ifndef V8ELEMENT_H_B55C09NB
+#define V8ELEMENT_H_B55C09NB
+
+#include "V8DOM.h"
+#include "V8Node.h"
+
+namespace uscxml {
+
+ class V8Element {
+ public:
+ static v8::Handle<v8::Value> tagNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+
+ static v8::Handle<v8::Value> getAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> setAttributeCallback(const v8::Arguments& args);
+ static v8::Handle<v8::Value> removeAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> getAttributeNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> setAttributeNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> removeAttributeNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> getElementsByTagNameCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> getAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> setAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> removeAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> getElementsByTagNameNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> getAttributeNodeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> setAttributeNodeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> hasAttributeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> hasAttributeNSCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+
+ V8_DESTRUCTOR(Arabica::DOM::Element<std::string>);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Element"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(2);
+
+ instance->SetAccessor(v8::String::NewSymbol("tagName"), V8Element::tagNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("getAttribute"),
+ v8::FunctionTemplate::New(V8Element::getAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttribute"),
+ v8::FunctionTemplate::New(V8Element::setAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttribute"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttributeNode"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagName"),
+ v8::FunctionTemplate::New(V8Element::getElementsByTagNameCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::removeAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getElementsByTagNameNS"),
+ v8::FunctionTemplate::New(V8Element::getElementsByTagNameNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getAttributeNodeNS"),
+ v8::FunctionTemplate::New(V8Element::getAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setAttributeNodeNS"),
+ v8::FunctionTemplate::New(V8Element::setAttributeNodeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttribute"),
+ v8::FunctionTemplate::New(V8Element::hasAttributeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttributeNS"),
+ v8::FunctionTemplate::New(V8Element::hasAttributeNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+ };
+
+}
+
+
+#endif /* end of include guard: V8ELEMENT_H_B55C09NB */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
new file mode 100644
index 0000000..dc8696d
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp
@@ -0,0 +1,35 @@
+#include "V8Entity.h"
+#include "V8Node.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8Entity::Tmpl;
+
+
+ v8::Handle<v8::Value> V8Entity::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getPublicId().c_str());
+ }
+
+ v8::Handle<v8::Value> V8Entity::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getSystemId().c_str());
+ }
+
+ v8::Handle<v8::Value> V8Entity::notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getNotationName().c_str());
+ }
+ bool V8Entity::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
new file mode 100644
index 0000000..1c609d9
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h
@@ -0,0 +1,79 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8Entity_h
+#define V8Entity_h
+
+#include "DOM/Node.hpp"
+#include "V8Node.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8Entity {
+public:
+ struct V8EntityPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Entity<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8EntityPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Entity"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Entity::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Entity::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("notationName"), V8Entity::notationNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8Entity_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
new file mode 100644
index 0000000..95ceee8
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.cpp
@@ -0,0 +1,14 @@
+#include "V8EntityReference.h"
+#include "V8Node.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8EntityReference::Tmpl;
+
+ bool V8EntityReference::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
new file mode 100644
index 0000000..1bd33e9
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h
@@ -0,0 +1,70 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8EntityReference_h
+#define V8EntityReference_h
+
+#include "DOM/Node.hpp"
+#include "V8Node.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8EntityReference {
+public:
+ struct V8EntityReferencePrivate {
+ V8DOM* dom;
+ Arabica::DOM::EntityReference<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8EntityReferencePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("EntityReference"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8EntityReference_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
new file mode 100644
index 0000000..1037b91
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp
@@ -0,0 +1,188 @@
+#include "V8NamedNodeMap.h"
+#include "V8Node.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8NamedNodeMap::Tmpl;
+
+
+ v8::Handle<v8::Value> V8NamedNodeMap::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+
+ return v8::Integer::New(privData->arabicaThis->getLength());
+ }
+ v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in getNamedItem");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getNamedItem(*localName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setNamedItem");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setNamedItem");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis;
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->setNamedItem(*localArg));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeNamedItem");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localName(args[0]);
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->removeNamedItem(*localName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8NamedNodeMap::itemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in item");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->item(localIndex));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in getNamedItemNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getNamedItemNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in setNamedItemNS");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling setNamedItemNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis;
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->setNamedItemNS(*localArg));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemNSCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in removeNamedItemNS");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNamespaceURI(args[0]);
+ v8::String::AsciiValue localLocalName(args[1]);
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->removeNamedItemNS(*localNamespaceURI, *localLocalName));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ bool V8NamedNodeMap::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
new file mode 100644
index 0000000..53402cc
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h
@@ -0,0 +1,92 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8NamedNodeMap_h
+#define V8NamedNodeMap_h
+
+#include "DOM/Node.hpp"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8NamedNodeMap {
+public:
+ struct V8NamedNodeMapPrivate {
+ V8DOM* dom;
+ Arabica::DOM::NamedNodeMap<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8NamedNodeMapPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> getNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeNamedItemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> getNamedItemNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> setNamedItemNSCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeNamedItemNSCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NamedNodeMap"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8NamedNodeMap::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("getNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeNamedItem"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("item"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("getNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::getNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("setNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::setNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeNamedItemNS"),
+ v8::FunctionTemplate::New(V8NamedNodeMap::removeNamedItemNSCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8NamedNodeMap_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
index 97a8c1a..168e067 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp
@@ -1,23 +1,385 @@
+#include "V8Document.h"
+#include "V8NamedNodeMap.h"
#include "V8Node.h"
-#include <DOM/Node.hpp>
+#include "V8NodeList.h"
-namespace uscxml {
+namespace Arabica {
+namespace DOM {
-using namespace Arabica::DOM;
+ v8::Persistent<v8::FunctionTemplate> V8Node::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8Node::Tmpl;
-v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) {
- assert(args.Length() == 1);
- assert(args[0]->IsObject());
+ v8::Handle<v8::Value> V8Node::nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
- v8::Local<v8::Object> self = args.Holder();
+ return v8::String::New(privData->arabicaThis->getNodeName().c_str());
+ }
- Node<std::string>* node = V8DOM::toClassPtr<Node<std::string> >(self->GetInternalField(0));
- Node<std::string>* childToAppend = V8DOM::toClassPtr<Node<std::string> >(args[0]->ToObject()->GetInternalField(0));
- node->appendChild(*childToAppend);
-
- return v8::Undefined();
-}
+ v8::Handle<v8::Value> V8Node::nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
-} \ No newline at end of file
+ return v8::String::New(privData->arabicaThis->getNodeValue().c_str());
+ }
+
+ void V8Node::nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localNodeValue(value);
+ privData->arabicaThis->setNodeValue(*localNodeValue);
+ }
+
+ v8::Handle<v8::Value> V8Node::nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ return v8::Integer::New(privData->arabicaThis->getNodeType());
+ }
+
+ v8::Handle<v8::Value> V8Node::parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getParentNode());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::NodeList<std::string>* arbaicaRet = new Arabica::DOM::NodeList<std::string>(privData->arabicaThis->getChildNodes());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NodeList::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NodeList::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getFirstChild());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getLastChild());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getPreviousSibling());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getNextSibling());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->arabicaThis->getAttributes());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Document<std::string>* arbaicaRet = new Arabica::DOM::Document<std::string>(privData->arabicaThis->getOwnerDocument());
+
+ v8::Handle<v8::Function> arbaicaRetCtor = V8Document::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance());
+
+ V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = arbaicaRet;
+
+ arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+ arbaicaRetObj.MakeWeak(0, V8Document::jsDestructor);
+ return arbaicaRetObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getNamespaceURI().c_str());
+ }
+
+ v8::Handle<v8::Value> V8Node::prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getPrefix().c_str());
+ }
+
+ void V8Node::prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localPrefix(value);
+ privData->arabicaThis->setPrefix(*localPrefix);
+ }
+
+ v8::Handle<v8::Value> V8Node::localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getLocalName().c_str());
+ }
+ v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in insertBefore");
+ if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
+ throw V8Exception("Parameter mismatch while calling insertBefore");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis;
+ Arabica::DOM::Node<std::string>* localRefChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->arabicaThis;
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->insertBefore(*localNewChild, *localRefChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in replaceChild");
+ if (!((V8Node::hasInstance(args[0])) && (V8Node::hasInstance(args[1]))))
+ throw V8Exception("Parameter mismatch while calling replaceChild");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis;
+ Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->arabicaThis;
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->replaceChild(*localNewChild, *localOldChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in removeChild");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling removeChild");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis;
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->removeChild(*localOldChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in appendChild");
+ if (!(V8Node::hasInstance(args[0])))
+ throw V8Exception("Parameter mismatch while calling appendChild");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis;
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->appendChild(*localNewChild));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::hasChildNodesCallback(const v8::Arguments& args) {
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ bool retVal = privData->arabicaThis->hasChildNodes();
+
+ return v8::Boolean::New(retVal);
+ }
+
+ v8::Handle<v8::Value> V8Node::cloneNodeCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in cloneNode");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ bool localDeep = args[0]->ToBoolean()->BooleanValue();
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->cloneNode(localDeep));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8Node::normalizeCallback(const v8::Arguments& args) {
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ privData->arabicaThis->normalize();
+
+ return v8::Undefined();
+ }
+
+ v8::Handle<v8::Value> V8Node::isSupportedCallback(const v8::Arguments& args) {
+ if (args.Length() < 2)
+ throw V8Exception("Wrong number of arguments in isSupported");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localFeature(args[0]);
+ v8::String::AsciiValue localVersion(args[1]);
+
+ bool retVal = privData->arabicaThis->isSupported(*localFeature, *localVersion);
+
+ return v8::Boolean::New(retVal);
+ }
+
+ v8::Handle<v8::Value> V8Node::hasAttributesCallback(const v8::Arguments& args) {
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0));
+
+ bool retVal = privData->arabicaThis->hasAttributes();
+
+ return v8::Boolean::New(retVal);
+ }
+
+ bool V8Node::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp.old
new file mode 100644
index 0000000..97a8c1a
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp.old
@@ -0,0 +1,23 @@
+#include "V8Node.h"
+#include <DOM/Node.hpp>
+
+namespace uscxml {
+
+using namespace Arabica::DOM;
+
+v8::Persistent<v8::FunctionTemplate> V8Node::Tmpl;
+
+v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) {
+ assert(args.Length() == 1);
+ assert(args[0]->IsObject());
+
+ v8::Local<v8::Object> self = args.Holder();
+
+ Node<std::string>* node = V8DOM::toClassPtr<Node<std::string> >(self->GetInternalField(0));
+ Node<std::string>* childToAppend = V8DOM::toClassPtr<Node<std::string> >(args[0]->ToObject()->GetInternalField(0));
+ node->appendChild(*childToAppend);
+
+ return v8::Undefined();
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
index 7048ab5..094d57a 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h
@@ -1,161 +1,163 @@
-#ifndef V8NODE_H_9VGQMJNI
-#define V8NODE_H_9VGQMJNI
-
-#include "V8DOM.h"
-
-namespace uscxml {
-
- class V8Node {
- public:
- static v8::Handle<v8::Value> nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> baseURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> textContentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> parentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
-
- static void nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { }
- static void prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { }
- static void textContentAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { }
-
- static v8::Handle<v8::Value> insertBeforeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> replaceChildCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> removeChildCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> appendChildCallback(const v8::Arguments& args);
- static v8::Handle<v8::Value> hasChildNodesCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> cloneNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> normalizeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> isSupportedCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> hasAttributesCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> lookupPrefixCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> isDefaultNamespaceCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> lookupNamespaceURICallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
-
- V8_DESTRUCTOR(Arabica::DOM::Node<std::string>);
-
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("Node"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(2);
-
- instance->SetAccessor(v8::String::NewSymbol("nodeName"), V8Node::nodeNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nodeValue"), V8Node::nodeValueAttrGetter, V8Node::nodeValueAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nodeType"), V8Node::nodeTypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("parentNode"), V8Node::parentNodeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("childNodes"), V8Node::childNodesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("firstChild"), V8Node::firstChildAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("lastChild"), V8Node::lastChildAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("previousSibling"), V8Node::previousSiblingAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("nextSibling"), V8Node::nextSiblingAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("attributes"), V8Node::attributesAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("ownerDocument"), V8Node::ownerDocumentAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("namespaceURI"), V8Node::namespaceURIAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("prefix"), V8Node::prefixAttrGetter, V8Node::prefixAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("localName"), V8Node::localNameAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("baseURI"), V8Node::baseURIAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("textContent"), V8Node::textContentAttrGetter, V8Node::textContentAttrSetter,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("parentElement"), V8Node::parentElementAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("insertBefore"),
- v8::FunctionTemplate::New(V8Node::insertBeforeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("replaceChild"),
- v8::FunctionTemplate::New(V8Node::replaceChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeChild"),
- v8::FunctionTemplate::New(V8Node::removeChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("appendChild"),
- v8::FunctionTemplate::New(V8Node::appendChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasChildNodes"),
- v8::FunctionTemplate::New(V8Node::hasChildNodesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("cloneNode"),
- v8::FunctionTemplate::New(V8Node::cloneNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("normalize"),
- v8::FunctionTemplate::New(V8Node::normalizeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("isSupported"),
- v8::FunctionTemplate::New(V8Node::isSupportedCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("hasAttributes"),
- v8::FunctionTemplate::New(V8Node::hasAttributesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("lookupPrefix"),
- v8::FunctionTemplate::New(V8Node::lookupPrefixCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("isDefaultNamespace"),
- v8::FunctionTemplate::New(V8Node::isDefaultNamespaceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("lookupNamespaceURI"),
- v8::FunctionTemplate::New(V8Node::lookupNamespaceURICallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("addEventListener"),
- v8::FunctionTemplate::New(V8Node::addEventListenerCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("removeEventListener"),
- v8::FunctionTemplate::New(V8Node::removeEventListenerCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ELEMENT_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ELEMENT_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ATTRIBUTE_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ATTRIBUTE_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::TEXT_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::TEXT_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::CDATA_SECTION_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::CDATA_SECTION_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_REFERENCE_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_REFERENCE_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::PROCESSING_INSTRUCTION_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::PROCESSING_INSTRUCTION_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::COMMENT_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::COMMENT_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_TYPE_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_TYPE_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_FRAGMENT_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_FRAGMENT_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::NOTATION_NODE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::NOTATION_NODE), v8::ReadOnly);
- tmpl->Set(v8::String::NewSymbol("MAX_TYPE"), v8::Integer::New(Arabica::DOM::Node_base::MAX_TYPE), v8::ReadOnly);
- prototype->Set(v8::String::NewSymbol("MAX_TYPE"), v8::Integer::New(Arabica::DOM::Node_base::MAX_TYPE), v8::ReadOnly);
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
-
- };
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8Node_h
+#define V8Node_h
+
+#include "DOM/Node.hpp"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8Node {
+public:
+ struct V8NodePrivate {
+ V8DOM* dom;
+ Arabica::DOM::Node<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8NodePrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> insertBeforeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> replaceChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> removeChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> appendChildCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasChildNodesCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> cloneNodeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> normalizeCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> isSupportedCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> hasAttributesCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Node"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("nodeName"), V8Node::nodeNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nodeValue"), V8Node::nodeValueAttrGetter, V8Node::nodeValueAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nodeType"), V8Node::nodeTypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("parentNode"), V8Node::parentNodeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("childNodes"), V8Node::childNodesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("firstChild"), V8Node::firstChildAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("lastChild"), V8Node::lastChildAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("previousSibling"), V8Node::previousSiblingAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nextSibling"), V8Node::nextSiblingAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("attributes"), V8Node::attributesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("ownerDocument"), V8Node::ownerDocumentAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("namespaceURI"), V8Node::namespaceURIAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("prefix"), V8Node::prefixAttrGetter, V8Node::prefixAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("localName"), V8Node::localNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("insertBefore"),
+ v8::FunctionTemplate::New(V8Node::insertBeforeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("replaceChild"),
+ v8::FunctionTemplate::New(V8Node::replaceChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeChild"),
+ v8::FunctionTemplate::New(V8Node::removeChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("appendChild"),
+ v8::FunctionTemplate::New(V8Node::appendChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasChildNodes"),
+ v8::FunctionTemplate::New(V8Node::hasChildNodesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("cloneNode"),
+ v8::FunctionTemplate::New(V8Node::cloneNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("normalize"),
+ v8::FunctionTemplate::New(V8Node::normalizeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("isSupported"),
+ v8::FunctionTemplate::New(V8Node::isSupportedCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttributes"),
+ v8::FunctionTemplate::New(V8Node::hasAttributesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+ tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), v8::ReadOnly);
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
}
+}
-
-#endif /* end of include guard: V8NODE_H_9VGQMJNI */
+#endif // V8Node_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h.old
new file mode 100644
index 0000000..7048ab5
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h.old
@@ -0,0 +1,161 @@
+#ifndef V8NODE_H_9VGQMJNI
+#define V8NODE_H_9VGQMJNI
+
+#include "V8DOM.h"
+
+namespace uscxml {
+
+ class V8Node {
+ public:
+ static v8::Handle<v8::Value> nodeNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> namespaceURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> baseURIAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> textContentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> parentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+
+ static void nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { }
+ static void prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { }
+ static void textContentAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { }
+
+ static v8::Handle<v8::Value> insertBeforeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> replaceChildCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> removeChildCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> appendChildCallback(const v8::Arguments& args);
+ static v8::Handle<v8::Value> hasChildNodesCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> cloneNodeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> normalizeCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> isSupportedCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> hasAttributesCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> lookupPrefixCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> isDefaultNamespaceCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> lookupNamespaceURICallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> addEventListenerCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> removeEventListenerCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+
+ V8_DESTRUCTOR(Arabica::DOM::Node<std::string>);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Node"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(2);
+
+ instance->SetAccessor(v8::String::NewSymbol("nodeName"), V8Node::nodeNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nodeValue"), V8Node::nodeValueAttrGetter, V8Node::nodeValueAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nodeType"), V8Node::nodeTypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("parentNode"), V8Node::parentNodeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("childNodes"), V8Node::childNodesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("firstChild"), V8Node::firstChildAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("lastChild"), V8Node::lastChildAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("previousSibling"), V8Node::previousSiblingAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("nextSibling"), V8Node::nextSiblingAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("attributes"), V8Node::attributesAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("ownerDocument"), V8Node::ownerDocumentAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("namespaceURI"), V8Node::namespaceURIAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("prefix"), V8Node::prefixAttrGetter, V8Node::prefixAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("localName"), V8Node::localNameAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("baseURI"), V8Node::baseURIAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("textContent"), V8Node::textContentAttrGetter, V8Node::textContentAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("parentElement"), V8Node::parentElementAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("insertBefore"),
+ v8::FunctionTemplate::New(V8Node::insertBeforeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("replaceChild"),
+ v8::FunctionTemplate::New(V8Node::replaceChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeChild"),
+ v8::FunctionTemplate::New(V8Node::removeChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("appendChild"),
+ v8::FunctionTemplate::New(V8Node::appendChildCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasChildNodes"),
+ v8::FunctionTemplate::New(V8Node::hasChildNodesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("cloneNode"),
+ v8::FunctionTemplate::New(V8Node::cloneNodeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("normalize"),
+ v8::FunctionTemplate::New(V8Node::normalizeCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("isSupported"),
+ v8::FunctionTemplate::New(V8Node::isSupportedCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("hasAttributes"),
+ v8::FunctionTemplate::New(V8Node::hasAttributesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("lookupPrefix"),
+ v8::FunctionTemplate::New(V8Node::lookupPrefixCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("isDefaultNamespace"),
+ v8::FunctionTemplate::New(V8Node::isDefaultNamespaceCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("lookupNamespaceURI"),
+ v8::FunctionTemplate::New(V8Node::lookupNamespaceURICallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("addEventListener"),
+ v8::FunctionTemplate::New(V8Node::addEventListenerCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("removeEventListener"),
+ v8::FunctionTemplate::New(V8Node::removeEventListenerCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+ tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ELEMENT_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ELEMENT_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ATTRIBUTE_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ATTRIBUTE_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::TEXT_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::TEXT_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::CDATA_SECTION_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::CDATA_SECTION_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_REFERENCE_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_REFERENCE_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(Arabica::DOM::Node_base::ENTITY_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::PROCESSING_INSTRUCTION_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::PROCESSING_INSTRUCTION_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::COMMENT_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::COMMENT_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_TYPE_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_TYPE_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_FRAGMENT_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(Arabica::DOM::Node_base::DOCUMENT_FRAGMENT_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::NOTATION_NODE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(Arabica::DOM::Node_base::NOTATION_NODE), v8::ReadOnly);
+ tmpl->Set(v8::String::NewSymbol("MAX_TYPE"), v8::Integer::New(Arabica::DOM::Node_base::MAX_TYPE), v8::ReadOnly);
+ prototype->Set(v8::String::NewSymbol("MAX_TYPE"), v8::Integer::New(Arabica::DOM::Node_base::MAX_TYPE), v8::ReadOnly);
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+ };
+
+}
+
+
+#endif /* end of include guard: V8NODE_H_9VGQMJNI */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
new file mode 100644
index 0000000..d1d0125
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp
@@ -0,0 +1,44 @@
+#include "V8Node.h"
+#include "V8NodeList.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8NodeList::Tmpl;
+
+
+ v8::Handle<v8::Value> V8NodeList::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
+
+ return v8::Integer::New(privData->arabicaThis->getLength());
+ }
+ v8::Handle<v8::Value> V8NodeList::itemCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in item");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0));
+ unsigned long localIndex = args[0]->ToNumber()->Uint32Value();
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->item(localIndex));
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+
+ }
+
+ bool V8NodeList::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
new file mode 100644
index 0000000..b70bc0e
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h
@@ -0,0 +1,74 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8NodeList_h
+#define V8NodeList_h
+
+#include "DOM/Node.hpp"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8NodeList {
+public:
+ struct V8NodeListPrivate {
+ V8DOM* dom;
+ Arabica::DOM::NodeList<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8NodeListPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> itemCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NodeList"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8NodeList::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("item"),
+ v8::FunctionTemplate::New(V8NodeList::itemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8NodeList_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
index cadcf7f..8421d2e 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp
@@ -1,60 +1,37 @@
#include "V8NodeSet.h"
-#include "V8Element.h"
-#include "V8Node.h"
-#include <DOM/Node.hpp>
-namespace uscxml {
+namespace Arabica {
+namespace DOM {
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
+ v8::Persistent<v8::FunctionTemplate> V8NodeSet::Tmpl;
-v8::Persistent<v8::FunctionTemplate> V8NodeSet::Tmpl;
+ v8::Handle<v8::Value> V8NodeSet::sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8NodeSet::indexGetter(uint32_t index, const v8::AccessorInfo &info) {
- v8::Local<v8::Object> self = info.Holder();
-
- NodeSet<std::string>* nodeSet = V8DOM::toClassPtr<NodeSet<std::string> >(self->GetInternalField(0));
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
-
- if (nodeSet->size() >= index) {
- switch((*nodeSet)[index].getNodeType()) {
- case Node_base::ELEMENT_NODE: {
- v8::Handle<v8::Function> elementCtor = V8Element::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> elementObj = v8::Persistent<v8::Object>::New(elementCtor->NewInstance());
-
- Element<std::string>* element = new Element<std::string>((*nodeSet)[index]);
-
- elementObj->SetInternalField(0, V8DOM::toExternal(element));
- elementObj->SetInternalField(1, self->GetInternalField(1));
- elementObj.MakeWeak(0, V8Element::jsDestructor);
- return elementObj;
- }
- default: {
- v8::Handle<v8::Function> nodeCtor = V8Node::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> nodeObj = v8::Persistent<v8::Object>::New(nodeCtor->NewInstance());
-
- Node<std::string>* node = new Node<std::string>((*nodeSet)[index]);
+ return v8::Integer::New(privData->arabicaThis->size());
+ }
- nodeObj->SetInternalField(0, V8DOM::toExternal(node));
- nodeObj->SetInternalField(1, self->GetInternalField(1));
- nodeObj.MakeWeak(0, V8Node::jsDestructor);
- return nodeObj;
+ v8::Handle<v8::Value> V8NodeSet::emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
- }
- }
+ return v8::Boolean::New(privData->arabicaThis->empty());
}
+ v8::Handle<v8::Value> V8NodeSet::toDocumentOrderCallback(const v8::Arguments& args) {
- return v8::Undefined();
-}
+ v8::Local<v8::Object> self = args.Holder();
+ V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
-v8::Handle<v8::Value> V8NodeSet::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
- v8::Local<v8::Object> self = info.Holder();
+ privData->arabicaThis->to_document_order();
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
- NodeSet<std::string>* nodeSet = V8DOM::toClassPtr<NodeSet<std::string> >(self->GetInternalField(1));
+ return v8::Undefined();
+ }
- return v8::Integer::New(nodeSet->size());
-}
+ bool V8NodeSet::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-} \ No newline at end of file
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp.old
new file mode 100644
index 0000000..cadcf7f
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp.old
@@ -0,0 +1,60 @@
+#include "V8NodeSet.h"
+#include "V8Element.h"
+#include "V8Node.h"
+#include <DOM/Node.hpp>
+
+namespace uscxml {
+
+using namespace Arabica::DOM;
+using namespace Arabica::XPath;
+
+v8::Persistent<v8::FunctionTemplate> V8NodeSet::Tmpl;
+
+
+v8::Handle<v8::Value> V8NodeSet::indexGetter(uint32_t index, const v8::AccessorInfo &info) {
+ v8::Local<v8::Object> self = info.Holder();
+
+ NodeSet<std::string>* nodeSet = V8DOM::toClassPtr<NodeSet<std::string> >(self->GetInternalField(0));
+ V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
+
+ if (nodeSet->size() >= index) {
+ switch((*nodeSet)[index].getNodeType()) {
+ case Node_base::ELEMENT_NODE: {
+ v8::Handle<v8::Function> elementCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> elementObj = v8::Persistent<v8::Object>::New(elementCtor->NewInstance());
+
+ Element<std::string>* element = new Element<std::string>((*nodeSet)[index]);
+
+ elementObj->SetInternalField(0, V8DOM::toExternal(element));
+ elementObj->SetInternalField(1, self->GetInternalField(1));
+ elementObj.MakeWeak(0, V8Element::jsDestructor);
+ return elementObj;
+ }
+ default: {
+ v8::Handle<v8::Function> nodeCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> nodeObj = v8::Persistent<v8::Object>::New(nodeCtor->NewInstance());
+
+ Node<std::string>* node = new Node<std::string>((*nodeSet)[index]);
+
+ nodeObj->SetInternalField(0, V8DOM::toExternal(node));
+ nodeObj->SetInternalField(1, self->GetInternalField(1));
+ nodeObj.MakeWeak(0, V8Node::jsDestructor);
+ return nodeObj;
+
+ }
+ }
+ }
+
+ return v8::Undefined();
+}
+
+v8::Handle<v8::Value> V8NodeSet::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+
+ V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
+ NodeSet<std::string>* nodeSet = V8DOM::toClassPtr<NodeSet<std::string> >(self->GetInternalField(1));
+
+ return v8::Integer::New(nodeSet->size());
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
index cb95a5d..6650b8d 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h
@@ -1,41 +1,79 @@
-#ifndef V8NODESET_HPP_WKKXJ1RD
-#define V8NODESET_HPP_WKKXJ1RD
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-#include "V8DOM.h"
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
-namespace uscxml {
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
- class V8NodeSet {
- public:
- static v8::Handle<v8::Value> indexGetter(uint32_t index, const v8::AccessorInfo &info);
- static v8::Handle<v8::Value> indexSetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
- V8_DESTRUCTOR(Arabica::XPath::NodeSet<std::string>);
+#ifndef V8NodeSet_h
+#define V8NodeSet_h
- static v8::Persistent<v8::FunctionTemplate> Tmpl;
- static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("NodeSet"));
- tmpl->ReadOnlyPrototype();
+#include "DOM/Node.hpp"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- // v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(2);
+namespace Arabica {
+namespace DOM {
- instance->SetIndexedPropertyHandler(V8NodeSet::indexGetter, V8NodeSet::indexSetter);
+class V8NodeSet {
+public:
+ struct V8NodeSetPrivate {
+ V8DOM* dom;
+ Arabica::XPath::NodeSet<std::string>* arabicaThis;
+ };
- instance->SetAccessor(v8::String::NewSymbol("length"), V8NodeSet::lengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ V8_DESTRUCTOR(V8NodeSetPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
- }
+ static v8::Handle<v8::Value> toDocumentOrderCallback(const v8::Arguments&);
- };
+ static v8::Handle<v8::Value> sizeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&);
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NodeSet"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("size"), V8NodeSet::sizeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("empty"), V8NodeSet::emptyAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ instance->SetIndexedPropertyHandler(V8NodeSet::indexedPropertyCustomGetter, 0);
+ prototype->Set(v8::String::NewSymbol("toDocumentOrder"),
+ v8::FunctionTemplate::New(V8NodeSet::toDocumentOrderCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
}
-#endif /* end of include guard: V8NODESET_HPP_WKKXJ1RD */
+#endif // V8NodeSet_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h.old
new file mode 100644
index 0000000..cb95a5d
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h.old
@@ -0,0 +1,41 @@
+#ifndef V8NODESET_HPP_WKKXJ1RD
+#define V8NODESET_HPP_WKKXJ1RD
+
+#include "V8DOM.h"
+
+namespace uscxml {
+
+ class V8NodeSet {
+ public:
+ static v8::Handle<v8::Value> indexGetter(uint32_t index, const v8::AccessorInfo &info);
+ static v8::Handle<v8::Value> indexSetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo &info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ V8_DESTRUCTOR(Arabica::XPath::NodeSet<std::string>);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("NodeSet"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ // v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(2);
+
+ instance->SetIndexedPropertyHandler(V8NodeSet::indexGetter, V8NodeSet::indexSetter);
+
+ instance->SetAccessor(v8::String::NewSymbol("length"), V8NodeSet::lengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+ };
+
+}
+
+#endif /* end of include guard: V8NODESET_HPP_WKKXJ1RD */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp
new file mode 100644
index 0000000..4904878
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp
@@ -0,0 +1,52 @@
+#include "V8NodeSet.h"
+#include "V8Element.h"
+#include "V8Node.h"
+
+namespace Arabica {
+namespace DOM {
+
+v8::Handle<v8::Value> V8NodeSet::indexedPropertyCustomGetter(uint32_t index, const v8::AccessorInfo &info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0));
+
+ if (privData->arabicaThis->size() >= index) {
+ switch((*privData->arabicaThis)[index].getNodeType()) {
+ case Node_base::ELEMENT_NODE: {
+ Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>((*privData->arabicaThis)[index]);
+
+ v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Element::jsDestructor);
+ return retObj;
+ }
+ default: {
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>((*privData->arabicaThis)[index]);
+
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+ }
+ }
+ }
+
+ return v8::Undefined();
+
+}
+
+}
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
new file mode 100644
index 0000000..0e9d5f6
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp
@@ -0,0 +1,28 @@
+#include "V8Node.h"
+#include "V8Notation.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8Notation::Tmpl;
+
+
+ v8::Handle<v8::Value> V8Notation::publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getPublicId().c_str());
+ }
+
+ v8::Handle<v8::Value> V8Notation::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getSystemId().c_str());
+ }
+ bool V8Notation::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
new file mode 100644
index 0000000..edf7c44
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h
@@ -0,0 +1,76 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8Notation_h
+#define V8Notation_h
+
+#include "DOM/Node.hpp"
+#include "V8Node.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8Notation {
+public:
+ struct V8NotationPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Notation<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8NotationPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> publicIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Notation"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("publicId"), V8Notation::publicIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("systemId"), V8Notation::systemIdAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8Notation_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
new file mode 100644
index 0000000..09ba4fe
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp
@@ -0,0 +1,35 @@
+#include "V8Node.h"
+#include "V8ProcessingInstruction.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8ProcessingInstruction::Tmpl;
+
+
+ v8::Handle<v8::Value> V8ProcessingInstruction::targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getTarget().c_str());
+ }
+
+ v8::Handle<v8::Value> V8ProcessingInstruction::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->getData().c_str());
+ }
+
+ void V8ProcessingInstruction::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0));
+ v8::String::AsciiValue localData(value);
+ privData->arabicaThis->setData(*localData);
+ }
+ bool V8ProcessingInstruction::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
new file mode 100644
index 0000000..7793a72
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h
@@ -0,0 +1,77 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8ProcessingInstruction_h
+#define V8ProcessingInstruction_h
+
+#include "DOM/Node.hpp"
+#include "V8Node.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8ProcessingInstruction {
+public:
+ struct V8ProcessingInstructionPrivate {
+ V8DOM* dom;
+ Arabica::DOM::ProcessingInstruction<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8ProcessingInstructionPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+
+ static v8::Handle<v8::Value> targetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static void dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("ProcessingInstruction"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("target"), V8ProcessingInstruction::targetAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("data"), V8ProcessingInstruction::dataAttrGetter, V8ProcessingInstruction::dataAttrSetter,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+
+
+ tmpl->Inherit(V8Node::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8ProcessingInstruction_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
new file mode 100644
index 0000000..70411f9
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp
@@ -0,0 +1,37 @@
+#include "V8CharacterData.h"
+#include "V8Text.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8Text::Tmpl;
+
+ v8::Handle<v8::Value> V8Text::splitTextCallback(const v8::Arguments& args) {
+ if (args.Length() < 1)
+ throw V8Exception("Wrong number of arguments in splitText");
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8TextPrivate* privData = V8DOM::toClassPtr<V8TextPrivate >(self->GetInternalField(0));
+ unsigned long localOffset = args[0]->ToNumber()->Uint32Value();
+
+ Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->arabicaThis->splitText(localOffset));
+ v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Text::jsDestructor);
+ return retObj;
+
+ }
+
+ bool V8Text::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
+
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
new file mode 100644
index 0000000..f8154ef
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h
@@ -0,0 +1,73 @@
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef V8Text_h
+#define V8Text_h
+
+#include "DOM/Node.hpp"
+#include "V8CharacterData.h"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8Text {
+public:
+ struct V8TextPrivate {
+ V8DOM* dom;
+ Arabica::DOM::Text<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8TextPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> splitTextCallback(const v8::Arguments&);
+
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("Text"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+
+ prototype->Set(v8::String::NewSymbol("splitText"),
+ v8::FunctionTemplate::New(V8Text::splitTextCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ tmpl->Inherit(V8CharacterData::getTmpl());
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+
+};
+
+}
+}
+
+#endif // V8Text_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
index 04bfcbe..6b7c077 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp
@@ -1,30 +1,85 @@
-#include "V8XPathResult.h"
#include "V8NodeSet.h"
+#include "V8XPathResult.h"
+
+namespace Arabica {
+namespace DOM {
+
+ v8::Persistent<v8::FunctionTemplate> V8XPathResult::Tmpl;
+
+
+ v8::Handle<v8::Value> V8XPathResult::numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+
+ return v8::Number::New(privData->arabicaThis->asNumber());
+ }
+
+ v8::Handle<v8::Value> V8XPathResult::stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+
+ return v8::String::New(privData->arabicaThis->asString().c_str());
+ }
+
+ v8::Handle<v8::Value> V8XPathResult::booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+
+ return v8::Boolean::New(privData->arabicaThis->asBool());
+ }
+ v8::Handle<v8::Value> V8XPathResult::asNodeSetCallback(const v8::Arguments& args) {
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+
+ Arabica::XPath::NodeSet<std::string>* retVal = new Arabica::XPath::NodeSet<std::string>(privData->arabicaThis->asNodeSet());
+ v8::Handle<v8::Function> retCtor = V8NodeSet::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8NodeSet::V8NodeSetPrivate* retPrivData = new V8NodeSet::V8NodeSetPrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8NodeSet::jsDestructor);
+ return retObj;
+
+ }
+
+ v8::Handle<v8::Value> V8XPathResult::asBoolCallback(const v8::Arguments& args) {
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+
+ bool retVal = privData->arabicaThis->asBool();
+
+ return v8::Boolean::New(retVal);
+ }
+
+ v8::Handle<v8::Value> V8XPathResult::asStringCallback(const v8::Arguments& args) {
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+
+ std::string retVal = privData->arabicaThis->asString();
+
+ return v8::String::New(retVal.c_str());
+ }
+
+ v8::Handle<v8::Value> V8XPathResult::asNumberCallback(const v8::Arguments& args) {
+
+ v8::Local<v8::Object> self = args.Holder();
+ V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+
+ double retVal = privData->arabicaThis->asNumber();
+
+ return v8::Number::New(retVal);
+ }
+
+ bool V8XPathResult::hasInstance(v8::Handle<v8::Value> value) {
+ return getTmpl()->HasInstance(value);
+ }
-namespace uscxml {
-
-using namespace Arabica::DOM;
-using namespace Arabica::XPath;
-
-v8::Persistent<v8::FunctionTemplate> V8XPathResult::Tmpl;
-
-v8::Handle<v8::Value> V8XPathResult::asNodeSetCallback(const v8::Arguments& args) {
-
- v8::Local<v8::Object> self = args.Holder();
- XPathValue<std::string>* xpathValue = V8DOM::toClassPtr<XPathValue<std::string> >(self->GetInternalField(0));
- V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
-
- v8::Handle<v8::Function> nodeSetCtor = V8NodeSet::getTmpl()->GetFunction();
- v8::Persistent<v8::Object> nodeSetObj = v8::Persistent<v8::Object>::New(nodeSetCtor->NewInstance());
-
- Arabica::XPath::NodeSet<std::string>* nodeSet = new Arabica::XPath::NodeSet<std::string>(xpathValue->asNodeSet());
-
- nodeSetObj->SetInternalField(0, V8DOM::toExternal(nodeSet));
- nodeSetObj->SetInternalField(1, self->GetInternalField(1));
-
- nodeSetObj.MakeWeak(0, V8NodeSet::jsDestructor);
- return nodeSetObj;
-
-}
-
-} \ No newline at end of file
+}
+}
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp.old
new file mode 100644
index 0000000..04bfcbe
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp.old
@@ -0,0 +1,30 @@
+#include "V8XPathResult.h"
+#include "V8NodeSet.h"
+
+namespace uscxml {
+
+using namespace Arabica::DOM;
+using namespace Arabica::XPath;
+
+v8::Persistent<v8::FunctionTemplate> V8XPathResult::Tmpl;
+
+v8::Handle<v8::Value> V8XPathResult::asNodeSetCallback(const v8::Arguments& args) {
+
+ v8::Local<v8::Object> self = args.Holder();
+ XPathValue<std::string>* xpathValue = V8DOM::toClassPtr<XPathValue<std::string> >(self->GetInternalField(0));
+ V8DOM* dom = V8DOM::toClassPtr<V8DOM>(self->GetInternalField(1)); (void)dom;
+
+ v8::Handle<v8::Function> nodeSetCtor = V8NodeSet::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> nodeSetObj = v8::Persistent<v8::Object>::New(nodeSetCtor->NewInstance());
+
+ Arabica::XPath::NodeSet<std::string>* nodeSet = new Arabica::XPath::NodeSet<std::string>(xpathValue->asNodeSet());
+
+ nodeSetObj->SetInternalField(0, V8DOM::toExternal(nodeSet));
+ nodeSetObj->SetInternalField(1, self->GetInternalField(1));
+
+ nodeSetObj.MakeWeak(0, V8NodeSet::jsDestructor);
+ return nodeSetObj;
+
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
index ce5e2d5..76c6913 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h
@@ -1,75 +1,92 @@
-#ifndef V8XPATHRESULT_HPP_AYZD0IRH
-#define V8XPATHRESULT_HPP_AYZD0IRH
+/*
+ This file is part of the Arabica open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-#include "V8DOM.h"
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
-namespace uscxml {
- class V8XPathResult {
- public:
- static v8::Handle<v8::Value> resultTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> singleNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> invalidIteratorStateAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> snapshotLengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
- static v8::Handle<v8::Value> iterateNextCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> snapshotItemCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
- static v8::Handle<v8::Value> asNodeSetCallback(const v8::Arguments& args);
- static v8::Handle<v8::Value> asBoolCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> asStringCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
- static v8::Handle<v8::Value> asNumberCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+#ifndef V8XPathResult_h
+#define V8XPathResult_h
- V8_DESTRUCTOR(Arabica::XPath::XPathValue<std::string>);
+#include "DOM/Node.hpp"
+#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h"
+#include <v8.h>
+
+namespace Arabica {
+namespace DOM {
+
+class V8XPathResult {
+public:
+ struct V8XPathResultPrivate {
+ V8DOM* dom;
+ Arabica::XPath::XPathValue<std::string>* arabicaThis;
+ };
+
+ V8_DESTRUCTOR(V8XPathResultPrivate);
+ static bool hasInstance(v8::Handle<v8::Value>);
+
+ static v8::Handle<v8::Value> asNodeSetCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asBoolCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asStringCallback(const v8::Arguments&);
+ static v8::Handle<v8::Value> asNumberCallback(const v8::Arguments&);
+
+ static v8::Handle<v8::Value> numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
+ static v8::Handle<v8::Value> singleNodeValueCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info);
static v8::Persistent<v8::FunctionTemplate> Tmpl;
static v8::Handle<v8::FunctionTemplate> getTmpl() {
- if (Tmpl.IsEmpty()) {
- v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
- tmpl->SetClassName(v8::String::New("XPathResult"));
- tmpl->ReadOnlyPrototype();
-
- v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
- v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
- instance->SetInternalFieldCount(2);
-
- instance->SetAccessor(v8::String::NewSymbol("resultType"), V8XPathResult::resultTypeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("numberValue"), V8XPathResult::numberValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("stringValue"), V8XPathResult::stringValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("booleanValue"), V8XPathResult::booleanValueAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("singleNode"), V8XPathResult::singleNodeAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("invalidIteratorState"), V8XPathResult::invalidIteratorStateAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
- instance->SetAccessor(v8::String::NewSymbol("snapshotLength"), V8XPathResult::snapshotLengthAttrGetter, 0,
- v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
-
- prototype->Set(v8::String::NewSymbol("iterateNext"),
- v8::FunctionTemplate::New(V8XPathResult::iterateNextCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("snapshotItem"),
- v8::FunctionTemplate::New(V8XPathResult::snapshotItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asNodeSet"),
- v8::FunctionTemplate::New(V8XPathResult::asNodeSetCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asBool"),
- v8::FunctionTemplate::New(V8XPathResult::asBoolCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asString"),
- v8::FunctionTemplate::New(V8XPathResult::asStringCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
- prototype->Set(v8::String::NewSymbol("asNumber"),
- v8::FunctionTemplate::New(V8XPathResult::asNumberCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
-
- Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
- }
- return Tmpl;
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("XPathResult"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(1);
+
+ instance->SetAccessor(v8::String::NewSymbol("numberValue"), V8XPathResult::numberValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("stringValue"), V8XPathResult::stringValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("booleanValue"), V8XPathResult::booleanValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("singleNodeValue"), V8XPathResult::singleNodeValueCustomAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("asNodeSet"),
+ v8::FunctionTemplate::New(V8XPathResult::asNodeSetCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asBool"),
+ v8::FunctionTemplate::New(V8XPathResult::asBoolCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asString"),
+ v8::FunctionTemplate::New(V8XPathResult::asStringCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asNumber"),
+ v8::FunctionTemplate::New(V8XPathResult::asNumberCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
}
- };
-}
+};
+
+}
+}
-#endif /* end of include guard: V8XPATHRESULT_HPP_AYZD0IRH */
+#endif // V8XPathResult_h
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h.old b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h.old
new file mode 100644
index 0000000..ce5e2d5
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h.old
@@ -0,0 +1,75 @@
+#ifndef V8XPATHRESULT_HPP_AYZD0IRH
+#define V8XPATHRESULT_HPP_AYZD0IRH
+
+#include "V8DOM.h"
+
+namespace uscxml {
+ class V8XPathResult {
+ public:
+ static v8::Handle<v8::Value> resultTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> numberValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> singleNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> invalidIteratorStateAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> snapshotLengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { assert(false); return v8::Undefined(); }
+
+ static v8::Handle<v8::Value> iterateNextCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> snapshotItemCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+
+ static v8::Handle<v8::Value> asNodeSetCallback(const v8::Arguments& args);
+ static v8::Handle<v8::Value> asBoolCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> asStringCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+ static v8::Handle<v8::Value> asNumberCallback(const v8::Arguments& args) { assert(false); return v8::Undefined(); }
+
+ V8_DESTRUCTOR(Arabica::XPath::XPathValue<std::string>);
+
+ static v8::Persistent<v8::FunctionTemplate> Tmpl;
+ static v8::Handle<v8::FunctionTemplate> getTmpl() {
+ if (Tmpl.IsEmpty()) {
+ v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New();
+ tmpl->SetClassName(v8::String::New("XPathResult"));
+ tmpl->ReadOnlyPrototype();
+
+ v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate();
+ v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate();
+ instance->SetInternalFieldCount(2);
+
+ instance->SetAccessor(v8::String::NewSymbol("resultType"), V8XPathResult::resultTypeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("numberValue"), V8XPathResult::numberValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("stringValue"), V8XPathResult::stringValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("booleanValue"), V8XPathResult::booleanValueAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("singleNode"), V8XPathResult::singleNodeAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("invalidIteratorState"), V8XPathResult::invalidIteratorStateAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+ instance->SetAccessor(v8::String::NewSymbol("snapshotLength"), V8XPathResult::snapshotLengthAttrGetter, 0,
+ v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None));
+
+ prototype->Set(v8::String::NewSymbol("iterateNext"),
+ v8::FunctionTemplate::New(V8XPathResult::iterateNextCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("snapshotItem"),
+ v8::FunctionTemplate::New(V8XPathResult::snapshotItemCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asNodeSet"),
+ v8::FunctionTemplate::New(V8XPathResult::asNodeSetCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asBool"),
+ v8::FunctionTemplate::New(V8XPathResult::asBoolCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asString"),
+ v8::FunctionTemplate::New(V8XPathResult::asStringCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+ prototype->Set(v8::String::NewSymbol("asNumber"),
+ v8::FunctionTemplate::New(V8XPathResult::asNumberCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete));
+
+ Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl);
+ }
+ return Tmpl;
+ }
+
+ };
+}
+
+
+#endif /* end of include guard: V8XPATHRESULT_HPP_AYZD0IRH */
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp
new file mode 100644
index 0000000..6ec0f85
--- /dev/null
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp
@@ -0,0 +1,27 @@
+#include "V8XPathResult.h"
+#include "V8Node.h"
+
+namespace Arabica {
+namespace DOM {
+
+v8::Handle<v8::Value> V8XPathResult::singleNodeValueCustomAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) {
+ v8::Local<v8::Object> self = info.Holder();
+ V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0));
+
+ Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->asNodeSet()[0]);
+
+ v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction();
+ v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());
+
+ struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate();
+ retPrivData->dom = privData->dom;
+ retPrivData->arabicaThis = retVal;
+
+ retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));
+
+ retObj.MakeWeak(0, V8Node::jsDestructor);
+ return retObj;
+}
+
+}
+} \ No newline at end of file