Merge "Remove the memory leak on osp-security-service" into tizen_2.2
[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 the specified encoded string using the specified 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. @n
82         *                               The supplied encoding scheme is used to determine what characters are represented
83         *                               by any consecutive sequences of the form "%ab", where ab is the two-digit hexadecimal representation of a
84         *                               byte.
85         * @see                  UrlEncoder
86         */
87         static result Decode(const Tizen::Base::String& str, const Tizen::Base::String& encodingScheme, Tizen::Base::String& decodedStr);
88
89 private:
90         /**
91         * This default constructor is intentionally declared as private so that only the platform can create an instance.
92         */
93         UrlDecoder(void);
94
95         /*
96          * This destructor is intentionally declared as private so that only the platform can delete an instance.
97          */
98         virtual ~UrlDecoder(void);
99
100         /**
101          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
102          *
103          * @param[in]   rhs     The instance of the UrlDecoder
104          */
105         UrlDecoder(const UrlDecoder& rhs);
106
107         /**
108          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
109          *
110          * @param[in]   rhs     An instance of %UrlDecoder
111          */
112         UrlDecoder& operator =(const UrlDecoder& rhs);
113 }; // UrlDecoder
114
115 }}} // Tizen::Base::Utility
116 #endif // _FBASE_UTIL_URL_DECODER_H_