summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp')
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp99
1 files changed, 0 insertions, 99 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp
deleted file mode 100644
index 91c18e5..0000000
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeListCustom.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
- * @copyright Simplified BSD
- *
- * @cond
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the FreeBSD license as published by the FreeBSD
- * project.
- *
- * This program 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.
- *
- * You should have received a copy of the FreeBSD license along with this
- * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
- * @endcond
- */
-
-#include "JSCNodeList.h"
-#include "JSCElement.h"
-#include "JSCNode.h"
-
-namespace Arabica {
-namespace DOM {
-
-bool JSCNodeList::hasPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName) {
- size_t propMaxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
- char* propBuffer = new char[propMaxSize];
- JSStringGetUTF8CString(propertyName, propBuffer, propMaxSize);
- std::string propName(propBuffer);
- free(propBuffer);
-
- std::string base = "0123456789";
- if (propName.find_first_not_of(base) != std::string::npos) {
- return false;
- }
-
- int index = boost::lexical_cast<int>(propName);
- struct JSCNodeListPrivate* privData = (struct JSCNodeListPrivate*)JSObjectGetPrivate(object);
-
- if (privData->nativeObj->getLength() < index) {
- return false;
- }
-
- return true;
-}
-
-JSValueRef JSCNodeList::getPropertyCustomCallback(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) {
- size_t propMaxSize = JSStringGetMaximumUTF8CStringSize(propertyName);
- char* propBuffer = new char[propMaxSize];
- JSStringGetUTF8CString(propertyName, propBuffer, propMaxSize);
- std::string propName(propBuffer);
- free(propBuffer);
-
- std::string base = "0123456789";
- if (propName.find_first_not_of(base) != std::string::npos) {
- return JSValueMakeUndefined(ctx);
- }
-
- int index = boost::lexical_cast<int>(propName);
- struct JSCNodeListPrivate* privData = (struct JSCNodeListPrivate*)JSObjectGetPrivate(object);
- if (privData->nativeObj->getLength() < index) {
- return JSValueMakeUndefined(ctx);
- }
-
- switch(privData->nativeObj->item(index).getNodeType()) {
- case Node_base::ELEMENT_NODE: {
- Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->item(index));
- JSClassRef retClass = JSCElement::getTmpl();
-
- struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
- break;
- }
- default: {
- Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(index));
- JSClassRef retClass = JSCNode::getTmpl();
-
- struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate();
- retPrivData->dom = privData->dom;
- retPrivData->nativeObj = retVal;
-
- JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
-
- return retObj;
- }
- }
-
- return JSValueMakeUndefined(ctx);
-}
-
-}
-} \ No newline at end of file