2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FBaseUtilUrlEncoder.h
19 * @brief This is the header file for the %UrlEncoder class.
21 * This header file contains the declarations of the %UrlEncoder class.
24 #ifndef _FBASE_UTIL_URL_ENCODER_H_
25 #define _FBASE_UTIL_URL_ENCODER_H_
28 #include <FBaseString.h>
31 namespace Tizen { namespace Base { namespace Utility
35 * @brief This class provides a method for encoding a string using a specific encoding scheme.
39 * The %UrlEncoder class provides a method for encoding a string using a specific encoding scheme.
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>.
43 * The following example demonstrates how to use the %UrlEncoder class.
48 * using namespace Tizen::Base;
49 * using namespace Tizen::Base::Utility;
52 * MyClass::UrlEncoderSample(void)
54 * result r = E_SUCCESS;
55 * String str1(L"url encoding test?");
58 * // Encodes the input string
59 * r = UrlEncoder::Encode(str1, L"UTF-8", str2);
65 class _OSP_EXPORT_ UrlEncoder
69 * Encodes the specified input string using the specified encoding scheme. @n
70 * It encodes all unsafe characters of a string.
74 * @return An error code
75 * @param[in] str An instance of String to encode
76 * @param[in] encodingScheme The supported encoding scheme
77 * @param[out] encodedStr The encoded string
78 * @exception E_SUCCESS The method is successful.
79 * @exception E_INVALID_ARG A specified input parameter is invalid.
80 * @exception E_SYSTEM A system error has occurred.
81 * @exception E_UNSUPPORTED_TYPE The specified encoding scheme is not supported.
82 * @exception E_INVALID_ENCODING_RANGE The specified string contains code points that are outside the bounds of the character encoding scheme.
83 * @remarks This method is used for encoding. @n
84 * It encodes input string into an
85 * application/x-www-form-urlencoded format using a specific encoding scheme. @n
86 * This method uses the specified encoding scheme to obtain the bytes for unsafe characters.
89 static result Encode(const Tizen::Base::String& str, const Tizen::Base::String& encodingScheme, Tizen::Base::String& encodedStr);
93 * This default constructor is intentionally declared as private so that only the platform can create an instance.
98 * This destructor is intentionally declared as private so that only the platform can delete an instance.
100 virtual ~UrlEncoder(void);
103 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
105 * @param[in] rhs An instance of %UrlEncoder
107 UrlEncoder(const UrlEncoder& rhs);
110 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
112 * @param[in] rhs An instance of %UrlEncoder
114 UrlEncoder& operator =(const UrlEncoder& rhs);
117 }}} // Tizen::Base::Utility
118 #endif // _FBASE_UTIL_URL_ENCODER_H_