Modify Scanner class
[platform/framework/native/appfw.git] / inc / FBaseUtilInflator.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                FBaseUtilInflator.h
20  * @brief               This is the header file for the %Inflator class.
21  *
22  * This header file contains the declarations of the %Inflator class.
23  */
24 #ifndef _FBASE_UTIL_INFLATOR_H_
25 #define _FBASE_UTIL_INFLATOR_H_
26
27 #include <FBaseByteBuffer.h>
28 #include <FBaseUtilTypes.h>
29
30
31 namespace Tizen { namespace Base { namespace Utility
32 {
33 /**
34  * @class       Inflator
35  * @brief       This class provides the inflate functionality using zlib.
36  *
37  * @since 2.0
38  *
39  * The %Inflator class provides the inflate functionality using zlib.
40  *
41  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/utility_namespace.htm">Utility</a>.
42  *
43  * The following example demonstrates how to use the %Inflator class.
44  *
45  * @code
46  *
47  *      #include <FBase.h>
48  *
49  *      using namespace Tizen::Base;
50  *      using namespace Tizen::Base::Utility;
51  *
52  *      void
53  *      MyClass::InflatorSample(ByteBuffer &buf)
54  *      {
55  *              ByteBuffer* pBuf1 = null;
56  *              ByteBuffer* pBuf2 = null;
57  *
58  *              // Inflates the buf from the current position to limit of the buf
59  *              pBuf1 = Inflator::InflateN(buf);
60  *              if (null == pBuf1)
61  *              {
62  *                      // Error case handling...
63  *              }
64  *              // pBuf1 : Inflated Data of buf
65  *
66  *
67  *              // Inflates the buf from the current position to (limit-2) of the buf
68  *              pBuf2 = Inflator::InflateN(buf, (buf.GetLimit()-2));
69  *              if (null == pBuf2)
70  *              {
71  *                      // Error case handling...
72  *              }
73  *
74  *
75  *              delete pBuf1;
76  *              delete pBuf2;
77  *      }
78  *
79  * @endcode
80  */
81 class _OSP_EXPORT_ Inflator
82 {
83 public:
84         /**
85          * Inflates the number of bytes from the source byte buffer to the output byte buffer.
86          *
87          * @since 2.0
88          *
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
99          */
100         static ByteBuffer* InflateN(const ByteBuffer& src, int byteCount);
101
102         /**
103          * Inflates data from the source byte buffer to the output byte buffer.
104          *
105          * @since 2.0
106          *
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
116          */
117         static ByteBuffer* InflateN(const ByteBuffer& src);
118
119 private:
120         static ByteBuffer* __InflateN(const ByteBuffer& src, int byteCount);
121
122         /**
123          * This default constructor is intentionally declared as private because this class cannot be constructed.
124          */
125         Inflator(void);
126
127         /**
128          * This destructor is intentionally declared as private because this class cannot be constructed.
129          */
130         ~Inflator(void);
131
132         /**
133          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
134          *
135          * @param[in]   rhs     An instance of %Inflator
136          */
137         Inflator(const Inflator& rhs);
138
139         /**
140          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
141          *
142          * @param[in]   rhs     An instance of %Inflator
143          */
144         Inflator& operator =(const Inflator& rhs);
145
146 }; // Inflator
147
148 }}} // Tizen::Base::Utility
149
150 #endif // _FBASE_UTIL_INFLATOR_H_