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