Git Init
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / Messaging / JSMessageFolder.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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. 
15 */
16
17
18 /*
19  * @file          JSMessageFolder.h
20  * @author        Oy Kwon (sirot.kwon@samsung.com)
21  * @version   0.1
22  * @brief       Declaration of the Templete class
23  */
24
25 #ifndef WRTPLUGINS_TIZEN_JS_MESSAGEFOLDER_H_
26 #define WRTPLUGINS_TIZEN_JS_MESSAGEFOLDER_H_
27
28 #include <JavaScriptCore/JavaScript.h>
29 #include <CommonsJavaScript/PrivateObject.h>
30 #include <API/Messaging/IMessageFolder.h>
31
32 namespace TizenApis {
33 namespace Tizen1_0 {
34
35
36 typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<Api::Messaging::IMessageFolderPtr>::Type JSMessageFolderPriv;
37
38 class JSMessageFolder {
39 public:
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);
49
50 private:
51         /**
52          * The callback invoked when an object is first created.
53          */
54         static void initialize(JSContextRef context, JSObjectRef object);
55
56         /**
57          * The callback invoked when an object is finalized.
58          */
59         static void finalize(JSObjectRef object);
60
61         /**
62          * The callback invoked when an object is used as the target of an 'instanceof' expression.
63          */
64         static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
65
66
67           /**
68           * The callback invoked when determining whether an object has a property.
69           */
70          static bool hasProperty(JSContextRef context,
71                          JSObjectRef object,
72                          JSStringRef propertyName);
73   
74          /**
75           * The callback invoked when getting a property's value.
76           */
77
78         static JSValueRef getProperty(JSContextRef context,
79                          JSObjectRef object,
80                          JSStringRef propertyName,
81                          JSValueRef* exception);
82
83         static bool setProperty(JSContextRef context,
84                         JSObjectRef object,
85                         JSStringRef propertyName,
86                         JSValueRef value,
87                         JSValueRef* exception);
88
89         /**
90          * This structure contains properties and callbacks that define a type of object.
91          */
92         static JSClassDefinition m_classInfo;
93
94         /**
95          * This structure describes a statically declared function property.
96          */
97         static JSStaticValue m_properties[];
98         static JSClassRef m_jsClassRef;
99
100
101         
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;
110
111         static const std::string TYPE_SMS;
112         static const std::string TYPE_MMS;
113         static const std::string TYPE_EMAIL;
114
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;    
120
121
122 };
123
124
125 } //WrtPlugins
126
127 #endif //WRTPLUGINS_TIZEN_JS_MESSAGING_SERVICE_MANAGER_H_
128
129