summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp.old
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp.old')
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp.old30
1 files changed, 30 insertions, 0 deletions
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