12a12fccb14a725eeaaf12d0754f8a2e07c5092d
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Messaging / MessageFactory.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  *
20  *
21  * @file       MessageFactory.h
22  * @author     Pawel Misiak (p.misiak@samsung.com)
23  * @version    0.1
24  * @brief
25  */
26 #ifndef MESSAGEFACTORY_H
27 #define MESSAGEFACTORY_H
28
29 #include <string>
30 #include "IMessaging.h"
31 #include "IMessage.h"
32 #include "EmailAccountInfo.h"
33
34 namespace TizenApis {
35 namespace Api {
36 namespace Messaging {
37
38 //--------------------------------------------------------------------------
39
40 class MessageFactory
41 {
42   public:
43
44     /**
45      * Generate message specyfied type
46      * @param[in] msgType type of message to create
47      * @param[in] id if id is set, then is trying to read existing message
48      * from storage by specyfid if
49      */
50     static IMessagePtr createMessage(const MessageType msgType,
51             const std::string& id = "");
52
53     /**
54      * Generate message specyfied type
55      * @param[in] msgType type of message to create
56      * @param[in] int id
57      * from storage by specyfid if
58      */
59     static IMessagePtr createMessage(const MessageType msgType,
60             const int id);
61
62     /**
63      * Generate message specyfied type
64      * @param[in] msgType type of message to create
65      * @param[in] account of mail.
66      */
67     static IMessagePtr createMessage(const MessageType msgType,
68            Api::Messaging::EmailAccountInfo& account, const std::string& id = "" );
69
70     static IMessagePtr createEmailMessage ( const int id = 0, const int accountId = 0);
71
72     /**
73      * Generate virtual message specyfied type, without platform projection
74      * @param[in] msgType type of message to create
75      */
76     static IMessagePtr createVirtualMessage();
77
78     /**
79      * Convert abstract message (IMessage) to virtual message
80      * @param[in] msg - pointer to message to convert
81      * @throw ConversionException if conversion fail
82      */
83     static VirtualMessagePtr convertToVirtualMessage(IMessagePtr msg);
84
85     /**
86      * Convert abstract message (IMessage) to abstract sms (ISms)
87      * @param[in] msg - pointer to message to convert
88      * @throw ConversionException if conversion fail
89      */
90     static ISmsPtr convertToSms(IMessagePtr msg);
91
92     /**
93      * Convert abstract message (IMessage) to abstract binary sms (IBinarySms)
94      * @param[in] msg - pointer to message to convert
95      * @throw ConversionException if conversion fail
96      */
97     static IBinarySmsPtr convertToBinarySms(IMessagePtr msg);
98
99     /**
100      * Convert abstract message (IMessage) to abstract Mms (IMms)
101      * @param[in] msg - pointer to message to convert
102      * @throw ConversionException if conversion fail
103      */
104     static IMmsPtr convertToMms(IMessagePtr msg);
105
106     /**
107      * Convert abstract message (IMessage) to abstract email (IEmail)
108      * @param[in] msg - pointer to message to convert
109      * @throw ConversionException if conversion fail
110      */
111     static IEmailPtr convertToEmail(IMessagePtr msg);
112 };
113 }
114 }
115 }
116 #endif