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 an input string using a specific 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. It encodes input string into an
84 * application/x-www-form-urlencoded format using a specific encoding scheme. This method uses the specified
85 * encoding scheme to obtain the bytes for unsafe characters.
88 static result Encode(const Tizen::Base::String& str, const Tizen::Base::String& encodingScheme, Tizen::Base::String& encodedStr);
92 * This default constructor is intentionally declared as private so that only the platform can create an instance.
97 * This destructor is intentionally declared as private so that only the platform can delete an instance.
99 virtual ~UrlEncoder(void);
102 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
104 * @param[in] rhs An instance of %UrlEncoder
106 UrlEncoder(const UrlEncoder& rhs);
109 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
111 * @param[in] rhs An instance of %UrlEncoder
113 UrlEncoder& operator =(const UrlEncoder& rhs);
116 }}} // Tizen::Base::Utility
117 #endif // _FBASE_UTIL_URL_ENCODER_H_