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