Init Tizen 2.2.1
[framework/osp/social.git] / inc / FSclEmail.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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 * @file         FSclEmail.h
18 * @brief        This is the header file for the %Email class.
19 *
20 * This header file contains the declarations of the %Email class.
21 */
22 #ifndef _FSCL_EMAIL_H_
23 #define _FSCL_EMAIL_H_
24
25 #include <FBaseResult.h>
26 #include <FBaseObject.h>
27 #include <FBaseString.h>
28 #include <FSclTypes.h>
29
30 namespace Tizen { namespace Social
31 {
32
33 /**
34 * @class        Email
35 * @brief        This class represents an email.
36 *
37 * @since        2.0
38 *
39 * @final        This class is not intended for extension.
40 *
41 * The %Email class represents an email.
42 * An email consists of the email address and email type.
43 *
44 * The following example demonstrates how to use the %Email class.
45 *
46 * @code
47 using namespace Tizen::Base;
48 using namespace Tizen::Social;
49
50 result
51 MyClass::SomeMethod(void)
52 {
53         result r = E_SUCCESS;
54
55         // Creates an instance of %Email
56         Email email = Email();
57
58         // Sets the email address
59         r = email.SetEmail(L"hello@Tizen.com");
60         if (IsFailed(r))
61         {
62                 return r;
63         }
64
65         // Sets the email type
66         email.SetType(EMAIL_TYPE_PERSONAL);
67
68         return E_SUCCESS;
69 }
70 * @endcode
71 */
72 class _OSP_EXPORT_ Email
73         : public Tizen::Base::Object
74 {
75 public:
76         /**
77          * This is the default constructor for this class.
78          *
79          * @since       2.0
80          */
81         Email(void);
82
83         /**
84          * Initializes this instance of %Email with the specified @c type and @c email. @n
85          * This constructs an instance of %Email with the specified @c type.
86          *
87          * @since       2.0
88          *
89          * @param[in]   type            The type of email
90          * @param[in]   email           The email address
91          */
92         Email(EmailType type, const Tizen::Base::String& email);
93
94         /**
95          * Copying of objects using this copy constructor is allowed.
96          *
97          * @since       2.0
98          *
99          * @param[in]   rhs     An instance of %Email to copy
100          */
101         Email(const Email& rhs);
102
103         /**
104          * This destructor overrides Tizen::Base::Object::~Object().
105          *
106          * @since       2.0
107          */
108         virtual ~Email(void);
109
110         /**
111          * Checks whether the value of the specified instance is equal to the value of the current instance of Tizen::Base::Object.
112          *
113          * @since       2.0
114          *
115          * @return      @c true if the value of the specified instance of Tizen::Base::Object is equal to the value of the current instance of %Tizen::Base::Object, @n
116          *                      else @c false
117          * @param[in]   rhs             An instance of Tizen::Base::Object to compare
118          */
119         virtual bool Equals(const Tizen::Base::Object& rhs) const;
120
121         /**
122          * Gets the hash value of the current instance of Tizen::Base::Object.
123          *
124          * @since       2.0
125          *
126          * @return      The integer value that indicates the hash value of the current instance of Tizen::Base::Object
127          */
128         virtual int GetHashCode(void) const;
129
130         /**
131      * Gets the type of the email.
132      *
133          * @if OSPCOMPAT
134      * @brief <i> [Compatibility] </i>
135          * @endif
136      * @since   2.0
137          * @if OSPCOMPAT
138          * @compatibility            This method has compatibility issues with OSP compatible applications. @n
139      *                           For more information, see @ref CompEmailGetTypePage "here".
140          * @endif
141      *
142      * @return  The type of the email
143      */
144         EmailType GetType(void) const;
145
146         /**
147          * @if OSPCOMPAT
148      * @page                CompEmailGetTypePage         Compatibility for GetType()
149      * @section             CompEmailGetTypePageIssueSection             Issues
150          *                                              Implementing this method in OSP compatible applications has the following issue: @n
151      *                                          -# EMAIL_TYPE_CUSTOM is not supported. If the type of the email is EMAIL_TYPE_CUSTOM, EMAIL_TYPE_OTHER is returned instead.
152      *
153      * @section             CompEmailGetTypePageSolutionSection          Resolutions
154          *                                              The issue mentioned above has been resolved in Tizen.
155          * @endif
156      */
157
158         /**
159          * Gets the email address.
160          *
161          * @since       2.0
162          *
163          * @return      The email address
164          */
165         Tizen::Base::String GetEmail(void) const;
166
167         /**
168          * Sets the type of the email.
169          *
170          * @since       2.0
171          *
172          * @param[in]   type            The type of the email to set
173          */
174         void SetType(EmailType type);
175
176         /**
177          * Sets the email address.
178          *
179          * @if OSPCOMPAT
180          * @brief <i> [Compatibility] </i>
181          * @endif
182          * @since       2.0
183          * @if OSPCOMPAT
184          * @compatibility            This method has compatibility issues with OSP compatible applications. @n
185          *                            For more information, see @ref CompEmailSetEmailPage "here".
186          * @endif
187          *
188          * @return              An error code
189          * @param[in]   email                   The email address
190          * @exception   E_SUCCESS               The method is successful.
191          * @exception   E_INVALID_ARG   The specified @c email address is an empty string.
192          */
193         result SetEmail(const Tizen::Base::String& email);
194
195         /**
196          * @if OSPCOMPAT
197          * @page                CompEmailSetEmailPage           Compatibility for SetEmail()
198          * @section             CompEmailSetEmailPageIssueSection               Issues
199          *                              Implementing this method in OSP compatible applications has the following issue: @n
200          *                               -# If the length of an email address to be set is greater than 100 characters, E_INVALID_ARG is returned.
201          *
202          * @section             CompEmailSetEmailPageSolutionSection            Resolutions
203          *                              The issue mentioned above has been resolved in Tizen.
204          * @endif
205          */
206
207         /**
208          * Gets the label of an email.
209          *
210          * @since       2.0
211          *
212          * @return      The email label
213          * @see SetLabel()
214          */
215         Tizen::Base::String GetLabel(void) const;
216
217         /**
218          * Sets the label of an email.
219          *
220          * @since       2.0
221          *
222          * @param[in]   label   The email label
223          * @see GetLabel()
224          */
225         void SetLabel(const Tizen::Base::String& label);
226
227         /**
228          * Copying of objects using this copy assignment operator is allowed.
229          *
230          * @since       2.0
231          *
232          * @param[in]   rhs     An instance of %Email to copy
233          */
234         Email& operator =(const Email& rhs);
235
236         /**
237          * Checks whether the value of the specified instance of %Email is equal to the value of the current instance.
238          *
239          * @since       2.0
240          *
241          * @return              @c true if the value of the specified instance of %Email equals the value of the current instance, @n
242          *                              else @c false
243          * @param[in]   rhs             An instance of %Email
244          */
245         bool operator ==(const Email& rhs) const;
246
247         /**
248          * Checks whether the value of the specified instance of %Email is not equal to the value of the current instance.
249          *
250          * @since       2.0
251          *
252          * @return              @c true if the value of the specified instance of %Email is not equal to the value of the current instance, @n
253          *                              else @c false
254          * @param[in]   rhs             An instance of %Email
255          */
256         bool operator !=(const Email& rhs) const;
257
258 private:
259         friend class _EmailImpl;
260         class _EmailImpl* __pEmailImpl;
261
262 }; // Email
263
264 }} // Tizen::Social
265
266 #endif // _FSCL_EMAIL_H_