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 FBaseUtilInflator.h
20 * @brief This is the header file for the %Inflator class.
22 * This header file contains the declarations of the %Inflator class.
24 #ifndef _FBASE_UTIL_INFLATOR_H_
25 #define _FBASE_UTIL_INFLATOR_H_
27 #include <FBaseByteBuffer.h>
28 #include <FBaseUtilTypes.h>
31 namespace Tizen { namespace Base { namespace Utility
35 * @brief This class provides the inflate functionality using zlib.
39 * The %Inflator class provides the inflate functionality using zlib.
41 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/utility_namespace.htm">Utility</a>.
43 * The following example demonstrates how to use the %Inflator class.
49 * using namespace Tizen::Base;
50 * using namespace Tizen::Base::Utility;
53 * MyClass::InflatorSample(ByteBuffer &buf)
55 * ByteBuffer* pBuf1 = null;
56 * ByteBuffer* pBuf2 = null;
58 * // Inflates the buf from the current position to limit of the buf
59 * pBuf1 = Inflator::InflateN(buf);
62 * // Error case handling...
64 * // pBuf1 : Inflated Data of buf
67 * // Inflates the buf from the current position to (limit-2) of the buf
68 * pBuf2 = Inflator::InflateN(buf, (buf.GetLimit()-2));
71 * // Error case handling...
81 class _OSP_EXPORT_ Inflator
85 * Inflates the number of bytes from the source byte buffer to the output byte buffer.
89 * @return A pointer to the ByteBuffer instance with the inflated equivalent of the source buffer @n
90 * The buffer's limit is the length of the inflated data, @n
91 * else @c null if an exception occurs.
92 * @param[in] src The buffer to inflate
93 * @param[in] byteCount The number of bytes to inflate from the source buffer
94 * @exception E_SUCCESS The method is successful.
95 * @exception E_INVALID_ARG A specified input parameter is invalid.
96 * @exception E_SYSTEM A system error has occurred.
97 * @remarks The specific error code can be accessed using the GetLastResult() method.
98 * @see Tizen::Base::Utility::Deflator
100 static ByteBuffer* InflateN(const ByteBuffer& src, int byteCount);
103 * Inflates data from the source byte buffer to the output byte buffer.
107 * @return A pointer to the ByteBuffer instance with the inflated equivalent of the source buffer @n
108 * The buffer's limit is the length of the inflated data, @n
109 * else @c null if an exception occurs.
110 * @param[in] src The buffer to inflate
111 * @exception E_SUCCESS The method is successful.
112 * @exception E_INVALID_ARG The specified input parameter is invalid.
113 * @exception E_SYSTEM A system error has occurred.
114 * @remarks The specific error code can be accessed using the GetLastResult() method.
115 * @see Tizen::Base::Utility::Deflator
117 static ByteBuffer* InflateN(const ByteBuffer& src);
120 static ByteBuffer* __InflateN(const ByteBuffer& src, int byteCount);
123 * This default constructor is intentionally declared as private because this class cannot be constructed.
128 * This destructor is intentionally declared as private because this class cannot be constructed.
133 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
135 * @param[in] rhs An instance of %Inflator
137 Inflator(const Inflator& rhs);
140 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
142 * @param[in] rhs An instance of %Inflator
144 Inflator& operator =(const Inflator& rhs);
148 }}} // Tizen::Base::Utility
150 #endif // _FBASE_UTIL_INFLATOR_H_