2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #ifndef WRTPLUGINS_TIZEN_JS_MESSAGEFOLDER_H_
21 #define WRTPLUGINS_TIZEN_JS_MESSAGEFOLDER_H_
23 #include <JavaScriptCore/JavaScript.h>
24 #include <CommonsJavaScript/PrivateObject.h>
25 #include <API/Messaging/IMessageFolder.h>
31 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<Api::Messaging::IMessageFolderPtr>::Type JSMessageFolderPriv;
33 class JSMessageFolder {
35 //@struct JSClassDefinition
36 // @abstract This structure contains properties and callbacks that define a type of object. All fields other than the version field are optional. Any pointer may be NULL.
37 static const JSClassDefinition* getClassInfo();
38 static const JSClassRef getClassRef();
39 static JSObjectRef createJSObject(JSContextRef context, Api::Messaging::IMessageFolderPtr object);
40 static Api::Messaging::IMessageFolderPtr getMessageFolder(JSContextRef context, JSValueRef value);
41 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
42 static std::string convertMessageType(int msgType);
43 static std::string convertFolderType(int msgType);
47 * The callback invoked when an object is first created.
49 static void initialize(JSContextRef context, JSObjectRef object);
52 * The callback invoked when an object is finalized.
54 static void finalize(JSObjectRef object);
57 * The callback invoked when an object is used as the target of an 'instanceof' expression.
59 static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
63 * The callback invoked when determining whether an object has a property.
65 static bool hasProperty(JSContextRef context,
67 JSStringRef propertyName);
70 * The callback invoked when getting a property's value.
73 static JSValueRef getProperty(JSContextRef context,
75 JSStringRef propertyName,
76 JSValueRef* exception);
78 static bool setProperty(JSContextRef context,
80 JSStringRef propertyName,
82 JSValueRef* exception);
85 * This structure contains properties and callbacks that define a type of object.
87 static JSClassDefinition m_classInfo;
90 * This structure describes a statically declared function property.
92 static JSStaticValue m_properties[];
93 static JSClassRef m_jsClassRef;
97 static const char* FOLDERID;
98 static const char* PARENTID;
99 static const char* ACCOUNTID;
100 static const char* CONTENTTYPE;
101 static const char* NAME;
102 static const char* PATH;
103 static const char* TYPE;
104 static const char* SYNCHRONIZABLE;
106 static const std::string TYPE_SMS;
107 static const std::string TYPE_MMS;
108 static const std::string TYPE_EMAIL;
110 static const std::string FOLDER_INBOX;
111 static const std::string FOLDER_OUTBOX;
112 static const std::string FOLDER_DRAFTBOX;
113 static const std::string FOLDER_SENTBOX;
114 static const std::string FOLDER_NOTSTANDARD;
122 #endif //WRTPLUGINS_TIZEN_JS_MESSAGING_SERVICE_MANAGER_H_