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