diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-06-21 09:14:06 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-06-21 09:14:06 (GMT) |
commit | 8e3cca4a153a5178a77ae6956292606563f4b8fe (patch) | |
tree | 89537d5153690ee0d9a7b0038b1280f407f70dc3 /src/uscxml/plugins/datamodel/ecmascript | |
parent | 794575f01ce5a6bf7e377eb815f3def5aded74f5 (diff) | |
download | uscxml-8e3cca4a153a5178a77ae6956292606563f4b8fe.zip uscxml-8e3cca4a153a5178a77ae6956292606563f4b8fe.tar.gz uscxml-8e3cca4a153a5178a77ae6956292606563f4b8fe.tar.bz2 |
More work on JSC implementation for ecma datamodel
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript')
39 files changed, 2334 insertions, 320 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp index 4c6c23e..f856f96 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp @@ -23,7 +23,7 @@ bool connect(pluma::Host& host) { JSCDataModel::JSCDataModel() { } -boost::shared_ptr<DataModelImpl> JSCDataModel::create(Interpreter* interpreter) { +boost::shared_ptr<DataModelImpl> JSCDataModel::create(InterpreterImpl* interpreter) { boost::shared_ptr<JSCDataModel> dm = boost::shared_ptr<JSCDataModel>(new JSCDataModel()); dm->_ctx = JSGlobalContextCreate(NULL); @@ -34,13 +34,10 @@ boost::shared_ptr<DataModelImpl> JSCDataModel::create(Interpreter* interpreter) dom->xpath = new Arabica::XPath::XPath<std::string>(); dom->xpath->setNamespaceContext(interpreter->getNSContext()); - - dm->setName(interpreter->getName()); - dm->setSessionId(interpreter->getSessionId()); dm->eval("_ioprocessors = {};"); Arabica::DOM::JSCDocument::JSCDocumentPrivate* privData = new Arabica::DOM::JSCDocument::JSCDocumentPrivate(); - privData->arabicaThis = new Arabica::DOM::Document<std::string>(interpreter->getDocument()); + privData->nativeObj = new Arabica::DOM::Document<std::string>(interpreter->getDocument()); privData->dom = dom; JSObjectRef documentObject = JSObjectMake(dm->_ctx, Arabica::DOM::JSCDocument::getTmpl(), privData); @@ -50,18 +47,6 @@ boost::shared_ptr<DataModelImpl> JSCDataModel::create(Interpreter* interpreter) return dm; } -void JSCDataModel::registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor) { - assign("_ioprocessors['" + name + "']", ioprocessor.getDataModelVariables()); -} - -void JSCDataModel::setSessionId(const std::string& sessionId) { - _sessionId = sessionId; -} - -void JSCDataModel::setName(const std::string& name) { - _name = name; -} - JSCDataModel::~JSCDataModel() { JSGlobalContextRelease(_ctx); } @@ -72,9 +57,6 @@ void JSCDataModel::pushContext() { void JSCDataModel::popContext() { } -void JSCDataModel::initialize() { -} - void JSCDataModel::setEvent(const Event& event) { LOG(ERROR) << "setEvent not implemented in JSC"; } @@ -207,14 +189,20 @@ JSValueRef JSCDataModel::evalAsValue(const std::string& expr) { return result; } +void JSCDataModel::assign(const Arabica::DOM::Element<std::string>& assignElem, + const Arabica::DOM::Document<std::string>& doc, + const std::string& content) { +} + void JSCDataModel::assign(const std::string& location, const Data& data) { - std::stringstream ssJSON; - ssJSON << data; - assign(location, ssJSON.str()); } -void JSCDataModel::assign(const std::string& location, const std::string& expr) { - evalAsValue(location + " = " + expr); +void JSCDataModel::init(const Arabica::DOM::Element<std::string>& dataElem, + const Arabica::DOM::Document<std::string>& doc, + const std::string& content) { +} + +void JSCDataModel::init(const std::string& location, const Data& data) { } void JSCDataModel::handleException(JSValueRef exception) { diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h index 5662d42..f99551b 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h @@ -20,7 +20,7 @@ class JSCDataModel : public DataModelImpl { public: JSCDataModel(); virtual ~JSCDataModel(); - virtual boost::shared_ptr<DataModelImpl> create(Interpreter* interpreter); + virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; @@ -28,35 +28,40 @@ public: return names; } - virtual void initialize(); - virtual void setSessionId(const std::string& sessionId); - virtual void setName(const std::string& name); - virtual void setEvent(const Event& event); - - virtual void registerIOProcessor(const std::string& name, const IOProcessor& ioprocessor); - virtual bool validate(const std::string& location, const std::string& schema); + virtual void setEvent(const Event& event); + virtual Data getStringAsData(const std::string& content); + // foreach virtual uint32_t getLength(const std::string& expr); + virtual void setForeach(const std::string& item, + const std::string& array, + const std::string& index, + uint32_t iteration); virtual void pushContext(); virtual void popContext(); virtual void eval(const std::string& expr); - virtual void assign(const std::string& location, const std::string& expr); - virtual void assign(const std::string& location, const Data& data); - - virtual Data getStringAsData(const std::string& content); - virtual Data getValueAsData(const JSValueRef value); - virtual std::string evalAsString(const std::string& expr); virtual bool evalAsBool(const std::string& expr); - virtual JSValueRef evalAsValue(const std::string& expr); + virtual bool isDeclared(const std::string& expr); + + virtual void assign(const Arabica::DOM::Element<std::string>& assignElem, + const Arabica::DOM::Document<std::string>& doc, + const std::string& content); + virtual void assign(const std::string& location, const Data& data); + + virtual void init(const Arabica::DOM::Element<std::string>& dataElem, + const Arabica::DOM::Document<std::string>& doc, + const std::string& content); + virtual void init(const std::string& location, const Data& data); protected: - void handleException(JSValueRef exception); + Data getValueAsData(const JSValueRef value); + JSValueRef evalAsValue(const std::string& expr); - Interpreter* _interpreter; + void handleException(JSValueRef exception); std::string _sessionId; std::string _name; diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp index 4259b86..62b6e9d 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp @@ -19,42 +19,57 @@ JSStaticFunction JSCAttr::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCAttr::nameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCAttrPrivate* privData = static_cast<JSCAttr::JSCAttrPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getName().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +JSValueRef JSCAttr::nameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCAttrPrivate* privData = (struct JSCAttrPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getName().c_str()); + return JSValueMakeString(ctx, stringRef); +} + + +JSValueRef JSCAttr::specifiedAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCAttrPrivate* privData = (struct JSCAttrPrivate*)JSObjectGetPrivate(object); + return JSValueMakeNumber(ctx, privData->nativeObj->getSpecified()); } -JSValueRef JSCAttr::specifiedAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCAttrPrivate* privData = static_cast<JSCAttr::JSCAttrPrivate* >(JSObjectGetPrivate(thisObj)); - return JSValueMakeBoolean(ctx, privData->arabicaThis->getSpecified()); +JSValueRef JSCAttr::valueAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCAttrPrivate* privData = (struct JSCAttrPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getValue().c_str()); + return JSValueMakeString(ctx, stringRef); } -JSValueRef JSCAttr::valueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCAttrPrivate* privData = static_cast<JSCAttr::JSCAttrPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getValue().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +bool JSCAttr::valueAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { + struct JSCAttrPrivate* privData = (struct JSCAttrPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalValue = JSValueToStringCopy(ctx, value, exception); + size_t localValueMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalValue); + char* localValueBuffer = new char[localValueMaxSize]; + JSStringGetUTF8CString(stringReflocalValue, localValueBuffer, sizeof(localValueBuffer)); + std::string localValue(localValueBuffer, localValueMaxSize); + free(localValueBuffer); + + privData->nativeObj->setValue(localValue); + return true; } -JSValueRef JSCAttr::ownerElementAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCAttrPrivate* privData = static_cast<JSCAttr::JSCAttrPrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->arabicaThis->getOwnerElement()); +JSValueRef JSCAttr::ownerElementAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCAttrPrivate* privData = (struct JSCAttrPrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->getOwnerElement()) return JSValueMakeUndefined(ctx); + Arabica::DOM::Element<std::string>* arabicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getOwnerElement()); + + JSClassRef arbaicaRetClass = JSCElement::getTmpl(); struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCElement::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; - } + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.h index f7c3fec..5efc53a 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCAttr_h #define JSCAttr_h +#include <string> #include "DOM/Node.hpp" #include "JSCNode.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCAttr { public: struct JSCAttrPrivate { JSCDOM* dom; - Arabica::DOM::Attr<std::string>* arabicaThis; + Arabica::DOM::Attr<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCAttrPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.h index b4cd391..a4d86f2 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCCDATASection_h #define JSCCDATASection_h +#include <string> #include "DOM/Node.hpp" #include "JSCText.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCCDATASection { public: struct JSCCDATASectionPrivate { JSCDOM* dom; - Arabica::DOM::CDATASection<std::string>* arabicaThis; + Arabica::DOM::CDATASection<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCCDATASectionPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp index 5108625..4d55722 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp @@ -21,20 +21,157 @@ JSStaticFunction JSCCharacterData::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCCharacterData::dataAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCCharacterDataPrivate* privData = static_cast<JSCCharacterData::JSCCharacterDataPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getData().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +JSValueRef JSCCharacterData::dataAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getData().c_str()); + return JSValueMakeString(ctx, stringRef); +} + + +bool JSCCharacterData::dataAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { + struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalData = JSValueToStringCopy(ctx, value, exception); + size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData); + char* localDataBuffer = new char[localDataMaxSize]; + JSStringGetUTF8CString(stringReflocalData, localDataBuffer, sizeof(localDataBuffer)); + std::string localData(localDataBuffer, localDataMaxSize); + free(localDataBuffer); + + privData->nativeObj->setData(localData); + return true; +} + +JSValueRef JSCCharacterData::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); +} + +JSValueRef JSCCharacterData::substringDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in substringData"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + unsigned long localCount = (unsigned long)JSValueToNumber(ctx, arguments[1], exception); + + std::string retVal = privData->nativeObj->substringData(localOffset, localCount); + + JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str()); + JSValueRef jscRetVal = JSValueMakeString(ctx, jscString); + return jscRetVal; +} + +JSValueRef JSCCharacterData::appendDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in appendData"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalArg = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localArgMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalArg); + char* localArgBuffer = new char[localArgMaxSize]; + JSStringGetUTF8CString(stringReflocalArg, localArgBuffer, sizeof(localArgBuffer)); + std::string localArg(localArgBuffer, localArgMaxSize); + free(localArgBuffer); + + privData->nativeObj->appendData(localArg); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; } -JSValueRef JSCCharacterData::lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCCharacterDataPrivate* privData = static_cast<JSCCharacterData::JSCCharacterDataPrivate* >(JSObjectGetPrivate(thisObj)); +JSValueRef JSCCharacterData::insertDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in insertData"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + JSStringRef stringReflocalArg = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localArgMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalArg); + char* localArgBuffer = new char[localArgMaxSize]; + JSStringGetUTF8CString(stringReflocalArg, localArgBuffer, sizeof(localArgBuffer)); + std::string localArg(localArgBuffer, localArgMaxSize); + free(localArgBuffer); + + + privData->nativeObj->insertData(localOffset, localArg); - return JSValueMakeNumber(ctx, privData->arabicaThis->getLength()); + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; } +JSValueRef JSCCharacterData::deleteDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in deleteData"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + unsigned long localCount = (unsigned long)JSValueToNumber(ctx, arguments[1], exception); + + privData->nativeObj->deleteData(localOffset, localCount); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCCharacterData::replaceDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 3) { + std::string errorMsg = "Wrong number of arguments in replaceData"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + unsigned long localCount = (unsigned long)JSValueToNumber(ctx, arguments[1], exception); + JSStringRef stringReflocalArg = JSValueToStringCopy(ctx, arguments[2], exception); + size_t localArgMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalArg); + char* localArgBuffer = new char[localArgMaxSize]; + JSStringGetUTF8CString(stringReflocalArg, localArgBuffer, sizeof(localArgBuffer)); + std::string localArg(localArgBuffer, localArgMaxSize); + free(localArgBuffer); + + + privData->nativeObj->replaceData(localOffset, localCount, localArg); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.h index 1289143..2620468 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCCharacterData_h #define JSCCharacterData_h +#include <string> #include "DOM/Node.hpp" #include "JSCNode.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCCharacterData { public: struct JSCCharacterDataPrivate { JSCDOM* dom; - Arabica::DOM::CharacterData<std::string>* arabicaThis; + Arabica::DOM::CharacterData<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCCharacterDataPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.h index c311c49..c1678ea 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCComment_h #define JSCComment_h +#include <string> #include "DOM/Node.hpp" #include "JSCCharacterData.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCComment { public: struct JSCCommentPrivate { JSCDOM* dom; - Arabica::DOM::Comment<std::string>* arabicaThis; + Arabica::DOM::Comment<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCCommentPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h index af946a9..2cd30f6 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h @@ -7,7 +7,7 @@ #define JSC_DESTRUCTOR(type) \ static void jsDestructor(JSObjectRef object) { \ type* thing = static_cast<type*>(JSObjectGetPrivate(object)); \ -delete thing->arabicaThis; \ +delete thing->nativeObj; \ delete thing; \ } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp index ee42a3e..e54d260 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp @@ -1,4 +1,6 @@ #include "JSCDOMImplementation.h" +#include "JSCDocument.h" +#include "JSCDocumentType.h" namespace Arabica { namespace DOM { @@ -15,6 +17,127 @@ JSStaticFunction JSCDOMImplementation::staticFunctions[] = { { "createDocument", createDocumentCallback, kJSPropertyAttributeDontDelete }, { 0, 0, 0 } }; +JSValueRef JSCDOMImplementation::hasFeatureCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in hasFeature"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDOMImplementationPrivate* privData = (struct JSCDOMImplementationPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalFeature = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localFeatureMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalFeature); + char* localFeatureBuffer = new char[localFeatureMaxSize]; + JSStringGetUTF8CString(stringReflocalFeature, localFeatureBuffer, sizeof(localFeatureBuffer)); + std::string localFeature(localFeatureBuffer, localFeatureMaxSize); + free(localFeatureBuffer); + + JSStringRef stringReflocalVersion = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localVersionMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalVersion); + char* localVersionBuffer = new char[localVersionMaxSize]; + JSStringGetUTF8CString(stringReflocalVersion, localVersionBuffer, sizeof(localVersionBuffer)); + std::string localVersion(localVersionBuffer, localVersionMaxSize); + free(localVersionBuffer); + + + bool retVal = privData->nativeObj->hasFeature(localFeature, localVersion); + + JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCDOMImplementation::createDocumentTypeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 3) { + std::string errorMsg = "Wrong number of arguments in createDocumentType"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDOMImplementationPrivate* privData = (struct JSCDOMImplementationPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalQualifiedName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localQualifiedNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalQualifiedName); + char* localQualifiedNameBuffer = new char[localQualifiedNameMaxSize]; + JSStringGetUTF8CString(stringReflocalQualifiedName, localQualifiedNameBuffer, sizeof(localQualifiedNameBuffer)); + std::string localQualifiedName(localQualifiedNameBuffer, localQualifiedNameMaxSize); + free(localQualifiedNameBuffer); + + JSStringRef stringReflocalPublicId = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localPublicIdMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalPublicId); + char* localPublicIdBuffer = new char[localPublicIdMaxSize]; + JSStringGetUTF8CString(stringReflocalPublicId, localPublicIdBuffer, sizeof(localPublicIdBuffer)); + std::string localPublicId(localPublicIdBuffer, localPublicIdMaxSize); + free(localPublicIdBuffer); + + JSStringRef stringReflocalSystemId = JSValueToStringCopy(ctx, arguments[2], exception); + size_t localSystemIdMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalSystemId); + char* localSystemIdBuffer = new char[localSystemIdMaxSize]; + JSStringGetUTF8CString(stringReflocalSystemId, localSystemIdBuffer, sizeof(localSystemIdBuffer)); + std::string localSystemId(localSystemIdBuffer, localSystemIdMaxSize); + free(localSystemIdBuffer); + + + Arabica::DOM::DocumentType<std::string>* retVal = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->createDocumentType(localQualifiedName, localPublicId, localSystemId)); + JSClassRef retClass = JSCDocumentType::getTmpl(); + + struct JSCDocumentType::JSCDocumentTypePrivate* retPrivData = new JSCDocumentType::JSCDocumentTypePrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCDOMImplementation::createDocumentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 3) { + std::string errorMsg = "Wrong number of arguments in createDocument"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDOMImplementationPrivate* privData = (struct JSCDOMImplementationPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalQualifiedName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localQualifiedNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalQualifiedName); + char* localQualifiedNameBuffer = new char[localQualifiedNameMaxSize]; + JSStringGetUTF8CString(stringReflocalQualifiedName, localQualifiedNameBuffer, sizeof(localQualifiedNameBuffer)); + std::string localQualifiedName(localQualifiedNameBuffer, localQualifiedNameMaxSize); + free(localQualifiedNameBuffer); + + Arabica::DOM::DocumentType<std::string>* localDoctype = ((struct JSCDocumentType::JSCDocumentTypePrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + + Arabica::DOM::Document<std::string>* retVal = new Arabica::DOM::Document<std::string>(privData->nativeObj->createDocument(localNamespaceURI, localQualifiedName, *localDoctype)); + JSClassRef retClass = JSCDocument::getTmpl(); + + struct JSCDocument::JSCDocumentPrivate* retPrivData = new JSCDocument::JSCDocumentPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.h index 033f2c1..551c2fe 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCDOMImplementation_h #define JSCDOMImplementation_h +#include <string> #include "DOM/Node.hpp" #include <JavaScriptCore/JavaScriptCore.h> #include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" @@ -32,7 +33,7 @@ class JSCDOMImplementation { public: struct JSCDOMImplementationPrivate { JSCDOM* dom; - Arabica::DOM::DOMImplementation<std::string>* arabicaThis; + Arabica::DOM::DOMImplementation<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCDOMImplementationPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp index 36bb243..a3c394e 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp @@ -1,8 +1,16 @@ +#include "JSCAttr.h" +#include "JSCCDATASection.h" +#include "JSCComment.h" #include "JSCDOMImplementation.h" #include "JSCDocument.h" +#include "JSCDocumentFragment.h" #include "JSCDocumentType.h" #include "JSCElement.h" +#include "JSCEntityReference.h" #include "JSCNode.h" +#include "JSCNodeList.h" +#include "JSCProcessingInstruction.h" +#include "JSCText.h" namespace Arabica { namespace DOM { @@ -35,44 +43,526 @@ JSStaticFunction JSCDocument::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCDocument::doctypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCDocumentPrivate* privData = static_cast<JSCDocument::JSCDocumentPrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::DocumentType<std::string>* arbaicaRet = new Arabica::DOM::DocumentType<std::string>(privData->arabicaThis->getDoctype()); +JSValueRef JSCDocument::doctypeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->getDoctype()) return JSValueMakeUndefined(ctx); + Arabica::DOM::DocumentType<std::string>* arabicaRet = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->getDoctype()); + + JSClassRef arbaicaRetClass = JSCDocumentType::getTmpl(); struct JSCDocumentType::JSCDocumentTypePrivate* retPrivData = new JSCDocumentType::JSCDocumentTypePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCDocumentType::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; - } -JSValueRef JSCDocument::implementationAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCDocumentPrivate* privData = static_cast<JSCDocument::JSCDocumentPrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::DOMImplementation<std::string>* arbaicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->arabicaThis->getImplementation()); + +JSValueRef JSCDocument::implementationAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->getImplementation()) return JSValueMakeUndefined(ctx); + Arabica::DOM::DOMImplementation<std::string>* arabicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->nativeObj->getImplementation()); + + JSClassRef arbaicaRetClass = JSCDOMImplementation::getTmpl(); struct JSCDOMImplementation::JSCDOMImplementationPrivate* retPrivData = new JSCDOMImplementation::JSCDOMImplementationPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCDOMImplementation::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; - } -JSValueRef JSCDocument::documentElementAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCDocumentPrivate* privData = static_cast<JSCDocument::JSCDocumentPrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->arabicaThis->getDocumentElement()); + +JSValueRef JSCDocument::documentElementAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->getDocumentElement()) return JSValueMakeUndefined(ctx); + Arabica::DOM::Element<std::string>* arabicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getDocumentElement()); + + JSClassRef arbaicaRetClass = JSCElement::getTmpl(); struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCElement::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; +} + +JSValueRef JSCDocument::createElementCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in createElement"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalTagName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localTagNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalTagName); + char* localTagNameBuffer = new char[localTagNameMaxSize]; + JSStringGetUTF8CString(stringReflocalTagName, localTagNameBuffer, sizeof(localTagNameBuffer)); + std::string localTagName(localTagNameBuffer, localTagNameMaxSize); + free(localTagNameBuffer); + + + Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElement(localTagName)); + 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; } +JSValueRef JSCDocument::createDocumentFragmentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + + Arabica::DOM::DocumentFragment<std::string>* retVal = new Arabica::DOM::DocumentFragment<std::string>(privData->nativeObj->createDocumentFragment()); + JSClassRef retClass = JSCDocumentFragment::getTmpl(); + + struct JSCDocumentFragment::JSCDocumentFragmentPrivate* retPrivData = new JSCDocumentFragment::JSCDocumentFragmentPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCDocument::createTextNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in createTextNode"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalData = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData); + char* localDataBuffer = new char[localDataMaxSize]; + JSStringGetUTF8CString(stringReflocalData, localDataBuffer, sizeof(localDataBuffer)); + std::string localData(localDataBuffer, localDataMaxSize); + free(localDataBuffer); + + + Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->createTextNode(localData)); + JSClassRef retClass = JSCText::getTmpl(); + + struct JSCText::JSCTextPrivate* retPrivData = new JSCText::JSCTextPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCDocument::createCommentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in createComment"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalData = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData); + char* localDataBuffer = new char[localDataMaxSize]; + JSStringGetUTF8CString(stringReflocalData, localDataBuffer, sizeof(localDataBuffer)); + std::string localData(localDataBuffer, localDataMaxSize); + free(localDataBuffer); + + + Arabica::DOM::Comment<std::string>* retVal = new Arabica::DOM::Comment<std::string>(privData->nativeObj->createComment(localData)); + JSClassRef retClass = JSCComment::getTmpl(); + + struct JSCComment::JSCCommentPrivate* retPrivData = new JSCComment::JSCCommentPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCDocument::createCDATASectionCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in createCDATASection"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalData = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData); + char* localDataBuffer = new char[localDataMaxSize]; + JSStringGetUTF8CString(stringReflocalData, localDataBuffer, sizeof(localDataBuffer)); + std::string localData(localDataBuffer, localDataMaxSize); + free(localDataBuffer); + + + Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->nativeObj->createCDATASection(localData)); + JSClassRef retClass = JSCCDATASection::getTmpl(); + + struct JSCCDATASection::JSCCDATASectionPrivate* retPrivData = new JSCCDATASection::JSCCDATASectionPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCDocument::createProcessingInstructionCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in createProcessingInstruction"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalTarget = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localTargetMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalTarget); + char* localTargetBuffer = new char[localTargetMaxSize]; + JSStringGetUTF8CString(stringReflocalTarget, localTargetBuffer, sizeof(localTargetBuffer)); + std::string localTarget(localTargetBuffer, localTargetMaxSize); + free(localTargetBuffer); + + JSStringRef stringReflocalData = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData); + char* localDataBuffer = new char[localDataMaxSize]; + JSStringGetUTF8CString(stringReflocalData, localDataBuffer, sizeof(localDataBuffer)); + std::string localData(localDataBuffer, localDataMaxSize); + free(localDataBuffer); + + + Arabica::DOM::ProcessingInstruction<std::string>* retVal = new Arabica::DOM::ProcessingInstruction<std::string>(privData->nativeObj->createProcessingInstruction(localTarget, localData)); + JSClassRef retClass = JSCProcessingInstruction::getTmpl(); + + struct JSCProcessingInstruction::JSCProcessingInstructionPrivate* retPrivData = new JSCProcessingInstruction::JSCProcessingInstructionPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCDocument::createAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in createAttribute"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName); + char* localNameBuffer = new char[localNameMaxSize]; + JSStringGetUTF8CString(stringReflocalName, localNameBuffer, sizeof(localNameBuffer)); + std::string localName(localNameBuffer, localNameMaxSize); + free(localNameBuffer); + + + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttribute(localName)); + JSClassRef retClass = JSCAttr::getTmpl(); + + struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCDocument::createEntityReferenceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in createEntityReference"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName); + char* localNameBuffer = new char[localNameMaxSize]; + JSStringGetUTF8CString(stringReflocalName, localNameBuffer, sizeof(localNameBuffer)); + std::string localName(localNameBuffer, localNameMaxSize); + free(localNameBuffer); + + + Arabica::DOM::EntityReference<std::string>* retVal = new Arabica::DOM::EntityReference<std::string>(privData->nativeObj->createEntityReference(localName)); + JSClassRef retClass = JSCEntityReference::getTmpl(); + + struct JSCEntityReference::JSCEntityReferencePrivate* retPrivData = new JSCEntityReference::JSCEntityReferencePrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCDocument::getElementsByTagNameCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in getElementsByTagName"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalTagname = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localTagnameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalTagname); + char* localTagnameBuffer = new char[localTagnameMaxSize]; + JSStringGetUTF8CString(stringReflocalTagname, localTagnameBuffer, sizeof(localTagnameBuffer)); + std::string localTagname(localTagnameBuffer, localTagnameMaxSize); + free(localTagnameBuffer); + + + Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(localTagname)); + JSClassRef retClass = JSCNodeList::getTmpl(); + + struct JSCNodeList::JSCNodeListPrivate* retPrivData = new JSCNodeList::JSCNodeListPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCDocument::importNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in importNode"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + Arabica::DOM::Node<std::string>* localImportedNode = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + bool localDeep = JSValueToBoolean(ctx, arguments[1]); + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->importNode(*localImportedNode, localDeep)); + 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; + +} + +JSValueRef JSCDocument::createElementNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in createElementNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalQualifiedName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localQualifiedNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalQualifiedName); + char* localQualifiedNameBuffer = new char[localQualifiedNameMaxSize]; + JSStringGetUTF8CString(stringReflocalQualifiedName, localQualifiedNameBuffer, sizeof(localQualifiedNameBuffer)); + std::string localQualifiedName(localQualifiedNameBuffer, localQualifiedNameMaxSize); + free(localQualifiedNameBuffer); + + + Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElementNS(localNamespaceURI, localQualifiedName)); + 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; + +} + +JSValueRef JSCDocument::createAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in createAttributeNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalQualifiedName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localQualifiedNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalQualifiedName); + char* localQualifiedNameBuffer = new char[localQualifiedNameMaxSize]; + JSStringGetUTF8CString(stringReflocalQualifiedName, localQualifiedNameBuffer, sizeof(localQualifiedNameBuffer)); + std::string localQualifiedName(localQualifiedNameBuffer, localQualifiedNameMaxSize); + free(localQualifiedNameBuffer); + + + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttributeNS(localNamespaceURI, localQualifiedName)); + JSClassRef retClass = JSCAttr::getTmpl(); + + struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCDocument::getElementsByTagNameNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in getElementsByTagNameNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName); + char* localLocalNameBuffer = new char[localLocalNameMaxSize]; + JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, sizeof(localLocalNameBuffer)); + std::string localLocalName(localLocalNameBuffer, localLocalNameMaxSize); + free(localLocalNameBuffer); + + + Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(localNamespaceURI, localLocalName)); + JSClassRef retClass = JSCNodeList::getTmpl(); + + struct JSCNodeList::JSCNodeListPrivate* retPrivData = new JSCNodeList::JSCNodeListPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCDocument::getElementByIdCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in getElementById"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCDocumentPrivate* privData = (struct JSCDocumentPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalElementId = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localElementIdMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalElementId); + char* localElementIdBuffer = new char[localElementIdMaxSize]; + JSStringGetUTF8CString(stringReflocalElementId, localElementIdBuffer, sizeof(localElementIdBuffer)); + std::string localElementId(localElementIdBuffer, localElementIdMaxSize); + free(localElementIdBuffer); + + + Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->getElementById(localElementId)); + 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; + +} + + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.h index c1f052e..3446cc2 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCDocument_h #define JSCDocument_h +#include <string> #include "DOM/Node.hpp" #include "JSCNode.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCDocument { public: struct JSCDocumentPrivate { JSCDOM* dom; - Arabica::DOM::Document<std::string>* arabicaThis; + Arabica::DOM::Document<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCDocumentPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.h index 4c6f46e..1d8a9c9 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCDocumentFragment_h #define JSCDocumentFragment_h +#include <string> #include "DOM/Node.hpp" #include "JSCNode.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCDocumentFragment { public: struct JSCDocumentFragmentPrivate { JSCDOM* dom; - Arabica::DOM::DocumentFragment<std::string>* arabicaThis; + Arabica::DOM::DocumentFragment<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCDocumentFragmentPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp index bbfa35c..0d9d059 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp @@ -21,67 +21,67 @@ JSStaticFunction JSCDocumentType::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCDocumentType::nameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCDocumentTypePrivate* privData = static_cast<JSCDocumentType::JSCDocumentTypePrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getName().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; - +JSValueRef JSCDocumentType::nameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getName().c_str()); + return JSValueMakeString(ctx, stringRef); } -JSValueRef JSCDocumentType::entitiesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCDocumentTypePrivate* privData = static_cast<JSCDocumentType::JSCDocumentTypePrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->arabicaThis->getEntities()); + +JSValueRef JSCDocumentType::entitiesAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object); + + + Arabica::DOM::NamedNodeMap<std::string>* arabicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getEntities()); + + JSClassRef arbaicaRetClass = JSCNamedNodeMap::getTmpl(); struct JSCNamedNodeMap::JSCNamedNodeMapPrivate* retPrivData = new JSCNamedNodeMap::JSCNamedNodeMapPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNamedNodeMap::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; - } -JSValueRef JSCDocumentType::notationsAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCDocumentTypePrivate* privData = static_cast<JSCDocumentType::JSCDocumentTypePrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->arabicaThis->getNotations()); + +JSValueRef JSCDocumentType::notationsAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object); + + + Arabica::DOM::NamedNodeMap<std::string>* arabicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getNotations()); + + JSClassRef arbaicaRetClass = JSCNamedNodeMap::getTmpl(); struct JSCNamedNodeMap::JSCNamedNodeMapPrivate* retPrivData = new JSCNamedNodeMap::JSCNamedNodeMapPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNamedNodeMap::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; - } -JSValueRef JSCDocumentType::publicIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCDocumentTypePrivate* privData = static_cast<JSCDocumentType::JSCDocumentTypePrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getPublicId().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +JSValueRef JSCDocumentType::publicIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getPublicId().c_str()); + return JSValueMakeString(ctx, stringRef); } -JSValueRef JSCDocumentType::systemIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCDocumentTypePrivate* privData = static_cast<JSCDocumentType::JSCDocumentTypePrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getSystemId().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +JSValueRef JSCDocumentType::systemIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getSystemId().c_str()); + return JSValueMakeString(ctx, stringRef); } -JSValueRef JSCDocumentType::internalSubsetAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCDocumentTypePrivate* privData = static_cast<JSCDocumentType::JSCDocumentTypePrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getInternalSubset().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +JSValueRef JSCDocumentType::internalSubsetAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCDocumentTypePrivate* privData = (struct JSCDocumentTypePrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getInternalSubset().c_str()); + return JSValueMakeString(ctx, stringRef); } + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.h index 875b1f7..6f839a2 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCDocumentType_h #define JSCDocumentType_h +#include <string> #include "DOM/Node.hpp" #include "JSCNode.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCDocumentType { public: struct JSCDocumentTypePrivate { JSCDOM* dom; - Arabica::DOM::DocumentType<std::string>* arabicaThis; + Arabica::DOM::DocumentType<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCDocumentTypePrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp index 2ff24d7..4b885f0 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp @@ -1,5 +1,7 @@ +#include "JSCAttr.h" #include "JSCElement.h" #include "JSCNode.h" +#include "JSCNodeList.h" namespace Arabica { namespace DOM { @@ -30,14 +32,491 @@ JSStaticFunction JSCElement::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCElement::tagNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCElementPrivate* privData = static_cast<JSCElement::JSCElementPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getTagName().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); +JSValueRef JSCElement::tagNameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getTagName().c_str()); + return JSValueMakeString(ctx, stringRef); +} + +JSValueRef JSCElement::getAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in getAttribute"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName); + char* localNameBuffer = new char[localNameMaxSize]; + JSStringGetUTF8CString(stringReflocalName, localNameBuffer, sizeof(localNameBuffer)); + std::string localName(localNameBuffer, localNameMaxSize); + free(localNameBuffer); + + + std::string retVal = privData->nativeObj->getAttribute(localName); + + JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str()); + JSValueRef jscRetVal = JSValueMakeString(ctx, jscString); + return jscRetVal; +} + +JSValueRef JSCElement::setAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in setAttribute"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName); + char* localNameBuffer = new char[localNameMaxSize]; + JSStringGetUTF8CString(stringReflocalName, localNameBuffer, sizeof(localNameBuffer)); + std::string localName(localNameBuffer, localNameMaxSize); + free(localNameBuffer); + + JSStringRef stringReflocalValue = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localValueMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalValue); + char* localValueBuffer = new char[localValueMaxSize]; + JSStringGetUTF8CString(stringReflocalValue, localValueBuffer, sizeof(localValueBuffer)); + std::string localValue(localValueBuffer, localValueMaxSize); + free(localValueBuffer); + + + privData->nativeObj->setAttribute(localName, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCElement::removeAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in removeAttribute"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName); + char* localNameBuffer = new char[localNameMaxSize]; + JSStringGetUTF8CString(stringReflocalName, localNameBuffer, sizeof(localNameBuffer)); + std::string localName(localNameBuffer, localNameMaxSize); + free(localNameBuffer); + + + privData->nativeObj->removeAttribute(localName); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCElement::getAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in getAttributeNode"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName); + char* localNameBuffer = new char[localNameMaxSize]; + JSStringGetUTF8CString(stringReflocalName, localNameBuffer, sizeof(localNameBuffer)); + std::string localName(localNameBuffer, localNameMaxSize); + free(localNameBuffer); + + + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNode(localName)); + JSClassRef retClass = JSCAttr::getTmpl(); + + struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + return retObj; } +JSValueRef JSCElement::setAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in setAttributeNode"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + Arabica::DOM::Attr<std::string>* localNewAttr = ((struct JSCAttr::JSCAttrPrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNode(*localNewAttr)); + JSClassRef retClass = JSCAttr::getTmpl(); + + struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCElement::removeAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in removeAttributeNode"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + Arabica::DOM::Attr<std::string>* localOldAttr = ((struct JSCAttr::JSCAttrPrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->removeAttributeNode(*localOldAttr)); + JSClassRef retClass = JSCAttr::getTmpl(); + + struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCElement::getElementsByTagNameCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in getElementsByTagName"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName); + char* localNameBuffer = new char[localNameMaxSize]; + JSStringGetUTF8CString(stringReflocalName, localNameBuffer, sizeof(localNameBuffer)); + std::string localName(localNameBuffer, localNameMaxSize); + free(localNameBuffer); + + + Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(localName)); + JSClassRef retClass = JSCNodeList::getTmpl(); + + struct JSCNodeList::JSCNodeListPrivate* retPrivData = new JSCNodeList::JSCNodeListPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCElement::getAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in getAttributeNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName); + char* localLocalNameBuffer = new char[localLocalNameMaxSize]; + JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, sizeof(localLocalNameBuffer)); + std::string localLocalName(localLocalNameBuffer, localLocalNameMaxSize); + free(localLocalNameBuffer); + + + std::string retVal = privData->nativeObj->getAttributeNS(localNamespaceURI, localLocalName); + + JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str()); + JSValueRef jscRetVal = JSValueMakeString(ctx, jscString); + return jscRetVal; +} + +JSValueRef JSCElement::setAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 3) { + std::string errorMsg = "Wrong number of arguments in setAttributeNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalQualifiedName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localQualifiedNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalQualifiedName); + char* localQualifiedNameBuffer = new char[localQualifiedNameMaxSize]; + JSStringGetUTF8CString(stringReflocalQualifiedName, localQualifiedNameBuffer, sizeof(localQualifiedNameBuffer)); + std::string localQualifiedName(localQualifiedNameBuffer, localQualifiedNameMaxSize); + free(localQualifiedNameBuffer); + + JSStringRef stringReflocalValue = JSValueToStringCopy(ctx, arguments[2], exception); + size_t localValueMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalValue); + char* localValueBuffer = new char[localValueMaxSize]; + JSStringGetUTF8CString(stringReflocalValue, localValueBuffer, sizeof(localValueBuffer)); + std::string localValue(localValueBuffer, localValueMaxSize); + free(localValueBuffer); + + + privData->nativeObj->setAttributeNS(localNamespaceURI, localQualifiedName, localValue); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCElement::removeAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in removeAttributeNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName); + char* localLocalNameBuffer = new char[localLocalNameMaxSize]; + JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, sizeof(localLocalNameBuffer)); + std::string localLocalName(localLocalNameBuffer, localLocalNameMaxSize); + free(localLocalNameBuffer); + + + privData->nativeObj->removeAttributeNS(localNamespaceURI, localLocalName); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCElement::getAttributeNodeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in getAttributeNodeNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName); + char* localLocalNameBuffer = new char[localLocalNameMaxSize]; + JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, sizeof(localLocalNameBuffer)); + std::string localLocalName(localLocalNameBuffer, localLocalNameMaxSize); + free(localLocalNameBuffer); + + + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNodeNS(localNamespaceURI, localLocalName)); + JSClassRef retClass = JSCAttr::getTmpl(); + + struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCElement::setAttributeNodeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in setAttributeNodeNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + Arabica::DOM::Attr<std::string>* localNewAttr = ((struct JSCAttr::JSCAttrPrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNodeNS(*localNewAttr)); + JSClassRef retClass = JSCAttr::getTmpl(); + + struct JSCAttr::JSCAttrPrivate* retPrivData = new JSCAttr::JSCAttrPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCElement::getElementsByTagNameNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in getElementsByTagNameNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName); + char* localLocalNameBuffer = new char[localLocalNameMaxSize]; + JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, sizeof(localLocalNameBuffer)); + std::string localLocalName(localLocalNameBuffer, localLocalNameMaxSize); + free(localLocalNameBuffer); + + + Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(localNamespaceURI, localLocalName)); + JSClassRef retClass = JSCNodeList::getTmpl(); + + struct JSCNodeList::JSCNodeListPrivate* retPrivData = new JSCNodeList::JSCNodeListPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCElement::hasAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in hasAttribute"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName); + char* localNameBuffer = new char[localNameMaxSize]; + JSStringGetUTF8CString(stringReflocalName, localNameBuffer, sizeof(localNameBuffer)); + std::string localName(localNameBuffer, localNameMaxSize); + free(localNameBuffer); + + + bool retVal = privData->nativeObj->hasAttribute(localName); + + JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCElement::hasAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in hasAttributeNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCElementPrivate* privData = (struct JSCElementPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName); + char* localLocalNameBuffer = new char[localLocalNameMaxSize]; + JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, sizeof(localLocalNameBuffer)); + std::string localLocalName(localLocalNameBuffer, localLocalNameMaxSize); + free(localLocalNameBuffer); + + + bool retVal = privData->nativeObj->hasAttributeNS(localNamespaceURI, localLocalName); + + JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal); + return jscRetVal; +} + + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.h index 01f9f2f..42dc2ac 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCElement_h #define JSCElement_h +#include <string> #include "DOM/Node.hpp" #include "JSCNode.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCElement { public: struct JSCElementPrivate { JSCDOM* dom; - Arabica::DOM::Element<std::string>* arabicaThis; + Arabica::DOM::Element<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCElementPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp index 55aee54..717b5dd 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp @@ -17,32 +17,26 @@ JSStaticFunction JSCEntity::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCEntity::publicIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCEntityPrivate* privData = static_cast<JSCEntity::JSCEntityPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getPublicId().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; - +JSValueRef JSCEntity::publicIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCEntityPrivate* privData = (struct JSCEntityPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getPublicId().c_str()); + return JSValueMakeString(ctx, stringRef); } -JSValueRef JSCEntity::systemIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCEntityPrivate* privData = static_cast<JSCEntity::JSCEntityPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getSystemId().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +JSValueRef JSCEntity::systemIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCEntityPrivate* privData = (struct JSCEntityPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getSystemId().c_str()); + return JSValueMakeString(ctx, stringRef); } -JSValueRef JSCEntity::notationNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCEntityPrivate* privData = static_cast<JSCEntity::JSCEntityPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getNotationName().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +JSValueRef JSCEntity::notationNameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCEntityPrivate* privData = (struct JSCEntityPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getNotationName().c_str()); + return JSValueMakeString(ctx, stringRef); } + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.h index 79d8ddf..e16cc1f 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCEntity_h #define JSCEntity_h +#include <string> #include "DOM/Node.hpp" #include "JSCNode.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCEntity { public: struct JSCEntityPrivate { JSCDOM* dom; - Arabica::DOM::Entity<std::string>* arabicaThis; + Arabica::DOM::Entity<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCEntityPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.h index 48a660d..d8e4803 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCEntityReference_h #define JSCEntityReference_h +#include <string> #include "DOM/Node.hpp" #include "JSCNode.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCEntityReference { public: struct JSCEntityReferencePrivate { JSCDOM* dom; - Arabica::DOM::EntityReference<std::string>* arabicaThis; + Arabica::DOM::EntityReference<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCEntityReferencePrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp index 49ef0c1..9b344d2 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp @@ -1,4 +1,5 @@ #include "JSCNamedNodeMap.h" +#include "JSCNode.h" namespace Arabica { namespace DOM { @@ -21,11 +22,239 @@ JSStaticFunction JSCNamedNodeMap::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCNamedNodeMap::lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNamedNodeMapPrivate* privData = static_cast<JSCNamedNodeMap::JSCNamedNodeMapPrivate* >(JSObjectGetPrivate(thisObj)); +JSValueRef JSCNamedNodeMap::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(object); - return JSValueMakeNumber(ctx, privData->arabicaThis->getLength()); + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); } +JSValueRef JSCNamedNodeMap::getNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in getNamedItem"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName); + char* localNameBuffer = new char[localNameMaxSize]; + JSStringGetUTF8CString(stringReflocalName, localNameBuffer, sizeof(localNameBuffer)); + std::string localName(localNameBuffer, localNameMaxSize); + free(localNameBuffer); + + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItem(localName)); + 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; + +} + +JSValueRef JSCNamedNodeMap::setNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in setNamedItem"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj); + + Arabica::DOM::Node<std::string>* localArg = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItem(*localArg)); + 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; + +} + +JSValueRef JSCNamedNodeMap::removeNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in removeNamedItem"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalName = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalName); + char* localNameBuffer = new char[localNameMaxSize]; + JSStringGetUTF8CString(stringReflocalName, localNameBuffer, sizeof(localNameBuffer)); + std::string localName(localNameBuffer, localNameMaxSize); + free(localNameBuffer); + + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItem(localName)); + 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; + +} + +JSValueRef JSCNamedNodeMap::itemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in item"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex)); + 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; + +} + +JSValueRef JSCNamedNodeMap::getNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in getNamedItemNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName); + char* localLocalNameBuffer = new char[localLocalNameMaxSize]; + JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, sizeof(localLocalNameBuffer)); + std::string localLocalName(localLocalNameBuffer, localLocalNameMaxSize); + free(localLocalNameBuffer); + + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItemNS(localNamespaceURI, localLocalName)); + 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; + +} + +JSValueRef JSCNamedNodeMap::setNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in setNamedItemNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj); + + Arabica::DOM::Node<std::string>* localArg = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItemNS(*localArg)); + 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; + +} + +JSValueRef JSCNamedNodeMap::removeNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in removeNamedItemNS"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNamedNodeMapPrivate* privData = (struct JSCNamedNodeMapPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNamespaceURI = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localNamespaceURIMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNamespaceURI); + char* localNamespaceURIBuffer = new char[localNamespaceURIMaxSize]; + JSStringGetUTF8CString(stringReflocalNamespaceURI, localNamespaceURIBuffer, sizeof(localNamespaceURIBuffer)); + std::string localNamespaceURI(localNamespaceURIBuffer, localNamespaceURIMaxSize); + free(localNamespaceURIBuffer); + + JSStringRef stringReflocalLocalName = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localLocalNameMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalLocalName); + char* localLocalNameBuffer = new char[localLocalNameMaxSize]; + JSStringGetUTF8CString(stringReflocalLocalName, localLocalNameBuffer, sizeof(localLocalNameBuffer)); + std::string localLocalName(localLocalNameBuffer, localLocalNameMaxSize); + free(localLocalNameBuffer); + + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItemNS(localNamespaceURI, localLocalName)); + 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; + +} + + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.h index b95796a..c82bfdd 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCNamedNodeMap_h #define JSCNamedNodeMap_h +#include <string> #include "DOM/Node.hpp" #include <JavaScriptCore/JavaScriptCore.h> #include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" @@ -32,7 +33,7 @@ class JSCNamedNodeMap { public: struct JSCNamedNodeMapPrivate { JSCDOM* dom; - Arabica::DOM::NamedNodeMap<std::string>* arabicaThis; + Arabica::DOM::NamedNodeMap<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCNamedNodeMapPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp index ca1ca41..54e7139 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp @@ -1,5 +1,4 @@ #include "JSCDocument.h" -#include "JSCNamedNodeMap.h" #include "JSCNode.h" #include "JSCNodeList.h" @@ -17,7 +16,7 @@ JSStaticValue JSCNode::staticValues[] = { { "lastChild", lastChildAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, { "previousSibling", previousSiblingAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, { "nextSibling", nextSiblingAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "attributes", attributesAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "attributes", attributesCustomAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, { "ownerDocument", ownerDocumentAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, { "namespaceURI", namespaceURIAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, { "prefix", prefixAttrGetter, prefixAttrSetter, kJSPropertyAttributeDontDelete }, @@ -51,160 +50,397 @@ JSStaticFunction JSCNode::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCNode::nodeNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getNodeName().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +JSValueRef JSCNode::nodeNameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getNodeName().c_str()); + return JSValueMakeString(ctx, stringRef); +} + +JSValueRef JSCNode::nodeValueAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getNodeValue().c_str()); + return JSValueMakeString(ctx, stringRef); } -JSValueRef JSCNode::nodeValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getNodeValue().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +bool JSCNode::nodeValueAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalNodeValue = JSValueToStringCopy(ctx, value, exception); + size_t localNodeValueMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalNodeValue); + char* localNodeValueBuffer = new char[localNodeValueMaxSize]; + JSStringGetUTF8CString(stringReflocalNodeValue, localNodeValueBuffer, sizeof(localNodeValueBuffer)); + std::string localNodeValue(localNodeValueBuffer, localNodeValueMaxSize); + free(localNodeValueBuffer); + + privData->nativeObj->setNodeValue(localNodeValue); + return true; } -JSValueRef JSCNode::nodeTypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); +JSValueRef JSCNode::nodeTypeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); - return JSValueMakeNumber(ctx, privData->arabicaThis->getNodeType()); + return JSValueMakeNumber(ctx, privData->nativeObj->getNodeType()); } -JSValueRef JSCNode::parentNodeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getParentNode()); + +JSValueRef JSCNode::parentNodeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->getParentNode()) return JSValueMakeUndefined(ctx); + Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getParentNode()); + + JSClassRef arbaicaRetClass = JSCNode::getTmpl(); struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNode::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; - } -JSValueRef JSCNode::childNodesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::NodeList<std::string>* arbaicaRet = new Arabica::DOM::NodeList<std::string>(privData->arabicaThis->getChildNodes()); + +JSValueRef JSCNode::childNodesAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + + + Arabica::DOM::NodeList<std::string>* arabicaRet = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getChildNodes()); + + JSClassRef arbaicaRetClass = JSCNodeList::getTmpl(); struct JSCNodeList::JSCNodeListPrivate* retPrivData = new JSCNodeList::JSCNodeListPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNodeList::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; - } -JSValueRef JSCNode::firstChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getFirstChild()); + +JSValueRef JSCNode::firstChildAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->getFirstChild()) return JSValueMakeUndefined(ctx); + Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getFirstChild()); + + JSClassRef arbaicaRetClass = JSCNode::getTmpl(); struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNode::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; - } -JSValueRef JSCNode::lastChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getLastChild()); + +JSValueRef JSCNode::lastChildAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->getLastChild()) return JSValueMakeUndefined(ctx); + Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getLastChild()); + + JSClassRef arbaicaRetClass = JSCNode::getTmpl(); struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNode::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; - } -JSValueRef JSCNode::previousSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getPreviousSibling()); + +JSValueRef JSCNode::previousSiblingAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->getPreviousSibling()) return JSValueMakeUndefined(ctx); + Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getPreviousSibling()); + + JSClassRef arbaicaRetClass = JSCNode::getTmpl(); struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNode::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; - } -JSValueRef JSCNode::nextSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getNextSibling()); + +JSValueRef JSCNode::nextSiblingAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->getNextSibling()) return JSValueMakeUndefined(ctx); + Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNextSibling()); + + JSClassRef arbaicaRetClass = JSCNode::getTmpl(); struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNode::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; - } -JSValueRef JSCNode::attributesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->arabicaThis->getAttributes()); - struct JSCNamedNodeMap::JSCNamedNodeMapPrivate* retPrivData = new JSCNamedNodeMap::JSCNamedNodeMapPrivate(); +JSValueRef JSCNode::ownerDocumentAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->getOwnerDocument()) return JSValueMakeUndefined(ctx); + Arabica::DOM::Document<std::string>* arabicaRet = new Arabica::DOM::Document<std::string>(privData->nativeObj->getOwnerDocument()); + + JSClassRef arbaicaRetClass = JSCDocument::getTmpl(); + + struct JSCDocument::JSCDocumentPrivate* retPrivData = new JSCDocument::JSCDocumentPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arabicaRet; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNamedNodeMap::getTmpl(), retPrivData); + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); return arbaicaRetObj; +} + +JSValueRef JSCNode::namespaceURIAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getNamespaceURI().c_str()); + return JSValueMakeString(ctx, stringRef); } -JSValueRef JSCNode::ownerDocumentAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - Arabica::DOM::Document<std::string>* arbaicaRet = new Arabica::DOM::Document<std::string>(privData->arabicaThis->getOwnerDocument()); - struct JSCDocument::JSCDocumentPrivate* retPrivData = new JSCDocument::JSCDocumentPrivate(); +JSValueRef JSCNode::prefixAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getPrefix().c_str()); + return JSValueMakeString(ctx, stringRef); +} + + +bool JSCNode::prefixAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalPrefix = JSValueToStringCopy(ctx, value, exception); + size_t localPrefixMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalPrefix); + char* localPrefixBuffer = new char[localPrefixMaxSize]; + JSStringGetUTF8CString(stringReflocalPrefix, localPrefixBuffer, sizeof(localPrefixBuffer)); + std::string localPrefix(localPrefixBuffer, localPrefixMaxSize); + free(localPrefixBuffer); + + privData->nativeObj->setPrefix(localPrefix); + return true; +} + +JSValueRef JSCNode::localNameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getLocalName().c_str()); + return JSValueMakeString(ctx, stringRef); +} + +JSValueRef JSCNode::insertBeforeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in insertBefore"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj); + + Arabica::DOM::Node<std::string>* localNewChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + Arabica::DOM::Node<std::string>* localRefChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->insertBefore(*localNewChild, *localRefChild)); + JSClassRef retClass = JSCNode::getTmpl(); + + struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = retVal; - JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCDocument::getTmpl(), retPrivData); - return arbaicaRetObj; + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + +JSValueRef JSCNode::replaceChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in replaceChild"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj); + + Arabica::DOM::Node<std::string>* localNewChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + Arabica::DOM::Node<std::string>* localOldChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->replaceChild(*localNewChild, *localOldChild)); + 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; } -JSValueRef JSCNode::namespaceURIAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getNamespaceURI().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); +JSValueRef JSCNode::removeChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in removeChild"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj); + + Arabica::DOM::Node<std::string>* localOldChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeChild(*localOldChild)); + 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; } -JSValueRef JSCNode::prefixAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getPrefix().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); +JSValueRef JSCNode::appendChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in appendChild"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj); + + Arabica::DOM::Node<std::string>* localNewChild = ((struct JSCNode::JSCNodePrivate*)JSObjectGetPrivate(thisObj))->nativeObj; + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->appendChild(*localNewChild)); + 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; } -JSValueRef JSCNode::localNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getLocalName().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); +JSValueRef JSCNode::hasChildNodesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj); + + + bool retVal = privData->nativeObj->hasChildNodes(); + + JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCNode::cloneNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in cloneNode"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj); + + bool localDeep = JSValueToBoolean(ctx, arguments[0]); + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->cloneNode(localDeep)); + 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; } +JSValueRef JSCNode::normalizeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj); + + + privData->nativeObj->normalize(); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; +} + +JSValueRef JSCNode::isSupportedCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 2) { + std::string errorMsg = "Wrong number of arguments in isSupported"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalFeature = JSValueToStringCopy(ctx, arguments[0], exception); + size_t localFeatureMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalFeature); + char* localFeatureBuffer = new char[localFeatureMaxSize]; + JSStringGetUTF8CString(stringReflocalFeature, localFeatureBuffer, sizeof(localFeatureBuffer)); + std::string localFeature(localFeatureBuffer, localFeatureMaxSize); + free(localFeatureBuffer); + + JSStringRef stringReflocalVersion = JSValueToStringCopy(ctx, arguments[1], exception); + size_t localVersionMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalVersion); + char* localVersionBuffer = new char[localVersionMaxSize]; + JSStringGetUTF8CString(stringReflocalVersion, localVersionBuffer, sizeof(localVersionBuffer)); + std::string localVersion(localVersionBuffer, localVersionMaxSize); + free(localVersionBuffer); + + + bool retVal = privData->nativeObj->isSupported(localFeature, localVersion); + + JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCNode::hasAttributesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + + struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj); + + + bool retVal = privData->nativeObj->hasAttributes(); + + JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal); + return jscRetVal; +} + + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h index f99d561..d833ecb 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCNode_h #define JSCNode_h +#include <string> #include "DOM/Node.hpp" #include <JavaScriptCore/JavaScriptCore.h> #include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" @@ -32,7 +33,7 @@ class JSCNode { public: struct JSCNodePrivate { JSCDOM* dom; - Arabica::DOM::Node<std::string>* arabicaThis; + Arabica::DOM::Node<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCNodePrivate); @@ -57,13 +58,12 @@ public: static JSValueRef lastChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); static JSValueRef previousSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); static JSValueRef nextSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); - static JSValueRef attributesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef attributesCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); static JSValueRef ownerDocumentAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); static JSValueRef namespaceURIAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); static JSValueRef prefixAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); static bool prefixAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); static JSValueRef localNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); - static JSValueRef ELEMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); static JSValueRef ATTRIBUTE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); static JSValueRef TEXT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); @@ -77,6 +77,7 @@ public: static JSValueRef DOCUMENT_FRAGMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); static JSValueRef NOTATION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSStaticValue staticValues[]; static JSStaticFunction staticFunctions[]; diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp index 5046dcd..60c47e8 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp @@ -1,3 +1,4 @@ +#include "JSCNode.h" #include "JSCNodeList.h" namespace Arabica { @@ -15,11 +16,39 @@ JSStaticFunction JSCNodeList::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCNodeList::lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodeListPrivate* privData = static_cast<JSCNodeList::JSCNodeListPrivate* >(JSObjectGetPrivate(thisObj)); +JSValueRef JSCNodeList::lengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodeListPrivate* privData = (struct JSCNodeListPrivate*)JSObjectGetPrivate(object); - return JSValueMakeNumber(ctx, privData->arabicaThis->getLength()); + return JSValueMakeNumber(ctx, privData->nativeObj->getLength()); } +JSValueRef JSCNodeList::itemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in item"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCNodeListPrivate* privData = (struct JSCNodeListPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localIndex = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex)); + 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; + +} + + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.h index 6236deb..4a1ba11 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCNodeList_h #define JSCNodeList_h +#include <string> #include "DOM/Node.hpp" #include <JavaScriptCore/JavaScriptCore.h> #include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" @@ -32,7 +33,7 @@ class JSCNodeList { public: struct JSCNodeListPrivate { JSCDOM* dom; - Arabica::DOM::NodeList<std::string>* arabicaThis; + Arabica::DOM::NodeList<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCNodeListPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp index 7c72faf..c2b56c1 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp @@ -16,17 +16,30 @@ JSStaticFunction JSCNodeSet::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCNodeSet::sizeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodeSetPrivate* privData = static_cast<JSCNodeSet::JSCNodeSetPrivate* >(JSObjectGetPrivate(thisObj)); +JSValueRef JSCNodeSet::sizeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodeSetPrivate* privData = (struct JSCNodeSetPrivate*)JSObjectGetPrivate(object); - return JSValueMakeNumber(ctx, privData->arabicaThis->size()); + return JSValueMakeNumber(ctx, privData->nativeObj->size()); } -JSValueRef JSCNodeSet::emptyAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNodeSetPrivate* privData = static_cast<JSCNodeSet::JSCNodeSetPrivate* >(JSObjectGetPrivate(thisObj)); - return JSValueMakeBoolean(ctx, privData->arabicaThis->empty()); +JSValueRef JSCNodeSet::emptyAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNodeSetPrivate* privData = (struct JSCNodeSetPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->empty()); +} + +JSValueRef JSCNodeSet::toDocumentOrderCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + + struct JSCNodeSetPrivate* privData = (struct JSCNodeSetPrivate*)JSObjectGetPrivate(thisObj); + + + privData->nativeObj->to_document_order(); + + JSValueRef jscRetVal = JSValueMakeUndefined(ctx); + return jscRetVal; } + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.h index 5ee0b9b..42b4f29 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCNodeSet_h #define JSCNodeSet_h +#include <string> #include "DOM/Node.hpp" #include <JavaScriptCore/JavaScriptCore.h> #include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" @@ -32,7 +33,7 @@ class JSCNodeSet { public: struct JSCNodeSetPrivate { JSCDOM* dom; - Arabica::XPath::NodeSet<std::string>* arabicaThis; + Arabica::XPath::NodeSet<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCNodeSetPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp index 04bb8ec..ba6d506 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp @@ -16,23 +16,19 @@ JSStaticFunction JSCNotation::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCNotation::publicIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNotationPrivate* privData = static_cast<JSCNotation::JSCNotationPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getPublicId().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; - +JSValueRef JSCNotation::publicIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNotationPrivate* privData = (struct JSCNotationPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getPublicId().c_str()); + return JSValueMakeString(ctx, stringRef); } -JSValueRef JSCNotation::systemIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCNotationPrivate* privData = static_cast<JSCNotation::JSCNotationPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getSystemId().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +JSValueRef JSCNotation::systemIdAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCNotationPrivate* privData = (struct JSCNotationPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getSystemId().c_str()); + return JSValueMakeString(ctx, stringRef); } + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.h index 29e7280..ed793ed 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCNotation_h #define JSCNotation_h +#include <string> #include "DOM/Node.hpp" #include "JSCNode.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCNotation { public: struct JSCNotationPrivate { JSCDOM* dom; - Arabica::DOM::Notation<std::string>* arabicaThis; + Arabica::DOM::Notation<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCNotationPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp index a9e69e6..864f455 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp @@ -16,22 +16,32 @@ JSStaticFunction JSCProcessingInstruction::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCProcessingInstruction::targetAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCProcessingInstructionPrivate* privData = static_cast<JSCProcessingInstruction::JSCProcessingInstructionPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getTarget().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +JSValueRef JSCProcessingInstruction::targetAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCProcessingInstructionPrivate* privData = (struct JSCProcessingInstructionPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getTarget().c_str()); + return JSValueMakeString(ctx, stringRef); +} + +JSValueRef JSCProcessingInstruction::dataAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCProcessingInstructionPrivate* privData = (struct JSCProcessingInstructionPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getData().c_str()); + return JSValueMakeString(ctx, stringRef); } -JSValueRef JSCProcessingInstruction::dataAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCProcessingInstructionPrivate* privData = static_cast<JSCProcessingInstruction::JSCProcessingInstructionPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->getData().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); - return retObj; +bool JSCProcessingInstruction::dataAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { + struct JSCProcessingInstructionPrivate* privData = (struct JSCProcessingInstructionPrivate*)JSObjectGetPrivate(thisObj); + + JSStringRef stringReflocalData = JSValueToStringCopy(ctx, value, exception); + size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData); + char* localDataBuffer = new char[localDataMaxSize]; + JSStringGetUTF8CString(stringReflocalData, localDataBuffer, sizeof(localDataBuffer)); + std::string localData(localDataBuffer, localDataMaxSize); + free(localDataBuffer); + + privData->nativeObj->setData(localData); + return true; } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.h index 835fb2e..fdf7bc5 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCProcessingInstruction_h #define JSCProcessingInstruction_h +#include <string> #include "DOM/Node.hpp" #include "JSCNode.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCProcessingInstruction { public: struct JSCProcessingInstructionPrivate { JSCDOM* dom; - Arabica::DOM::ProcessingInstruction<std::string>* arabicaThis; + Arabica::DOM::ProcessingInstruction<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCProcessingInstructionPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp new file mode 100644 index 0000000..2e43005 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.cpp @@ -0,0 +1,93 @@ +#include "JSCNode.h" +#include "JSCSCXMLEvent.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCSCXMLEvent::staticValues[] = { + { "type", typeCustomAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "name", nameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "origin", originAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "origintype", origintypeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "raw", rawAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "dom", domAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "sendid", sendidCustomAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "invokeid", invokeidAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { "INTERNAL", INTERNALConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "EXTERNAL", EXTERNALConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "PLATFORM", PLATFORMConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCSCXMLEvent::staticFunctions[] = { + { 0, 0, 0 } +}; + +JSValueRef JSCSCXMLEvent::nameAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->name.c_str()); + return JSValueMakeString(ctx, stringRef); +} + + +JSValueRef JSCSCXMLEvent::originAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object); + + if (privData->nativeObj->origin.length() == 0) + return JSValueMakeUndefined(ctx); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->origin.c_str()); + return JSValueMakeString(ctx, stringRef); +} + + +JSValueRef JSCSCXMLEvent::origintypeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object); + + if (privData->nativeObj->origintype.length() == 0) + return JSValueMakeUndefined(ctx); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->origintype.c_str()); + return JSValueMakeString(ctx, stringRef); +} + + +JSValueRef JSCSCXMLEvent::rawAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object); + + if (privData->nativeObj->raw.length() == 0) + return JSValueMakeUndefined(ctx); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->raw.c_str()); + return JSValueMakeString(ctx, stringRef); +} + + +JSValueRef JSCSCXMLEvent::domAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object); + + if (!privData->nativeObj->dom) return JSValueMakeUndefined(ctx); + Arabica::DOM::Node<std::string>* arabicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->dom); + + JSClassRef arbaicaRetClass = JSCNode::getTmpl(); + + struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = arabicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, arbaicaRetClass, arabicaRet); + return arbaicaRetObj; +} + + +JSValueRef JSCSCXMLEvent::invokeidAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCSCXMLEventPrivate* privData = (struct JSCSCXMLEventPrivate*)JSObjectGetPrivate(object); + + if (privData->nativeObj->invokeid.length() == 0) + return JSValueMakeUndefined(ctx); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->invokeid.c_str()); + return JSValueMakeString(ctx, stringRef); +} + + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.h new file mode 100644 index 0000000..306e563 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCSCXMLEvent.h @@ -0,0 +1,78 @@ +/* + This file is part of the Wrapper 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 JSCSCXMLEvent_h +#define JSCSCXMLEvent_h + +#include <string> +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCSCXMLEvent { +public: + struct JSCSCXMLEventPrivate { + JSCDOM* dom; + uscxml::Event* nativeObj; + }; + + JSC_DESTRUCTOR(JSCSCXMLEventPrivate); + + + static JSValueRef typeCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef nameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef originAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef origintypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef rawAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef domAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef sendidCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef invokeidAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef INTERNALConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef EXTERNALConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef PLATFORMConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + + + 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 // JSCSCXMLEvent_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp index a0ba7df..231823b 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp @@ -14,6 +14,33 @@ JSStaticFunction JSCText::staticFunctions[] = { { "splitText", splitTextCallback, kJSPropertyAttributeDontDelete }, { 0, 0, 0 } }; +JSValueRef JSCText::splitTextCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + if (argumentCount < 1) { + std::string errorMsg = "Wrong number of arguments in splitText"; + JSStringRef string = JSStringCreateWithUTF8CString(errorMsg.c_str()); + JSValueRef exceptionString =JSValueMakeString(ctx, string); + JSStringRelease(string); + *exception = JSValueToObject(ctx, exceptionString, NULL); + return NULL; + } + + struct JSCTextPrivate* privData = (struct JSCTextPrivate*)JSObjectGetPrivate(thisObj); + + unsigned long localOffset = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); + + Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->splitText(localOffset)); + JSClassRef retClass = JSCText::getTmpl(); + + struct JSCText::JSCTextPrivate* retPrivData = new JSCText::JSCTextPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + + return retObj; + +} + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.h index 10aa682..a6fdbbd 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCText_h #define JSCText_h +#include <string> #include "DOM/Node.hpp" #include "JSCCharacterData.h" #include <JavaScriptCore/JavaScriptCore.h> @@ -33,7 +34,7 @@ class JSCText { public: struct JSCTextPrivate { JSCDOM* dom; - Arabica::DOM::Text<std::string>* arabicaThis; + Arabica::DOM::Text<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCTextPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp index 465e4fd..d8dcbed 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp @@ -1,3 +1,4 @@ +#include "JSCNodeSet.h" #include "JSCXPathResult.h" namespace Arabica { @@ -21,26 +22,78 @@ JSStaticFunction JSCXPathResult::staticFunctions[] = { { 0, 0, 0 } }; -JSValueRef JSCXPathResult::numberValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCXPathResultPrivate* privData = static_cast<JSCXPathResult::JSCXPathResultPrivate* >(JSObjectGetPrivate(thisObj)); +JSValueRef JSCXPathResult::numberValueAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(object); - return JSValueMakeNumber(ctx, privData->arabicaThis->asNumber()); + return JSValueMakeNumber(ctx, privData->nativeObj->asNumber()); } -JSValueRef JSCXPathResult::stringValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCXPathResultPrivate* privData = static_cast<JSCXPathResult::JSCXPathResultPrivate* >(JSObjectGetPrivate(thisObj)); - JSStringRef retString = JSStringCreateWithUTF8CString(privData->arabicaThis->asString().c_str()); - JSValueRef retObj = JSValueMakeString(ctx, retString); - JSStringRelease(retString); + +JSValueRef JSCXPathResult::stringValueAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(object); + JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->asString().c_str()); + return JSValueMakeString(ctx, stringRef); +} + + +JSValueRef JSCXPathResult::booleanValueAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { + struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(object); + + return JSValueMakeNumber(ctx, privData->nativeObj->asBool()); +} + +JSValueRef JSCXPathResult::asNodeSetCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + + struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(thisObj); + + + Arabica::XPath::NodeSet<std::string>* retVal = new Arabica::XPath::NodeSet<std::string>(privData->nativeObj->asNodeSet()); + JSClassRef retClass = JSCNodeSet::getTmpl(); + + struct JSCNodeSet::JSCNodeSetPrivate* retPrivData = new JSCNodeSet::JSCNodeSetPrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = retVal; + + JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); + return retObj; } -JSValueRef JSCXPathResult::booleanValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - struct JSCXPathResultPrivate* privData = static_cast<JSCXPathResult::JSCXPathResultPrivate* >(JSObjectGetPrivate(thisObj)); +JSValueRef JSCXPathResult::asBoolCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + + struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(thisObj); + - return JSValueMakeBoolean(ctx, privData->arabicaThis->asBool()); + bool retVal = privData->nativeObj->asBool(); + + JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal); + return jscRetVal; +} + +JSValueRef JSCXPathResult::asStringCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + + struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(thisObj); + + + std::string retVal = privData->nativeObj->asString(); + + JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str()); + JSValueRef jscRetVal = JSValueMakeString(ctx, jscString); + return jscRetVal; } +JSValueRef JSCXPathResult::asNumberCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + + struct JSCXPathResultPrivate* privData = (struct JSCXPathResultPrivate*)JSObjectGetPrivate(thisObj); + + + double retVal = privData->nativeObj->asNumber(); + + JSValueRef jscRetVal = JSValueMakeNumber(ctx, retVal); + return jscRetVal; +} + + } } diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.h index 7eb45e1..cd6ead7 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.h @@ -1,5 +1,5 @@ /* - This file is part of the Arabica open source project. + This file is part of the Wrapper 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 @@ -21,6 +21,7 @@ #ifndef JSCXPathResult_h #define JSCXPathResult_h +#include <string> #include "DOM/Node.hpp" #include <JavaScriptCore/JavaScriptCore.h> #include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" @@ -32,7 +33,7 @@ class JSCXPathResult { public: struct JSCXPathResultPrivate { JSCDOM* dom; - Arabica::XPath::XPathValue<std::string>* arabicaThis; + Arabica::XPath::XPathValue<std::string>* nativeObj; }; JSC_DESTRUCTOR(JSCXPathResultPrivate); |