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/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp | |
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/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp')
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCDocument.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
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; + +} + +} +} |