summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-01-20 17:18:19 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-01-20 17:18:19 (GMT)
commitf4f05b40c8c464daf1e11df6fcdb63d05766ed1f (patch)
treea513019b456be25248212ab9d722e9c7bb5fdbc2 /src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp
parentb5c33505b3345795811b4aba7e5fda961068f369 (diff)
downloaduscxml-f4f05b40c8c464daf1e11df6fcdb63d05766ed1f.zip
uscxml-f4f05b40c8c464daf1e11df6fcdb63d05766ed1f.tar.gz
uscxml-f4f05b40c8c464daf1e11df6fcdb63d05766ed1f.tar.bz2
Completed V8 IDL to DOM generator
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp')
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp52
1 files changed, 52 insertions, 0 deletions
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