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.
19 * @file JSMessageFolder.h
20 * @author Oy Kwon (sirot.kwon@samsung.com)
22 * @brief Declaration of the Templete class
25 #ifndef WRTPLUGINS_TIZEN_JS_MESSAGEFOLDER_H_
26 #define WRTPLUGINS_TIZEN_JS_MESSAGEFOLDER_H_
28 #include <JavaScriptCore/JavaScript.h>
29 #include <CommonsJavaScript/PrivateObject.h>
30 #include <API/Messaging/IMessageFolder.h>
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<Api::Messaging::IMessageFolderPtr>::Type JSMessageFolderPriv;
38 class JSMessageFolder {
40 //@struct JSClassDefinition
41 // @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.
42 static const JSClassDefinition* getClassInfo();
43 static const JSClassRef getClassRef();
44 static JSObjectRef createJSObject(JSContextRef context, Api::Messaging::IMessageFolderPtr object);
45 static Api::Messaging::IMessageFolderPtr getMessageFolder(JSContextRef context, JSValueRef value);
46 static bool isObjectOfClass(JSContextRef context, JSValueRef value);
47 static std::string convertMessageType(int msgType);
48 static std::string convertFolderType(int msgType);
52 * The callback invoked when an object is first created.
54 static void initialize(JSContextRef context, JSObjectRef object);
57 * The callback invoked when an object is finalized.
59 static void finalize(JSObjectRef object);
62 * The callback invoked when an object is used as the target of an 'instanceof' expression.
64 static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
68 * The callback invoked when determining whether an object has a property.
70 static bool hasProperty(JSContextRef context,
72 JSStringRef propertyName);
75 * The callback invoked when getting a property's value.
78 static JSValueRef getProperty(JSContextRef context,
80 JSStringRef propertyName,
81 JSValueRef* exception);
83 static bool setProperty(JSContextRef context,
85 JSStringRef propertyName,
87 JSValueRef* exception);
90 * This structure contains properties and callbacks that define a type of object.
92 static JSClassDefinition m_classInfo;
95 * This structure describes a statically declared function property.
97 static JSStaticValue m_properties[];
98 static JSClassRef m_jsClassRef;
102 static const char* FOLDERID;
103 static const char* PARENTID;
104 static const char* ACCOUNTID;
105 static const char* CONTENTTYPE;
106 static const char* NAME;
107 static const char* PATH;
108 static const char* TYPE;
109 static const char* SYNCHRONIZABLE;
111 static const std::string TYPE_SMS;
112 static const std::string TYPE_MMS;
113 static const std::string TYPE_EMAIL;
115 static const std::string FOLDER_INBOX;
116 static const std::string FOLDER_OUTBOX;
117 static const std::string FOLDER_DRAFTBOX;
118 static const std::string FOLDER_SENTBOX;
119 static const std::string FOLDER_NOTSTANDARD;
127 #endif //WRTPLUGINS_TIZEN_JS_MESSAGING_SERVICE_MANAGER_H_