2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FBaseUtilUrlEncoder.h
20 * @brief This is the header file for the %UrlEncoder class.
22 * This header file contains the declarations of the %UrlEncoder class.
25 #ifndef _FBASE_UTIL_URL_ENCODER_H_
26 #define _FBASE_UTIL_URL_ENCODER_H_
29 #include <FBaseString.h>
32 namespace Tizen { namespace Base { namespace Utility
36 * @brief This class provides a method for encoding a string using a specific encoding scheme.
40 * The %UrlEncoder class provides a method for encoding a string using a specific encoding scheme.
42 * 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>.
44 * The following example demonstrates how to use the %UrlEncoder class.
49 * using namespace Tizen::Base;
50 * using namespace Tizen::Base::Utility;
53 * MyClass::UrlEncoderSample(void)
55 * result r = E_SUCCESS;
56 * String str1(L"url encoding test?");
59 * // Encodes the input string
60 * r = UrlEncoder::Encode(str1, L"UTF-8", str2);
66 class _OSP_EXPORT_ UrlEncoder
70 * Encodes an input string using a specific encoding scheme. @n
71 * It encodes all unsafe characters of a string.
75 * @return An error code
76 * @param[in] str An instance of String to encode
77 * @param[in] encodingScheme The supported encoding scheme
78 * @param[out] encodedStr The encoded string
79 * @exception E_SUCCESS The method is successful.
80 * @exception E_INVALID_ARG A specified input parameter is invalid.
81 * @exception E_SYSTEM A system error has occurred.
82 * @exception E_UNSUPPORTED_TYPE The specified encoding scheme is not supported.
83 * @exception E_INVALID_ENCODING_RANGE The specified string contains code points that are outside the bounds of the character encoding scheme.
84 * @remarks This method is used for encoding. It encodes input string into an
85 * application/x-www-form-urlencoded format using a specific encoding scheme. This method uses the specified
86 * 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_