Modify Scanner class
[platform/framework/native/appfw.git] / inc / FBaseUtilUrlDecoder.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 /**
19  * @file                FBaseUtilUrlDecoder.h
20  * @brief               This is the header file for the %UrlDecoder class.
21  *
22  * This header file contains the declarations of the %UrlDecoder class.
23  */
24 #ifndef _FBASE_UTIL_URL_DECODER_H_
25 #define _FBASE_UTIL_URL_DECODER_H_
26
27 // includes
28 #include <FBaseString.h>
29
30
31 namespace Tizen { namespace Base { namespace Utility
32 {
33 /**
34  * @class       UrlDecoder
35  * @brief       This class provides a method for decoding strings using a specific encoding scheme.
36  *
37  * @since 2.0
38  *
39  * The %UrlDecoder class provides a method for decoding strings using a specific encoding scheme.
40  *
41  * 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>.
42  *
43  * The following example demonstrates how to use the %UrlDecoder class.
44  *
45  * @code
46  *      #include <FBase.h>
47  *
48  *      using namespace Tizen::Base;
49  *      using namespace Tizen::Base::Utility;
50  *
51  *      void
52  *      MyClass::UrlDecoderSample(void)
53  *      {
54  *              result r = E_SUCCESS;
55  *              String str1(L"url+encoding+test%3f");
56  *              String str2;
57  *
58  *              // Decodes the input string
59  *              r = UrlDecoder::Decode(str1, L"UTF-8", str2);
60  *      }
61  * @endcode
62  */
63
64 class _OSP_EXPORT_ UrlDecoder
65 {
66 public:
67         /**
68         * Decodes an encoded string using a specific encoding scheme.
69         *
70         * @since 2.0
71         *
72         * @return               An error code
73         * @param[in]    str                                                     An instance of String to decode
74         * @param[in]    encodingScheme                          The supported encoding scheme
75         * @param[out]   decodedStr                                      The decoded string
76         * @exception    E_SUCCESS                                       The method is successful.
77         * @exception    E_INVALID_ARG                           A specified input parameter is invalid.
78         * @exception    E_SYSTEM                                        A system error has occurred.
79         * @exception    E_UNSUPPORTED_TYPE                      The specified encoding scheme is not supported.
80         * @exception    E_INVALID_ENCODING_RANGE        The specified string contains code points that are outside the bounds of the character encoding scheme.
81         * @remarks      This method is used for decoding. It decodes an application/x-www-form-urlencoded string using a
82         * specific encoding scheme. 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_