tizen beta release
[framework/web/wrt-plugins-common.git] / src / modules / API / Messaging / Recipient.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       Recipient.h
20  * @author     Pawel Misiak (p.misiak@samsung.com)
21  * @version    0.1
22  * @brief
23  */
24 #ifndef RECIPIENT_H
25 #define RECIPIENT_H
26
27 #include "IMessagingTypes.h"
28 #include <string>
29 #include <vector>
30 #include <dpl/shared_ptr.h>
31
32 namespace WrtDeviceApis {
33 namespace Messaging {
34 namespace Api {
35 //--------------------------------------------------------------------------
36
37 class Recipients
38 {
39   private: // fields
40
41     /**
42      * recipient value
43      */
44     std::vector<std::string> m_recipients;
45
46     bool m_validRecipients;
47
48   public: // methods
49
50     Recipients();
51
52     explicit Recipients(const std::vector<std::string>& value);
53
54     virtual ~Recipients();
55
56     /**
57      * information if abstract message to recipient has been changed and
58      * need update in low level
59      */
60     bool isValid() const;
61
62     void setValid(bool state);
63
64     /**
65      * setter of recipient value
66      */
67     void setRecipients(const std::vector<std::string>& value);
68
69     void setRecipients(const std::string& value);
70
71     void setRecipient(const size_t index,
72             const std::string& value);
73
74     void setRecipientWithExpand(const size_t index,
75             const std::string& value);
76
77     /**
78      * getter of recipient value
79      */
80     std::vector<std::string> getRecipients() const;
81
82     const std::vector<std::string>& getRecipientsRef() const;
83
84     std::string getRecipient(const size_t index) const;
85
86     void appendRecipient(const std::string & value);
87
88     void removeRecipient(const size_t position);
89
90     void removeRecipient(const std::string & value);
91
92     size_t getRecipientSize() const;
93
94     bool operator !=(const Recipients& arg) const;
95
96     Recipients & operator +=(const Recipients& val);
97
98     Recipients & operator -=(const Recipients& val);
99
100     std::string join(char delimiter = ';') const;
101
102   private:
103
104     std::vector<std::string> split(const std::string& input,
105             char delimiter);
106 };
107
108 typedef DPL::SharedPtr<Recipients> RecipientsPtr;
109 }
110 }
111 }
112 #endif