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