2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #include <CommonsJavaScript/Converter.h>
19 #include "IMessagingTypes.h"
20 #include "MessageFactory.h"
21 #include "Recipient.h"
23 #include "EventUpdateMessage.h"
24 #include "IConversation.h"
26 #include "MessageSendCallback.h"
27 #include "MessagingStorageMultiCallback.h"
29 #if 0 // MESSAGING ATTACHMENT IS BLOCKED
30 #include <API/Messaging/IMessageFolder.h>
31 #include <API/Filesystem/INodeTypes.h>
34 #ifndef CONVERTEDMESSAGE_H
35 #define CONVERTEDMESSAGE_H
39 class ConverterMessage : public WrtDeviceApis::CommonsJavaScript::Converter
51 messageFolderInbox = 1,
52 messageFolderOutbox = 2,
53 messageFolderDrafts = 3,
54 messageFolderSentbox = 4
56 static MessageFunctions m_callbackNames[MESSAGING_MULTI_FUNTION_MAX];
60 using WrtDeviceApis::CommonsJavaScript::Converter::toJSValueRef;
62 explicit ConverterMessage(JSContextRef context);
64 virtual ~ConverterMessage();
66 OnMessagesChanged toMessageMultifunctions(JSValueRef argument, int MessageFunctionNum);
68 JSContextRef toJSGlobalContext(JSObjectRef arg);
70 JSValueRef toJSValueRef(FolderType arg);
72 JSValueRef toJSValueRef(const std::vector<IMmsSlidePtr>& slides);
74 JSValueRef toJSValueRef(MessageType arg);
76 JSValueRef toJSValueRef(const IMessagePtr& arg);
78 JSValueRef toJSValueRef(const IMessagePtr& arg,
79 EventUpdateMessageAnswerReceiver* listener);
81 JSValueRef toJSValueRef(const std::vector<IMessagePtr>& arg,
82 EventUpdateMessageAnswerReceiver* listener);
83 JSValueRef toJSValueRef(const std::vector<IConversationPtr>& conversations);
84 JSValueRef toJSValueRef(const std::vector<IMessageFolderPtr>& messagefolders);
86 IConversationPtr toConversation(const JSValueRef& arg);
87 std::vector<IConversationPtr> toVectorOfConversation(const JSValueRef& arg);
89 JSValueRef toJSValueRef(const MessagePriority& arg);
91 JSValueRef toJSValueRef(const IAttachmentPtr& arg);
93 JSValueRef keyToJSValue(JSValueRef value,
94 const std::string& key);
96 IMessagePtr toIMessage(JSValueRef arg);
98 IMessagePtr toIMessage(JSObjectRef arg);
100 IAttachmentPtr toIAttachment(JSValueRef arg);
102 IAttachmentPtr toIAttachment(JSObjectRef arg);
104 Recipients toRecipients(JSValueRef arg);
106 std::vector<FolderType> toVectorOfFolderTypes(JSValueRef arg);
108 FolderType toFolderType(const JSValueRef& arg);
110 IMessageFolderPtr toIMessageFolder(JSValueRef arg);
112 IMessageFolderPtr toIMessageFolder(JSObjectRef arg);
114 MessageType toMessageType(JSValueRef arg);
116 MessageType toMessageType(JSObjectRef arg);
118 std::string toMessageType( long msgtype );
120 MessageType toMessageType(std::string arg);
122 std::string toMessageStatusType( long msgstatus );
124 std::string convertIntToString( int msgInt );
126 AddressType toAddressType(JSValueRef arg);
128 MessagePriority::Priority toMessagePriority(JSValueRef arg);
130 #if 0 // MESSAGING ATTACHMENT IS BLOCKED
131 DeviceAPI::Filesystem::INodePtr toFilesystemNode(JSValueRef arg);
136 * @throw InvalidArgumentException If not a callback nor JS null.
138 JSValueRef toFunctionOrNull(const JSValueRef& arg);
141 * @throw ConversionException If JS null.
142 * @throw InvalidArgumentException If not a callback nor JS null.
144 JSValueRef toFunction(const JSValueRef& arg);
146 MessageSendCallback toMessageSendCallback(const JSValueRef& arg);
149 typedef WrtDeviceApis::CommonsJavaScript::ConverterFactory<ConverterMessage> ConverterMessageFactory;