// // Tizen Web Device API // Copyright (c) 2012 Samsung Electronics Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the License); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #ifndef WRT_PLUGINS_TIZEN_JS_MESSAGE_ATTACHMENT_H_ #define WRT_PLUGINS_TIZEN_JS_MESSAGE_ATTACHMENT_H_ #include #include #include "IMessagingService.h" #include "IMessage.h" namespace DeviceAPI { namespace Messaging { typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT::Type JSMessageAttachmentPrivate; //IAttachmentPtr class JSMessageAttachment { static JSClassRef m_jsClassRef; public: static const JSClassDefinition* getClassInfo(); static JSClassRef getClassRef(); static JSObjectRef createJS( JSContextRef context, const IAttachmentPtr &msg); static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); private: /** * The callback invoked when an object is first created. */ static void initialize(JSContextRef context, JSObjectRef object); /** * The callback invoked when an object is finalized. */ static void finalize(JSObjectRef object); static bool hasProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName); static JSValueRef getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); static bool setProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception); static void getPropertyNames(JSContextRef context, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames); #if 0 /** * Get MIME Type of Attachment File. readonly */ static JSValueRef getMIMEType(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); static JSValueRef getMessageID(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); static JSValueRef getContentLocation(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); static JSValueRef getContentID(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); static JSValueRef getLoaded(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); static JSValueRef getFilePath(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception); #endif /* * returns private object or throws WrtDeviceApis::Commons::NullPointerException */ static JSMessageAttachmentPrivate* getPrivate(JSObjectRef value); /* * extracts Api Message representation * throws WrtDeviceApis::Commons::NullPointerException if there's no private object * throws WrtDeviceApis::Commons::ConversionException if it's not possible to convert to JSObjectRef */ static IAttachmentPtr getAttachment(JSContextRef context, JSValueRef value); /* * extracts Api Message representation * throws WrtDeviceApis::Commons::NullPointerException if there's no private object */ static IAttachmentPtr getAttachment(JSContextRef context, JSObjectRef object); /** * This structure describes a statically declared function property. */ static JSStaticFunction m_function[]; /** * This structure contains properties and callbacks that define a type of object. */ static JSClassDefinition m_classInfo; /** * This member variable contains the initialization values for the static properties of this class. * The values are given according to the data structure JSPropertySpec */ //static JSStaticValue m_property[]; static const char* ATTACHMENTID; static const char* MSGID; static const char* MIMETYPE; static const char* FILEPATH; }; } } #endif //WRT_PLUGINS_TIZEN_JS_MESSAGE_ATTACHMENT_H_