diff options
Diffstat (limited to 'mobile_src/Messaging/MessageFactory.h')
-rwxr-xr-x | mobile_src/Messaging/MessageFactory.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/mobile_src/Messaging/MessageFactory.h b/mobile_src/Messaging/MessageFactory.h new file mode 100755 index 0000000..bf0ded6 --- /dev/null +++ b/mobile_src/Messaging/MessageFactory.h @@ -0,0 +1,112 @@ +// +// Tizen Web Device API +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#ifndef MESSAGEFACTORY_H +#define MESSAGEFACTORY_H + +#include <string> +#include "IMessaging.h" +#include "IMessage.h" +#include "EmailAccountInfo.h" +#include "msg_types.h" + +namespace DeviceAPI { +namespace Messaging { + +//-------------------------------------------------------------------------- + +class MessageFactory +{ + public: + + /** + * Generate message specyfied type + * @param[in] msgType type of message to create + * @param[in] id if id is set, then is trying to read existing message + * from storage by specyfid if + */ + static IMessagePtr createMessage(const MessageType msgType, + const std::string& id = ""); + + /** + * Generate message specyfied type + * @param[in] msgType type of message to create + * @param[in] int id + * from storage by specyfid if + */ + static IMessagePtr createMessage(const MessageType msgType, + const int id); + + static IMessagePtr createMessage(const MessageType msgType, + const int id, const msg_struct_t msg_data); + + /** + * Generate message specyfied type + * @param[in] msgType type of message to create + * @param[in] account of mail. + */ + static IMessagePtr createMessage(const MessageType msgType, + EmailAccountInfo& account, const std::string& id = "" ); + + static IMessagePtr createEmailMessage ( const int accountId, const int id = 0 ); + + static IMessagePtr createEmailMessage(); + + /** + * Generate virtual message specyfied type, without platform projection + * @param[in] msgType type of message to create + */ + static IMessagePtr createVirtualMessage(); + + /** + * Convert abstract message (IMessage) to virtual message + * @param[in] msg - pointer to message to convert + * @throw ConversionException if conversion fail + */ + static VirtualMessagePtr convertToVirtualMessage(IMessagePtr msg); + + /** + * Convert abstract message (IMessage) to abstract sms (ISms) + * @param[in] msg - pointer to message to convert + * @throw ConversionException if conversion fail + */ + static ISmsPtr convertToSms(IMessagePtr msg); + + /** + * Convert abstract message (IMessage) to abstract binary sms (IBinarySms) + * @param[in] msg - pointer to message to convert + * @throw ConversionException if conversion fail + */ + static IBinarySmsPtr convertToBinarySms(IMessagePtr msg); + + /** + * Convert abstract message (IMessage) to abstract Mms (IMms) + * @param[in] msg - pointer to message to convert + * @throw ConversionException if conversion fail + */ + static IMmsPtr convertToMms(IMessagePtr msg); + + /** + * Convert abstract message (IMessage) to abstract email (IEmail) + * @param[in] msg - pointer to message to convert + * @throw ConversionException if conversion fail + */ + static IEmailPtr convertToEmail(IMessagePtr msg); +}; +} +} +#endif |