diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-21 23:47:54 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-21 23:47:54 (GMT) |
commit | 3be96d1aa3024c1acc129e587f5d3165c9434e48 (patch) | |
tree | fae65a932b899ed9424a5a76b9b98562d979fe40 /src/uscxml | |
parent | 3bda299c6d2efce71d76b44dea8e732a073304f3 (diff) | |
download | uscxml-3be96d1aa3024c1acc129e587f5d3165c9434e48.zip uscxml-3be96d1aa3024c1acc129e587f5d3165c9434e48.tar.gz uscxml-3be96d1aa3024c1acc129e587f5d3165c9434e48.tar.bz2 |
See detailed commitlog
- Started DirectoryMonitor invoker
- Refactored Invoker / IOProcessor interface
- Started with JavaScriptCore bindings
- Embedding applications can now use setParentQueue to receive events
sent to #_parent
Diffstat (limited to 'src/uscxml')
117 files changed, 4824 insertions, 691 deletions
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp index b65f088..623dbaf 100644 --- a/src/uscxml/Factory.cpp +++ b/src/uscxml/Factory.cpp @@ -12,6 +12,7 @@ # include "uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h" # include "uscxml/plugins/invoker/scxml/USCXMLInvoker.h" # include "uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h" +# include "uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h" # ifdef UMUNDO_FOUND # include "uscxml/plugins/invoker/umundo/UmundoInvoker.h" @@ -29,6 +30,10 @@ # include "uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h" # endif +# ifdef JSC_FOUND +# include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h" +# endif + # ifdef SWI_FOUND # include "uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h" # endif @@ -99,6 +104,13 @@ Factory::Factory() { } #endif +#ifdef JSC_FOUND + { + JSCDataModel* dataModel = new JSCDataModel(); + registerDataModel(dataModel); + } +#endif + #ifdef SWI_FOUND { SWIDataModel* dataModel = new SWIDataModel(); @@ -116,9 +128,14 @@ Factory::Factory() { registerInvoker(invoker); } { + DirMonInvoker* invoker = new DirMonInvoker(); + registerInvoker(invoker); + } + { EventIOProcessor* ioProcessor = new EventIOProcessor(); registerIOProcessor(ioProcessor); } + #endif } @@ -223,6 +240,19 @@ Factory* Factory::getInstance() { return _instance; } +void IOProcessorImpl::returnEvent(Event& event) { + if (event.invokeid.length() == 0) + event.invokeid = _invokeId; + if (event.type == 0) + event.type = Event::EXTERNAL; + if (event.origin.length() == 0) + event.origin = "#_" + _invokeId; + if (event.origintype.length() == 0) + event.origintype = _type; + + _interpreter->receive(event); +} + Factory* Factory::_instance = NULL; std::string Factory::pluginPath; }
\ No newline at end of file diff --git a/src/uscxml/Factory.h b/src/uscxml/Factory.h index e1aebea..8004366 100644 --- a/src/uscxml/Factory.h +++ b/src/uscxml/Factory.h @@ -27,6 +27,12 @@ template <typename T> T strTo(std::string tmp) { return output; } +inline bool isNumeric( const char* pszInput, int nNumberBase) { + std::string base = "0123456789ABCDEF"; + std::string input = pszInput; + return (input.find_first_not_of(base.substr(0, nNumberBase)) == std::string::npos); +} + class Interpreter; #if 0 @@ -47,14 +53,24 @@ public: virtual void setInterpreter(Interpreter* interpreter) { _interpreter = interpreter; } + void setInvokeId(const std::string& invokeId) { + _invokeId = invokeId; + } + void setType(const std::string& type) { + _type = type; + } virtual Data getDataModelVariables() = 0; virtual void send(const SendRequest& req) = 0; virtual void runOnMainThread() {}; + void returnEvent(Event& event); + protected: Interpreter* _interpreter; + std::string _invokeId; + std::string _type; }; class IOProcessor { @@ -91,6 +107,16 @@ public: return _impl->runOnMainThread(); } + void setInterpreter(Interpreter* interpreter) { + _impl->setInterpreter(interpreter); + } + void setInvokeId(const std::string& invokeId) { + _impl->setInvokeId(invokeId); + } + void setType(const std::string& type) { + _impl->setType(type); + } + protected: boost::shared_ptr<IOProcessorImpl> _impl; }; @@ -98,7 +124,6 @@ protected: class InvokerImpl : public IOProcessorImpl { public: virtual void invoke(const InvokeRequest& req) = 0; - virtual void sendToParent(const SendRequest& req) = 0; virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter) = 0; }; @@ -130,9 +155,6 @@ public: virtual void invoke(InvokeRequest& req) { _impl->invoke(req); } - virtual void sendToParent(SendRequest& req) { - _impl->sendToParent(req); - } protected: boost::shared_ptr<InvokerImpl> _impl; @@ -160,6 +182,12 @@ public: virtual bool evalAsBool(const std::string& expr) = 0; virtual void assign(const std::string& location, const std::string& expr) = 0; virtual void assign(const std::string& location, const Data& data) = 0; + +protected: + Interpreter* _interpreter; + std::string _sessionId; + std::string _name; + }; class DataModel { diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index 5000498..6e34e07 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -32,6 +32,7 @@ Interpreter::Interpreter() : Arabica::SAX2DOM::Parser<std::string>() { _lastRunOnMainThread = 0; _thread = NULL; _sendQueue = NULL; + _parentQueue = NULL; _running = false; _done = false; @@ -164,7 +165,8 @@ void Interpreter::init() { Interpreter::~Interpreter() { if (_thread) { _running = false; - _externalQueue.push(Event()); + Event event; + _externalQueue.push(event); _thread->join(); delete(_thread); } @@ -445,6 +447,7 @@ void Interpreter::mainEventLoop() { } Event externalEvent = _externalQueue.pop(); + externalEvent.type = Event::EXTERNAL; // make sure it is set to external if (!_running) exitInterpreter(); @@ -679,8 +682,8 @@ void Interpreter::delayedSend(void* userdata, std::string eventName) { if (boost::iequals(sendReq.target, "#_parent")) { // send to parent scxml session - if (INSTANCE->_invoker) { - INSTANCE->_invoker.sendToParent(sendReq); + if (INSTANCE->_parentQueue != NULL) { + INSTANCE->_parentQueue->push(sendReq); } else { LOG(ERROR) << "Can not send to parent, we were not invoked" << std::endl; } @@ -794,6 +797,9 @@ void Interpreter::invoke(const Arabica::DOM::Node<std::string>& element) { Invoker invoker(Factory::createInvoker(invokeReq.type, this)); if (invoker) { tthread::lock_guard<tthread::mutex> lock(_mutex); + invoker.setInvokeId(invokeReq.invokeid); + invoker.setType(invokeReq.type); + invoker.setInterpreter(this); _invokers[invokeReq.invokeid] = invoker; LOG(INFO) << "Added invoker " << invokeReq.type << " at " << invokeReq.invokeid; invoker.invoke(invokeReq); @@ -1827,6 +1833,9 @@ void Interpreter::setupIOProcessors() { std::map<std::string, IOProcessorImpl*>::iterator ioProcIter = Factory::getInstance()->_ioProcessors.begin(); while(ioProcIter != Factory::getInstance()->_ioProcessors.end()) { _ioProcessors[ioProcIter->first] = Factory::createIOProcessor(ioProcIter->first, this); + _ioProcessors[ioProcIter->first].setType(ioProcIter->first); + _ioProcessors[ioProcIter->first].setInterpreter(this); + if (_dataModel) { try { _dataModel.registerIOProcessor(ioProcIter->first, _ioProcessors[ioProcIter->first]); diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h index 96667c4..61d09e0 100644 --- a/src/uscxml/Interpreter.h +++ b/src/uscxml/Interpreter.h @@ -82,15 +82,13 @@ public: URL getBaseURI() { return _baseURI; } + bool toAbsoluteURI(URL& uri); DataModel getDataModel() { return _dataModel; } - Invoker getInvoker() { - return _invoker; - } - void setInvoker(const Invoker& invoker) { - _invoker = invoker; + void setParentQueue(uscxml::concurrency::BlockingQueue<Event>* parentQueue) { + _parentQueue = parentQueue; } std::string getNSPrefix() { return _nsPrefix; @@ -181,11 +179,10 @@ protected: std::list<Event > _internalQueue; uscxml::concurrency::BlockingQueue<Event> _externalQueue; + uscxml::concurrency::BlockingQueue<Event>* _parentQueue; DelayedEventQueue* _sendQueue; - Invoker _invoker; static URL toBaseURI(const URL& url); - bool toAbsoluteURI(URL& uri); void microstep(const Arabica::XPath::NodeSet<std::string>& enabledTransitions); void exitStates(const Arabica::XPath::NodeSet<std::string>& enabledTransitions); diff --git a/src/uscxml/Message.h b/src/uscxml/Message.h index c241b78..a006ff6 100644 --- a/src/uscxml/Message.h +++ b/src/uscxml/Message.h @@ -54,9 +54,9 @@ protected: class Event : public Data { public: enum Type { - PLATFORM, - INTERNAL, - EXTERNAL + INTERNAL = 1, + EXTERNAL = 2, + PLATFORM = 3 }; Event() : type(INTERNAL) {} diff --git a/src/uscxml/concurrency/BlockingQueue.h b/src/uscxml/concurrency/BlockingQueue.h index 3d45720..f318ccf 100644 --- a/src/uscxml/concurrency/BlockingQueue.h +++ b/src/uscxml/concurrency/BlockingQueue.h @@ -14,13 +14,13 @@ public: virtual ~BlockingQueue() { } - void push(T elem) { + virtual void push(T& elem) { tthread::lock_guard<tthread::mutex> lock(_mutex); _queue.push_back(elem); _cond.notify_all(); } - T pop() { + virtual T pop() { tthread::lock_guard<tthread::mutex> lock(_mutex); while (_queue.empty()) { _cond.wait(_mutex); @@ -30,7 +30,7 @@ public: return ret; } - bool isEmpty() { + virtual bool isEmpty() { tthread::lock_guard<tthread::mutex> lock(_mutex); return _queue.empty(); } diff --git a/src/uscxml/debug/SCXMLDotWriter.h b/src/uscxml/debug/SCXMLDotWriter.h index 0a3c2dc..e6e2215 100644 --- a/src/uscxml/debug/SCXMLDotWriter.h +++ b/src/uscxml/debug/SCXMLDotWriter.h @@ -35,7 +35,6 @@ public: static std::string getPrefix(); static std::string dotEscape(const std::string& text); - Interpreter* _interpreter; std::set<std::string> _knownIds; static int _indentation; }; diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp index 303b7d1..4c6c23e 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp @@ -1,5 +1,8 @@ #include "uscxml/Common.h" #include "JSCDataModel.h" +#include "dom/JSCDOM.h" +#include "dom/JSCDocument.h" + #include "uscxml/Message.h" #include <glog/logging.h> @@ -22,14 +25,27 @@ JSCDataModel::JSCDataModel() { boost::shared_ptr<DataModelImpl> JSCDataModel::create(Interpreter* interpreter) { boost::shared_ptr<JSCDataModel> dm = boost::shared_ptr<JSCDataModel>(new JSCDataModel()); + + dm->_ctx = JSGlobalContextCreate(NULL); dm->_interpreter = interpreter; + Arabica::DOM::JSCDOM* dom = new Arabica::DOM::JSCDOM(); + // dom->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 = {};"); - dm->_ctx = JSGlobalContextCreate(NULL); + Arabica::DOM::JSCDocument::JSCDocumentPrivate* privData = new Arabica::DOM::JSCDocument::JSCDocumentPrivate(); + privData->arabicaThis = new Arabica::DOM::Document<std::string>(interpreter->getDocument()); + privData->dom = dom; + + JSObjectRef documentObject = JSObjectMake(dm->_ctx, Arabica::DOM::JSCDocument::getTmpl(), privData); JSObjectRef globalObject = JSContextGetGlobalObject(dm->_ctx); + JSObjectSetProperty(dm->_ctx, globalObject, JSStringCreateWithUTF8CString("document"), documentObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, NULL); return dm; } @@ -47,7 +63,7 @@ void JSCDataModel::setName(const std::string& name) { } JSCDataModel::~JSCDataModel() { -// JSGlobalContextRelease(_ctx); + JSGlobalContextRelease(_ctx); } void JSCDataModel::pushContext() { @@ -60,9 +76,84 @@ void JSCDataModel::initialize() { } void JSCDataModel::setEvent(const Event& event) { + LOG(ERROR) << "setEvent not implemented in JSC"; } Data JSCDataModel::getStringAsData(const std::string& content) { + JSValueRef result = evalAsValue(content); + Data data = getValueAsData(result); + return data; +} + +Data JSCDataModel::getValueAsData(const JSValueRef value) { + Data data; + JSValueRef exception = NULL; + switch(JSValueGetType(_ctx, value)) { + case kJSTypeUndefined: + LOG(ERROR) << "IsUndefined is unimplemented"; + break; + case kJSTypeNull: + LOG(ERROR) << "IsNull is unimplemented"; + break; + case kJSTypeBoolean: + data.atom = (JSValueToBoolean(_ctx, value) ? "true" : "false"); + break; + case kJSTypeNumber: + data.atom = toStr(JSValueToNumber(_ctx, value, &exception)); + if (exception) + handleException(exception); + break; + case kJSTypeString: { + JSStringRef stringValue = JSValueToStringCopy( _ctx, value, &exception); + if (exception) + handleException(exception); + + char* buf = (char*)malloc(JSStringGetMaximumUTF8CStringSize(stringValue)); + JSStringGetUTF8CString(stringValue, buf, sizeof(buf)); + data.atom = std::string(buf, sizeof(buf)); + free(buf); + break; + } + case kJSTypeObject: { + JSObjectRef objValue = JSValueToObject(_ctx, value, &exception); + if (exception) + handleException(exception); + std::set<std::string> propertySet; + JSPropertyNameArrayRef properties = JSObjectCopyPropertyNames(_ctx, objValue); + size_t paramCount = JSPropertyNameArrayGetCount(properties); + bool isArray = true; + for (size_t i = 0; i < paramCount; i++) { + JSStringRef stringValue = JSPropertyNameArrayGetNameAtIndex(properties, i); + char* buf = (char*)malloc(JSStringGetMaximumUTF8CStringSize(stringValue)); + JSStringGetUTF8CString(stringValue, buf, sizeof(buf)); + std::string property(buf, sizeof(buf)); + if (!isNumeric(property.c_str(), 10)) + isArray = false; + propertySet.insert(property); + free(buf); + } + std::set<std::string>::iterator propIter = propertySet.begin(); + while(propIter != propertySet.end()) { + if (isArray) { + JSValueRef nestedValue = JSObjectGetPropertyAtIndex(_ctx, objValue, strTo<int>(*propIter), &exception); + if (exception) + handleException(exception); + data.array.push_back(getValueAsData(nestedValue)); + } else { + JSStringRef jsString = JSStringCreateWithUTF8CString(propIter->c_str()); + JSValueRef nestedValue = JSObjectGetProperty(_ctx, objValue, jsString, &exception); + JSStringRelease(jsString); + if (exception) + handleException(exception); + data.compound[*propIter] = getValueAsData(nestedValue); + } + propIter++; + } + + break; + } + } + return data; } bool JSCDataModel::validate(const std::string& location, const std::string& schema) { @@ -70,21 +161,64 @@ bool JSCDataModel::validate(const std::string& location, const std::string& sche } uint32_t JSCDataModel::getLength(const std::string& expr) { + LOG(ERROR) << "I am not sure whether getLength() works :("; + JSValueRef result = evalAsValue(expr); + JSValueRef exception = NULL; + double length = JSValueToNumber(_ctx, result, &exception); + if (exception) + handleException(exception); + + return (uint32_t)length; } void JSCDataModel::eval(const std::string& expr) { + evalAsValue(expr); } bool JSCDataModel::evalAsBool(const std::string& expr) { + JSValueRef result = evalAsValue(expr); + return JSValueToBoolean(_ctx, result); } std::string JSCDataModel::evalAsString(const std::string& expr) { + JSValueRef result = evalAsValue(expr); + JSValueRef exception = NULL; + JSStringRef stringValue = JSValueToStringCopy( _ctx, result, &exception); + if (exception) + handleException(exception); + + char* data = (char*)malloc(JSStringGetMaximumUTF8CStringSize(stringValue)); + JSStringGetUTF8CString(stringValue, data, sizeof(data)); + std::string retString(data, sizeof(data)); + + JSStringRelease(stringValue); + free(data); + return retString; +} + +JSValueRef JSCDataModel::evalAsValue(const std::string& expr) { + JSStringRef scriptJS = JSStringCreateWithUTF8CString(expr.c_str()); + JSValueRef exception = NULL; + JSValueRef result = JSEvaluateScript(_ctx, scriptJS, NULL, NULL, 0, &exception); + if (exception) + handleException(exception); + + JSStringRelease(scriptJS); + return result; } 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::handleException(JSValueRef exception) { + assert(false); } }
\ No newline at end of file diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h index c223d4f..5662d42 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h @@ -46,19 +46,23 @@ public: 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); protected: + void handleException(JSValueRef exception); + Interpreter* _interpreter; std::string _sessionId; std::string _name; Event _event; - JSContextRef _ctx; + JSGlobalContextRef _ctx; }; #ifdef BUILD_AS_PLUGINS diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp new file mode 100644 index 0000000..4259b86 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.cpp @@ -0,0 +1,60 @@ +#include "JSCAttr.h" +#include "JSCElement.h" +#include "JSCNode.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCAttr::staticValues[] = { + { "name", nameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "specified", specifiedAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "value", valueAttrGetter, valueAttrSetter, kJSPropertyAttributeDontDelete }, + { "ownerElement", ownerElementAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +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::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 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; + +} + +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()); + + struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCElement::getTmpl(), retPrivData); + return arbaicaRetObj; + +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.h new file mode 100644 index 0000000..f7c3fec --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCAttr.h @@ -0,0 +1,72 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCAttr_h +#define JSCAttr_h + +#include "DOM/Node.hpp" +#include "JSCNode.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCAttr { +public: + struct JSCAttrPrivate { + JSCDOM* dom; + Arabica::DOM::Attr<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCAttrPrivate); + + + static JSValueRef nameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef specifiedAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef valueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static bool valueAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); + static JSValueRef ownerElementAttrGetter(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 // JSCAttr_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp new file mode 100644 index 0000000..c735084 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.cpp @@ -0,0 +1,18 @@ +#include "JSCCDATASection.h" +#include "JSCText.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCCDATASection::staticValues[] = { + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCCDATASection::staticFunctions[] = { + { 0, 0, 0 } +}; + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.h new file mode 100644 index 0000000..b4cd391 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCDATASection.h @@ -0,0 +1,67 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCCDATASection_h +#define JSCCDATASection_h + +#include "DOM/Node.hpp" +#include "JSCText.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCCDATASection { +public: + struct JSCCDATASectionPrivate { + JSCDOM* dom; + Arabica::DOM::CDATASection<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCCDATASectionPrivate); + + + + + 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 // JSCCDATASection_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp new file mode 100644 index 0000000..5108625 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.cpp @@ -0,0 +1,40 @@ +#include "JSCCharacterData.h" +#include "JSCNode.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCCharacterData::staticValues[] = { + { "data", dataAttrGetter, dataAttrSetter, kJSPropertyAttributeDontDelete }, + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCCharacterData::staticFunctions[] = { + { "substringData", substringDataCallback, kJSPropertyAttributeDontDelete }, + { "appendData", appendDataCallback, kJSPropertyAttributeDontDelete }, + { "insertData", insertDataCallback, kJSPropertyAttributeDontDelete }, + { "deleteData", deleteDataCallback, kJSPropertyAttributeDontDelete }, + { "replaceData", replaceDataCallback, kJSPropertyAttributeDontDelete }, + { 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::lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + struct JSCCharacterDataPrivate* privData = static_cast<JSCCharacterData::JSCCharacterDataPrivate* >(JSObjectGetPrivate(thisObj)); + + return JSValueMakeNumber(ctx, privData->arabicaThis->getLength()); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.h new file mode 100644 index 0000000..1289143 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCCharacterData.h @@ -0,0 +1,75 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCCharacterData_h +#define JSCCharacterData_h + +#include "DOM/Node.hpp" +#include "JSCNode.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCCharacterData { +public: + struct JSCCharacterDataPrivate { + JSCDOM* dom; + Arabica::DOM::CharacterData<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCCharacterDataPrivate); + + static JSValueRef substringDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef appendDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef insertDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef deleteDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef replaceDataCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef dataAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static bool dataAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); + static JSValueRef lengthAttrGetter(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 // JSCCharacterData_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp new file mode 100644 index 0000000..b9aa25c --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.cpp @@ -0,0 +1,18 @@ +#include "JSCCharacterData.h" +#include "JSCComment.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCComment::staticValues[] = { + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCComment::staticFunctions[] = { + { 0, 0, 0 } +}; + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.h new file mode 100644 index 0000000..c311c49 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCComment.h @@ -0,0 +1,67 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCComment_h +#define JSCComment_h + +#include "DOM/Node.hpp" +#include "JSCCharacterData.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCComment { +public: + struct JSCCommentPrivate { + JSCDOM* dom; + Arabica::DOM::Comment<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCCommentPrivate); + + + + + 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 // JSCComment_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.cpp index f42c9bd..bd66f8c 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.cpp @@ -1,9 +1,11 @@ #include "JSCDOM.h" -namespace uscxml { +namespace Arabica { +namespace DOM { JSCDOM::JSCDOM() { } +} }
\ No newline at end of file diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h index 248d057..af946a9 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h @@ -7,21 +7,22 @@ #define JSC_DESTRUCTOR(type) \ static void jsDestructor(JSObjectRef object) { \ type* thing = static_cast<type*>(JSObjectGetPrivate(object)); \ +delete thing->arabicaThis; \ delete thing; \ } -namespace uscxml { +namespace Arabica { +namespace DOM { class JSCDOM { public: JSCDOM(); virtual ~JSCDOM() { }; - Interpreter* interpreter; Arabica::XPath::XPath<std::string>* xpath; }; } - +} #endif /* end of include guard: JSCDOM_H_1RC5LCG8 */ diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp new file mode 100644 index 0000000..ee42a3e --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.cpp @@ -0,0 +1,20 @@ +#include "JSCDOMImplementation.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCDOMImplementation::staticValues[] = { + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCDOMImplementation::staticFunctions[] = { + { "hasFeature", hasFeatureCallback, kJSPropertyAttributeDontDelete }, + { "createDocumentType", createDocumentTypeCallback, kJSPropertyAttributeDontDelete }, + { "createDocument", createDocumentCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.h new file mode 100644 index 0000000..033f2c1 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOMImplementation.h @@ -0,0 +1,69 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCDOMImplementation_h +#define JSCDOMImplementation_h + +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCDOMImplementation { +public: + struct JSCDOMImplementationPrivate { + JSCDOM* dom; + Arabica::DOM::DOMImplementation<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCDOMImplementationPrivate); + + static JSValueRef hasFeatureCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef createDocumentTypeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef createDocumentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, 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 // JSCDOMImplementation_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp new file mode 100644 index 0000000..36bb243 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp @@ -0,0 +1,78 @@ +#include "JSCDOMImplementation.h" +#include "JSCDocument.h" +#include "JSCDocumentType.h" +#include "JSCElement.h" +#include "JSCNode.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCDocument::staticValues[] = { + { "doctype", doctypeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "implementation", implementationAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "documentElement", documentElementAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCDocument::staticFunctions[] = { + { "createElement", createElementCallback, kJSPropertyAttributeDontDelete }, + { "createDocumentFragment", createDocumentFragmentCallback, kJSPropertyAttributeDontDelete }, + { "createTextNode", createTextNodeCallback, kJSPropertyAttributeDontDelete }, + { "createComment", createCommentCallback, kJSPropertyAttributeDontDelete }, + { "createCDATASection", createCDATASectionCallback, kJSPropertyAttributeDontDelete }, + { "createProcessingInstruction", createProcessingInstructionCallback, kJSPropertyAttributeDontDelete }, + { "createAttribute", createAttributeCallback, kJSPropertyAttributeDontDelete }, + { "createEntityReference", createEntityReferenceCallback, kJSPropertyAttributeDontDelete }, + { "getElementsByTagName", getElementsByTagNameCallback, kJSPropertyAttributeDontDelete }, + { "importNode", importNodeCallback, kJSPropertyAttributeDontDelete }, + { "createElementNS", createElementNSCallback, kJSPropertyAttributeDontDelete }, + { "createAttributeNS", createAttributeNSCallback, kJSPropertyAttributeDontDelete }, + { "getElementsByTagNameNS", getElementsByTagNameNSCallback, kJSPropertyAttributeDontDelete }, + { "getElementById", getElementByIdCallback, kJSPropertyAttributeDontDelete }, + { "evaluate", evaluateCustomCallback, kJSPropertyAttributeDontDelete }, + { 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()); + + struct JSCDocumentType::JSCDocumentTypePrivate* retPrivData = new JSCDocumentType::JSCDocumentTypePrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCDocumentType::getTmpl(), retPrivData); + 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()); + + struct JSCDOMImplementation::JSCDOMImplementationPrivate* retPrivData = new JSCDOMImplementation::JSCDOMImplementationPrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCDOMImplementation::getTmpl(), retPrivData); + 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()); + + struct JSCElement::JSCElementPrivate* retPrivData = new JSCElement::JSCElementPrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCElement::getTmpl(), retPrivData); + return arbaicaRetObj; + +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.h new file mode 100644 index 0000000..c1f052e --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.h @@ -0,0 +1,85 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCDocument_h +#define JSCDocument_h + +#include "DOM/Node.hpp" +#include "JSCNode.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCDocument { +public: + struct JSCDocumentPrivate { + JSCDOM* dom; + Arabica::DOM::Document<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCDocumentPrivate); + + static JSValueRef createElementCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef createDocumentFragmentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef createTextNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef createCommentCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef createCDATASectionCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef createProcessingInstructionCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef createAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef createEntityReferenceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getElementsByTagNameCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef importNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef createElementNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef createAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getElementsByTagNameNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getElementByIdCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef evaluateCustomCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef doctypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef implementationAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef documentElementAttrGetter(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 // JSCDocument_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp new file mode 100644 index 0000000..77203a7 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.cpp @@ -0,0 +1,18 @@ +#include "JSCDocumentFragment.h" +#include "JSCNode.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCDocumentFragment::staticValues[] = { + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCDocumentFragment::staticFunctions[] = { + { 0, 0, 0 } +}; + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.h new file mode 100644 index 0000000..4c6f46e --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentFragment.h @@ -0,0 +1,67 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCDocumentFragment_h +#define JSCDocumentFragment_h + +#include "DOM/Node.hpp" +#include "JSCNode.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCDocumentFragment { +public: + struct JSCDocumentFragmentPrivate { + JSCDOM* dom; + Arabica::DOM::DocumentFragment<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCDocumentFragmentPrivate); + + + + + 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 // JSCDocumentFragment_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp new file mode 100644 index 0000000..bbfa35c --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.cpp @@ -0,0 +1,87 @@ +#include "JSCDocumentType.h" +#include "JSCNamedNodeMap.h" +#include "JSCNode.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCDocumentType::staticValues[] = { + { "name", nameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "entities", entitiesAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "notations", notationsAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "publicId", publicIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "systemId", systemIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "internalSubset", internalSubsetAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +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::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()); + + struct JSCNamedNodeMap::JSCNamedNodeMapPrivate* retPrivData = new JSCNamedNodeMap::JSCNamedNodeMapPrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNamedNodeMap::getTmpl(), retPrivData); + 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()); + + struct JSCNamedNodeMap::JSCNamedNodeMapPrivate* retPrivData = new JSCNamedNodeMap::JSCNamedNodeMapPrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNamedNodeMap::getTmpl(), retPrivData); + 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::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::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; + +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.h new file mode 100644 index 0000000..875b1f7 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocumentType.h @@ -0,0 +1,73 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCDocumentType_h +#define JSCDocumentType_h + +#include "DOM/Node.hpp" +#include "JSCNode.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCDocumentType { +public: + struct JSCDocumentTypePrivate { + JSCDOM* dom; + Arabica::DOM::DocumentType<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCDocumentTypePrivate); + + + static JSValueRef nameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef entitiesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef notationsAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef publicIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef systemIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef internalSubsetAttrGetter(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 // JSCDocumentType_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp new file mode 100644 index 0000000..2ff24d7 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.cpp @@ -0,0 +1,43 @@ +#include "JSCElement.h" +#include "JSCNode.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCElement::staticValues[] = { + { "tagName", tagNameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCElement::staticFunctions[] = { + { "getAttribute", getAttributeCallback, kJSPropertyAttributeDontDelete }, + { "setAttribute", setAttributeCallback, kJSPropertyAttributeDontDelete }, + { "removeAttribute", removeAttributeCallback, kJSPropertyAttributeDontDelete }, + { "getAttributeNode", getAttributeNodeCallback, kJSPropertyAttributeDontDelete }, + { "setAttributeNode", setAttributeNodeCallback, kJSPropertyAttributeDontDelete }, + { "removeAttributeNode", removeAttributeNodeCallback, kJSPropertyAttributeDontDelete }, + { "getElementsByTagName", getElementsByTagNameCallback, kJSPropertyAttributeDontDelete }, + { "getAttributeNS", getAttributeNSCallback, kJSPropertyAttributeDontDelete }, + { "setAttributeNS", setAttributeNSCallback, kJSPropertyAttributeDontDelete }, + { "removeAttributeNS", removeAttributeNSCallback, kJSPropertyAttributeDontDelete }, + { "getAttributeNodeNS", getAttributeNodeNSCallback, kJSPropertyAttributeDontDelete }, + { "setAttributeNodeNS", setAttributeNodeNSCallback, kJSPropertyAttributeDontDelete }, + { "getElementsByTagNameNS", getElementsByTagNameNSCallback, kJSPropertyAttributeDontDelete }, + { "hasAttribute", hasAttributeCallback, kJSPropertyAttributeDontDelete }, + { "hasAttributeNS", hasAttributeNSCallback, kJSPropertyAttributeDontDelete }, + { 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); + return retObj; + +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.h new file mode 100644 index 0000000..01f9f2f --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCElement.h @@ -0,0 +1,83 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCElement_h +#define JSCElement_h + +#include "DOM/Node.hpp" +#include "JSCNode.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCElement { +public: + struct JSCElementPrivate { + JSCDOM* dom; + Arabica::DOM::Element<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCElementPrivate); + + static JSValueRef getAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef removeAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef removeAttributeNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getElementsByTagNameCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef removeAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getAttributeNodeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setAttributeNodeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getElementsByTagNameNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef hasAttributeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef hasAttributeNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef tagNameAttrGetter(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 // JSCElement_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp new file mode 100644 index 0000000..55aee54 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.cpp @@ -0,0 +1,48 @@ +#include "JSCEntity.h" +#include "JSCNode.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCEntity::staticValues[] = { + { "publicId", publicIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "systemId", systemIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "notationName", notationNameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +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::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::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; + +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.h new file mode 100644 index 0000000..79d8ddf --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntity.h @@ -0,0 +1,70 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCEntity_h +#define JSCEntity_h + +#include "DOM/Node.hpp" +#include "JSCNode.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCEntity { +public: + struct JSCEntityPrivate { + JSCDOM* dom; + Arabica::DOM::Entity<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCEntityPrivate); + + + static JSValueRef publicIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef systemIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef notationNameAttrGetter(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 // JSCEntity_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp new file mode 100644 index 0000000..a8aac23 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.cpp @@ -0,0 +1,18 @@ +#include "JSCEntityReference.h" +#include "JSCNode.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCEntityReference::staticValues[] = { + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCEntityReference::staticFunctions[] = { + { 0, 0, 0 } +}; + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.h new file mode 100644 index 0000000..48a660d --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCEntityReference.h @@ -0,0 +1,67 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCEntityReference_h +#define JSCEntityReference_h + +#include "DOM/Node.hpp" +#include "JSCNode.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCEntityReference { +public: + struct JSCEntityReferencePrivate { + JSCDOM* dom; + Arabica::DOM::EntityReference<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCEntityReferencePrivate); + + + + + 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 // JSCEntityReference_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp new file mode 100644 index 0000000..49ef0c1 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.cpp @@ -0,0 +1,31 @@ +#include "JSCNamedNodeMap.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCNamedNodeMap::staticValues[] = { + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCNamedNodeMap::staticFunctions[] = { + { "getNamedItem", getNamedItemCallback, kJSPropertyAttributeDontDelete }, + { "setNamedItem", setNamedItemCallback, kJSPropertyAttributeDontDelete }, + { "removeNamedItem", removeNamedItemCallback, kJSPropertyAttributeDontDelete }, + { "item", itemCallback, kJSPropertyAttributeDontDelete }, + { "getNamedItemNS", getNamedItemNSCallback, kJSPropertyAttributeDontDelete }, + { "setNamedItemNS", setNamedItemNSCallback, kJSPropertyAttributeDontDelete }, + { "removeNamedItemNS", removeNamedItemNSCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCNamedNodeMap::lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + struct JSCNamedNodeMapPrivate* privData = static_cast<JSCNamedNodeMap::JSCNamedNodeMapPrivate* >(JSObjectGetPrivate(thisObj)); + + return JSValueMakeNumber(ctx, privData->arabicaThis->getLength()); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.h new file mode 100644 index 0000000..b95796a --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNamedNodeMap.h @@ -0,0 +1,74 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCNamedNodeMap_h +#define JSCNamedNodeMap_h + +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCNamedNodeMap { +public: + struct JSCNamedNodeMapPrivate { + JSCDOM* dom; + Arabica::DOM::NamedNodeMap<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCNamedNodeMapPrivate); + + static JSValueRef getNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef removeNamedItemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef itemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef getNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef setNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef removeNamedItemNSCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef lengthAttrGetter(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 // JSCNamedNodeMap_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp index 7d38f9f..ca1ca41 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp @@ -1,41 +1,40 @@ +#include "JSCDocument.h" +#include "JSCNamedNodeMap.h" #include "JSCNode.h" -#include <DOM/Node.hpp> +#include "JSCNodeList.h" -namespace uscxml { +namespace Arabica { +namespace DOM { -using namespace Arabica::DOM; JSStaticValue JSCNode::staticValues[] = { - { "nodeName", nodeNameAttrGetter, nodeValueAttrSetter, kJSPropertyAttributeDontDelete }, - { "nodeValue", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "nodeType", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "parentNode", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "childNodes", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "firstChild", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "lastChild", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "previousSibling", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "nextSibling", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "attributes", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "ownerDocument", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "namespaceURI", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "prefix", nodeValueAttrGetter, prefixAttrSetter, kJSPropertyAttributeDontDelete }, - { "localName", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "baseURI", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "textContent", nodeValueAttrGetter, textContentAttrSetter, kJSPropertyAttributeDontDelete }, - { "parentElement", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "ELEMENT_NODE", ELEMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "ATTRIBUTE_NODE", ATTRIBUTE_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "TEXT_NODE", TEXT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "CDATA_SECTION_NODE", CDATA_SECTION_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "ENTITY_REFERENCE_NODE", ENTITY_REFERENCE_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "ENTITY_NODE", ENTITY_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "PROCESSING_INSTRUCTION_NODE", PROCESSING_INSTRUCTION_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "COMMENT_NODE", COMMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "DOCUMENT_NODE", DOCUMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "DOCUMENT_TYPE_NODE", DOCUMENT_TYPE_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "DOCUMENT_FRAGMENT_NODE", DOCUMENT_FRAGMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "NOTATION_NODE", NOTATION_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "MAX_TYPE", MAX_TYPEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "nodeName", nodeNameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "nodeValue", nodeValueAttrGetter, nodeValueAttrSetter, kJSPropertyAttributeDontDelete }, + { "nodeType", nodeTypeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "parentNode", parentNodeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "childNodes", childNodesAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "firstChild", firstChildAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "lastChild", lastChildAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "previousSibling", previousSiblingAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "nextSibling", nextSiblingAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "attributes", attributesAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "ownerDocument", ownerDocumentAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "namespaceURI", namespaceURIAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "prefix", prefixAttrGetter, prefixAttrSetter, kJSPropertyAttributeDontDelete }, + { "localName", localNameAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { "ELEMENT_NODE", ELEMENT_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "ATTRIBUTE_NODE", ATTRIBUTE_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "TEXT_NODE", TEXT_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "CDATA_SECTION_NODE", CDATA_SECTION_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "ENTITY_REFERENCE_NODE", ENTITY_REFERENCE_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "ENTITY_NODE", ENTITY_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "PROCESSING_INSTRUCTION_NODE", PROCESSING_INSTRUCTION_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "COMMENT_NODE", COMMENT_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "DOCUMENT_NODE", DOCUMENT_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "DOCUMENT_TYPE_NODE", DOCUMENT_TYPE_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "DOCUMENT_FRAGMENT_NODE", DOCUMENT_FRAGMENT_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "NOTATION_NODE", NOTATION_NODEConstGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, { 0, 0, 0, 0 } }; @@ -49,12 +48,163 @@ JSStaticFunction JSCNode::staticFunctions[] = { { "normalize", normalizeCallback, kJSPropertyAttributeDontDelete }, { "isSupported", isSupportedCallback, kJSPropertyAttributeDontDelete }, { "hasAttributes", hasAttributesCallback, kJSPropertyAttributeDontDelete }, - { "lookupPrefix", lookupPrefixCallback, kJSPropertyAttributeDontDelete }, - { "isDefaultNamespace", isDefaultNamespaceCallback, kJSPropertyAttributeDontDelete }, - { "lookupNamespaceURI", lookupNamespaceURICallback, kJSPropertyAttributeDontDelete }, - { "addEventListener", addEventListenerCallback, kJSPropertyAttributeDontDelete }, - { "removeEventListener", removeEventListenerCallback, kJSPropertyAttributeDontDelete }, { 0, 0, 0 } }; -}
\ No newline at end of file +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::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; + +} + +JSValueRef JSCNode::nodeTypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + struct JSCNodePrivate* privData = static_cast<JSCNode::JSCNodePrivate* >(JSObjectGetPrivate(thisObj)); + + return JSValueMakeNumber(ctx, privData->arabicaThis->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()); + + struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNode::getTmpl(), retPrivData); + 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()); + + struct JSCNodeList::JSCNodeListPrivate* retPrivData = new JSCNodeList::JSCNodeListPrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNodeList::getTmpl(), retPrivData); + 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()); + + struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNode::getTmpl(), retPrivData); + 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()); + + struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNode::getTmpl(), retPrivData); + 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()); + + struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNode::getTmpl(), retPrivData); + 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()); + + struct JSCNode::JSCNodePrivate* retPrivData = new JSCNode::JSCNodePrivate(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNode::getTmpl(), retPrivData); + 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(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCNamedNodeMap::getTmpl(), retPrivData); + return arbaicaRetObj; + +} + +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(); + retPrivData->dom = privData->dom; + retPrivData->arabicaThis = arbaicaRet; + + JSObjectRef arbaicaRetObj = JSObjectMake(ctx, JSCDocument::getTmpl(), retPrivData); + return arbaicaRetObj; + +} + +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); + 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); + 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); + return retObj; + +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp.old b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp.old new file mode 100644 index 0000000..7d38f9f --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.cpp.old @@ -0,0 +1,60 @@ +#include "JSCNode.h" +#include <DOM/Node.hpp> + +namespace uscxml { + +using namespace Arabica::DOM; + +JSStaticValue JSCNode::staticValues[] = { + { "nodeName", nodeNameAttrGetter, nodeValueAttrSetter, kJSPropertyAttributeDontDelete }, + { "nodeValue", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "nodeType", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "parentNode", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "childNodes", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "firstChild", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "lastChild", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "previousSibling", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "nextSibling", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "attributes", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "ownerDocument", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "namespaceURI", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "prefix", nodeValueAttrGetter, prefixAttrSetter, kJSPropertyAttributeDontDelete }, + { "localName", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "baseURI", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "textContent", nodeValueAttrGetter, textContentAttrSetter, kJSPropertyAttributeDontDelete }, + { "parentElement", nodeValueAttrGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "ELEMENT_NODE", ELEMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "ATTRIBUTE_NODE", ATTRIBUTE_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "TEXT_NODE", TEXT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "CDATA_SECTION_NODE", CDATA_SECTION_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "ENTITY_REFERENCE_NODE", ENTITY_REFERENCE_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "ENTITY_NODE", ENTITY_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "PROCESSING_INSTRUCTION_NODE", PROCESSING_INSTRUCTION_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "COMMENT_NODE", COMMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "DOCUMENT_NODE", DOCUMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "DOCUMENT_TYPE_NODE", DOCUMENT_TYPE_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "DOCUMENT_FRAGMENT_NODE", DOCUMENT_FRAGMENT_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "NOTATION_NODE", NOTATION_NODEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "MAX_TYPE", MAX_TYPEConstGetter, NULL, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCNode::staticFunctions[] = { + { "insertBefore", insertBeforeCallback, kJSPropertyAttributeDontDelete }, + { "replaceChild", replaceChildCallback, kJSPropertyAttributeDontDelete }, + { "removeChild", removeChildCallback, kJSPropertyAttributeDontDelete }, + { "appendChild", appendChildCallback, kJSPropertyAttributeDontDelete }, + { "hasChildNodes", hasChildNodesCallback, kJSPropertyAttributeDontDelete }, + { "cloneNode", cloneNodeCallback, kJSPropertyAttributeDontDelete }, + { "normalize", normalizeCallback, kJSPropertyAttributeDontDelete }, + { "isSupported", isSupportedCallback, kJSPropertyAttributeDontDelete }, + { "hasAttributes", hasAttributesCallback, kJSPropertyAttributeDontDelete }, + { "lookupPrefix", lookupPrefixCallback, kJSPropertyAttributeDontDelete }, + { "isDefaultNamespace", isDefaultNamespaceCallback, kJSPropertyAttributeDontDelete }, + { "lookupNamespaceURI", lookupNamespaceURICallback, kJSPropertyAttributeDontDelete }, + { "addEventListener", addEventListenerCallback, kJSPropertyAttributeDontDelete }, + { "removeEventListener", removeEventListenerCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +}
\ No newline at end of file diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h index 677a63b..f99d561 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h @@ -1,202 +1,81 @@ -#ifndef JSCNODE_H_6BAK1S3C -#define JSCNODE_H_6BAK1S3C +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! -#include "JSCDOM.h" + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. -namespace uscxml { + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + 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 JSCNode_h +#define JSCNode_h + +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { class JSCNode { public: - static JSValueRef nodeNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef nodeValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef nodeTypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef parentNodeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef childNodesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef firstChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef lastChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef previousSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef nextSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef attributesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef ownerDocumentAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef namespaceURIAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef prefixAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef localNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef baseURIAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef textContentAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef parentElementAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } + struct JSCNodePrivate { + JSCDOM* dom; + Arabica::DOM::Node<std::string>* arabicaThis; + }; - static bool nodeValueAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { - return false; - } - static bool prefixAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { - return false; - } - static bool textContentAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { - return false; - } + JSC_DESTRUCTOR(JSCNodePrivate); - static JSValueRef insertBeforeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef replaceChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef removeChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef appendChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef hasChildNodesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef cloneNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef normalizeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef isSupportedCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef hasAttributesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef lookupPrefixCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef isDefaultNamespaceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef lookupNamespaceURICallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef addEventListenerCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } - static JSValueRef removeEventListenerCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - assert(false); - return JSValueMakeUndefined(ctx); - } + static JSValueRef insertBeforeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef replaceChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef removeChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef appendChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef hasChildNodesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef cloneNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef normalizeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef isSupportedCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef hasAttributesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); - static JSValueRef ELEMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ELEMENT_NODE); - } - static JSValueRef ATTRIBUTE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ATTRIBUTE_NODE); - } - static JSValueRef TEXT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::TEXT_NODE); - } - static JSValueRef CDATA_SECTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::CDATA_SECTION_NODE); - } - static JSValueRef ENTITY_REFERENCE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ENTITY_REFERENCE_NODE); - } - static JSValueRef ENTITY_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ENTITY_NODE); - } - static JSValueRef PROCESSING_INSTRUCTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::PROCESSING_INSTRUCTION_NODE); - } - static JSValueRef COMMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::COMMENT_NODE); - } - static JSValueRef DOCUMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::DOCUMENT_NODE); - } - static JSValueRef DOCUMENT_TYPE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::DOCUMENT_TYPE_NODE); - } - static JSValueRef DOCUMENT_FRAGMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::DOCUMENT_FRAGMENT_NODE); - } - static JSValueRef NOTATION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::NOTATION_NODE); - } - static JSValueRef MAX_TYPEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { - assert(false); - return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::MAX_TYPE); - } + static JSValueRef nodeNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef nodeValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static bool nodeValueAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); + static JSValueRef nodeTypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef parentNodeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef childNodesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef firstChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + 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 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); - JSC_DESTRUCTOR(Arabica::DOM::Node<std::string>); + 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); + static JSValueRef CDATA_SECTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef ENTITY_REFERENCE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef ENTITY_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef PROCESSING_INSTRUCTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef COMMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef DOCUMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef DOCUMENT_TYPE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + 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[]; @@ -215,9 +94,10 @@ public: return Tmpl; } + }; } +} - -#endif /* end of include guard: JSCNODE_H_6BAK1S3C */ +#endif // JSCNode_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h.old b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h.old new file mode 100644 index 0000000..677a63b --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNode.h.old @@ -0,0 +1,223 @@ +#ifndef JSCNODE_H_6BAK1S3C +#define JSCNODE_H_6BAK1S3C + +#include "JSCDOM.h" + +namespace uscxml { + +class JSCNode { +public: + static JSValueRef nodeNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef nodeValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef nodeTypeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef parentNodeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef childNodesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef firstChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef lastChildAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef previousSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef nextSiblingAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef attributesAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef ownerDocumentAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef namespaceURIAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef prefixAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef localNameAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef baseURIAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef textContentAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef parentElementAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + + static bool nodeValueAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { + return false; + } + static bool prefixAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { + return false; + } + static bool textContentAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { + return false; + } + + static JSValueRef insertBeforeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef replaceChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef removeChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef appendChildCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef hasChildNodesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef cloneNodeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef normalizeCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef isSupportedCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef hasAttributesCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef lookupPrefixCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef isDefaultNamespaceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef lookupNamespaceURICallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef addEventListenerCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + static JSValueRef removeEventListenerCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { + assert(false); + return JSValueMakeUndefined(ctx); + } + + static JSValueRef ELEMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ELEMENT_NODE); + } + static JSValueRef ATTRIBUTE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ATTRIBUTE_NODE); + } + static JSValueRef TEXT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::TEXT_NODE); + } + static JSValueRef CDATA_SECTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::CDATA_SECTION_NODE); + } + static JSValueRef ENTITY_REFERENCE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ENTITY_REFERENCE_NODE); + } + static JSValueRef ENTITY_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::ENTITY_NODE); + } + static JSValueRef PROCESSING_INSTRUCTION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::PROCESSING_INSTRUCTION_NODE); + } + static JSValueRef COMMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::COMMENT_NODE); + } + static JSValueRef DOCUMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::DOCUMENT_NODE); + } + static JSValueRef DOCUMENT_TYPE_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::DOCUMENT_TYPE_NODE); + } + static JSValueRef DOCUMENT_FRAGMENT_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::DOCUMENT_FRAGMENT_NODE); + } + static JSValueRef NOTATION_NODEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::NOTATION_NODE); + } + static JSValueRef MAX_TYPEConstGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + assert(false); + return JSValueMakeNumber(ctx, Arabica::DOM::Node_base::MAX_TYPE); + } + + JSC_DESTRUCTOR(Arabica::DOM::Node<std::string>); + + static JSStaticValue staticValues[]; + static JSStaticFunction staticFunctions[]; + + static JSClassRef Tmpl; + static JSClassRef getTmpl() { + if (Tmpl == NULL) { + JSClassDefinition classDef = kJSClassDefinitionEmpty; + classDef.staticValues = staticValues; + classDef.staticFunctions = staticFunctions; + classDef.finalize = jsDestructor; + + Tmpl = JSClassCreate(&classDef); + JSClassRetain(Tmpl); + } + return Tmpl; + } + +}; + +} + + +#endif /* end of include guard: JSCNODE_H_6BAK1S3C */ diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp new file mode 100644 index 0000000..5046dcd --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.cpp @@ -0,0 +1,25 @@ +#include "JSCNodeList.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCNodeList::staticValues[] = { + { "length", lengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCNodeList::staticFunctions[] = { + { "item", itemCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCNodeList::lengthAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + struct JSCNodeListPrivate* privData = static_cast<JSCNodeList::JSCNodeListPrivate* >(JSObjectGetPrivate(thisObj)); + + return JSValueMakeNumber(ctx, privData->arabicaThis->getLength()); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.h new file mode 100644 index 0000000..6236deb --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeList.h @@ -0,0 +1,68 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCNodeList_h +#define JSCNodeList_h + +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCNodeList { +public: + struct JSCNodeListPrivate { + JSCDOM* dom; + Arabica::DOM::NodeList<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCNodeListPrivate); + + static JSValueRef itemCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef lengthAttrGetter(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 // JSCNodeList_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp new file mode 100644 index 0000000..7c72faf --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.cpp @@ -0,0 +1,32 @@ +#include "JSCNodeSet.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCNodeSet::staticValues[] = { + { "size", sizeAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "empty", emptyAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCNodeSet::staticFunctions[] = { + { "toDocumentOrder", toDocumentOrderCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCNodeSet::sizeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + struct JSCNodeSetPrivate* privData = static_cast<JSCNodeSet::JSCNodeSetPrivate* >(JSObjectGetPrivate(thisObj)); + + return JSValueMakeNumber(ctx, privData->arabicaThis->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()); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.h new file mode 100644 index 0000000..5ee0b9b --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNodeSet.h @@ -0,0 +1,69 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCNodeSet_h +#define JSCNodeSet_h + +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCNodeSet { +public: + struct JSCNodeSetPrivate { + JSCDOM* dom; + Arabica::XPath::NodeSet<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCNodeSetPrivate); + + static JSValueRef toDocumentOrderCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef sizeAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef emptyAttrGetter(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 // JSCNodeSet_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp new file mode 100644 index 0000000..04bb8ec --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.cpp @@ -0,0 +1,38 @@ +#include "JSCNode.h" +#include "JSCNotation.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCNotation::staticValues[] = { + { "publicId", publicIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "systemId", systemIdAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +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::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; + +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.h new file mode 100644 index 0000000..29e7280 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCNotation.h @@ -0,0 +1,69 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCNotation_h +#define JSCNotation_h + +#include "DOM/Node.hpp" +#include "JSCNode.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCNotation { +public: + struct JSCNotationPrivate { + JSCDOM* dom; + Arabica::DOM::Notation<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCNotationPrivate); + + + static JSValueRef publicIdAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef systemIdAttrGetter(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 // JSCNotation_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp new file mode 100644 index 0000000..a9e69e6 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.cpp @@ -0,0 +1,38 @@ +#include "JSCNode.h" +#include "JSCProcessingInstruction.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCProcessingInstruction::staticValues[] = { + { "target", targetAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "data", dataAttrGetter, dataAttrSetter, kJSPropertyAttributeDontDelete }, + + { 0, 0, 0, 0 } +}; + +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::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; + +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.h new file mode 100644 index 0000000..835fb2e --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCProcessingInstruction.h @@ -0,0 +1,70 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCProcessingInstruction_h +#define JSCProcessingInstruction_h + +#include "DOM/Node.hpp" +#include "JSCNode.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCProcessingInstruction { +public: + struct JSCProcessingInstructionPrivate { + JSCDOM* dom; + Arabica::DOM::ProcessingInstruction<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCProcessingInstructionPrivate); + + + static JSValueRef targetAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef dataAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static bool dataAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, 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 // JSCProcessingInstruction_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp new file mode 100644 index 0000000..a0ba7df --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.cpp @@ -0,0 +1,19 @@ +#include "JSCCharacterData.h" +#include "JSCText.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCText::staticValues[] = { + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCText::staticFunctions[] = { + { "splitText", splitTextCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.h new file mode 100644 index 0000000..10aa682 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCText.h @@ -0,0 +1,68 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCText_h +#define JSCText_h + +#include "DOM/Node.hpp" +#include "JSCCharacterData.h" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCText { +public: + struct JSCTextPrivate { + JSCDOM* dom; + Arabica::DOM::Text<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCTextPrivate); + + static JSValueRef splitTextCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, 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 // JSCText_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp new file mode 100644 index 0000000..465e4fd --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.cpp @@ -0,0 +1,46 @@ +#include "JSCXPathResult.h" + +namespace Arabica { +namespace DOM { + + +JSStaticValue JSCXPathResult::staticValues[] = { + { "numberValue", numberValueAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "stringValue", stringValueAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "booleanValue", booleanValueAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + { "singleNodeValue", singleNodeValueCustomAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, + + { 0, 0, 0, 0 } +}; + +JSStaticFunction JSCXPathResult::staticFunctions[] = { + { "asNodeSet", asNodeSetCallback, kJSPropertyAttributeDontDelete }, + { "asBool", asBoolCallback, kJSPropertyAttributeDontDelete }, + { "asString", asStringCallback, kJSPropertyAttributeDontDelete }, + { "asNumber", asNumberCallback, kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } +}; + +JSValueRef JSCXPathResult::numberValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + struct JSCXPathResultPrivate* privData = static_cast<JSCXPathResult::JSCXPathResultPrivate* >(JSObjectGetPrivate(thisObj)); + + return JSValueMakeNumber(ctx, privData->arabicaThis->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); + return retObj; + +} + +JSValueRef JSCXPathResult::booleanValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) { + struct JSCXPathResultPrivate* privData = static_cast<JSCXPathResult::JSCXPathResultPrivate* >(JSObjectGetPrivate(thisObj)); + + return JSValueMakeBoolean(ctx, privData->arabicaThis->asBool()); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.h b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.h new file mode 100644 index 0000000..7eb45e1 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCXPathResult.h @@ -0,0 +1,74 @@ +/* + This file is part of the Arabica open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef JSCXPathResult_h +#define JSCXPathResult_h + +#include "DOM/Node.hpp" +#include <JavaScriptCore/JavaScriptCore.h> +#include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDOM.h" + +namespace Arabica { +namespace DOM { + +class JSCXPathResult { +public: + struct JSCXPathResultPrivate { + JSCDOM* dom; + Arabica::XPath::XPathValue<std::string>* arabicaThis; + }; + + JSC_DESTRUCTOR(JSCXPathResultPrivate); + + static JSValueRef asNodeSetCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef asBoolCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef asStringCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + static JSValueRef asNumberCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception); + + static JSValueRef numberValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef stringValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef booleanValueAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception); + static JSValueRef singleNodeValueCustomAttrGetter(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 // JSCXPathResult_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp index ac1fbbd..9f04670 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp @@ -1,7 +1,8 @@ #include "uscxml/Common.h" #include "V8DataModel.h" -#include "dom/V8DOM.h" #include "dom/V8Document.h" +#include "dom/V8SCXMLEvent.h" + #include "uscxml/Message.h" #include <glog/logging.h> @@ -29,10 +30,10 @@ boost::shared_ptr<DataModelImpl> V8DataModel::create(Interpreter* interpreter) { v8::Locker locker; v8::HandleScope scope; - Arabica::DOM::V8DOM* dom = new Arabica::DOM::V8DOM(); + dm->_dom = new Arabica::DOM::V8DOM(); // dom->interpreter = interpreter; - dom->xpath = new Arabica::XPath::XPath<std::string>(); - dom->xpath->setNamespaceContext(interpreter->getNSContext()); + dm->_dom->xpath = new Arabica::XPath::XPath<std::string>(); + dm->_dom->xpath->setNamespaceContext(interpreter->getNSContext()); // see http://stackoverflow.com/questions/3171418/v8-functiontemplate-class-instance @@ -49,8 +50,8 @@ boost::shared_ptr<DataModelImpl> V8DataModel::create(Interpreter* interpreter) { v8::Handle<v8::Object> docObj = docCtor->NewInstance(); Arabica::DOM::V8Document::V8DocumentPrivate* privData = new Arabica::DOM::V8Document::V8DocumentPrivate(); - privData->arabicaThis = new Arabica::DOM::Document<std::string>(interpreter->getDocument()); - privData->dom = dom; + privData->nativeObj = new Arabica::DOM::Document<std::string>(interpreter->getDocument()); + privData->dom = dm->_dom; docObj->SetInternalField(0, Arabica::DOM::V8DOM::toExternal(privData)); context->Global()->Set(v8::String::New("document"), docObj); @@ -72,21 +73,12 @@ void V8DataModel::registerIOProcessor(const std::string& name, const IOProcessor void V8DataModel::setSessionId(const std::string& sessionId) { _sessionId = sessionId; - v8::Locker locker; - v8::HandleScope handleScope; - v8::Context::Scope contextScope(_contexts.front()); - v8::Handle<v8::Object> global = _contexts.front()->Global(); - - global->Set(v8::String::New("_sessionid"), v8::String::New(sessionId.c_str())); + assign("_sessionId", "'" + sessionId + "'"); } void V8DataModel::setName(const std::string& name) { _name = name; - v8::HandleScope handleScope; - v8::Context::Scope contextScope(_contexts.front()); - v8::Handle<v8::Object> global = _contexts.front()->Global(); - - global->Set(v8::String::New("_name"), v8::String::New(name.c_str())); + assign("_name", "'" + name + "'"); } V8DataModel::~V8DataModel() { @@ -117,25 +109,16 @@ void V8DataModel::setEvent(const Event& event) { v8::Context::Scope contextScope(_contexts.front()); v8::Handle<v8::Object> global = _contexts.front()->Global(); - // this is unfortunate - can't we store the template in the object? - if (_eventTemplate.IsEmpty()) { - v8::Handle<v8::ObjectTemplate> localEventTemplate = v8::ObjectTemplate::New(); - localEventTemplate->SetInternalFieldCount(1); // we only have a single C++ object - localEventTemplate->SetAccessor(v8::String::New("name"), V8DataModel::jsGetEventName); - localEventTemplate->SetAccessor(v8::String::New("type"), V8DataModel::jsGetEventType); - localEventTemplate->SetAccessor(v8::String::New("sendid"), V8DataModel::jsGetEventSendId); - localEventTemplate->SetAccessor(v8::String::New("origin"), V8DataModel::jsGetEventOrigin); - localEventTemplate->SetAccessor(v8::String::New("origintype"), V8DataModel::jsGetEventOriginType); - localEventTemplate->SetAccessor(v8::String::New("invokeid"), V8DataModel::jsGetEventInvokeId); - _eventTemplate = v8::Persistent<v8::ObjectTemplate>::New(localEventTemplate); - } + v8::Handle<v8::Function> eventCtor = Arabica::DOM::V8SCXMLEvent::getTmpl()->GetFunction(); + v8::Handle<v8::Object> eventObj = eventCtor->NewInstance(); - assert(_eventTemplate->InternalFieldCount() == 1); - v8::Handle<v8::Object> eventJS = _eventTemplate->NewInstance(); - eventJS->SetInternalField(0, v8::External::New(&_event)); + Arabica::DOM::V8SCXMLEvent::V8SCXMLEventPrivate* privData = new Arabica::DOM::V8SCXMLEvent::V8SCXMLEventPrivate(); + privData->nativeObj = &_event; + privData->dom = _dom; + eventObj->SetInternalField(0, Arabica::DOM::V8DOM::toExternal(privData)); - eventJS->Set(v8::String::New("data"), getDataAsValue(event)); // set data part of _event - global->Set(v8::String::New("_event"), eventJS); + eventObj->Set(v8::String::New("data"), getDataAsValue(event)); // set data part of _event + global->Set(v8::String::New("_event"), eventObj); } Data V8DataModel::getStringAsData(const std::string& content) { @@ -254,56 +237,6 @@ v8::Handle<v8::Value> V8DataModel::jsIn(const v8::Arguments& args) { return v8::Boolean::New(true); } -v8::Handle<v8::Value> V8DataModel::jsGetEventName(v8::Local<v8::String> property, - const v8::AccessorInfo &info) { - Event* event = static_cast<Event*>(v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0))->Value()); - return v8::String::New(event->name.c_str()); -} - -v8::Handle<v8::Value> V8DataModel::jsGetEventType(v8::Local<v8::String> property, - const v8::AccessorInfo &info) { - Event* event = static_cast<Event*>(v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0))->Value()); - switch (event->type) { - case Event::PLATFORM: - return v8::String::New("platform"); - break; - case Event::INTERNAL: - return v8::String::New("internal"); - break; - case Event::EXTERNAL: - return v8::String::New("external"); - break; - default: - return v8::String::New(""); - break; - } -} - -v8::Handle<v8::Value> V8DataModel::jsGetEventSendId(v8::Local<v8::String> property, - const v8::AccessorInfo &info) { - Event* event = static_cast<Event*>(v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0))->Value()); - return v8::String::New(event->sendid.c_str()); - -} - -v8::Handle<v8::Value> V8DataModel::jsGetEventOrigin(v8::Local<v8::String> property, - const v8::AccessorInfo &info) { - Event* event = static_cast<Event*>(v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0))->Value()); - return v8::String::New(event->origin.c_str()); -} - -v8::Handle<v8::Value> V8DataModel::jsGetEventOriginType(v8::Local<v8::String> property, - const v8::AccessorInfo &info) { - Event* event = static_cast<Event*>(v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0))->Value()); - return v8::String::New(event->origintype.c_str()); -} - -v8::Handle<v8::Value> V8DataModel::jsGetEventInvokeId(v8::Local<v8::String> property, - const v8::AccessorInfo &info) { - Event* event = static_cast<Event*>(v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0))->Value()); - return v8::String::New(event->invokeid.c_str()); -} - bool V8DataModel::validate(const std::string& location, const std::string& schema) { return true; } @@ -348,35 +281,13 @@ void V8DataModel::assign(const std::string& location, const Data& data) { std::stringstream ssJSON; ssJSON << data; assign(location, ssJSON.str()); -// v8::Handle<v8::Object> variable = evalAsValue(location).As<v8::Object>(); -// assert(!variable.IsEmpty()); -// if (data.compound.size() > 0) { -// std::map<std::string, Data>::const_iterator compoundIter = data.compound.begin(); -// while(compoundIter != data.compound.end()) { -// variable->Set(v8::String::New(compoundIter->first.c_str()), getDataAsValue(compoundIter->second)); -// compoundIter++; -// } -// return; -// } else if (data.array.size() > 0) { -// std::list<Data>::const_iterator arrayIter = data.array.begin(); -// uint32_t index = 0; -// while(arrayIter != data.array.end()) { -// variable->Set(index++, getDataAsValue(*arrayIter)); -// arrayIter++; -// } -// } else if (data.type == Data::VERBATIM) { -// assign(location, "'" + data.atom + "'"); -// } else { -// assign(location, data.atom); -// } - } void V8DataModel::assign(const std::string& location, const std::string& expr) { v8::Locker locker; v8::HandleScope handleScope; v8::Context::Scope contextScope(_contexts.back()); - evalAsValue((location + " = " + expr).c_str()); + evalAsValue(location + " = " + expr); } v8::Handle<v8::Value> V8DataModel::evalAsValue(const std::string& expr) { diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h index bcc9052..b99392f 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h @@ -4,6 +4,7 @@ #include "uscxml/Interpreter.h" #include <list> #include <v8.h> +#include "dom/V8DOM.h" #ifdef BUILD_AS_PLUGINS #include "uscxml/plugins/Plugins.h" @@ -52,33 +53,14 @@ public: virtual std::string evalAsString(const std::string& expr); virtual bool evalAsBool(const std::string& expr); - static v8::Handle<v8::Value> jsGetEventName(v8::Local<v8::String> property, - const v8::AccessorInfo &info); - static v8::Handle<v8::Value> jsGetEventType(v8::Local<v8::String> property, - const v8::AccessorInfo &info); - static v8::Handle<v8::Value> jsGetEventSendId(v8::Local<v8::String> property, - const v8::AccessorInfo &info); - static v8::Handle<v8::Value> jsGetEventOrigin(v8::Local<v8::String> property, - const v8::AccessorInfo &info); - static v8::Handle<v8::Value> jsGetEventOriginType(v8::Local<v8::String> property, - const v8::AccessorInfo &info); - static v8::Handle<v8::Value> jsGetEventInvokeId(v8::Local<v8::String> property, - const v8::AccessorInfo &info); - static v8::Handle<v8::Value> jsIn(const v8::Arguments& args); static v8::Handle<v8::Value> jsPrint(const v8::Arguments& args); - protected: std::list<v8::Persistent<v8::Context> > _contexts; - Interpreter* _interpreter; - - std::string _sessionId; - std::string _name; Event _event; - v8::Persistent<v8::ObjectTemplate> _globalTemplate; - v8::Persistent<v8::ObjectTemplate> _eventTemplate; + Arabica::DOM::V8DOM* _dom; v8::Handle<v8::Value> evalAsValue(const std::string& expr); virtual v8::Handle<v8::Value> getDataAsValue(const Data& data); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp index dd11694..bee6042 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.cpp @@ -12,41 +12,43 @@ v8::Handle<v8::Value> V8Attr::nameAttrGetter(v8::Local<v8::String> property, con v8::Local<v8::Object> self = info.Holder(); struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getName().c_str()); + return v8::String::New(privData->nativeObj->getName().c_str()); } v8::Handle<v8::Value> V8Attr::specifiedAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0)); - return v8::Boolean::New(privData->arabicaThis->getSpecified()); + return v8::Boolean::New(privData->nativeObj->getSpecified()); } v8::Handle<v8::Value> V8Attr::valueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getValue().c_str()); + return v8::String::New(privData->nativeObj->getValue().c_str()); } void V8Attr::valueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localValue(value); - privData->arabicaThis->setValue(*localValue); + privData->nativeObj->setValue(*localValue); } v8::Handle<v8::Value> V8Attr::ownerElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8AttrPrivate* privData = V8DOM::toClassPtr<V8AttrPrivate >(self->GetInternalField(0)); - Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->arabicaThis->getOwnerElement()); + + if (!privData->nativeObj->getOwnerElement()) return v8::Undefined(); + Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getOwnerElement()); v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h index 5cd4831..e290415 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Attr.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 @@ -33,7 +33,7 @@ class V8Attr { public: struct V8AttrPrivate { V8DOM* dom; - Arabica::DOM::Attr<std::string>* arabicaThis; + Arabica::DOM::Attr<std::string>* nativeObj; }; V8_DESTRUCTOR(V8AttrPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h index d2543c1..a0b5ced 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CDATASection.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 @@ -33,7 +33,7 @@ class V8CDATASection { public: struct V8CDATASectionPrivate { V8DOM* dom; - Arabica::DOM::CDATASection<std::string>* arabicaThis; + Arabica::DOM::CDATASection<std::string>* nativeObj; }; V8_DESTRUCTOR(V8CDATASectionPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp index 13c582a..459cf96 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.cpp @@ -11,21 +11,21 @@ v8::Handle<v8::Value> V8CharacterData::dataAttrGetter(v8::Local<v8::String> prop v8::Local<v8::Object> self = info.Holder(); struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getData().c_str()); + return v8::String::New(privData->nativeObj->getData().c_str()); } void V8CharacterData::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localData(value); - privData->arabicaThis->setData(*localData); + privData->nativeObj->setData(*localData); } v8::Handle<v8::Value> V8CharacterData::lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0)); - return v8::Integer::New(privData->arabicaThis->getLength()); + return v8::Integer::New(privData->nativeObj->getLength()); } v8::Handle<v8::Value> V8CharacterData::substringDataCallback(const v8::Arguments& args) { if (args.Length() < 2) @@ -36,7 +36,7 @@ v8::Handle<v8::Value> V8CharacterData::substringDataCallback(const v8::Arguments unsigned long localOffset = args[0]->ToNumber()->Uint32Value(); unsigned long localCount = args[1]->ToNumber()->Uint32Value(); - std::string retVal = privData->arabicaThis->substringData(localOffset, localCount); + std::string retVal = privData->nativeObj->substringData(localOffset, localCount); return v8::String::New(retVal.c_str()); } @@ -49,7 +49,7 @@ v8::Handle<v8::Value> V8CharacterData::appendDataCallback(const v8::Arguments& a struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localArg(args[0]); - privData->arabicaThis->appendData(*localArg); + privData->nativeObj->appendData(*localArg); return v8::Undefined(); } @@ -63,7 +63,7 @@ v8::Handle<v8::Value> V8CharacterData::insertDataCallback(const v8::Arguments& a unsigned long localOffset = args[0]->ToNumber()->Uint32Value(); v8::String::AsciiValue localArg(args[1]); - privData->arabicaThis->insertData(localOffset, *localArg); + privData->nativeObj->insertData(localOffset, *localArg); return v8::Undefined(); } @@ -77,7 +77,7 @@ v8::Handle<v8::Value> V8CharacterData::deleteDataCallback(const v8::Arguments& a unsigned long localOffset = args[0]->ToNumber()->Uint32Value(); unsigned long localCount = args[1]->ToNumber()->Uint32Value(); - privData->arabicaThis->deleteData(localOffset, localCount); + privData->nativeObj->deleteData(localOffset, localCount); return v8::Undefined(); } @@ -92,7 +92,7 @@ v8::Handle<v8::Value> V8CharacterData::replaceDataCallback(const v8::Arguments& unsigned long localCount = args[1]->ToNumber()->Uint32Value(); v8::String::AsciiValue localArg(args[2]); - privData->arabicaThis->replaceData(localOffset, localCount, *localArg); + privData->nativeObj->replaceData(localOffset, localCount, *localArg); return v8::Undefined(); } diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h index d9808a3..a86519b 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8CharacterData.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 @@ -33,7 +33,7 @@ class V8CharacterData { public: struct V8CharacterDataPrivate { V8DOM* dom; - Arabica::DOM::CharacterData<std::string>* arabicaThis; + Arabica::DOM::CharacterData<std::string>* nativeObj; }; V8_DESTRUCTOR(V8CharacterDataPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h index 8ff626e..b07bf19 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Comment.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 @@ -33,7 +33,7 @@ class V8Comment { public: struct V8CommentPrivate { V8DOM* dom; - Arabica::DOM::Comment<std::string>* arabicaThis; + Arabica::DOM::Comment<std::string>* nativeObj; }; V8_DESTRUCTOR(V8CommentPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h index 122a457..10528e8 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h @@ -9,12 +9,21 @@ static void jsDestructor(v8::Persistent<v8::Value> object, void* data) { \ v8::HandleScope handleScope; \ type* thing = static_cast<type*>(v8::Local<v8::External>::Cast(object->ToObject()->GetInternalField(0))->Value()); \ - delete thing->arabicaThis; \ + delete thing->nativeObj; \ delete thing; \ object.Dispose(); \ object.Clear(); \ } +#define V8_DESTRUCTOR_KEEP_WRAPPED(type) \ +static void jsDestructor(v8::Persistent<v8::Value> object, void* data) { \ +v8::HandleScope handleScope; \ +type* thing = static_cast<type*>(v8::Local<v8::External>::Cast(object->ToObject()->GetInternalField(0))->Value()); \ +delete thing; \ +object.Dispose(); \ +object.Clear(); \ +} + namespace Arabica { namespace DOM { diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp index 6d26cee..f7a7575 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.cpp @@ -16,7 +16,7 @@ v8::Handle<v8::Value> V8DOMImplementation::hasFeatureCallback(const v8::Argument v8::String::AsciiValue localFeature(args[0]); v8::String::AsciiValue localVersion(args[1]); - bool retVal = privData->arabicaThis->hasFeature(*localFeature, *localVersion); + bool retVal = privData->nativeObj->hasFeature(*localFeature, *localVersion); return v8::Boolean::New(retVal); } @@ -31,13 +31,13 @@ v8::Handle<v8::Value> V8DOMImplementation::createDocumentTypeCallback(const v8:: v8::String::AsciiValue localPublicId(args[1]); v8::String::AsciiValue localSystemId(args[2]); - Arabica::DOM::DocumentType<std::string>* retVal = new Arabica::DOM::DocumentType<std::string>(privData->arabicaThis->createDocumentType(*localQualifiedName, *localPublicId, *localSystemId)); + Arabica::DOM::DocumentType<std::string>* retVal = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->createDocumentType(*localQualifiedName, *localPublicId, *localSystemId)); v8::Handle<v8::Function> retCtor = V8DocumentType::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -56,15 +56,15 @@ v8::Handle<v8::Value> V8DOMImplementation::createDocumentCallback(const v8::Argu struct V8DOMImplementationPrivate* privData = V8DOM::toClassPtr<V8DOMImplementationPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localNamespaceURI(args[0]); v8::String::AsciiValue localQualifiedName(args[1]); - Arabica::DOM::DocumentType<std::string>* localDoctype = V8DOM::toClassPtr<V8DocumentType::V8DocumentTypePrivate >(args[2]->ToObject()->GetInternalField(0))->arabicaThis; + Arabica::DOM::DocumentType<std::string>* localDoctype = V8DOM::toClassPtr<V8DocumentType::V8DocumentTypePrivate >(args[2]->ToObject()->GetInternalField(0))->nativeObj; - Arabica::DOM::Document<std::string>* retVal = new Arabica::DOM::Document<std::string>(privData->arabicaThis->createDocument(*localNamespaceURI, *localQualifiedName, *localDoctype)); + Arabica::DOM::Document<std::string>* retVal = new Arabica::DOM::Document<std::string>(privData->nativeObj->createDocument(*localNamespaceURI, *localQualifiedName, *localDoctype)); v8::Handle<v8::Function> retCtor = V8Document::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h index f14a39b..5a4c9d3 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOMImplementation.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 @@ -32,7 +32,7 @@ class V8DOMImplementation { public: struct V8DOMImplementationPrivate { V8DOM* dom; - Arabica::DOM::DOMImplementation<std::string>* arabicaThis; + Arabica::DOM::DOMImplementation<std::string>* nativeObj; }; V8_DESTRUCTOR(V8DOMImplementationPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp index 2bad2dd..06191ea 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.cpp @@ -21,14 +21,16 @@ v8::Persistent<v8::FunctionTemplate> V8Document::Tmpl; v8::Handle<v8::Value> V8Document::doctypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); - Arabica::DOM::DocumentType<std::string>* arbaicaRet = new Arabica::DOM::DocumentType<std::string>(privData->arabicaThis->getDoctype()); + + if (!privData->nativeObj->getDoctype()) return v8::Undefined(); + Arabica::DOM::DocumentType<std::string>* arbaicaRet = new Arabica::DOM::DocumentType<std::string>(privData->nativeObj->getDoctype()); v8::Handle<v8::Function> arbaicaRetCtor = V8DocumentType::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8DocumentType::V8DocumentTypePrivate* retPrivData = new V8DocumentType::V8DocumentTypePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8DocumentType::jsDestructor); @@ -39,14 +41,16 @@ v8::Handle<v8::Value> V8Document::doctypeAttrGetter(v8::Local<v8::String> proper v8::Handle<v8::Value> V8Document::implementationAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); - Arabica::DOM::DOMImplementation<std::string>* arbaicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->arabicaThis->getImplementation()); + + if (!privData->nativeObj->getImplementation()) return v8::Undefined(); + Arabica::DOM::DOMImplementation<std::string>* arbaicaRet = new Arabica::DOM::DOMImplementation<std::string>(privData->nativeObj->getImplementation()); v8::Handle<v8::Function> arbaicaRetCtor = V8DOMImplementation::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8DOMImplementation::V8DOMImplementationPrivate* retPrivData = new V8DOMImplementation::V8DOMImplementationPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8DOMImplementation::jsDestructor); @@ -57,14 +61,16 @@ v8::Handle<v8::Value> V8Document::implementationAttrGetter(v8::Local<v8::String> v8::Handle<v8::Value> V8Document::documentElementAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); - Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->arabicaThis->getDocumentElement()); + + if (!privData->nativeObj->getDocumentElement()) return v8::Undefined(); + Arabica::DOM::Element<std::string>* arbaicaRet = new Arabica::DOM::Element<std::string>(privData->nativeObj->getDocumentElement()); v8::Handle<v8::Function> arbaicaRetCtor = V8Element::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8Element::jsDestructor); @@ -79,13 +85,13 @@ v8::Handle<v8::Value> V8Document::createElementCallback(const v8::Arguments& arg struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localTagName(args[0]); - Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->arabicaThis->createElement(*localTagName)); + Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElement(*localTagName)); v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -99,13 +105,13 @@ v8::Handle<v8::Value> V8Document::createDocumentFragmentCallback(const v8::Argum v8::Local<v8::Object> self = args.Holder(); struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); - Arabica::DOM::DocumentFragment<std::string>* retVal = new Arabica::DOM::DocumentFragment<std::string>(privData->arabicaThis->createDocumentFragment()); + Arabica::DOM::DocumentFragment<std::string>* retVal = new Arabica::DOM::DocumentFragment<std::string>(privData->nativeObj->createDocumentFragment()); v8::Handle<v8::Function> retCtor = V8DocumentFragment::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8DocumentFragment::V8DocumentFragmentPrivate* retPrivData = new V8DocumentFragment::V8DocumentFragmentPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -122,13 +128,13 @@ v8::Handle<v8::Value> V8Document::createTextNodeCallback(const v8::Arguments& ar struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localData(args[0]); - Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->arabicaThis->createTextNode(*localData)); + Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->createTextNode(*localData)); v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -145,13 +151,13 @@ v8::Handle<v8::Value> V8Document::createCommentCallback(const v8::Arguments& arg struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localData(args[0]); - Arabica::DOM::Comment<std::string>* retVal = new Arabica::DOM::Comment<std::string>(privData->arabicaThis->createComment(*localData)); + Arabica::DOM::Comment<std::string>* retVal = new Arabica::DOM::Comment<std::string>(privData->nativeObj->createComment(*localData)); v8::Handle<v8::Function> retCtor = V8Comment::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Comment::V8CommentPrivate* retPrivData = new V8Comment::V8CommentPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -168,13 +174,13 @@ v8::Handle<v8::Value> V8Document::createCDATASectionCallback(const v8::Arguments struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localData(args[0]); - Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->arabicaThis->createCDATASection(*localData)); + Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->nativeObj->createCDATASection(*localData)); v8::Handle<v8::Function> retCtor = V8CDATASection::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8CDATASection::V8CDATASectionPrivate* retPrivData = new V8CDATASection::V8CDATASectionPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -192,13 +198,13 @@ v8::Handle<v8::Value> V8Document::createProcessingInstructionCallback(const v8:: v8::String::AsciiValue localTarget(args[0]); v8::String::AsciiValue localData(args[1]); - Arabica::DOM::ProcessingInstruction<std::string>* retVal = new Arabica::DOM::ProcessingInstruction<std::string>(privData->arabicaThis->createProcessingInstruction(*localTarget, *localData)); + Arabica::DOM::ProcessingInstruction<std::string>* retVal = new Arabica::DOM::ProcessingInstruction<std::string>(privData->nativeObj->createProcessingInstruction(*localTarget, *localData)); v8::Handle<v8::Function> retCtor = V8ProcessingInstruction::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8ProcessingInstruction::V8ProcessingInstructionPrivate* retPrivData = new V8ProcessingInstruction::V8ProcessingInstructionPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -215,13 +221,13 @@ v8::Handle<v8::Value> V8Document::createAttributeCallback(const v8::Arguments& a struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localName(args[0]); - Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->createAttribute(*localName)); + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttribute(*localName)); v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -238,13 +244,13 @@ v8::Handle<v8::Value> V8Document::createEntityReferenceCallback(const v8::Argume struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localName(args[0]); - Arabica::DOM::EntityReference<std::string>* retVal = new Arabica::DOM::EntityReference<std::string>(privData->arabicaThis->createEntityReference(*localName)); + Arabica::DOM::EntityReference<std::string>* retVal = new Arabica::DOM::EntityReference<std::string>(privData->nativeObj->createEntityReference(*localName)); v8::Handle<v8::Function> retCtor = V8EntityReference::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8EntityReference::V8EntityReferencePrivate* retPrivData = new V8EntityReference::V8EntityReferencePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -261,13 +267,13 @@ v8::Handle<v8::Value> V8Document::getElementsByTagNameCallback(const v8::Argumen struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localTagname(args[0]); - Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->arabicaThis->getElementsByTagName(*localTagname)); + Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localTagname)); v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -284,16 +290,16 @@ v8::Handle<v8::Value> V8Document::importNodeCallback(const v8::Arguments& args) v8::Local<v8::Object> self = args.Holder(); struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* localImportedNode = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis; + Arabica::DOM::Node<std::string>* localImportedNode = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj; bool localDeep = args[1]->ToBoolean()->BooleanValue(); - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->importNode(*localImportedNode, localDeep)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->importNode(*localImportedNode, localDeep)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -311,13 +317,13 @@ v8::Handle<v8::Value> V8Document::createElementNSCallback(const v8::Arguments& a v8::String::AsciiValue localNamespaceURI(args[0]); v8::String::AsciiValue localQualifiedName(args[1]); - Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->arabicaThis->createElementNS(*localNamespaceURI, *localQualifiedName)); + Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->createElementNS(*localNamespaceURI, *localQualifiedName)); v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -335,13 +341,13 @@ v8::Handle<v8::Value> V8Document::createAttributeNSCallback(const v8::Arguments& v8::String::AsciiValue localNamespaceURI(args[0]); v8::String::AsciiValue localQualifiedName(args[1]); - Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->createAttributeNS(*localNamespaceURI, *localQualifiedName)); + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->createAttributeNS(*localNamespaceURI, *localQualifiedName)); v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -359,13 +365,13 @@ v8::Handle<v8::Value> V8Document::getElementsByTagNameNSCallback(const v8::Argum v8::String::AsciiValue localNamespaceURI(args[0]); v8::String::AsciiValue localLocalName(args[1]); - Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->arabicaThis->getElementsByTagNameNS(*localNamespaceURI, *localLocalName)); + Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName)); v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -382,13 +388,13 @@ v8::Handle<v8::Value> V8Document::getElementByIdCallback(const v8::Arguments& ar struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localElementId(args[0]); - Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->arabicaThis->getElementById(*localElementId)); + Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>(privData->nativeObj->getElementById(*localElementId)); v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h index 22d2713..da61876 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Document.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 @@ -33,7 +33,7 @@ class V8Document { public: struct V8DocumentPrivate { V8DOM* dom; - Arabica::DOM::Document<std::string>* arabicaThis; + Arabica::DOM::Document<std::string>* nativeObj; }; V8_DESTRUCTOR(V8DocumentPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp index 2756287..be9b05c 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentCustom.cpp @@ -21,7 +21,7 @@ v8::Handle<v8::Value> V8Document::evaluateCustomCallback(const v8::Arguments& ar Arabica::DOM::Node<std::string>* localContextNode = V8DOM::toClassPtr<Arabica::DOM::Node<std::string> >(args[1]->ToObject()->GetInternalField(0)); retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(*localExpression, *localContextNode)); } else { - retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(*localExpression, *privData->arabicaThis)); + retVal = new XPath::XPathValue<std::string>(privData->dom->xpath->evaluate(*localExpression, *privData->nativeObj)); } v8::Handle<v8::Function> retCtor = V8XPathResult::getTmpl()->GetFunction(); @@ -29,7 +29,7 @@ v8::Handle<v8::Value> V8Document::evaluateCustomCallback(const v8::Arguments& ar V8XPathResult::V8XPathResultPrivate* retPrivData = new V8XPathResult::V8XPathResultPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h index 2340eb7..62dc58d 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentFragment.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 @@ -33,7 +33,7 @@ class V8DocumentFragment { public: struct V8DocumentFragmentPrivate { V8DOM* dom; - Arabica::DOM::DocumentFragment<std::string>* arabicaThis; + Arabica::DOM::DocumentFragment<std::string>* nativeObj; }; V8_DESTRUCTOR(V8DocumentFragmentPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp index cd7e2a5..6b9a7b0 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.cpp @@ -12,20 +12,22 @@ v8::Handle<v8::Value> V8DocumentType::nameAttrGetter(v8::Local<v8::String> prope v8::Local<v8::Object> self = info.Holder(); struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getName().c_str()); + return v8::String::New(privData->nativeObj->getName().c_str()); } v8::Handle<v8::Value> V8DocumentType::entitiesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); - Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->arabicaThis->getEntities()); + + + Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getEntities()); v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor); @@ -36,14 +38,16 @@ v8::Handle<v8::Value> V8DocumentType::entitiesAttrGetter(v8::Local<v8::String> p v8::Handle<v8::Value> V8DocumentType::notationsAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); - Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->arabicaThis->getNotations()); + + + Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getNotations()); v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor); @@ -55,21 +59,21 @@ v8::Handle<v8::Value> V8DocumentType::publicIdAttrGetter(v8::Local<v8::String> p v8::Local<v8::Object> self = info.Holder(); struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getPublicId().c_str()); + return v8::String::New(privData->nativeObj->getPublicId().c_str()); } v8::Handle<v8::Value> V8DocumentType::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getSystemId().c_str()); + return v8::String::New(privData->nativeObj->getSystemId().c_str()); } v8::Handle<v8::Value> V8DocumentType::internalSubsetAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8DocumentTypePrivate* privData = V8DOM::toClassPtr<V8DocumentTypePrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getInternalSubset().c_str()); + return v8::String::New(privData->nativeObj->getInternalSubset().c_str()); } bool V8DocumentType::hasInstance(v8::Handle<v8::Value> value) { return getTmpl()->HasInstance(value); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h index 462cec9..f4d0c15 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8DocumentType.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 @@ -33,7 +33,7 @@ class V8DocumentType { public: struct V8DocumentTypePrivate { V8DOM* dom; - Arabica::DOM::DocumentType<std::string>* arabicaThis; + Arabica::DOM::DocumentType<std::string>* nativeObj; }; V8_DESTRUCTOR(V8DocumentTypePrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp index 3c7d7da..680dd5e 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.cpp @@ -13,7 +13,7 @@ v8::Handle<v8::Value> V8Element::tagNameAttrGetter(v8::Local<v8::String> propert v8::Local<v8::Object> self = info.Holder(); struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getTagName().c_str()); + return v8::String::New(privData->nativeObj->getTagName().c_str()); } v8::Handle<v8::Value> V8Element::getAttributeCallback(const v8::Arguments& args) { if (args.Length() < 1) @@ -23,7 +23,7 @@ v8::Handle<v8::Value> V8Element::getAttributeCallback(const v8::Arguments& args) struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localName(args[0]); - std::string retVal = privData->arabicaThis->getAttribute(*localName); + std::string retVal = privData->nativeObj->getAttribute(*localName); return v8::String::New(retVal.c_str()); } @@ -37,7 +37,7 @@ v8::Handle<v8::Value> V8Element::setAttributeCallback(const v8::Arguments& args) v8::String::AsciiValue localName(args[0]); v8::String::AsciiValue localValue(args[1]); - privData->arabicaThis->setAttribute(*localName, *localValue); + privData->nativeObj->setAttribute(*localName, *localValue); return v8::Undefined(); } @@ -50,7 +50,7 @@ v8::Handle<v8::Value> V8Element::removeAttributeCallback(const v8::Arguments& ar struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localName(args[0]); - privData->arabicaThis->removeAttribute(*localName); + privData->nativeObj->removeAttribute(*localName); return v8::Undefined(); } @@ -63,13 +63,13 @@ v8::Handle<v8::Value> V8Element::getAttributeNodeCallback(const v8::Arguments& a struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localName(args[0]); - Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->getAttributeNode(*localName)); + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNode(*localName)); v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -86,15 +86,15 @@ v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& a v8::Local<v8::Object> self = args.Holder(); struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0)); - Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis; + Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj; - Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->setAttributeNode(*localNewAttr)); + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNode(*localNewAttr)); v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -111,15 +111,15 @@ v8::Handle<v8::Value> V8Element::removeAttributeNodeCallback(const v8::Arguments v8::Local<v8::Object> self = args.Holder(); struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0)); - Arabica::DOM::Attr<std::string>* localOldAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis; + Arabica::DOM::Attr<std::string>* localOldAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj; - Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->removeAttributeNode(*localOldAttr)); + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->removeAttributeNode(*localOldAttr)); v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -136,13 +136,13 @@ v8::Handle<v8::Value> V8Element::getElementsByTagNameCallback(const v8::Argument struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localName(args[0]); - Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->arabicaThis->getElementsByTagName(*localName)); + Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagName(*localName)); v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -160,7 +160,7 @@ v8::Handle<v8::Value> V8Element::getAttributeNSCallback(const v8::Arguments& arg v8::String::AsciiValue localNamespaceURI(args[0]); v8::String::AsciiValue localLocalName(args[1]); - std::string retVal = privData->arabicaThis->getAttributeNS(*localNamespaceURI, *localLocalName); + std::string retVal = privData->nativeObj->getAttributeNS(*localNamespaceURI, *localLocalName); return v8::String::New(retVal.c_str()); } @@ -175,7 +175,7 @@ v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& arg v8::String::AsciiValue localQualifiedName(args[1]); v8::String::AsciiValue localValue(args[2]); - privData->arabicaThis->setAttributeNS(*localNamespaceURI, *localQualifiedName, *localValue); + privData->nativeObj->setAttributeNS(*localNamespaceURI, *localQualifiedName, *localValue); return v8::Undefined(); } @@ -189,7 +189,7 @@ v8::Handle<v8::Value> V8Element::removeAttributeNSCallback(const v8::Arguments& v8::String::AsciiValue localNamespaceURI(args[0]); v8::String::AsciiValue localLocalName(args[1]); - privData->arabicaThis->removeAttributeNS(*localNamespaceURI, *localLocalName); + privData->nativeObj->removeAttributeNS(*localNamespaceURI, *localLocalName); return v8::Undefined(); } @@ -203,13 +203,13 @@ v8::Handle<v8::Value> V8Element::getAttributeNodeNSCallback(const v8::Arguments& v8::String::AsciiValue localNamespaceURI(args[0]); v8::String::AsciiValue localLocalName(args[1]); - Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->getAttributeNodeNS(*localNamespaceURI, *localLocalName)); + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->getAttributeNodeNS(*localNamespaceURI, *localLocalName)); v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -226,15 +226,15 @@ v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& v8::Local<v8::Object> self = args.Holder(); struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0)); - Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis; + Arabica::DOM::Attr<std::string>* localNewAttr = V8DOM::toClassPtr<V8Attr::V8AttrPrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj; - Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->arabicaThis->setAttributeNodeNS(*localNewAttr)); + Arabica::DOM::Attr<std::string>* retVal = new Arabica::DOM::Attr<std::string>(privData->nativeObj->setAttributeNodeNS(*localNewAttr)); v8::Handle<v8::Function> retCtor = V8Attr::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Attr::V8AttrPrivate* retPrivData = new V8Attr::V8AttrPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -252,13 +252,13 @@ v8::Handle<v8::Value> V8Element::getElementsByTagNameNSCallback(const v8::Argume v8::String::AsciiValue localNamespaceURI(args[0]); v8::String::AsciiValue localLocalName(args[1]); - Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->arabicaThis->getElementsByTagNameNS(*localNamespaceURI, *localLocalName)); + Arabica::DOM::NodeList<std::string>* retVal = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getElementsByTagNameNS(*localNamespaceURI, *localLocalName)); v8::Handle<v8::Function> retCtor = V8NodeList::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -275,7 +275,7 @@ v8::Handle<v8::Value> V8Element::hasAttributeCallback(const v8::Arguments& args) struct V8ElementPrivate* privData = V8DOM::toClassPtr<V8ElementPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localName(args[0]); - bool retVal = privData->arabicaThis->hasAttribute(*localName); + bool retVal = privData->nativeObj->hasAttribute(*localName); return v8::Boolean::New(retVal); } @@ -289,7 +289,7 @@ v8::Handle<v8::Value> V8Element::hasAttributeNSCallback(const v8::Arguments& arg v8::String::AsciiValue localNamespaceURI(args[0]); v8::String::AsciiValue localLocalName(args[1]); - bool retVal = privData->arabicaThis->hasAttributeNS(*localNamespaceURI, *localLocalName); + bool retVal = privData->nativeObj->hasAttributeNS(*localNamespaceURI, *localLocalName); return v8::Boolean::New(retVal); } diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h index 5a824b3..338c249 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Element.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 @@ -33,7 +33,7 @@ class V8Element { public: struct V8ElementPrivate { V8DOM* dom; - Arabica::DOM::Element<std::string>* arabicaThis; + Arabica::DOM::Element<std::string>* nativeObj; }; V8_DESTRUCTOR(V8ElementPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp index 8bdd57c..f3ce21d 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.cpp @@ -11,21 +11,21 @@ v8::Handle<v8::Value> V8Entity::publicIdAttrGetter(v8::Local<v8::String> propert v8::Local<v8::Object> self = info.Holder(); struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getPublicId().c_str()); + return v8::String::New(privData->nativeObj->getPublicId().c_str()); } v8::Handle<v8::Value> V8Entity::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getSystemId().c_str()); + return v8::String::New(privData->nativeObj->getSystemId().c_str()); } v8::Handle<v8::Value> V8Entity::notationNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8EntityPrivate* privData = V8DOM::toClassPtr<V8EntityPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getNotationName().c_str()); + return v8::String::New(privData->nativeObj->getNotationName().c_str()); } bool V8Entity::hasInstance(v8::Handle<v8::Value> value) { return getTmpl()->HasInstance(value); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h index 6c22e3a..c8e0eaf 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Entity.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 @@ -33,7 +33,7 @@ class V8Entity { public: struct V8EntityPrivate { V8DOM* dom; - Arabica::DOM::Entity<std::string>* arabicaThis; + Arabica::DOM::Entity<std::string>* nativeObj; }; V8_DESTRUCTOR(V8EntityPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h index d99c7ab..85cc7cc 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8EntityReference.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 @@ -33,7 +33,7 @@ class V8EntityReference { public: struct V8EntityReferencePrivate { V8DOM* dom; - Arabica::DOM::EntityReference<std::string>* arabicaThis; + Arabica::DOM::EntityReference<std::string>* nativeObj; }; V8_DESTRUCTOR(V8EntityReferencePrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp index 4608ea1..037d651 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.cpp @@ -11,7 +11,7 @@ v8::Handle<v8::Value> V8NamedNodeMap::lengthAttrGetter(v8::Local<v8::String> pro v8::Local<v8::Object> self = info.Holder(); struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0)); - return v8::Integer::New(privData->arabicaThis->getLength()); + return v8::Integer::New(privData->nativeObj->getLength()); } v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemCallback(const v8::Arguments& args) { if (args.Length() < 1) @@ -21,13 +21,13 @@ v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemCallback(const v8::Arguments& struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localName(args[0]); - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getNamedItem(*localName)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItem(*localName)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -44,15 +44,15 @@ v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemCallback(const v8::Arguments& v8::Local<v8::Object> self = args.Holder(); struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis; + Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj; - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->setNamedItem(*localArg)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItem(*localArg)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -69,13 +69,13 @@ v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemCallback(const v8::Argument struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localName(args[0]); - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->removeNamedItem(*localName)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItem(*localName)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -92,13 +92,13 @@ v8::Handle<v8::Value> V8NamedNodeMap::itemCallback(const v8::Arguments& args) { struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0)); unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->item(localIndex)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -116,13 +116,13 @@ v8::Handle<v8::Value> V8NamedNodeMap::getNamedItemNSCallback(const v8::Arguments v8::String::AsciiValue localNamespaceURI(args[0]); v8::String::AsciiValue localLocalName(args[1]); - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getNamedItemNS(*localNamespaceURI, *localLocalName)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNamedItemNS(*localNamespaceURI, *localLocalName)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -139,15 +139,15 @@ v8::Handle<v8::Value> V8NamedNodeMap::setNamedItemNSCallback(const v8::Arguments v8::Local<v8::Object> self = args.Holder(); struct V8NamedNodeMapPrivate* privData = V8DOM::toClassPtr<V8NamedNodeMapPrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis; + Arabica::DOM::Node<std::string>* localArg = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj; - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->setNamedItemNS(*localArg)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->setNamedItemNS(*localArg)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -165,13 +165,13 @@ v8::Handle<v8::Value> V8NamedNodeMap::removeNamedItemNSCallback(const v8::Argume v8::String::AsciiValue localNamespaceURI(args[0]); v8::String::AsciiValue localLocalName(args[1]); - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->removeNamedItemNS(*localNamespaceURI, *localLocalName)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeNamedItemNS(*localNamespaceURI, *localLocalName)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h index 52e6c54..b8bc873 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NamedNodeMap.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 @@ -32,7 +32,7 @@ class V8NamedNodeMap { public: struct V8NamedNodeMapPrivate { V8DOM* dom; - Arabica::DOM::NamedNodeMap<std::string>* arabicaThis; + Arabica::DOM::NamedNodeMap<std::string>* nativeObj; }; V8_DESTRUCTOR(V8NamedNodeMapPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp index 52ff3ec..b77f38e 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.cpp @@ -13,41 +13,43 @@ v8::Handle<v8::Value> V8Node::nodeNameAttrGetter(v8::Local<v8::String> property, v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getNodeName().c_str()); + return v8::String::New(privData->nativeObj->getNodeName().c_str()); } v8::Handle<v8::Value> V8Node::nodeValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getNodeValue().c_str()); + return v8::String::New(privData->nativeObj->getNodeValue().c_str()); } void V8Node::nodeValueAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); v8::String::AsciiValue localNodeValue(value); - privData->arabicaThis->setNodeValue(*localNodeValue); + privData->nativeObj->setNodeValue(*localNodeValue); } v8::Handle<v8::Value> V8Node::nodeTypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - return v8::Integer::New(privData->arabicaThis->getNodeType()); + return v8::Integer::New(privData->nativeObj->getNodeType()); } v8::Handle<v8::Value> V8Node::parentNodeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getParentNode()); + + if (!privData->nativeObj->getParentNode()) return v8::Undefined(); + Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getParentNode()); v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor); @@ -58,14 +60,16 @@ v8::Handle<v8::Value> V8Node::parentNodeAttrGetter(v8::Local<v8::String> propert v8::Handle<v8::Value> V8Node::childNodesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::NodeList<std::string>* arbaicaRet = new Arabica::DOM::NodeList<std::string>(privData->arabicaThis->getChildNodes()); + + + Arabica::DOM::NodeList<std::string>* arbaicaRet = new Arabica::DOM::NodeList<std::string>(privData->nativeObj->getChildNodes()); v8::Handle<v8::Function> arbaicaRetCtor = V8NodeList::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8NodeList::V8NodeListPrivate* retPrivData = new V8NodeList::V8NodeListPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8NodeList::jsDestructor); @@ -76,14 +80,16 @@ v8::Handle<v8::Value> V8Node::childNodesAttrGetter(v8::Local<v8::String> propert v8::Handle<v8::Value> V8Node::firstChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getFirstChild()); + + if (!privData->nativeObj->getFirstChild()) return v8::Undefined(); + Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getFirstChild()); v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor); @@ -94,14 +100,16 @@ v8::Handle<v8::Value> V8Node::firstChildAttrGetter(v8::Local<v8::String> propert v8::Handle<v8::Value> V8Node::lastChildAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getLastChild()); + + if (!privData->nativeObj->getLastChild()) return v8::Undefined(); + Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getLastChild()); v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor); @@ -112,14 +120,16 @@ v8::Handle<v8::Value> V8Node::lastChildAttrGetter(v8::Local<v8::String> property v8::Handle<v8::Value> V8Node::previousSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getPreviousSibling()); + + if (!privData->nativeObj->getPreviousSibling()) return v8::Undefined(); + Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getPreviousSibling()); v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor); @@ -130,14 +140,16 @@ v8::Handle<v8::Value> V8Node::previousSiblingAttrGetter(v8::Local<v8::String> pr v8::Handle<v8::Value> V8Node::nextSiblingAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->arabicaThis->getNextSibling()); + + if (!privData->nativeObj->getNextSibling()) return v8::Undefined(); + Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->getNextSibling()); v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor); @@ -148,14 +160,16 @@ v8::Handle<v8::Value> V8Node::nextSiblingAttrGetter(v8::Local<v8::String> proper v8::Handle<v8::Value> V8Node::attributesAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->arabicaThis->getAttributes()); + + + Arabica::DOM::NamedNodeMap<std::string>* arbaicaRet = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getAttributes()); v8::Handle<v8::Function> arbaicaRetCtor = V8NamedNodeMap::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8NamedNodeMap::V8NamedNodeMapPrivate* retPrivData = new V8NamedNodeMap::V8NamedNodeMapPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8NamedNodeMap::jsDestructor); @@ -166,14 +180,16 @@ v8::Handle<v8::Value> V8Node::attributesAttrGetter(v8::Local<v8::String> propert v8::Handle<v8::Value> V8Node::ownerDocumentAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::Document<std::string>* arbaicaRet = new Arabica::DOM::Document<std::string>(privData->arabicaThis->getOwnerDocument()); + + if (!privData->nativeObj->getOwnerDocument()) return v8::Undefined(); + Arabica::DOM::Document<std::string>* arbaicaRet = new Arabica::DOM::Document<std::string>(privData->nativeObj->getOwnerDocument()); v8::Handle<v8::Function> arbaicaRetCtor = V8Document::getTmpl()->GetFunction(); v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); struct V8Document::V8DocumentPrivate* retPrivData = new V8Document::V8DocumentPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = arbaicaRet; + retPrivData->nativeObj = arbaicaRet; arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); arbaicaRetObj.MakeWeak(0, V8Document::jsDestructor); @@ -185,28 +201,28 @@ v8::Handle<v8::Value> V8Node::namespaceURIAttrGetter(v8::Local<v8::String> prope v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getNamespaceURI().c_str()); + return v8::String::New(privData->nativeObj->getNamespaceURI().c_str()); } v8::Handle<v8::Value> V8Node::prefixAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getPrefix().c_str()); + return v8::String::New(privData->nativeObj->getPrefix().c_str()); } void V8Node::prefixAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); v8::String::AsciiValue localPrefix(value); - privData->arabicaThis->setPrefix(*localPrefix); + privData->nativeObj->setPrefix(*localPrefix); } v8::Handle<v8::Value> V8Node::localNameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getLocalName().c_str()); + return v8::String::New(privData->nativeObj->getLocalName().c_str()); } v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args) { if (args.Length() < 2) @@ -216,16 +232,16 @@ v8::Handle<v8::Value> V8Node::insertBeforeCallback(const v8::Arguments& args) { v8::Local<v8::Object> self = args.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis; - Arabica::DOM::Node<std::string>* localRefChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->arabicaThis; + Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj; + Arabica::DOM::Node<std::string>* localRefChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj; - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->insertBefore(*localNewChild, *localRefChild)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->insertBefore(*localNewChild, *localRefChild)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -242,16 +258,16 @@ v8::Handle<v8::Value> V8Node::replaceChildCallback(const v8::Arguments& args) { v8::Local<v8::Object> self = args.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis; - Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->arabicaThis; + Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj; + Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[1]->ToObject()->GetInternalField(0))->nativeObj; - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->replaceChild(*localNewChild, *localOldChild)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->replaceChild(*localNewChild, *localOldChild)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -268,15 +284,15 @@ v8::Handle<v8::Value> V8Node::removeChildCallback(const v8::Arguments& args) { v8::Local<v8::Object> self = args.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis; + Arabica::DOM::Node<std::string>* localOldChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj; - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->removeChild(*localOldChild)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->removeChild(*localOldChild)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -293,15 +309,15 @@ v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) { v8::Local<v8::Object> self = args.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->arabicaThis; + Arabica::DOM::Node<std::string>* localNewChild = V8DOM::toClassPtr<V8Node::V8NodePrivate >(args[0]->ToObject()->GetInternalField(0))->nativeObj; - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->appendChild(*localNewChild)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->appendChild(*localNewChild)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -315,7 +331,7 @@ v8::Handle<v8::Value> V8Node::hasChildNodesCallback(const v8::Arguments& args) { v8::Local<v8::Object> self = args.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - bool retVal = privData->arabicaThis->hasChildNodes(); + bool retVal = privData->nativeObj->hasChildNodes(); return v8::Boolean::New(retVal); } @@ -328,13 +344,13 @@ v8::Handle<v8::Value> V8Node::cloneNodeCallback(const v8::Arguments& args) { struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); bool localDeep = args[0]->ToBoolean()->BooleanValue(); - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->cloneNode(localDeep)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->cloneNode(localDeep)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -348,7 +364,7 @@ v8::Handle<v8::Value> V8Node::normalizeCallback(const v8::Arguments& args) { v8::Local<v8::Object> self = args.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - privData->arabicaThis->normalize(); + privData->nativeObj->normalize(); return v8::Undefined(); } @@ -362,7 +378,7 @@ v8::Handle<v8::Value> V8Node::isSupportedCallback(const v8::Arguments& args) { v8::String::AsciiValue localFeature(args[0]); v8::String::AsciiValue localVersion(args[1]); - bool retVal = privData->arabicaThis->isSupported(*localFeature, *localVersion); + bool retVal = privData->nativeObj->isSupported(*localFeature, *localVersion); return v8::Boolean::New(retVal); } @@ -372,7 +388,7 @@ v8::Handle<v8::Value> V8Node::hasAttributesCallback(const v8::Arguments& args) { v8::Local<v8::Object> self = args.Holder(); struct V8NodePrivate* privData = V8DOM::toClassPtr<V8NodePrivate >(self->GetInternalField(0)); - bool retVal = privData->arabicaThis->hasAttributes(); + bool retVal = privData->nativeObj->hasAttributes(); return v8::Boolean::New(retVal); } diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h index ee14dc9..a15a676 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Node.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 @@ -32,7 +32,7 @@ class V8Node { public: struct V8NodePrivate { V8DOM* dom; - Arabica::DOM::Node<std::string>* arabicaThis; + Arabica::DOM::Node<std::string>* nativeObj; }; V8_DESTRUCTOR(V8NodePrivate); @@ -124,30 +124,30 @@ public: prototype->Set(v8::String::NewSymbol("hasAttributes"), v8::FunctionTemplate::New(V8Node::hasAttributesCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); - tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), v8::ReadOnly); - tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), v8::ReadOnly); - tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), v8::ReadOnly); - tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), v8::ReadOnly); - tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), v8::ReadOnly); - tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), v8::ReadOnly); - tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), v8::ReadOnly); - tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), v8::ReadOnly); - tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), v8::ReadOnly); - tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), v8::ReadOnly); - tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), v8::ReadOnly); - tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), v8::ReadOnly); - prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), v8::ReadOnly); + tmpl->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("ELEMENT_NODE"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("ATTRIBUTE_NODE"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("TEXT_NODE"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("CDATA_SECTION_NODE"), v8::Integer::New(4), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("ENTITY_REFERENCE_NODE"), v8::Integer::New(5), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("ENTITY_NODE"), v8::Integer::New(6), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("PROCESSING_INSTRUCTION_NODE"), v8::Integer::New(7), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("COMMENT_NODE"), v8::Integer::New(8), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("DOCUMENT_NODE"), v8::Integer::New(9), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("DOCUMENT_TYPE_NODE"), v8::Integer::New(10), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("DOCUMENT_FRAGMENT_NODE"), v8::Integer::New(11), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("NOTATION_NODE"), v8::Integer::New(12), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); } diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp index 1f6b368..bee706e 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.cpp @@ -11,7 +11,7 @@ v8::Handle<v8::Value> V8NodeList::lengthAttrGetter(v8::Local<v8::String> propert v8::Local<v8::Object> self = info.Holder(); struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0)); - return v8::Integer::New(privData->arabicaThis->getLength()); + return v8::Integer::New(privData->nativeObj->getLength()); } v8::Handle<v8::Value> V8NodeList::itemCallback(const v8::Arguments& args) { if (args.Length() < 1) @@ -21,13 +21,13 @@ v8::Handle<v8::Value> V8NodeList::itemCallback(const v8::Arguments& args) { struct V8NodeListPrivate* privData = V8DOM::toClassPtr<V8NodeListPrivate >(self->GetInternalField(0)); unsigned long localIndex = args[0]->ToNumber()->Uint32Value(); - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->item(localIndex)); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->item(localIndex)); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h index fefc084..771d82c 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeList.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 @@ -32,7 +32,7 @@ class V8NodeList { public: struct V8NodeListPrivate { V8DOM* dom; - Arabica::DOM::NodeList<std::string>* arabicaThis; + Arabica::DOM::NodeList<std::string>* nativeObj; }; V8_DESTRUCTOR(V8NodeListPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp index 2b051f1..fade729 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.cpp @@ -10,21 +10,21 @@ v8::Handle<v8::Value> V8NodeSet::sizeAttrGetter(v8::Local<v8::String> property, v8::Local<v8::Object> self = info.Holder(); struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0)); - return v8::Integer::New(privData->arabicaThis->size()); + return v8::Integer::New(privData->nativeObj->size()); } v8::Handle<v8::Value> V8NodeSet::emptyAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0)); - return v8::Boolean::New(privData->arabicaThis->empty()); + return v8::Boolean::New(privData->nativeObj->empty()); } v8::Handle<v8::Value> V8NodeSet::toDocumentOrderCallback(const v8::Arguments& args) { v8::Local<v8::Object> self = args.Holder(); struct V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0)); - privData->arabicaThis->to_document_order(); + privData->nativeObj->to_document_order(); return v8::Undefined(); } diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h index 583c1b9..294d851 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSet.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 @@ -32,7 +32,7 @@ class V8NodeSet { public: struct V8NodeSetPrivate { V8DOM* dom; - Arabica::XPath::NodeSet<std::string>* arabicaThis; + Arabica::XPath::NodeSet<std::string>* nativeObj; }; V8_DESTRUCTOR(V8NodeSetPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp index 61f5947..ba84b75 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8NodeSetCustom.cpp @@ -9,17 +9,17 @@ v8::Handle<v8::Value> V8NodeSet::indexedPropertyCustomGetter(uint32_t index, con v8::Local<v8::Object> self = info.Holder(); V8NodeSetPrivate* privData = V8DOM::toClassPtr<V8NodeSetPrivate >(self->GetInternalField(0)); - if (privData->arabicaThis->size() >= index) { - switch((*privData->arabicaThis)[index].getNodeType()) { + if (privData->nativeObj->size() >= index) { + switch((*privData->nativeObj)[index].getNodeType()) { case Node_base::ELEMENT_NODE: { - Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>((*privData->arabicaThis)[index]); + Arabica::DOM::Element<std::string>* retVal = new Arabica::DOM::Element<std::string>((*privData->nativeObj)[index]); v8::Handle<v8::Function> retCtor = V8Element::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Element::V8ElementPrivate* retPrivData = new V8Element::V8ElementPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -27,14 +27,14 @@ v8::Handle<v8::Value> V8NodeSet::indexedPropertyCustomGetter(uint32_t index, con return retObj; } default: { - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>((*privData->arabicaThis)[index]); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>((*privData->nativeObj)[index]); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp index e210491..129563d 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.cpp @@ -11,14 +11,14 @@ v8::Handle<v8::Value> V8Notation::publicIdAttrGetter(v8::Local<v8::String> prope v8::Local<v8::Object> self = info.Holder(); struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getPublicId().c_str()); + return v8::String::New(privData->nativeObj->getPublicId().c_str()); } v8::Handle<v8::Value> V8Notation::systemIdAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8NotationPrivate* privData = V8DOM::toClassPtr<V8NotationPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getSystemId().c_str()); + return v8::String::New(privData->nativeObj->getSystemId().c_str()); } bool V8Notation::hasInstance(v8::Handle<v8::Value> value) { return getTmpl()->HasInstance(value); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h index f29d1fe..ba90056 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Notation.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 @@ -33,7 +33,7 @@ class V8Notation { public: struct V8NotationPrivate { V8DOM* dom; - Arabica::DOM::Notation<std::string>* arabicaThis; + Arabica::DOM::Notation<std::string>* nativeObj; }; V8_DESTRUCTOR(V8NotationPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp index c299d76..c6d2b28 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.cpp @@ -11,21 +11,21 @@ v8::Handle<v8::Value> V8ProcessingInstruction::targetAttrGetter(v8::Local<v8::St v8::Local<v8::Object> self = info.Holder(); struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getTarget().c_str()); + return v8::String::New(privData->nativeObj->getTarget().c_str()); } v8::Handle<v8::Value> V8ProcessingInstruction::dataAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->getData().c_str()); + return v8::String::New(privData->nativeObj->getData().c_str()); } void V8ProcessingInstruction::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8ProcessingInstructionPrivate* privData = V8DOM::toClassPtr<V8ProcessingInstructionPrivate >(self->GetInternalField(0)); v8::String::AsciiValue localData(value); - privData->arabicaThis->setData(*localData); + privData->nativeObj->setData(*localData); } bool V8ProcessingInstruction::hasInstance(v8::Handle<v8::Value> value) { return getTmpl()->HasInstance(value); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h index 61eaa2e..995d066 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8ProcessingInstruction.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 @@ -33,7 +33,7 @@ class V8ProcessingInstruction { public: struct V8ProcessingInstructionPrivate { V8DOM* dom; - Arabica::DOM::ProcessingInstruction<std::string>* arabicaThis; + Arabica::DOM::ProcessingInstruction<std::string>* nativeObj; }; V8_DESTRUCTOR(V8ProcessingInstructionPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp new file mode 100644 index 0000000..ed6133a --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.cpp @@ -0,0 +1,76 @@ +#include "V8Node.h" +#include "V8SCXMLEvent.h" + +namespace Arabica { +namespace DOM { + +v8::Persistent<v8::FunctionTemplate> V8SCXMLEvent::Tmpl; + + +v8::Handle<v8::Value> V8SCXMLEvent::typeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0)); + + return v8::Integer::New(privData->nativeObj->type); +} + +v8::Handle<v8::Value> V8SCXMLEvent::nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0)); + + return v8::String::New(privData->nativeObj->name.c_str()); +} + +v8::Handle<v8::Value> V8SCXMLEvent::originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0)); + + return v8::String::New(privData->nativeObj->origin.c_str()); +} + +v8::Handle<v8::Value> V8SCXMLEvent::origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0)); + + return v8::String::New(privData->nativeObj->origintype.c_str()); +} + +v8::Handle<v8::Value> V8SCXMLEvent::domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0)); + + if (!privData->nativeObj->dom) return v8::Undefined(); + Arabica::DOM::Node<std::string>* arbaicaRet = new Arabica::DOM::Node<std::string>(privData->nativeObj->dom); + + v8::Handle<v8::Function> arbaicaRetCtor = V8Node::getTmpl()->GetFunction(); + v8::Persistent<v8::Object> arbaicaRetObj = v8::Persistent<v8::Object>::New(arbaicaRetCtor->NewInstance()); + + struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); + retPrivData->dom = privData->dom; + retPrivData->nativeObj = arbaicaRet; + + arbaicaRetObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); + arbaicaRetObj.MakeWeak(0, V8Node::jsDestructor); + return arbaicaRetObj; + +} + +v8::Handle<v8::Value> V8SCXMLEvent::sendidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0)); + + return v8::String::New(privData->nativeObj->sendid.c_str()); +} + +v8::Handle<v8::Value> V8SCXMLEvent::invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::Object> self = info.Holder(); + struct V8SCXMLEventPrivate* privData = V8DOM::toClassPtr<V8SCXMLEventPrivate >(self->GetInternalField(0)); + + return v8::String::New(privData->nativeObj->invokeid.c_str()); +} +bool V8SCXMLEvent::hasInstance(v8::Handle<v8::Value> value) { + return getTmpl()->HasInstance(value); +} + +} +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h new file mode 100644 index 0000000..26ac8b6 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8SCXMLEvent.h @@ -0,0 +1,95 @@ +/* + 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 V8SCXMLEvent_h +#define V8SCXMLEvent_h + +#include "DOM/Node.hpp" +#include "uscxml/plugins/datamodel/ecmascript/v8/dom/V8DOM.h" +#include <v8.h> + +namespace Arabica { +namespace DOM { + +class V8SCXMLEvent { +public: + struct V8SCXMLEventPrivate { + V8DOM* dom; + uscxml::Event* nativeObj; + }; + + V8_DESTRUCTOR_KEEP_WRAPPED(V8SCXMLEventPrivate); + static bool hasInstance(v8::Handle<v8::Value>); + + + static v8::Handle<v8::Value> typeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> nameAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> originAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> origintypeAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> domAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> sendidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> invokeidAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + + static v8::Persistent<v8::FunctionTemplate> Tmpl; + static v8::Handle<v8::FunctionTemplate> getTmpl() { + if (Tmpl.IsEmpty()) { + v8::Handle<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New(); + tmpl->SetClassName(v8::String::New("SCXMLEvent")); + tmpl->ReadOnlyPrototype(); + + v8::Local<v8::ObjectTemplate> instance = tmpl->InstanceTemplate(); + v8::Local<v8::ObjectTemplate> prototype = tmpl->PrototypeTemplate(); + instance->SetInternalFieldCount(1); + + instance->SetAccessor(v8::String::NewSymbol("type"), V8SCXMLEvent::typeAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + instance->SetAccessor(v8::String::NewSymbol("name"), V8SCXMLEvent::nameAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + instance->SetAccessor(v8::String::NewSymbol("origin"), V8SCXMLEvent::originAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + instance->SetAccessor(v8::String::NewSymbol("origintype"), V8SCXMLEvent::origintypeAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + instance->SetAccessor(v8::String::NewSymbol("dom"), V8SCXMLEvent::domAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + instance->SetAccessor(v8::String::NewSymbol("sendid"), V8SCXMLEvent::sendidAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + instance->SetAccessor(v8::String::NewSymbol("invokeid"), V8SCXMLEvent::invokeidAttrGetter, 0, + v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + + + tmpl->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("INTERNAL"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("EXTERNAL"), v8::Integer::New(2), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + prototype->Set(v8::String::NewSymbol("PLATFORM"), v8::Integer::New(3), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + + Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); + } + return Tmpl; + } + + +}; + +} +} + +#endif // V8SCXMLEvent_h diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp index fd9f6a3..42b298a 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.cpp @@ -14,13 +14,13 @@ v8::Handle<v8::Value> V8Text::splitTextCallback(const v8::Arguments& args) { struct V8TextPrivate* privData = V8DOM::toClassPtr<V8TextPrivate >(self->GetInternalField(0)); unsigned long localOffset = args[0]->ToNumber()->Uint32Value(); - Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->arabicaThis->splitText(localOffset)); + Arabica::DOM::Text<std::string>* retVal = new Arabica::DOM::Text<std::string>(privData->nativeObj->splitText(localOffset)); v8::Handle<v8::Function> retCtor = V8Text::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Text::V8TextPrivate* retPrivData = new V8Text::V8TextPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h index fdabf6e..4861dc8 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Text.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 @@ -33,7 +33,7 @@ class V8Text { public: struct V8TextPrivate { V8DOM* dom; - Arabica::DOM::Text<std::string>* arabicaThis; + Arabica::DOM::Text<std::string>* nativeObj; }; V8_DESTRUCTOR(V8TextPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp index 0d6210f..968e53d 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.cpp @@ -11,34 +11,34 @@ v8::Handle<v8::Value> V8XPathResult::numberValueAttrGetter(v8::Local<v8::String> v8::Local<v8::Object> self = info.Holder(); struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0)); - return v8::Number::New(privData->arabicaThis->asNumber()); + return v8::Number::New(privData->nativeObj->asNumber()); } v8::Handle<v8::Value> V8XPathResult::stringValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0)); - return v8::String::New(privData->arabicaThis->asString().c_str()); + return v8::String::New(privData->nativeObj->asString().c_str()); } v8::Handle<v8::Value> V8XPathResult::booleanValueAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::Object> self = info.Holder(); struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0)); - return v8::Boolean::New(privData->arabicaThis->asBool()); + return v8::Boolean::New(privData->nativeObj->asBool()); } v8::Handle<v8::Value> V8XPathResult::asNodeSetCallback(const v8::Arguments& args) { v8::Local<v8::Object> self = args.Holder(); struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0)); - Arabica::XPath::NodeSet<std::string>* retVal = new Arabica::XPath::NodeSet<std::string>(privData->arabicaThis->asNodeSet()); + Arabica::XPath::NodeSet<std::string>* retVal = new Arabica::XPath::NodeSet<std::string>(privData->nativeObj->asNodeSet()); v8::Handle<v8::Function> retCtor = V8NodeSet::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8NodeSet::V8NodeSetPrivate* retPrivData = new V8NodeSet::V8NodeSetPrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); @@ -52,7 +52,7 @@ v8::Handle<v8::Value> V8XPathResult::asBoolCallback(const v8::Arguments& args) { v8::Local<v8::Object> self = args.Holder(); struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0)); - bool retVal = privData->arabicaThis->asBool(); + bool retVal = privData->nativeObj->asBool(); return v8::Boolean::New(retVal); } @@ -62,7 +62,7 @@ v8::Handle<v8::Value> V8XPathResult::asStringCallback(const v8::Arguments& args) v8::Local<v8::Object> self = args.Holder(); struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0)); - std::string retVal = privData->arabicaThis->asString(); + std::string retVal = privData->nativeObj->asString(); return v8::String::New(retVal.c_str()); } @@ -72,7 +72,7 @@ v8::Handle<v8::Value> V8XPathResult::asNumberCallback(const v8::Arguments& args) v8::Local<v8::Object> self = args.Holder(); struct V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0)); - double retVal = privData->arabicaThis->asNumber(); + double retVal = privData->nativeObj->asNumber(); return v8::Number::New(retVal); } diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h index 96410df..9a3bf4d 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResult.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 @@ -32,7 +32,7 @@ class V8XPathResult { public: struct V8XPathResultPrivate { V8DOM* dom; - Arabica::XPath::XPathValue<std::string>* arabicaThis; + Arabica::XPath::XPathValue<std::string>* nativeObj; }; V8_DESTRUCTOR(V8XPathResultPrivate); diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp index 38b2cb5..6accfc7 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8XPathResultCustom.cpp @@ -8,14 +8,14 @@ v8::Handle<v8::Value> V8XPathResult::singleNodeValueCustomAttrGetter(v8::Local<v v8::Local<v8::Object> self = info.Holder(); V8XPathResultPrivate* privData = V8DOM::toClassPtr<V8XPathResultPrivate >(self->GetInternalField(0)); - Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->arabicaThis->asNodeSet()[0]); + Arabica::DOM::Node<std::string>* retVal = new Arabica::DOM::Node<std::string>(privData->nativeObj->asNodeSet()[0]); v8::Handle<v8::Function> retCtor = V8Node::getTmpl()->GetFunction(); v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); struct V8Node::V8NodePrivate* retPrivData = new V8Node::V8NodePrivate(); retPrivData->dom = privData->dom; - retPrivData->arabicaThis = retVal; + retPrivData->nativeObj = retVal; retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h index 9a10dc7..63300dd 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.h @@ -47,11 +47,6 @@ public: protected: - Interpreter* _interpreter; - - std::string _sessionId; - std::string _name; - Event _event; PlEngine* _plEngine; diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp new file mode 100644 index 0000000..8489d1d --- /dev/null +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp @@ -0,0 +1,197 @@ +#include "DirMonInvoker.h" +#include <glog/logging.h> + +#ifdef BUILD_AS_PLUGINS +#include <Pluma/Connector.hpp> +#endif + +#include <sys/stat.h> +#ifndef WIN32 +#include <dirent.h> +#else +#include <strsafe.h> +#endif + +namespace uscxml { + +#ifdef BUILD_AS_PLUGINS +PLUMA_CONNECTOR +bool connect(pluma::Host& host) { + host.add( new DirMonInvokerProvider() ); + return true; +} +#endif + +DirMonInvoker::DirMonInvoker() : _reportExisting(false), _recurse(false), _thread(NULL) { +} + +DirMonInvoker::~DirMonInvoker() { + _isRunning = false; + if (_thread) + _thread->join(); +}; + +boost::shared_ptr<IOProcessorImpl> DirMonInvoker::create(Interpreter* interpreter) { + boost::shared_ptr<DirMonInvoker> invoker = boost::shared_ptr<DirMonInvoker>(new DirMonInvoker()); + invoker->_interpreter = interpreter; + return invoker; +} + +Data DirMonInvoker::getDataModelVariables() { + Data data; + return data; +} + +void DirMonInvoker::send(const SendRequest& req) { +} + +void DirMonInvoker::cancel(const std::string sendId) { +} + +void DirMonInvoker::invoke(const InvokeRequest& req) { + if (req.params.find("dir") != req.params.end() && boost::iequals(req.params.find("reportexisting")->second, "true")) + _reportExisting = true; + if (req.params.find("recurse") != req.params.end() && boost::iequals(req.params.find("recurse")->second, "true")) + _recurse = true; + if (req.params.find("suffix") != req.params.end()) + _suffix = req.params.find("suffix")->second; + + std::multimap<std::string, std::string>::const_iterator dirIter = req.params.find("dir"); + while(dirIter != req.params.upper_bound("dir")) { + URL url(dirIter->second); + if (!_interpreter->toAbsoluteURI(url) || !boost::iequals(url.scheme(), "file")) { + LOG(ERROR) << "Given directory '" << dirIter->second << "' cannot be transformed to absolute path"; + } else { + _watchIds.insert(std::make_pair(url.path(), _fileWatcher.addWatch(url.path(), this, _recurse))); + } + dirIter++; + } + _isRunning = true; + _thread = new tthread::thread(DirMonInvoker::run, this); +} + +void DirMonInvoker::run(void* instance) { + if (((DirMonInvoker*)instance)->_reportExisting) + ((DirMonInvoker*)instance)->reportExisting(); + + while(((DirMonInvoker*)instance)->_isRunning) + ((DirMonInvoker*)instance)->_fileWatcher.update(); +} + +void DirMonInvoker::reportExisting() { + std::multimap<std::string, FW::WatchID>::iterator watchIter = _watchIds.begin(); + while(watchIter != _watchIds.end()) { + reportExistingIn(watchIter->first, watchIter->second); + watchIter++; + } +} + +void DirMonInvoker::handleFileAction(FW::WatchID watchid, const FW::String& dir, const FW::String& filename, FW::Action action) { + if (!boost::algorithm::ends_with(filename, _suffix)) + return; + + struct stat fileStat; + if (stat(filename.c_str(), &fileStat) != 0) { + LOG(ERROR) << "Error with stat on directory entry " << filename << ": " << strerror(errno); + return; + } + + Event event; + event.invokeid = _invokeId; + switch (action) { + case FW::Actions::Existing: + event.name = "file.existing"; + break; + case FW::Actions::Add: + event.name = "file.added"; + break; + case FW::Actions::Delete: + event.name = "file.deleted"; + break; + case FW::Actions::Modified: + event.name = "file.modified"; + break; + + default: + break; + } + + event.compound["file"].compound["name"] = Data(filename, Data::VERBATIM); + event.compound["file"].compound["dir"] = Data(dir, Data::VERBATIM); + + event.compound["file"].compound["mtime"] = toStr(fileStat.st_mtime); + event.compound["file"].compound["ctime"] = toStr(fileStat.st_ctime); + event.compound["file"].compound["atime"] = toStr(fileStat.st_atime); + event.compound["file"].compound["size"] = toStr(fileStat.st_size); + + returnEvent(event); +} + +bool DirMonInvoker::filter(const std::string filename) { + return true; +} + +void DirMonInvoker::reportExistingIn(const std::string dir, FW::WatchID watchid) { +#ifndef WIN32 + DIR *dp; + dp = opendir(dir.c_str()); + if (dp == NULL) { + LOG(ERROR) << "Error opening directory " << dir << ": " << strerror(errno); + return; + } + // iterate all entries and see what changed + struct dirent* entry; + while((entry = readdir(dp))) { + std::string dname = entry->d_name; +#else + WIN32_FIND_DATA ffd; + HANDLE hFind = INVALID_HANDLE_VALUE; + TCHAR szDir[MAX_PATH]; + StringCchCopy(szDir, MAX_PATH, dir.c_str()); + StringCchCat(szDir, MAX_PATH, TEXT("\\*")); + + hFind = FindFirstFile(szDir, &ffd); + do { + std::string dname = ffd.cFileName; +#endif + + if (boost::iequals(dname, ".") || boost::iequals(dname, "..")) + continue; + + char* filename; + asprintf(&filename, "%s/%s", dir.c_str(), dname.c_str()); + + struct stat fileStat; + if (stat(filename, &fileStat) != 0) { + LOG(ERROR) << "Error with stat on directory entry " << filename << ": " << strerror(errno); + free(filename); + continue; + } + + if (fileStat.st_mode & S_IFDIR) { + if (_recurse) { + reportExistingIn(filename, watchid); + } else { + free(filename); + continue; + } + } + + if (!filter(dname)) { + free(filename); + continue; + } + + handleFileAction(watchid, dir, filename, FW::Actions::Existing); +#ifndef WIN32 + } + closedir(dp); +#else + } + while (FindNextFile(hFind, &ffd) != 0); + FindClose(hFind); +#endif + +} + +}
\ No newline at end of file diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h new file mode 100644 index 0000000..1437759 --- /dev/null +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h @@ -0,0 +1,58 @@ +#ifndef DIRMONINVOKER_H_W09J90F0 +#define DIRMONINVOKER_H_W09J90F0 + +#include <uscxml/Interpreter.h> +#include "FileWatcher/FileWatcher.h" +#include <map> + +#ifdef BUILD_AS_PLUGINS +#include "uscxml/plugins/Plugins.h" +#endif + +namespace uscxml { + +class DirMonInvoker : public InvokerImpl, public FW::FileWatchListener { +public: + DirMonInvoker(); + virtual ~DirMonInvoker(); + virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); + + virtual std::set<std::string> getNames() { + std::set<std::string> names; + names.insert("dirmon"); + names.insert("DirectoryMonitor"); + names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#dirmon"); + return names; + } + + virtual Data getDataModelVariables(); + virtual void send(const SendRequest& req); + virtual void cancel(const std::string sendId); + virtual void invoke(const InvokeRequest& req); + + void handleFileAction(FW::WatchID watchid, const FW::String& dir, const FW::String& filename, FW::Action action); + void reportExisting(); + void reportExistingIn(const std::string dir, FW::WatchID watchid); + virtual bool filter(const std::string filename); + + static void run(void* instance); + +protected: + bool _reportExisting; + bool _recurse; + std::string _suffix; + + bool _isRunning; + tthread::thread* _thread; + FW::FileWatcher _fileWatcher; + std::multimap<std::string, FW::WatchID> _watchIds; +}; + +#ifdef BUILD_AS_PLUGINS +PLUMA_INHERIT_PROVIDER(DirMonInvoker, Invoker); +#endif + +} + + +#endif /* end of include guard: DIRMONINVOKER_H_W09J90F0 */ diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcher.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcher.cpp new file mode 100644 index 0000000..9399495 --- /dev/null +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcher.cpp @@ -0,0 +1,75 @@ +/**
+ Copyright (c) 2009 James Wynn (james@jameswynn.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
+#include <FileWatcher/FileWatcher.h>
+#include <FileWatcher/FileWatcherImpl.h>
+
+#if FILEWATCHER_PLATFORM == FILEWATCHER_PLATFORM_WIN32
+# include <FileWatcher/FileWatcherWin32.h>
+# define FILEWATCHER_IMPL FileWatcherWin32
+#elif FILEWATCHER_PLATFORM == FILEWATCHER_PLATFORM_KQUEUE
+# include <FileWatcher/FileWatcherOSX.h>
+# define FILEWATCHER_IMPL FileWatcherOSX
+#elif FILEWATCHER_PLATFORM == FILEWATCHER_PLATFORM_LINUX
+# include <FileWatcher/FileWatcherLinux.h>
+# define FILEWATCHER_IMPL FileWatcherLinux
+#endif
+
+namespace FW {
+
+//--------
+FileWatcher::FileWatcher() {
+ mImpl = new FILEWATCHER_IMPL();
+}
+
+//--------
+FileWatcher::~FileWatcher() {
+ delete mImpl;
+ mImpl = 0;
+}
+
+//--------
+WatchID FileWatcher::addWatch(const String& directory, FileWatchListener* watcher) {
+ return mImpl->addWatch(directory, watcher, false);
+}
+
+//--------
+WatchID FileWatcher::addWatch(const String& directory, FileWatchListener* watcher, bool recursive) {
+ return mImpl->addWatch(directory, watcher, recursive);
+}
+
+//--------
+void FileWatcher::removeWatch(const String& directory) {
+ mImpl->removeWatch(directory);
+}
+
+//--------
+void FileWatcher::removeWatch(WatchID watchid) {
+ mImpl->removeWatch(watchid);
+}
+
+//--------
+void FileWatcher::update() {
+ mImpl->update();
+}
+
+};//namespace FW
diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcher.h b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcher.h new file mode 100644 index 0000000..0e659b6 --- /dev/null +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcher.h @@ -0,0 +1,141 @@ +/**
+ Main header for the FileWatcher class. Declares all implementation
+ classes to reduce compilation overhead.
+
+ @author James Wynn
+ @date 4/15/2009
+
+ Copyright (c) 2009 James Wynn (james@jameswynn.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
+#ifndef _FW_FILEWATCHER_H_
+#define _FW_FILEWATCHER_H_
+#pragma once
+
+#include <string>
+#include <stdexcept>
+
+namespace FW {
+/// Type for a string
+typedef std::string String;
+/// Type for a watch id
+typedef unsigned long WatchID;
+
+// forward declarations
+class FileWatcherImpl;
+class FileWatchListener;
+
+/// Base exception class
+/// @class Exception
+class Exception : public std::runtime_error {
+public:
+ Exception(const String& message)
+ : std::runtime_error(message)
+ {}
+};
+
+/// Exception thrown when a file is not found.
+/// @class FileNotFoundException
+class FileNotFoundException : public Exception {
+public:
+ FileNotFoundException()
+ : Exception("File not found")
+ {}
+
+ FileNotFoundException(const String& filename)
+ : Exception("File not found (" + filename + ")")
+ {}
+};
+
+/// Actions to listen for. Rename will send two events, one for
+/// the deletion of the old file, and one for the creation of the
+/// new file.
+namespace Actions {
+enum Action {
+ /// Sent when a file is created or renamed
+ Add = 1,
+ /// Sent when a file is deleted or renamed
+ Delete = 2,
+ /// Sent when a file is modified
+ Modified = 4,
+ /// Sent when an existing file is reported
+ Existing = 8
+};
+};
+typedef Actions::Action Action;
+
+/// Listens to files and directories and dispatches events
+/// to notify the parent program of the changes.
+/// @class FileWatcher
+class FileWatcher {
+public:
+ ///
+ ///
+ FileWatcher();
+
+ ///
+ ///
+ virtual ~FileWatcher();
+
+ /// Add a directory watch. Same as the other addWatch, but doesn't have recursive option.
+ /// For backwards compatibility.
+ /// @exception FileNotFoundException Thrown when the requested directory does not exist
+ WatchID addWatch(const String& directory, FileWatchListener* watcher);
+
+ /// Add a directory watch
+ /// @exception FileNotFoundException Thrown when the requested directory does not exist
+ WatchID addWatch(const String& directory, FileWatchListener* watcher, bool recursive);
+
+ /// Remove a directory watch. This is a brute force search O(nlogn).
+ void removeWatch(const String& directory);
+
+ /// Remove a directory watch. This is a map lookup O(logn).
+ void removeWatch(WatchID watchid);
+
+ /// Updates the watcher. Must be called often.
+ void update();
+
+private:
+ /// The implementation
+ FileWatcherImpl* mImpl;
+
+};//end FileWatcher
+
+
+/// Basic interface for listening for file events.
+/// @class FileWatchListener
+class FileWatchListener {
+public:
+ FileWatchListener() {}
+ virtual ~FileWatchListener() {}
+
+ /// Handles the action file action
+ /// @param watchid The watch id for the directory
+ /// @param dir The directory
+ /// @param filename The filename that was accessed (not full path)
+ /// @param action Action that was performed
+ virtual void handleFileAction(WatchID watchid, const String& dir, const String& filename, Action action) = 0;
+
+};//class FileWatchListener
+
+};//namespace FW
+
+#endif//_FW_FILEWATCHER_H_
diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherImpl.h b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherImpl.h new file mode 100644 index 0000000..08cfed1 --- /dev/null +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherImpl.h @@ -0,0 +1,77 @@ +/**
+ Basic interface for the FileWatcher backend.
+
+ @author James Wynn
+ @date 5/11/2009
+
+ Copyright (c) 2009 James Wynn (james@jameswynn.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+#ifndef _FW_FILEWATCHERIMPL_H_
+#define _FW_FILEWATCHERIMPL_H_
+#pragma once
+
+#include "FileWatcher.h"
+
+#define FILEWATCHER_PLATFORM_WIN32 1
+#define FILEWATCHER_PLATFORM_LINUX 2
+#define FILEWATCHER_PLATFORM_KQUEUE 3
+
+#if defined(_WIN32)
+# define FILEWATCHER_PLATFORM FILEWATCHER_PLATFORM_WIN32
+#elif defined(__APPLE_CC__) || defined(BSD)
+# define FILEWATCHER_PLATFORM FILEWATCHER_PLATFORM_KQUEUE
+#elif defined(__linux__)
+# define FILEWATCHER_PLATFORM FILEWATCHER_PLATFORM_LINUX
+#endif
+
+namespace FW {
+struct WatchStruct;
+
+class FileWatcherImpl {
+public:
+ ///
+ ///
+ FileWatcherImpl() {}
+
+ ///
+ ///
+ virtual ~FileWatcherImpl() {}
+
+ /// Add a directory watch
+ /// @exception FileNotFoundException Thrown when the requested directory does not exist
+ virtual WatchID addWatch(const String& directory, FileWatchListener* watcher, bool recursive) = 0;
+
+ /// Remove a directory watch. This is a brute force lazy search O(nlogn).
+ virtual void removeWatch(const String& directory) = 0;
+
+ /// Remove a directory watch. This is a map lookup O(logn).
+ virtual void removeWatch(WatchID watchid) = 0;
+
+ /// Updates the watcher. Must be called often.
+ virtual void update() = 0;
+
+ /// Handles the action
+ virtual void handleAction(WatchStruct* watch, const String& filename, unsigned long action) = 0;
+
+};//end FileWatcherImpl
+};//namespace FW
+
+#endif//_FW_FILEWATCHERIMPL_H_
diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherLinux.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherLinux.cpp new file mode 100644 index 0000000..ecbaa32 --- /dev/null +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherLinux.cpp @@ -0,0 +1,165 @@ +/** + Copyright (c) 2009 James Wynn (james@jameswynn.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + James Wynn james@jameswynn.com +*/ + +#include <FileWatcher/FileWatcherLinux.h> + +#if FILEWATCHER_PLATFORM == FILEWATCHER_PLATFORM_LINUX + +#include <sys/stat.h> +#include <fcntl.h> +#include <string.h> +#include <stdio.h> +#include <errno.h> +#include <sys/inotify.h> + +#define BUFF_SIZE ((sizeof(struct inotify_event)+FILENAME_MAX)*1024) + +namespace FW { + +struct WatchStruct { + WatchID mWatchID; + String mDirName; + FileWatchListener* mListener; +}; + +//-------- +FileWatcherLinux::FileWatcherLinux() { + mFD = inotify_init(); + if (mFD < 0) + fprintf (stderr, "Error: %s\n", strerror(errno)); + + mTimeOut.tv_sec = 0; + mTimeOut.tv_usec = 0; + + FD_ZERO(&mDescriptorSet); +} + +//-------- +FileWatcherLinux::~FileWatcherLinux() { + WatchMap::iterator iter = mWatches.begin(); + WatchMap::iterator end = mWatches.end(); + for(; iter != end; ++iter) { + delete iter->second; + } + mWatches.clear(); +} + +//-------- +WatchID FileWatcherLinux::addWatch(const String& directory, FileWatchListener* watcher, bool recursive) { + int wd = inotify_add_watch (mFD, directory.c_str(), + IN_CLOSE_WRITE | IN_MOVED_TO | IN_CREATE | IN_MOVED_FROM | IN_DELETE); + if (wd < 0) { + if(errno == ENOENT) + throw FileNotFoundException(directory); + else + throw Exception(strerror(errno)); + +// fprintf (stderr, "Error: %s\n", strerror(errno)); +// return -1; + } + + WatchStruct* pWatch = new WatchStruct(); + pWatch->mListener = watcher; + pWatch->mWatchID = wd; + pWatch->mDirName = directory; + + mWatches.insert(std::make_pair(wd, pWatch)); + + return wd; +} + +//-------- +void FileWatcherLinux::removeWatch(const String& directory) { + WatchMap::iterator iter = mWatches.begin(); + WatchMap::iterator end = mWatches.end(); + for(; iter != end; ++iter) { + if(directory == iter->second->mDirName) { + removeWatch(iter->first); + return; + } + } +} + +//-------- +void FileWatcherLinux::removeWatch(WatchID watchid) { + WatchMap::iterator iter = mWatches.find(watchid); + + if(iter == mWatches.end()) + return; + + WatchStruct* watch = iter->second; + mWatches.erase(iter); + + inotify_rm_watch(mFD, watchid); + + delete watch; + watch = 0; +} + +//-------- +void FileWatcherLinux::update() { + FD_SET(mFD, &mDescriptorSet); + + int ret = select(mFD + 1, &mDescriptorSet, NULL, NULL, &mTimeOut); + if(ret < 0) { + perror("select"); + } else if(FD_ISSET(mFD, &mDescriptorSet)) { + ssize_t len, i = 0; + char action[81+FILENAME_MAX] = {0}; + char buff[BUFF_SIZE] = {0}; + + len = read (mFD, buff, BUFF_SIZE); + + while (i < len) { + struct inotify_event *pevent = (struct inotify_event *)&buff[i]; + + WatchStruct* watch = mWatches[pevent->wd]; + handleAction(watch, pevent->name, pevent->mask); + i += sizeof(struct inotify_event) + pevent->len; + } + } +} + +//-------- +void FileWatcherLinux::handleAction(WatchStruct* watch, const String& filename, unsigned long action) { + if(!watch->mListener) + return; + + if(IN_CLOSE_WRITE & action) { + watch->mListener->handleFileAction(watch->mWatchID, watch->mDirName, filename, + Actions::Modified); + } + if(IN_MOVED_TO & action || IN_CREATE & action) { + watch->mListener->handleFileAction(watch->mWatchID, watch->mDirName, filename, + Actions::Add); + } + if(IN_MOVED_FROM & action || IN_DELETE & action) { + watch->mListener->handleFileAction(watch->mWatchID, watch->mDirName, filename, + Actions::Delete); + } +} + +};//namespace FW + +#endif//FILEWATCHER_PLATFORM_LINUX diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherLinux.h b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherLinux.h new file mode 100644 index 0000000..b681e52 --- /dev/null +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherLinux.h @@ -0,0 +1,89 @@ +/** + Implementation header file for Linux based on inotify. + + @author James Wynn + @date 4/15/2009 + + Copyright (c) 2009 James Wynn (james@jameswynn.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ +#ifndef _FW_FILEWATCHERLINUX_H_ +#define _FW_FILEWATCHERLINUX_H_ +#pragma once + +#include "FileWatcherImpl.h" + +#if FILEWATCHER_PLATFORM == FILEWATCHER_PLATFORM_LINUX + +#include <map> +#include <sys/types.h> + +namespace FW { +/// Implementation for Linux based on inotify. +/// @class FileWatcherLinux +class FileWatcherLinux : public FileWatcherImpl { +public: + /// type for a map from WatchID to WatchStruct pointer + typedef std::map<WatchID, WatchStruct*> WatchMap; + +public: + /// + /// + FileWatcherLinux(); + + /// + /// + virtual ~FileWatcherLinux(); + + /// Add a directory watch + /// @exception FileNotFoundException Thrown when the requested directory does not exist + WatchID addWatch(const String& directory, FileWatchListener* watcher, bool recursive); + + /// Remove a directory watch. This is a brute force lazy search O(nlogn). + void removeWatch(const String& directory); + + /// Remove a directory watch. This is a map lookup O(logn). + void removeWatch(WatchID watchid); + + /// Updates the watcher. Must be called often. + void update(); + + /// Handles the action + void handleAction(WatchStruct* watch, const String& filename, unsigned long action); + +private: + /// Map of WatchID to WatchStruct pointers + WatchMap mWatches; + /// The last watchid + WatchID mLastWatchID; + /// inotify file descriptor + int mFD; + /// time out data + struct timeval mTimeOut; + /// File descriptor set + fd_set mDescriptorSet; + +};//end FileWatcherLinux + +};//namespace FW + +#endif//FILEWATCHER_PLATFORM_LINUX + +#endif//_FW_FILEWATCHERLINUX_H_ diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherOSX.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherOSX.cpp new file mode 100644 index 0000000..e1634b0 --- /dev/null +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherOSX.cpp @@ -0,0 +1,364 @@ +/** + Copyright (c) 2009 James Wynn (james@jameswynn.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + James Wynn james@jameswynn.com +*/ + +#include <FileWatcher/FileWatcherOSX.h> + +#if FILEWATCHER_PLATFORM == FILEWATCHER_PLATFORM_KQUEUE + +#include <sys/event.h> +#include <sys/time.h> +#include <sys/stat.h> +#include <unistd.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <dirent.h> +#include <string.h> + +// this is more suited: +// https://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/FSEvents_ProgGuide/UsingtheFSEventsFramework/UsingtheFSEventsFramework.html + +namespace FW { + +#define MAX_CHANGE_EVENT_SIZE 2000 + +typedef struct kevent KEvent; + +struct EntryStruct { + EntryStruct(const char* filename, time_t mtime = 0) + : mFilename(filename), mModifiedTime(mtime) { + } + ~EntryStruct() { + delete[] mFilename; + } + const char* mFilename; + time_t mModifiedTime; +}; + +int comparator(const void* ke1, const void* ke2) { + /*KEvent* kevent1 = (KEvent*) ke1; + KEvent* kevent2 = (KEvent*) ke2; + + EntryStruct* event1 = (EntryStruct*)kevent1->udata; + EntryStruct* event2 = (EntryStruct*)kevent2->udata; + return strcmp(event1->mFilename, event2->mFilename); + */ + return strcmp(((EntryStruct*)(((KEvent*)(ke1))->udata))->mFilename, ((EntryStruct*)(((KEvent*)(ke2))->udata))->mFilename); +} + +struct WatchStruct { + WatchID mWatchID; + String mDirName; + FileWatchListener* mListener; + + // index 0 is always the directory + KEvent mChangeList[MAX_CHANGE_EVENT_SIZE]; + size_t mChangeListCount; + + WatchStruct(WatchID watchid, const String& dirname, FileWatchListener* listener) + : mWatchID(watchid), mDirName(dirname), mListener(listener) { + mChangeListCount = 0; + addAll(); + } + + void addFile(const String& name, bool imitEvents = true) { + //fprintf(stderr, "ADDED: %s\n", name.c_str()); + + // create entry + struct stat attrib; + stat(name.c_str(), &attrib); + + int fd = open(name.c_str(), O_RDONLY); + + if(fd == -1) + throw FileNotFoundException(name); + + ++mChangeListCount; + + char* namecopy = new char[name.length() + 1]; + strncpy(namecopy, name.c_str(), name.length()); + namecopy[name.length()] = 0; + EntryStruct* entry = new EntryStruct(namecopy, attrib.st_mtime); + + // set the event data at the end of the list + EV_SET(&mChangeList[mChangeListCount], fd, EVFILT_VNODE, + EV_ADD | EV_ENABLE | EV_ONESHOT, + NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_ATTRIB, + 0, (void*)entry); + + // qsort + qsort(mChangeList + 1, mChangeListCount, sizeof(KEvent), comparator); + + // handle action + if(imitEvents) + handleAction(name, Actions::Add); + } + + void removeFile(const String& name, bool imitEvents = true) { + // bsearch + KEvent target; + EntryStruct tempEntry(name.c_str(), 0); + target.udata = &tempEntry; + KEvent* ke = (KEvent*)bsearch(&target, &mChangeList, mChangeListCount + 1, sizeof(KEvent), comparator); + if(!ke) + throw FileNotFoundException(name); + + tempEntry.mFilename = 0; + + // delete + close(ke->ident); + delete((EntryStruct*)ke->udata); + memset(ke, 0, sizeof(KEvent)); + + // move end to current + memcpy(ke, &mChangeList[mChangeListCount], sizeof(KEvent)); + memset(&mChangeList[mChangeListCount], 0, sizeof(KEvent)); + --mChangeListCount; + + // qsort + qsort(mChangeList + 1, mChangeListCount, sizeof(KEvent), comparator); + + // handle action + if(imitEvents) + handleAction(name, Actions::Delete); + } + + // called when the directory is actually changed + // means a file has been added or removed + // rescans the watched directory adding/removing files and sending notices + void rescan() { + // if new file, call addFile + // if missing file, call removeFile + // if timestamp modified, call handleAction(filename, ACTION_MODIFIED); + DIR* dir = opendir(mDirName.c_str()); + if(!dir) + return; + + struct dirent* dentry; + KEvent* ke = &mChangeList[1]; + EntryStruct* entry = 0; + struct stat attrib; + + while((dentry = readdir(dir)) != NULL) { + String fname = mDirName + "/" + dentry->d_name; + stat(fname.c_str(), &attrib); + if(!S_ISREG(attrib.st_mode)) + continue; + + if(ke <= &mChangeList[mChangeListCount]) { + entry = (EntryStruct*)ke->udata; + int result = strcmp(entry->mFilename, fname.c_str()); + //fprintf(stderr, "[%s cmp %s]\n", entry->mFilename, fname.c_str()); + if(result == 0) { + stat(entry->mFilename, &attrib); + time_t timestamp = attrib.st_mtime; + + if(entry->mModifiedTime != timestamp) { + entry->mModifiedTime = timestamp; + handleAction(entry->mFilename, Actions::Modified); + } + ke++; + } else if(result < 0) { + // f1 was deleted + removeFile(entry->mFilename); + ke++; + } else { + // f2 was created + addFile(fname); + ke++; + } + } else { + // just add + addFile(fname); + ke++; + } + }//end while + + closedir(dir); + }; + + void handleAction(const String& filename, FW::Action action) { + mListener->handleFileAction(mWatchID, mDirName, filename, action); + } + + void addAll() { + // add base dir + int fd = open(mDirName.c_str(), O_RDONLY); + EV_SET(&mChangeList[0], fd, EVFILT_VNODE, + EV_ADD | EV_ENABLE | EV_ONESHOT, + NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_ATTRIB, + 0, 0); + + //fprintf(stderr, "ADDED: %s\n", mDirName.c_str()); + + // scan directory and call addFile(name, false) on each file + DIR* dir = opendir(mDirName.c_str()); + if(!dir) + throw FileNotFoundException(mDirName); + + struct dirent* entry; + struct stat attrib; + while((entry = readdir(dir)) != NULL) { + String fname = (mDirName + "/" + String(entry->d_name)); + stat(fname.c_str(), &attrib); + if(S_ISREG(attrib.st_mode)) + addFile(fname, false); + //else + // fprintf(stderr, "NOT ADDED: %s (%d)\n", fname.c_str(), attrib.st_mode); + + }//end while + + closedir(dir); + } + + void removeAll() { + KEvent* ke = NULL; + + // go through list removing each file and sending an event + for(int i = 0; i < mChangeListCount; ++i) { + ke = &mChangeList[i]; + //handleAction(name, Action::Delete); + EntryStruct* entry = (EntryStruct*)ke->udata; + + handleAction(entry->mFilename, Actions::Delete); + + // delete + close(ke->ident); + delete((EntryStruct*)ke->udata); + } + } +}; + +void FileWatcherOSX::update() { + int nev = 0; + struct kevent event; + + WatchMap::iterator iter = mWatches.begin(); + WatchMap::iterator end = mWatches.end(); + for(; iter != end; ++iter) { + WatchStruct* watch = iter->second; + + while((nev = kevent(mDescriptor, (KEvent*)&(watch->mChangeList), watch->mChangeListCount + 1, &event, 1, &mTimeOut)) != 0) { + if(nev == -1) + perror("kevent"); + else { + EntryStruct* entry = 0; + if((entry = (EntryStruct*)event.udata) != 0) { + //fprintf(stderr, "File: %s -- ", (char*)entry->mFilename); + + if(event.fflags & NOTE_DELETE) { + //fprintf(stderr, "File deleted\n"); + //watch->handleAction(entry->mFilename, Action::Delete); + watch->removeFile(entry->mFilename); + } + if(event.fflags & NOTE_EXTEND || + event.fflags & NOTE_WRITE || + event.fflags & NOTE_ATTRIB) { + //fprintf(stderr, "modified\n"); + //watch->rescan(); + struct stat attrib; + stat(entry->mFilename, &attrib); + entry->mModifiedTime = attrib.st_mtime; + watch->handleAction(entry->mFilename, FW::Actions::Modified); + } + } else { + //fprintf(stderr, "Dir: %s -- rescanning\n", watch->mDirName.c_str()); + watch->rescan(); + } + } + } + } +} + +//-------- +FileWatcherOSX::FileWatcherOSX() { + mDescriptor = kqueue(); + mTimeOut.tv_sec = 0; + mTimeOut.tv_nsec = 2000000; +} + +//-------- +FileWatcherOSX::~FileWatcherOSX() { + WatchMap::iterator iter = mWatches.begin(); + WatchMap::iterator end = mWatches.end(); + for(; iter != end; ++iter) { + delete iter->second; + } + mWatches.clear(); + + close(mDescriptor); +} + +//-------- +WatchID FileWatcherOSX::addWatch(const String& directory, FileWatchListener* watcher, bool recursive) { + /* int fd = open(directory.c_str(), O_RDONLY); + if(fd == -1) + perror("open"); + + EV_SET(&change, fd, EVFILT_VNODE, + EV_ADD | EV_ENABLE | EV_ONESHOT, + NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_ATTRIB, + 0, (void*)"testing"); + */ + + WatchStruct* watch = new WatchStruct(++mLastWatchID, directory, watcher); + mWatches.insert(std::make_pair(mLastWatchID, watch)); + return mLastWatchID; +} + +//-------- +void FileWatcherOSX::removeWatch(const String& directory) { + WatchMap::iterator iter = mWatches.begin(); + WatchMap::iterator end = mWatches.end(); + for(; iter != end; ++iter) { + if(directory == iter->second->mDirName) { + removeWatch(iter->first); + return; + } + } +} + +//-------- +void FileWatcherOSX::removeWatch(WatchID watchid) { + WatchMap::iterator iter = mWatches.find(watchid); + + if(iter == mWatches.end()) + return; + + WatchStruct* watch = iter->second; + mWatches.erase(iter); + + //inotify_rm_watch(mFD, watchid); + + delete watch; + watch = 0; +} + +//-------- +void FileWatcherOSX::handleAction(WatchStruct* watch, const String& filename, unsigned long action) { +} + +};//namespace FW + +#endif//FILEWATCHER_PLATFORM_KQUEUE diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherOSX.h b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherOSX.h new file mode 100644 index 0000000..39f411c --- /dev/null +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherOSX.h @@ -0,0 +1,87 @@ +/** + Implementation header file for OSX based on KEvent. + + @author James Wynn + @date 4/15/2009 + + Copyright (c) 2009 James Wynn (james@jameswynn.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ +#ifndef _FW_FILEWATCHEROSX_H_ +#define _FW_FILEWATCHEROSX_H_ +#pragma once + +#include "FileWatcherImpl.h" + +#if FILEWATCHER_PLATFORM == FILEWATCHER_PLATFORM_KQUEUE + +#include <map> +#include <sys/types.h> + +namespace FW { +/// Implementation for OSX based on kqueue. +/// @class FileWatcherOSX +class FileWatcherOSX : public FileWatcherImpl { +public: + /// type for a map from WatchID to WatchStruct pointer + typedef std::map<WatchID, WatchStruct*> WatchMap; + +public: + /// + /// + FileWatcherOSX(); + + /// + /// + virtual ~FileWatcherOSX(); + + /// Add a directory watch + /// @exception FileNotFoundException Thrown when the requested directory does not exist + WatchID addWatch(const String& directory, FileWatchListener* watcher, bool recursive); + + /// Remove a directory watch. This is a brute force lazy search O(nlogn). + void removeWatch(const String& directory); + + /// Remove a directory watch. This is a map lookup O(logn). + void removeWatch(WatchID watchid); + + /// Updates the watcher. Must be called often. + void update(); + + /// Handles the action + void handleAction(WatchStruct* watch, const String& filename, unsigned long action); + +private: + /// Map of WatchID to WatchStruct pointers + WatchMap mWatches; + /// The descriptor for the kqueue + int mDescriptor; + /// time out data + struct timespec mTimeOut; + /// WatchID allocator + int mLastWatchID; + +};//end FileWatcherOSX + +};//namespace FW + +#endif//__APPLE_CC__ + +#endif//_FW_FILEWATCHEROSX_H_ diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherWin32.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherWin32.cpp new file mode 100644 index 0000000..ee5de7e --- /dev/null +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherWin32.cpp @@ -0,0 +1,244 @@ +/**
+ Copyright (c) 2009 James Wynn (james@jameswynn.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
+#include <FileWatcher/FileWatcherWin32.h>
+
+#if FILEWATCHER_PLATFORM == FILEWATCHER_PLATFORM_WIN32
+
+#define _WIN32_WINNT 0x0550
+#include <windows.h>
+
+#if defined(_MSC_VER)
+#pragma comment(lib, "comctl32.lib")
+#pragma comment(lib, "user32.lib")
+#pragma comment(lib, "ole32.lib")
+
+// disable secure warnings
+#pragma warning (disable: 4996)
+#endif
+
+namespace FW {
+/// Internal watch data
+struct WatchStruct {
+ OVERLAPPED mOverlapped;
+ HANDLE mDirHandle;
+ BYTE mBuffer[32 * 1024];
+ LPARAM lParam;
+ DWORD mNotifyFilter;
+ bool mStopNow;
+ FileWatcherImpl* mFileWatcher;
+ FileWatchListener* mFileWatchListener;
+ char* mDirName;
+ WatchID mWatchid;
+ bool mIsRecursive;
+};
+
+#pragma region Internal Functions
+
+// forward decl
+bool RefreshWatch(WatchStruct* pWatch, bool _clear = false);
+
+/// Unpacks events and passes them to a user defined callback.
+void CALLBACK WatchCallback(DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped) {
+ TCHAR szFile[MAX_PATH];
+ PFILE_NOTIFY_INFORMATION pNotify;
+ WatchStruct* pWatch = (WatchStruct*) lpOverlapped;
+ size_t offset = 0;
+
+ if(dwNumberOfBytesTransfered == 0)
+ return;
+
+ if (dwErrorCode == ERROR_SUCCESS) {
+ do {
+ pNotify = (PFILE_NOTIFY_INFORMATION) &pWatch->mBuffer[offset];
+ offset += pNotify->NextEntryOffset;
+
+# if defined(UNICODE)
+ {
+ lstrcpynW(szFile, pNotify->FileName,
+ min(MAX_PATH, pNotify->FileNameLength / sizeof(WCHAR) + 1));
+ }
+# else
+ {
+ int count = WideCharToMultiByte(CP_ACP, 0, pNotify->FileName,
+ pNotify->FileNameLength / sizeof(WCHAR),
+ szFile, MAX_PATH - 1, NULL, NULL);
+ szFile[count] = TEXT('\0');
+ }
+# endif
+
+ pWatch->mFileWatcher->handleAction(pWatch, szFile, pNotify->Action);
+
+ } while (pNotify->NextEntryOffset != 0);
+ }
+
+ if (!pWatch->mStopNow) {
+ RefreshWatch(pWatch);
+ }
+}
+
+/// Refreshes the directory monitoring.
+bool RefreshWatch(WatchStruct* pWatch, bool _clear) {
+ return ReadDirectoryChangesW(
+ pWatch->mDirHandle, pWatch->mBuffer, sizeof(pWatch->mBuffer), pWatch->mIsRecursive,
+ pWatch->mNotifyFilter, NULL, &pWatch->mOverlapped, _clear ? 0 : WatchCallback) != 0;
+}
+
+/// Stops monitoring a directory.
+void DestroyWatch(WatchStruct* pWatch) {
+ if (pWatch) {
+ pWatch->mStopNow = TRUE;
+
+ CancelIo(pWatch->mDirHandle);
+
+ RefreshWatch(pWatch, true);
+
+ if (!HasOverlappedIoCompleted(&pWatch->mOverlapped)) {
+ SleepEx(5, TRUE);
+ }
+
+ CloseHandle(pWatch->mOverlapped.hEvent);
+ CloseHandle(pWatch->mDirHandle);
+ delete pWatch->mDirName;
+ HeapFree(GetProcessHeap(), 0, pWatch);
+ }
+}
+
+/// Starts monitoring a directory.
+WatchStruct* CreateWatch(LPCTSTR szDirectory, bool recursive, DWORD mNotifyFilter) {
+ WatchStruct* pWatch;
+ size_t ptrsize = sizeof(*pWatch);
+ pWatch = static_cast<WatchStruct*>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ptrsize));
+
+ pWatch->mDirHandle = CreateFile(szDirectory, FILE_LIST_DIRECTORY,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
+ OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, NULL);
+
+ if (pWatch->mDirHandle != INVALID_HANDLE_VALUE) {
+ pWatch->mOverlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ pWatch->mNotifyFilter = mNotifyFilter;
+ pWatch->mIsRecursive = recursive;
+
+ if (RefreshWatch(pWatch)) {
+ return pWatch;
+ } else {
+ CloseHandle(pWatch->mOverlapped.hEvent);
+ CloseHandle(pWatch->mDirHandle);
+ }
+ }
+
+ HeapFree(GetProcessHeap(), 0, pWatch);
+ return NULL;
+}
+
+#pragma endregion
+
+//--------
+FileWatcherWin32::FileWatcherWin32()
+ : mLastWatchID(0) {
+}
+
+//--------
+FileWatcherWin32::~FileWatcherWin32() {
+ WatchMap::iterator iter = mWatches.begin();
+ WatchMap::iterator end = mWatches.end();
+ for(; iter != end; ++iter) {
+ DestroyWatch(iter->second);
+ }
+ mWatches.clear();
+}
+
+//--------
+WatchID FileWatcherWin32::addWatch(const String& directory, FileWatchListener* watcher, bool recursive) {
+ WatchID watchid = ++mLastWatchID;
+
+ WatchStruct* watch = CreateWatch(directory.c_str(), recursive,
+ FILE_NOTIFY_CHANGE_CREATION | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_FILE_NAME);
+
+ if(!watch)
+ throw FileNotFoundException(directory);
+
+ watch->mWatchid = watchid;
+ watch->mFileWatcher = this;
+ watch->mFileWatchListener = watcher;
+ watch->mDirName = new char[directory.length()+1];
+ strcpy(watch->mDirName, directory.c_str());
+
+ mWatches.insert(std::make_pair(watchid, watch));
+
+ return watchid;
+}
+
+//--------
+void FileWatcherWin32::removeWatch(const String& directory) {
+ WatchMap::iterator iter = mWatches.begin();
+ WatchMap::iterator end = mWatches.end();
+ for(; iter != end; ++iter) {
+ if(directory == iter->second->mDirName) {
+ removeWatch(iter->first);
+ return;
+ }
+ }
+}
+
+//--------
+void FileWatcherWin32::removeWatch(WatchID watchid) {
+ WatchMap::iterator iter = mWatches.find(watchid);
+
+ if(iter == mWatches.end())
+ return;
+
+ WatchStruct* watch = iter->second;
+ mWatches.erase(iter);
+
+ DestroyWatch(watch);
+}
+
+//--------
+void FileWatcherWin32::update() {
+ MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_ALLINPUT, MWMO_ALERTABLE);
+}
+
+//--------
+void FileWatcherWin32::handleAction(WatchStruct* watch, const String& filename, unsigned long action) {
+ Action fwAction;
+
+ switch(action) {
+ case FILE_ACTION_RENAMED_NEW_NAME:
+ case FILE_ACTION_ADDED:
+ fwAction = Actions::Add;
+ break;
+ case FILE_ACTION_RENAMED_OLD_NAME:
+ case FILE_ACTION_REMOVED:
+ fwAction = Actions::Delete;
+ break;
+ case FILE_ACTION_MODIFIED:
+ fwAction = Actions::Modified;
+ break;
+ };
+
+ watch->mFileWatchListener->handleFileAction(watch->mWatchid, watch->mDirName, filename, fwAction);
+}
+
+};//namespace FW
+
+#endif//_WIN32
diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherWin32.h b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherWin32.h new file mode 100644 index 0000000..d1626b0 --- /dev/null +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/FileWatcher/FileWatcherWin32.h @@ -0,0 +1,83 @@ +/**
+ Implementation for Windows. Uses ReadDirectoryChangesW to watch for
+ file system changes.
+
+ @author James Wynn
+ @date 4/15/2009
+
+ Copyright (c) 2009 James Wynn (james@jameswynn.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+#ifndef _FW_FILEWATCHERWIN32_H_
+#define _FW_FILEWATCHERWIN32_H_
+#pragma once
+
+#include "FileWatcherImpl.h"
+
+#if FILEWATCHER_PLATFORM == FILEWATCHER_PLATFORM_WIN32
+
+#include <map>
+
+namespace FW {
+/// Implementation for Win32 based on ReadDirectoryChangesW.
+/// @class FileWatcherWin32
+class FileWatcherWin32 : public FileWatcherImpl {
+public:
+ /// type for a map from WatchID to WatchStruct pointer
+ typedef std::map<WatchID, WatchStruct*> WatchMap;
+
+public:
+ ///
+ ///
+ FileWatcherWin32();
+
+ ///
+ ///
+ virtual ~FileWatcherWin32();
+
+ /// Add a directory watch
+ /// @exception FileNotFoundException Thrown when the requested directory does not exist
+ WatchID addWatch(const String& directory, FileWatchListener* watcher, bool recursive);
+
+ /// Remove a directory watch. This is a brute force lazy search O(nlogn).
+ void removeWatch(const String& directory);
+
+ /// Remove a directory watch. This is a map lookup O(logn).
+ void removeWatch(WatchID watchid);
+
+ /// Updates the watcher. Must be called often.
+ void update();
+
+ /// Handles the action
+ void handleAction(WatchStruct* watch, const String& filename, unsigned long action);
+
+private:
+ /// Map of WatchID to WatchStruct pointers
+ WatchMap mWatches;
+ /// The last watchid
+ WatchID mLastWatchID;
+
+};//end FileWatcherWin32
+
+};//namespace FW
+
+#endif//FILEWATCHER_PLATFORM_WIN32
+
+#endif//_FW_FILEWATCHERWIN32_H_
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp index 9e584c3..3b1a828 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp @@ -39,9 +39,6 @@ void OSGInvoker::send(const SendRequest& req) { void OSGInvoker::cancel(const std::string sendId) { } -void OSGInvoker::sendToParent(const SendRequest& req) { -} - void OSGInvoker::invoke(const InvokeRequest& req) { tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h index e65bff8..acfa55c 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h @@ -34,7 +34,6 @@ public: virtual void send(const SendRequest& req); virtual void cancel(const std::string sendId); virtual void invoke(const InvokeRequest& req); - virtual void sendToParent(const SendRequest& req); virtual void handleEvent(Arabica::DOM::Events::Event<std::string>& event); virtual void runOnMainThread(); @@ -95,7 +94,6 @@ protected: typedef std::map<Arabica::DOM::Node<std::string>, osg::Node*> _nodes_t; tthread::recursive_mutex _mutex; - std::string _invokeId; }; #ifdef BUILD_AS_PLUGINS diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp index a983d58..1f08378 100644 --- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp +++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp @@ -39,11 +39,7 @@ void HeartbeatInvoker::cancel(const std::string sendId) { HeartbeatDispatcher::getInstance()->cancelEvent(toStr(this)); } -void HeartbeatInvoker::sendToParent(const SendRequest& req) { -} - void HeartbeatInvoker::invoke(const InvokeRequest& req) { - _invokeId = req.invokeid; _event.invokeid = _invokeId; std::string intervalStr; double interval = 0; @@ -78,7 +74,7 @@ void HeartbeatInvoker::invoke(const InvokeRequest& req) { void HeartbeatInvoker::dispatch(void* instance, std::string name) { HeartbeatInvoker* invoker = (HeartbeatInvoker*)instance; - invoker->_interpreter->receive(invoker->_event); + invoker->returnEvent(invoker->_event); } HeartbeatDispatcher* HeartbeatDispatcher::_instance = NULL; diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h index a7f3cbd..11be295 100644 --- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h +++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h @@ -18,7 +18,7 @@ public: virtual std::set<std::string> getNames() { std::set<std::string> names; names.insert("heartbeat"); - names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#heartbaet"); + names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#heartbeat"); return names; } @@ -26,12 +26,10 @@ public: virtual void send(const SendRequest& req); virtual void cancel(const std::string sendId); virtual void invoke(const InvokeRequest& req); - virtual void sendToParent(const SendRequest& req); static void dispatch(void* instance, std::string name); protected: - std::string _invokeId; Event _event; }; diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp b/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp index 3678cc3..e7c2e10 100644 --- a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp +++ b/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp @@ -21,8 +21,8 @@ SampleInvoker::SampleInvoker() { SampleInvoker::~SampleInvoker() { }; -Invoker* SampleInvoker::create(Interpreter* interpreter) { - SampleInvoker* invoker = new SampleInvoker(); +boost::shared_ptr<IOProcessorImpl> SampleInvoker::create(Interpreter* interpreter) { + boost::shared_ptr<SampleInvoker> invoker = boost::shared_ptr<SampleInvoker>(new SampleInvoker()); invoker->_interpreter = interpreter; return invoker; } @@ -32,17 +32,13 @@ Data SampleInvoker::getDataModelVariables() { return data; } -void SampleInvoker::send(SendRequest& req) { +void SampleInvoker::send(const SendRequest& req) { } void SampleInvoker::cancel(const std::string sendId) { } -void SampleInvoker::sendToParent(SendRequest& req) { -} - -void SampleInvoker::invoke(InvokeRequest& req) { - _invokeId = req.invokeid; +void SampleInvoker::invoke(const InvokeRequest& req) { } }
\ No newline at end of file diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.h b/src/uscxml/plugins/invoker/sample/SampleInvoker.h index 1f30324..018dfc5 100644 --- a/src/uscxml/plugins/invoker/sample/SampleInvoker.h +++ b/src/uscxml/plugins/invoker/sample/SampleInvoker.h @@ -9,11 +9,11 @@ namespace uscxml { -class SampleInvoker : public Invoker { +class SampleInvoker : public InvokerImpl { public: SampleInvoker(); virtual ~SampleInvoker(); - virtual Invoker* create(Interpreter* interpreter); + virtual boost::shared_ptr<IOProcessorImpl> create(Interpreter* interpreter); virtual std::set<std::string> getNames() { std::set<std::string> names; @@ -23,13 +23,11 @@ public: } virtual Data getDataModelVariables(); - virtual void send(SendRequest& req); + virtual void send(const SendRequest& req); virtual void cancel(const std::string sendId); - virtual void invoke(InvokeRequest& req); - virtual void sendToParent(SendRequest& req); + virtual void invoke(const InvokeRequest& req); protected: - std::string _invokeId; }; #ifdef BUILD_AS_PLUGINS diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp index bcdf2d4..4f7d61d 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp @@ -42,23 +42,21 @@ void USCXMLInvoker::cancel(const std::string sendId) { assert(false); } -void USCXMLInvoker::sendToParent(const SendRequest& req) { - SendRequest parentReq = req; - parentReq.invokeid = _invokeId; - _parentInterpreter->receive(parentReq); -} - void USCXMLInvoker::invoke(const InvokeRequest& req) { - _invokeId = req.invokeid; _invokedInterpreter = Interpreter::fromURI(req.src); DataModel dataModel(_invokedInterpreter->getDataModel()); if (dataModel) { } if (_invokedInterpreter) { - _invokedInterpreter->setInvoker(boost::static_pointer_cast<InvokerImpl>(shared_from_this())); + _invokedInterpreter->setParentQueue(this); _invokedInterpreter->start(); } } +void USCXMLInvoker::push(Event& event) { + event.invokeid = _invokeId; + _parentInterpreter->receive(event); +} + }
\ No newline at end of file diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h index 62851e3..792cc5d 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h @@ -2,7 +2,8 @@ #define USCXMLINVOKER_H_OQFA21IO #include <uscxml/Interpreter.h> -#include <boost//enable_shared_from_this.hpp> +#include <boost/enable_shared_from_this.hpp> +#include "uscxml/concurrency/BlockingQueue.h" #ifdef BUILD_AS_PLUGINS #include "uscxml/plugins/Plugins.h" @@ -12,7 +13,10 @@ namespace uscxml { class Interpreter; -class USCXMLInvoker : public InvokerImpl, public boost::enable_shared_from_this<USCXMLInvoker> { +class USCXMLInvoker : + public InvokerImpl, + public uscxml::concurrency::BlockingQueue<Event>, + public boost::enable_shared_from_this<USCXMLInvoker> { public: USCXMLInvoker(); virtual ~USCXMLInvoker(); @@ -29,10 +33,10 @@ public: virtual void send(const SendRequest& req); virtual void cancel(const std::string sendId); virtual void invoke(const InvokeRequest& req); - virtual void sendToParent(const SendRequest& req); + + virtual void push(Event& event); protected: - std::string _invokeId; Interpreter* _invokedInterpreter; Interpreter* _parentInterpreter; }; diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp index c269869..1e15865 100644 --- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp +++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp @@ -80,12 +80,11 @@ void UmundoInvoker::send(const SendRequest& req) { protobufToData(event, *(const google::protobuf::Message*)rv); event.name = _invokeId + ".reply." + req.name; - event.invokeid = _invokeId; event.origin = msg->getMeta("um.channel"); event.origintype = "umundo"; event.type = Event::EXTERNAL; - _interpreter->receive(event); + returnEvent(event); svcIter++; } } @@ -105,12 +104,7 @@ void UmundoInvoker::cancel(const std::string sendId) { assert(false); } -void UmundoInvoker::sendToParent(const SendRequest& req) { - assert(false); -} - void UmundoInvoker::invoke(const InvokeRequest& req) { - _invokeId = req.invokeid; std::string domain; std::string channelName; @@ -201,7 +195,7 @@ void UmundoInvoker::receive(void* object, umundo::Message* msg) { metaIter++; } - _interpreter->receive(event); + returnEvent(event); } void UmundoInvoker::added(umundo::ServiceDescription desc) { @@ -223,7 +217,7 @@ void UmundoInvoker::added(umundo::ServiceDescription desc) { propIter++; } - _interpreter->receive(addedEvent); + returnEvent(addedEvent); } void UmundoInvoker::removed(umundo::ServiceDescription desc) { @@ -249,7 +243,7 @@ void UmundoInvoker::removed(umundo::ServiceDescription desc) { propIter++; } - _interpreter->receive(addedEvent); + returnEvent(addedEvent); } void UmundoInvoker::changed(umundo::ServiceDescription desc) { diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h index 58fa5d8..f03006b 100644 --- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h +++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h @@ -34,7 +34,6 @@ public: virtual void send(const SendRequest& req); virtual void cancel(const std::string sendId); virtual void invoke(const InvokeRequest& req); - virtual void sendToParent(const SendRequest& req); virtual void receive(void* object, umundo::Message* msg); @@ -43,7 +42,6 @@ public: virtual void changed(umundo::ServiceDescription); protected: - std::string _invokeId; bool _isService; bool dataToProtobuf(google::protobuf::Message* msg, Data& data); diff --git a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp index eb5d77b..b051310 100644 --- a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp +++ b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.cpp @@ -243,7 +243,7 @@ void EventIOProcessor::httpRecvReq(struct evhttp_request *req, void *arg) { } EventIOProcessor* INSTANCE = (EventIOProcessor*)arg; - INSTANCE->_interpreter->receive(reqEvent); + INSTANCE->returnEvent(reqEvent); evhttp_send_reply(req, 200, "OK", NULL); } diff --git a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h index d07bab5..3afe463 100644 --- a/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h +++ b/src/uscxml/plugins/ioprocessor/basichttp/libevent/EventIOProcessor.h @@ -57,7 +57,6 @@ protected: std::string _url; uscxml::DelayedEventQueue _asyncQueue; - uscxml::Interpreter* _interpreter; std::map<std::string, struct evhttp_connection*> _httpConnections; std::map<std::string, struct evhttp_request*> _httpRequests; struct evdns_base* _dns; |