2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FBaseUtilZipEntry.h
19 * @brief This is the header file for the %ZipEntry class.
21 * This header file contains the declarations of the %ZipEntry class.
24 #ifndef _FBASE_UTIL_ZIP_ENTRY_H_
25 #define _FBASE_UTIL_ZIP_ENTRY_H_
27 #include <FBaseString.h>
28 #include <FBaseDateTime.h>
29 #include <FBaseUtilTypes.h>
33 namespace Tizen { namespace Base { namespace Utility
37 * @brief This class provides access to the entries of a zip-archive.
41 * The %ZipEntry class is used for accessing the elements of a zip-archive. Each instance of
42 * %ZipEntry represents a single entry in the zip-archive.
43 * It also stores the information related to that entry, such as name, compressed size,
44 * uncompressed size, compression level, and archive name.
46 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/utility_namespace.htm">Utility</a>.
48 * The following example demonstrates how to use the %ZipEntry class.
53 * using namespace Tizen::App;
54 * using namespace Tizen::Base;
55 * using namespace Tizen::Base::Utility;
58 * MyClass::FileZipSample(void)
61 * int i = 0, count = 0;
62 * unsigned long size = 0;
66 * String dataPath = App::GetInstance()->GetAppDataPath();
67 * unzip.Construct(dataPath + L"sample.zip");
69 * count = unzip.GetEntryCount();
71 * for (i = 0; i < count; i++)
73 * // Gets a ZipEntry from the zip-archive
74 * unzip.GetEntry(i, entry);
76 * // Gets an entry name associated with the ZipEntry
77 * str = entry.GetName();
79 * // Gets the name of the zip file which ZipEntry belongs to
80 * str = entry.GetArchiveName();
82 * // Gets the compressed size of ZipEntry
83 * size = entry.GetCompressedSize();
89 class _OSP_EXPORT_ ZipEntry
90 : public Tizen::Base::Object
94 * This is the default constructor for this class.
101 * This destructor overrides Tizen::Base::Object::~Object().
105 virtual ~ZipEntry(void);
108 * Gets an entry name associated with a zip entry. @n
109 * It can be a file or directory name.
113 * @return An entry name
116 String GetName(void) const;
119 * Gets the compression level associated with a zip entry.
123 * @return The compression level associated with a zip entry
126 CompressionLevel GetCompressionLevel(void) const;
129 * Checks whether a zip entry is a file or directory.
133 * @return @c true if the entry is a directory, @n
136 bool IsDirectory(void) const;
139 * Gets the compressed size of a zip entry.
143 * @return The compressed size of a zip entry
145 unsigned long GetCompressedSize(void) const;
148 * Gets the uncompressed size of a zip entry.
152 * @return The uncompressed size of a zip entry
154 unsigned long GetUncompressedSize(void) const;
157 * Gets the name of a zip file to which %ZipEntry belongs.
161 * @return The name of a zip file
162 * @remarks This method returns the name of a zip file that is opened
163 * in the FileUnzipper::Construct() method.
165 String GetArchiveName(void) const;
168 * Compares the specified instance to the calling instance.
172 * @return @c true if the specified instance equals the current instance, @n
174 * @param[in] obj The object to compare with the current instance
175 * @remarks This method returns @c true if all the attributes in the instance are same.
177 virtual bool Equals(const Tizen::Base::Object& obj) const;
180 * Gets the hash value of the current instance.
184 * @return The hash value of the current instance
186 virtual int GetHashCode(void) const;
191 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
195 * @param[in] entry The instance of the %ZipEntry class to copy from
196 * @remarks This constructor is hidden.
198 ZipEntry(const ZipEntry& entry);
201 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
205 * @param[in] entry An instance of %ZipEntry
206 * @remarks This operator is hidden.
208 ZipEntry& operator =(const ZipEntry& entry);
210 void Set(void* unzFile);
215 CompressionLevel __compressionLevel;
217 friend class _FileUnzipperImpl;
219 friend class _ZipEntryImpl;
220 class _ZipEntryImpl* __pZipEntryImpl;
224 }}} // Tizen::Base::Utility
226 #endif // _FBASE_UTIL_ZIP_ENTRY_H_