Fix N_SE-56436 for Screen lock.
[platform/framework/native/appfw.git] / inc / FBaseUtilInflator.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file                FBaseUtilInflator.h
19  * @brief               This is the header file for the %Inflator class.
20  *
21  * This header file contains the declarations of the %Inflator class.
22  */
23 #ifndef _FBASE_UTIL_INFLATOR_H_
24 #define _FBASE_UTIL_INFLATOR_H_
25
26 #include <FBaseByteBuffer.h>
27 #include <FBaseUtilTypes.h>
28
29
30 namespace Tizen { namespace Base { namespace Utility
31 {
32 /**
33  * @class       Inflator
34  * @brief       This class provides the inflate functionality using zlib.
35  *
36  * @since 2.0
37  *
38  * The %Inflator class provides the inflate functionality using zlib.
39  *
40  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/utility_namespace.htm">Utility</a>.
41  *
42  * The following example demonstrates how to use the %Inflator class.
43  *
44  * @code
45  *
46  *      #include <FBase.h>
47  *
48  *      using namespace Tizen::Base;
49  *      using namespace Tizen::Base::Utility;
50  *
51  *      void
52  *      MyClass::InflatorSample(ByteBuffer &buf)
53  *      {
54  *              ByteBuffer* pBuf1 = null;
55  *              ByteBuffer* pBuf2 = null;
56  *
57  *              // Inflates the buf from the current position to limit of the buf
58  *              pBuf1 = Inflator::InflateN(buf);
59  *              if (null == pBuf1)
60  *              {
61  *                      // Error case handling...
62  *              }
63  *              // pBuf1 : Inflated Data of buf
64  *
65  *
66  *              // Inflates the buf from the current position to (limit-2) of the buf
67  *              pBuf2 = Inflator::InflateN(buf, (buf.GetLimit()-2));
68  *              if (null == pBuf2)
69  *              {
70  *                      // Error case handling...
71  *              }
72  *
73  *
74  *              delete pBuf1;
75  *              delete pBuf2;
76  *      }
77  *
78  * @endcode
79  */
80 class _OSP_EXPORT_ Inflator
81 {
82 public:
83         /**
84          * Inflates the number of bytes from the source byte buffer to the output byte buffer.
85          *
86          * @since 2.0
87          *
88          * @return                      A pointer to the ByteBuffer instance with the inflated equivalent of the source buffer @n
89          *                                      The buffer's limit is the length of the inflated data, @n
90          *                                      else @c null if an exception occurs.
91          * @param[in]           src                             The buffer to inflate
92          * @param[in]           byteCount               The number of bytes to inflate from the source buffer
93          * @exception           E_SUCCESS               The method is successful.
94          * @exception           E_INVALID_ARG   A specified input parameter is invalid.
95          * @exception           E_SYSTEM                A system error has occurred.
96          * @remarks                     The specific error code can be accessed using the GetLastResult() method.
97          * @see                         Tizen::Base::Utility::Deflator
98          */
99         static ByteBuffer* InflateN(const ByteBuffer& src, int byteCount);
100
101         /**
102          * Inflates data from the source byte buffer to the output byte buffer.
103          *
104          * @since 2.0
105          *
106          * @return                      A pointer to the ByteBuffer instance with the inflated equivalent of the source buffer @n
107          *                                      The buffer's limit is the length of the inflated data, @n
108          *                                      else @c null if an exception occurs.
109          * @param[in]           src                             The buffer to inflate
110          * @exception           E_SUCCESS               The method is successful.
111          * @exception           E_INVALID_ARG   The specified input parameter is invalid.
112          * @exception           E_SYSTEM                A system error has occurred.
113          * @remarks                     The specific error code can be accessed using the GetLastResult() method.
114          * @see                         Tizen::Base::Utility::Deflator
115          */
116         static ByteBuffer* InflateN(const ByteBuffer& src);
117
118 private:
119         static ByteBuffer* __InflateN(const ByteBuffer& src, int byteCount);
120
121         /**
122          * This default constructor is intentionally declared as private because this class cannot be constructed.
123          */
124         Inflator(void);
125
126         /**
127          * This destructor is intentionally declared as private because this class cannot be constructed.
128          */
129         ~Inflator(void);
130
131         /**
132          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
133          *
134          * @param[in]   rhs     An instance of %Inflator
135          */
136         Inflator(const Inflator& rhs);
137
138         /**
139          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
140          *
141          * @param[in]   rhs     An instance of %Inflator
142          */
143         Inflator& operator =(const Inflator& rhs);
144
145 }; // Inflator
146
147 }}} // Tizen::Base::Utility
148
149 #endif // _FBASE_UTIL_INFLATOR_H_