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 FBaseUtilZipEntry.h
20 * @brief This is the header file for the %ZipEntry class.
22 * This header file contains the declarations of the %ZipEntry class.
25 #ifndef _FBASE_UTIL_ZIP_ENTRY_H_
26 #define _FBASE_UTIL_ZIP_ENTRY_H_
28 #include <FBaseString.h>
29 #include <FBaseDateTime.h>
30 #include <FBaseUtilTypes.h>
34 namespace Tizen { namespace Base { namespace Utility
38 * @brief This class provides access to the entries of a zip-archive.
42 * The %ZipEntry class is used for accessing the elements of a zip-archive. Each instance of
43 * %ZipEntry represents a single entry in the zip-archive.
44 * It also stores the information related to that entry, such as name, compressed size,
45 * uncompressed size, compression level, and archive name.
47 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/utility_namespace.htm">Utility</a>.
49 * The following example demonstrates how to use the %ZipEntry class.
54 * using namespace Tizen::App;
55 * using namespace Tizen::Base;
56 * using namespace Tizen::Base::Utility;
59 * MyClass::FileZipSample(void)
62 * int i = 0, count = 0;
63 * unsigned long size = 0;
67 * String dataPath = App::GetInstance()->GetAppDataPath();
68 * unzip.Construct(dataPath + L"sample.zip");
70 * count = unzip.GetEntryCount();
72 * for (i = 0; i < count; i++)
74 * // Gets a ZipEntry from the zip-archive
75 * unzip.GetEntry(i, entry);
77 * // Gets an entry name associated with the ZipEntry
78 * str = entry.GetName();
80 * // Gets the name of the zip file which ZipEntry belongs to
81 * str = entry.GetArchiveName();
83 * // Gets the compressed size of ZipEntry
84 * size = entry.GetCompressedSize();
90 class _OSP_EXPORT_ ZipEntry
91 : public Tizen::Base::Object
95 * This is the default constructor for this class.
102 * This destructor overrides Tizen::Base::Object::~Object().
106 virtual ~ZipEntry(void);
109 * Gets an entry name associated with a zip entry. @n
110 * It can be a file or directory name.
114 * @return An entry name
117 String GetName(void) const;
120 * Gets the compression level associated with a zip entry.
124 * @return The compression level associated with a zip entry
127 CompressionLevel GetCompressionLevel(void) const;
130 * Checks whether a zip entry is a file or directory.
134 * @return @c true if the entry is a directory, @n
137 bool IsDirectory(void) const;
140 * Gets the compressed size of a zip entry.
144 * @return The compressed size of a zip entry
146 unsigned long GetCompressedSize(void) const;
149 * Gets the uncompressed size of a zip entry.
153 * @return The uncompressed size of a zip entry
155 unsigned long GetUncompressedSize(void) const;
158 * Gets the name of a zip file to which %ZipEntry belongs.
162 * @return The name of a zip file
163 * @remarks This method returns the name of a zip file that is opened
164 * in the FileUnzipper::Construct() method.
166 String GetArchiveName(void) const;
169 * Compares the specified instance to the calling instance.
173 * @return @c true if the specified instance equals the current instance, @n
175 * @param[in] obj The object to compare with the current instance
176 * @remarks This method returns @c true if all the attributes in the instance are same.
178 virtual bool Equals(const Tizen::Base::Object& obj) const;
181 * Gets the hash value of the current instance.
185 * @return The hash value of the current instance
187 virtual int GetHashCode(void) const;
192 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
196 * @param[in] entry The instance of the %ZipEntry class to copy from
197 * @remarks This constructor is hidden.
199 ZipEntry(const ZipEntry& entry);
202 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
206 * @param[in] entry An instance of %ZipEntry
207 * @remarks This operator is hidden.
209 ZipEntry& operator =(const ZipEntry& entry);
211 void Set(void* unzFile);
216 CompressionLevel __compressionLevel;
218 friend class _FileUnzipperImpl;
220 friend class _ZipEntryImpl;
221 class _ZipEntryImpl* __pZipEntryImpl;
225 }}} // Tizen::Base::Utility
227 #endif // _FBASE_UTIL_ZIP_ENTRY_H_