diff options
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp')
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp | 209 |
1 files changed, 0 insertions, 209 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp deleted file mode 100644 index b6a262d..0000000 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/JSCArrayBuffer.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/** - * @file - * @author This file has been generated by generate-bindings.pl. DO NOT MODIFY! - * @copyright Simplified BSD - * - * @cond - * This program is free software: you can redistribute it and/or modify - * it under the terms of the FreeBSD license as published by the FreeBSD - * project. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the FreeBSD license along with this - * program. If not, see <http://www.opensource.org/licenses/bsd-license>. - * @endcond - */ -#include "JSCArrayBuffer.h" - -namespace Arabica { -namespace DOM { - -JSClassRef JSCArrayBuffer::Tmpl; - -JSStaticValue JSCArrayBuffer::staticValues[] = { - { "byteLength", byteLengthAttrGetter, 0, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly }, - { "mimeType", mimeTypeAttrGetter, mimeTypeAttrSetter, kJSPropertyAttributeDontDelete }, - - { 0, 0, 0, 0 } -}; - -JSStaticFunction JSCArrayBuffer::staticFunctions[] = { - { "md5", md5Callback, kJSPropertyAttributeDontDelete }, - { "base64", base64Callback, kJSPropertyAttributeDontDelete }, - { "slice", sliceCallback, kJSPropertyAttributeDontDelete }, - { "isView", isViewCallback, kJSPropertyAttributeDontDelete }, - { 0, 0, 0 } -}; - -JSObjectRef JSCArrayBuffer::jsConstructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - uscxml::ArrayBuffer* localInstance = NULL; - - if (false) { - } else if (argumentCount == 1 && - JSValueIsNumber(ctx, arguments[0])) { - - unsigned long localLength = (unsigned long)JSValueToNumber(ctx, arguments[0], exception); - localInstance = new uscxml::ArrayBuffer(localLength); - - } - if (!localInstance) { - JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling constructor for ArrayBuffer"); - *exception = JSValueMakeString(ctx, exceptionString); - JSStringRelease(exceptionString); - return (JSObjectRef)JSValueMakeNull(ctx); - } - - JSClassRef retClass = JSCArrayBuffer::getTmpl(); - - struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate(); - retPrivData->nativeObj = localInstance; - - JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); - return retObj; -} - -JSValueRef JSCArrayBuffer::byteLengthAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { - struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(object); - - return JSValueMakeNumber(ctx, privData->nativeObj->getByteLength()); -} - - -JSValueRef JSCArrayBuffer::mimeTypeAttrGetter(JSContextRef ctx, JSObjectRef object, JSStringRef propertyName, JSValueRef *exception) { - struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(object); - - JSStringRef stringRef = JSStringCreateWithUTF8CString(privData->nativeObj->getMimeType().c_str()); - JSValueRef retVal = JSValueMakeString(ctx, stringRef); - JSStringRelease(stringRef); - return retVal; -} - - -bool JSCArrayBuffer::mimeTypeAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { - struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj); - - JSStringRef stringReflocalMimeType = JSValueToStringCopy(ctx, value, exception); - size_t localMimeTypeMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalMimeType); - char* localMimeTypeBuffer = new char[localMimeTypeMaxSize]; - JSStringGetUTF8CString(stringReflocalMimeType, localMimeTypeBuffer, localMimeTypeMaxSize); - std::string localMimeType(localMimeTypeBuffer); - JSStringRelease(stringReflocalMimeType); - free(localMimeTypeBuffer); - - privData->nativeObj->setMimeType(localMimeType); - return true; -} - -JSValueRef JSCArrayBuffer::md5Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - - struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj); - - if (false) { - } else if (argumentCount == 0) { - - std::string retVal = privData->nativeObj->md5(); - - JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str()); - JSValueRef jscRetVal = JSValueMakeString(ctx, jscString); - JSStringRelease(jscString); - return jscRetVal; - } - - JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling md5"); - *exception = JSValueMakeString(ctx, exceptionString); - JSStringRelease(exceptionString); - return JSValueMakeUndefined(ctx); -} - -JSValueRef JSCArrayBuffer::base64Callback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - - struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj); - - if (false) { - } else if (argumentCount == 0) { - - std::string retVal = privData->nativeObj->base64(); - - JSStringRef jscString = JSStringCreateWithUTF8CString(retVal.c_str()); - JSValueRef jscRetVal = JSValueMakeString(ctx, jscString); - JSStringRelease(jscString); - return jscRetVal; - } - - JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling base64"); - *exception = JSValueMakeString(ctx, exceptionString); - JSStringRelease(exceptionString); - return JSValueMakeUndefined(ctx); -} - -JSValueRef JSCArrayBuffer::sliceCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - - struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj); - - if (false) { - } else if (argumentCount == 2 && - JSValueIsNumber(ctx, arguments[0]) && - JSValueIsNumber(ctx, arguments[1])) { - long localBegin = (long)JSValueToNumber(ctx, arguments[0], exception); - long localEnd = (long)JSValueToNumber(ctx, arguments[1], exception); - - uscxml::ArrayBuffer* retVal = new uscxml::ArrayBuffer(privData->nativeObj->slice(localBegin, localEnd)); - JSClassRef retClass = JSCArrayBuffer::getTmpl(); - - struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate(); - retPrivData->dom = privData->dom; - retPrivData->nativeObj = retVal; - - JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); - - return retObj; - - } else if (argumentCount == 1 && - JSValueIsNumber(ctx, arguments[0])) { - long localBegin = (long)JSValueToNumber(ctx, arguments[0], exception); - - uscxml::ArrayBuffer* retVal = new uscxml::ArrayBuffer(privData->nativeObj->slice(localBegin)); - JSClassRef retClass = JSCArrayBuffer::getTmpl(); - - struct JSCArrayBuffer::JSCArrayBufferPrivate* retPrivData = new JSCArrayBuffer::JSCArrayBufferPrivate(); - retPrivData->dom = privData->dom; - retPrivData->nativeObj = retVal; - - JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData); - - return retObj; - - } - - JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling slice"); - *exception = JSValueMakeString(ctx, exceptionString); - JSStringRelease(exceptionString); - return JSValueMakeUndefined(ctx); -} - -JSValueRef JSCArrayBuffer::isViewCallback(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObj, size_t argumentCount, const JSValueRef* arguments, JSValueRef* exception) { - - struct JSCArrayBufferPrivate* privData = (struct JSCArrayBufferPrivate*)JSObjectGetPrivate(thisObj); - - if (false) { - } else if (argumentCount == 1 && - true) { - void* localValue = JSObjectGetPrivate(JSValueToObject(ctx, arguments[0], exception)); - - bool retVal = privData->nativeObj->isView(localValue); - - JSValueRef jscRetVal = JSValueMakeBoolean(ctx, retVal); - return jscRetVal; - } - - JSStringRef exceptionString = JSStringCreateWithUTF8CString("Parameter mismatch while calling isView"); - *exception = JSValueMakeString(ctx, exceptionString); - JSStringRelease(exceptionString); - return JSValueMakeUndefined(ctx); -} - -} -} |