3ecf31f81c686d2c3c1f93d7001cb90a1bea2b77
[platform/framework/native/appfw.git] / inc / FBaseUtilUrlDecoder.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 /**
18  * @file                FBaseUtilUrlDecoder.h
19  * @brief               This is the header file for the %UrlDecoder class.
20  *
21  * This header file contains the declarations of the %UrlDecoder class.
22  */
23 #ifndef _FBASE_UTIL_URL_DECODER_H_
24 #define _FBASE_UTIL_URL_DECODER_H_
25
26 // includes
27 #include <FBaseString.h>
28
29
30 namespace Tizen { namespace Base { namespace Utility
31 {
32 /**
33  * @class       UrlDecoder
34  * @brief       This class provides a method for decoding strings using a specific encoding scheme.
35  *
36  * @since 2.0
37  *
38  * The %UrlDecoder class provides a method for decoding strings using a specific encoding scheme.
39  *
40  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/url_encoder_decoder.htm">UrlEncoder and UrlDecoder</a>.
41  *
42  * The following example demonstrates how to use the %UrlDecoder class.
43  *
44  * @code
45  *      #include <FBase.h>
46  *
47  *      using namespace Tizen::Base;
48  *      using namespace Tizen::Base::Utility;
49  *
50  *      void
51  *      MyClass::UrlDecoderSample(void)
52  *      {
53  *              result r = E_SUCCESS;
54  *              String str1(L"url+encoding+test%3f");
55  *              String str2;
56  *
57  *              // Decodes the input string
58  *              r = UrlDecoder::Decode(str1, L"UTF-8", str2);
59  *      }
60  * @endcode
61  */
62
63 class _OSP_EXPORT_ UrlDecoder
64 {
65 public:
66         /**
67         * Decodes an encoded string using a specific encoding scheme.
68         *
69         * @since 2.0
70         *
71         * @return               An error code
72         * @param[in]    str                                                     An instance of String to decode
73         * @param[in]    encodingScheme                          The supported encoding scheme
74         * @param[out]   decodedStr                                      The decoded string
75         * @exception    E_SUCCESS                                       The method is successful.
76         * @exception    E_INVALID_ARG                           A specified input parameter is invalid.
77         * @exception    E_SYSTEM                                        A system error has occurred.
78         * @exception    E_UNSUPPORTED_TYPE                      The specified encoding scheme is not supported.
79         * @exception    E_INVALID_ENCODING_RANGE        The specified string contains code points that are outside the bounds of the character encoding scheme.
80         * @remarks      This method is used for decoding. It decodes an application/x-www-form-urlencoded string using a
81         * specific encoding scheme. The supplied encoding scheme is used to determine what characters are represented
82         * by any consecutive sequences of the form "%ab", where ab is the two-digit hexadecimal representation of a
83         * byte.
84         *@see           UrlEncoder
85         */
86         static result Decode(const Tizen::Base::String& str, const Tizen::Base::String& encodingScheme, Tizen::Base::String& decodedStr);
87
88 private:
89         /**
90         * This default constructor is intentionally declared as private so that only the platform can create an instance.
91         */
92         UrlDecoder(void);
93
94         /*
95          * This destructor is intentionally declared as private so that only the platform can delete an instance.
96          */
97         virtual ~UrlDecoder(void);
98
99         /**
100          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
101          *
102          * @param[in]   rhs     The instance of the UrlDecoder
103          */
104         UrlDecoder(const UrlDecoder& rhs);
105
106         /**
107          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
108          *
109          * @param[in]   rhs     An instance of %UrlDecoder
110          */
111         UrlDecoder& operator =(const UrlDecoder& rhs);
112 }; // UrlDecoder
113
114 }}} // Tizen::Base::Utility
115 #endif // _FBASE_UTIL_URL_DECODER_H_