summaryrefslogtreecommitdiff
path: root/utils/rbutilqt/quazip/quazip.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rbutilqt/quazip/quazip.h')
-rw-r--r--utils/rbutilqt/quazip/quazip.h611
1 files changed, 611 insertions, 0 deletions
diff --git a/utils/rbutilqt/quazip/quazip.h b/utils/rbutilqt/quazip/quazip.h
new file mode 100644
index 0000000000..8ff0756254
--- /dev/null
+++ b/utils/rbutilqt/quazip/quazip.h
@@ -0,0 +1,611 @@
1#ifndef QUA_ZIP_H
2#define QUA_ZIP_H
3
4/*
5Copyright (C) 2005-2014 Sergey A. Tachenov
6
7This file is part of QuaZIP.
8
9QuaZIP is free software: you can redistribute it and/or modify
10it under the terms of the GNU Lesser General Public License as published by
11the Free Software Foundation, either version 2.1 of the License, or
12(at your option) any later version.
13
14QuaZIP is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License
20along with QuaZIP. If not, see <http://www.gnu.org/licenses/>.
21
22See COPYING file for the full LGPL text.
23
24Original ZIP package is copyrighted by Gilles Vollant, see
25quazip/(un)zip.h files for details, basically it's zlib license.
26 **/
27
28#include <QtCore/QString>
29#include <QtCore/QStringList>
30#include <QTextCodec>
31
32#include "zip.h"
33#include "unzip.h"
34
35#include "quazip_global.h"
36#include "quazipfileinfo.h"
37
38// just in case it will be defined in the later versions of the ZIP/UNZIP
39#ifndef UNZ_OPENERROR
40// define additional error code
41#define UNZ_OPENERROR -1000
42#endif
43
44class QuaZipPrivate;
45
46/// ZIP archive.
47/** \class QuaZip quazip.h <quazip/quazip.h>
48 * This class implements basic interface to the ZIP archive. It can be
49 * used to read table contents of the ZIP archive and retreiving
50 * information about the files inside it.
51 *
52 * You can also use this class to open files inside archive by passing
53 * pointer to the instance of this class to the constructor of the
54 * QuaZipFile class. But see QuaZipFile::QuaZipFile(QuaZip*, QObject*)
55 * for the possible pitfalls.
56 *
57 * This class is indended to provide interface to the ZIP subpackage of
58 * the ZIP/UNZIP package as well as to the UNZIP subpackage. But
59 * currently it supports only UNZIP.
60 *
61 * The use of this class is simple - just create instance using
62 * constructor, then set ZIP archive file name using setFile() function
63 * (if you did not passed the name to the constructor), then open() and
64 * then use different functions to work with it! Well, if you are
65 * paranoid, you may also wish to call close before destructing the
66 * instance, to check for errors on close.
67 *
68 * You may also use getUnzFile() and getZipFile() functions to get the
69 * ZIP archive handle and use it with ZIP/UNZIP package API directly.
70 *
71 * This class supports localized file names inside ZIP archive, but you
72 * have to set up proper codec with setCodec() function. By default,
73 * locale codec will be used, which is probably ok for UNIX systems, but
74 * will almost certainly fail with ZIP archives created in Windows. This
75 * is because Windows ZIP programs have strange habit of using DOS
76 * encoding for file names in ZIP archives. For example, ZIP archive
77 * with cyrillic names created in Windows will have file names in \c
78 * IBM866 encoding instead of \c WINDOWS-1251. I think that calling one
79 * function is not much trouble, but for true platform independency it
80 * would be nice to have some mechanism for file name encoding auto
81 * detection using locale information. Does anyone know a good way to do
82 * it?
83 **/
84class QUAZIP_EXPORT QuaZip {
85 friend class QuaZipPrivate;
86 public:
87 /// Useful constants.
88 enum Constants {
89 MAX_FILE_NAME_LENGTH=256 /**< Maximum file name length. Taken from
90 \c UNZ_MAXFILENAMEINZIP constant in
91 unzip.c. */
92 };
93 /// Open mode of the ZIP file.
94 enum Mode {
95 mdNotOpen, ///< ZIP file is not open. This is the initial mode.
96 mdUnzip, ///< ZIP file is open for reading files inside it.
97 mdCreate, ///< ZIP file was created with open() call.
98 mdAppend, /**< ZIP file was opened in append mode. This refers to
99 * \c APPEND_STATUS_CREATEAFTER mode in ZIP/UNZIP package
100 * and means that zip is appended to some existing file
101 * what is useful when that file contains
102 * self-extractor code. This is obviously \em not what
103 * you whant to use to add files to the existing ZIP
104 * archive.
105 **/
106 mdAdd ///< ZIP file was opened for adding files in the archive.
107 };
108 /// Case sensitivity for the file names.
109 /** This is what you specify when accessing files in the archive.
110 * Works perfectly fine with any characters thanks to Qt's great
111 * unicode support. This is different from ZIP/UNZIP API, where
112 * only US-ASCII characters was supported.
113 **/
114 enum CaseSensitivity {
115 csDefault=0, ///< Default for platform. Case sensitive for UNIX, not for Windows.
116 csSensitive=1, ///< Case sensitive.
117 csInsensitive=2 ///< Case insensitive.
118 };
119 /// Returns the actual case sensitivity for the specified QuaZIP one.
120 /**
121 \param cs The value to convert.
122 \returns If CaseSensitivity::csDefault, then returns the default
123 file name case sensitivity for the platform. Otherwise, just
124 returns the appropriate value from the Qt::CaseSensitivity enum.
125 */
126 static Qt::CaseSensitivity convertCaseSensitivity(
127 CaseSensitivity cs);
128 private:
129 QuaZipPrivate *p;
130 // not (and will not be) implemented
131 QuaZip(const QuaZip& that);
132 // not (and will not be) implemented
133 QuaZip& operator=(const QuaZip& that);
134 public:
135 /// Constructs QuaZip object.
136 /** Call setName() before opening constructed object. */
137 QuaZip();
138 /// Constructs QuaZip object associated with ZIP file \a zipName.
139 QuaZip(const QString& zipName);
140 /// Constructs QuaZip object associated with ZIP file represented by \a ioDevice.
141 /** The IO device must be seekable, otherwise an error will occur when opening. */
142 QuaZip(QIODevice *ioDevice);
143 /// Destroys QuaZip object.
144 /** Calls close() if necessary. */
145 ~QuaZip();
146 /// Opens ZIP file.
147 /**
148 * Argument \a mode specifies open mode of the ZIP archive. See Mode
149 * for details. Note that there is zipOpen2() function in the
150 * ZIP/UNZIP API which accepts \a globalcomment argument, but it
151 * does not use it anywhere, so this open() function does not have this
152 * argument. See setComment() if you need to set global comment.
153 *
154 * If the ZIP file is accessed via explicitly set QIODevice, then
155 * this device is opened in the necessary mode. If the device was
156 * already opened by some other means, then QuaZIP checks if the
157 * open mode is compatible to the mode needed for the requested operation.
158 * If necessary, seeking is performed to position the device properly.
159 *
160 * \return \c true if successful, \c false otherwise.
161 *
162 * \note ZIP/UNZIP API open calls do not return error code - they
163 * just return \c NULL indicating an error. But to make things
164 * easier, quazip.h header defines additional error code \c
165 * UNZ_ERROROPEN and getZipError() will return it if the open call
166 * of the ZIP/UNZIP API returns \c NULL.
167 *
168 * Argument \a ioApi specifies IO function set for ZIP/UNZIP
169 * package to use. See unzip.h, zip.h and ioapi.h for details. Note
170 * that IO API for QuaZip is different from the original package.
171 * The file path argument was changed to be of type \c voidpf, and
172 * QuaZip passes a QIODevice pointer there. This QIODevice is either
173 * set explicitly via setIoDevice() or the QuaZip(QIODevice*)
174 * constructor, or it is created internally when opening the archive
175 * by its file name. The default API (qioapi.cpp) just delegates
176 * everything to the QIODevice API. Not only this allows to use a
177 * QIODevice instead of file name, but also has a nice side effect
178 * of raising the file size limit from 2G to 4G (in non-zip64 archives).
179 *
180 * \note If the zip64 support is needed, the ioApi argument \em must be NULL
181 * because due to the backwards compatibility issues it can be used to
182 * provide a 32-bit API only.
183 *
184 * \note If the \ref QuaZip::setAutoClose() "no-auto-close" feature is used,
185 * then the \a ioApi argument \em should be NULL because the old API
186 * doesn't support the 'fake close' operation, causing slight memory leaks
187 * and other possible troubles (like closing the output device in case
188 * when an error occurs during opening).
189 *
190 * In short: just forget about the \a ioApi argument and you'll be
191 * fine.
192 **/
193 bool open(Mode mode, zlib_filefunc_def *ioApi =NULL);
194 /// Closes ZIP file.
195 /** Call getZipError() to determine if the close was successful.
196 *
197 * If the file was opened by name, then the underlying QIODevice is closed
198 * and deleted.
199 *
200 * If the underlying QIODevice was set explicitly using setIoDevice() or
201 * the appropriate constructor, then it is closed if the auto-close flag
202 * is set (which it is by default). Call setAutoClose() to clear the
203 * auto-close flag if this behavior is undesirable.
204 *
205 * Since Qt 5.1, the QSaveFile was introduced. It breaks the QIODevice API
206 * by making close() private and crashing the application if it is called
207 * from the base class where it is public. It is an excellent example
208 * of poor design that illustrates why you should never ever break
209 * an is-a relationship between the base class and a subclass. QuaZIP
210 * works around this bug by checking if the QIODevice is an instance
211 * of QSaveFile, using qobject_cast<>, and if it is, calls
212 * QSaveFile::commit() instead of close(). It is a really ugly hack,
213 * but at least it makes your programs work instead of crashing. Note that
214 * if the auto-close flag is cleared, then this is a non-issue, and
215 * commit() isn't called.
216 */
217 void close();
218 /// Sets the codec used to encode/decode file names inside archive.
219 /** This is necessary to access files in the ZIP archive created
220 * under Windows with non-latin characters in file names. For
221 * example, file names with cyrillic letters will be in \c IBM866
222 * encoding.
223 **/
224 void setFileNameCodec(QTextCodec *fileNameCodec);
225 /// Sets the codec used to encode/decode file names inside archive.
226 /** \overload
227 * Equivalent to calling setFileNameCodec(QTextCodec::codecForName(codecName));
228 **/
229 void setFileNameCodec(const char *fileNameCodecName);
230 /// Sets the OS code (highest 8 bits of the “version made by” field) for new files.
231 /** There is currently no way to specify this for each file individually,
232 except by calling this function before opening each file. If this function is not called,
233 then the default OS code will be used. The default code is set by calling
234 setDefaultOsCode(). The default value at the moment of QuaZip creation will be used. */
235 void setOsCode(uint osCode);
236 /// Returns the OS code for new files.
237 uint getOsCode() const;
238 /// Returns the codec used to encode/decode comments inside archive.
239 QTextCodec* getFileNameCodec() const;
240 /// Sets the codec used to encode/decode comments inside archive.
241 /** This codec defaults to locale codec, which is probably ok.
242 **/
243 void setCommentCodec(QTextCodec *commentCodec);
244 /// Sets the codec used to encode/decode comments inside archive.
245 /** \overload
246 * Equivalent to calling setCommentCodec(QTextCodec::codecForName(codecName));
247 **/
248 void setCommentCodec(const char *commentCodecName);
249 /// Returns the codec used to encode/decode comments inside archive.
250 QTextCodec* getCommentCodec() const;
251 /// Returns the name of the ZIP file.
252 /** Returns null string if no ZIP file name has been set, for
253 * example when the QuaZip instance is set up to use a QIODevice
254 * instead.
255 * \sa setZipName(), setIoDevice(), getIoDevice()
256 **/
257 QString getZipName() const;
258 /// Sets the name of the ZIP file.
259 /** Does nothing if the ZIP file is open.
260 *
261 * Does not reset error code returned by getZipError().
262 * \sa setIoDevice(), getIoDevice(), getZipName()
263 **/
264 void setZipName(const QString& zipName);
265 /// Returns the device representing this ZIP file.
266 /** Returns null string if no device has been set explicitly, for
267 * example when opening a ZIP file by name.
268 * \sa setIoDevice(), getZipName(), setZipName()
269 **/
270 QIODevice *getIoDevice() const;
271 /// Sets the device representing the ZIP file.
272 /** Does nothing if the ZIP file is open.
273 *
274 * Does not reset error code returned by getZipError().
275 * \sa getIoDevice(), getZipName(), setZipName()
276 **/
277 void setIoDevice(QIODevice *ioDevice);
278 /// Returns the mode in which ZIP file was opened.
279 Mode getMode() const;
280 /// Returns \c true if ZIP file is open, \c false otherwise.
281 bool isOpen() const;
282 /// Returns the error code of the last operation.
283 /** Returns \c UNZ_OK if the last operation was successful.
284 *
285 * Error code resets to \c UNZ_OK every time you call any function
286 * that accesses something inside ZIP archive, even if it is \c
287 * const (like getEntriesCount()). open() and close() calls reset
288 * error code too. See documentation for the specific functions for
289 * details on error detection.
290 **/
291 int getZipError() const;
292 /// Returns number of the entries in the ZIP central directory.
293 /** Returns negative error code in the case of error. The same error
294 * code will be returned by subsequent getZipError() call.
295 **/
296 int getEntriesCount() const;
297 /// Returns global comment in the ZIP file.
298 QString getComment() const;
299 /// Sets the global comment in the ZIP file.
300 /** The comment will be written to the archive on close operation.
301 * QuaZip makes a distinction between a null QByteArray() comment
302 * and an empty &quot;&quot; comment in the QuaZip::mdAdd mode.
303 * A null comment is the default and it means &quot;don't change
304 * the comment&quot;. An empty comment removes the original comment.
305 *
306 * \sa open()
307 **/
308 void setComment(const QString& comment);
309 /// Sets the current file to the first file in the archive.
310 /** Returns \c true on success, \c false otherwise. Call
311 * getZipError() to get the error code.
312 **/
313 bool goToFirstFile();
314 /// Sets the current file to the next file in the archive.
315 /** Returns \c true on success, \c false otherwise. Call
316 * getZipError() to determine if there was an error.
317 *
318 * Should be used only in QuaZip::mdUnzip mode.
319 *
320 * \note If the end of file was reached, getZipError() will return
321 * \c UNZ_OK instead of \c UNZ_END_OF_LIST_OF_FILE. This is to make
322 * things like this easier:
323 * \code
324 * for(bool more=zip.goToFirstFile(); more; more=zip.goToNextFile()) {
325 * // do something
326 * }
327 * if(zip.getZipError()==UNZ_OK) {
328 * // ok, there was no error
329 * }
330 * \endcode
331 **/
332 bool goToNextFile();
333 /// Sets current file by its name.
334 /** Returns \c true if successful, \c false otherwise. Argument \a
335 * cs specifies case sensitivity of the file name. Call
336 * getZipError() in the case of a failure to get error code.
337 *
338 * This is not a wrapper to unzLocateFile() function. That is
339 * because I had to implement locale-specific case-insensitive
340 * comparison.
341 *
342 * Here are the differences from the original implementation:
343 *
344 * - If the file was not found, error code is \c UNZ_OK, not \c
345 * UNZ_END_OF_LIST_OF_FILE (see also goToNextFile()).
346 * - If this function fails, it unsets the current file rather than
347 * resetting it back to what it was before the call.
348 *
349 * If \a fileName is null string then this function unsets the
350 * current file and return \c true. Note that you should close the
351 * file first if it is open! See
352 * QuaZipFile::QuaZipFile(QuaZip*,QObject*) for the details.
353 *
354 * Should be used only in QuaZip::mdUnzip mode.
355 *
356 * \sa setFileNameCodec(), CaseSensitivity
357 **/
358 bool setCurrentFile(const QString& fileName, CaseSensitivity cs =csDefault);
359 /// Returns \c true if the current file has been set.
360 bool hasCurrentFile() const;
361 /// Retrieves information about the current file.
362 /** Fills the structure pointed by \a info. Returns \c true on
363 * success, \c false otherwise. In the latter case structure pointed
364 * by \a info remains untouched. If there was an error,
365 * getZipError() returns error code.
366 *
367 * Should be used only in QuaZip::mdUnzip mode.
368 *
369 * Does nothing and returns \c false in any of the following cases.
370 * - ZIP is not open;
371 * - ZIP does not have current file.
372 *
373 * In both cases getZipError() returns \c UNZ_OK since there
374 * is no ZIP/UNZIP API call.
375 *
376 * This overload doesn't support zip64, but will work OK on zip64 archives
377 * except that if one of the sizes (compressed or uncompressed) is greater
378 * than 0xFFFFFFFFu, it will be set to exactly 0xFFFFFFFFu.
379 *
380 * \sa getCurrentFileInfo(QuaZipFileInfo64* info)const
381 * \sa QuaZipFileInfo64::toQuaZipFileInfo(QuaZipFileInfo&)const
382 **/
383 bool getCurrentFileInfo(QuaZipFileInfo* info)const;
384 /// Retrieves information about the current file.
385 /** \overload
386 *
387 * This function supports zip64. If the archive doesn't use zip64, it is
388 * completely equivalent to getCurrentFileInfo(QuaZipFileInfo* info)
389 * except for the argument type.
390 *
391 * \sa
392 **/
393 bool getCurrentFileInfo(QuaZipFileInfo64* info)const;
394 /// Returns the current file name.
395 /** Equivalent to calling getCurrentFileInfo() and then getting \c
396 * name field of the QuaZipFileInfo structure, but faster and more
397 * convenient.
398 *
399 * Should be used only in QuaZip::mdUnzip mode.
400 **/
401 QString getCurrentFileName()const;
402 /// Returns \c unzFile handle.
403 /** You can use this handle to directly call UNZIP part of the
404 * ZIP/UNZIP package functions (see unzip.h).
405 *
406 * \warning When using the handle returned by this function, please
407 * keep in mind that QuaZip class is unable to detect any changes
408 * you make in the ZIP file state (e. g. changing current file, or
409 * closing the handle). So please do not do anything with this
410 * handle that is possible to do with the functions of this class.
411 * Or at least return the handle in the original state before
412 * calling some another function of this class (including implicit
413 * destructor calls and calls from the QuaZipFile objects that refer
414 * to this QuaZip instance!). So if you have changed the current
415 * file in the ZIP archive - then change it back or you may
416 * experience some strange behavior or even crashes.
417 **/
418 unzFile getUnzFile();
419 /// Returns \c zipFile handle.
420 /** You can use this handle to directly call ZIP part of the
421 * ZIP/UNZIP package functions (see zip.h). Warnings about the
422 * getUnzFile() function also apply to this function.
423 **/
424 zipFile getZipFile();
425 /// Changes the data descriptor writing mode.
426 /**
427 According to the ZIP format specification, a file inside archive
428 may have a data descriptor immediately following the file
429 data. This is reflected by a special flag in the local file header
430 and in the central directory. By default, QuaZIP sets this flag
431 and writes the data descriptor unless both method and level were
432 set to 0, in which case it operates in 1.0-compatible mode and
433 never writes data descriptors.
434
435 By setting this flag to false, it is possible to disable data
436 descriptor writing, thus increasing compatibility with archive
437 readers that don't understand this feature of the ZIP file format.
438
439 Setting this flag affects all the QuaZipFile instances that are
440 opened after this flag is set.
441
442 The data descriptor writing mode is enabled by default.
443
444 Note that if the ZIP archive is written into a QIODevice for which
445 QIODevice::isSequential() returns \c true, then the data descriptor
446 is mandatory and will be written even if this flag is set to false.
447
448 \param enabled If \c true, enable local descriptor writing,
449 disable it otherwise.
450
451 \sa QuaZipFile::isDataDescriptorWritingEnabled()
452 */
453 void setDataDescriptorWritingEnabled(bool enabled);
454 /// Returns the data descriptor default writing mode.
455 /**
456 \sa setDataDescriptorWritingEnabled()
457 */
458 bool isDataDescriptorWritingEnabled() const;
459 /// Returns a list of files inside the archive.
460 /**
461 \return A list of file names or an empty list if there
462 was an error or if the archive is empty (call getZipError() to
463 figure out which).
464 \sa getFileInfoList()
465 */
466 QStringList getFileNameList() const;
467 /// Returns information list about all files inside the archive.
468 /**
469 \return A list of QuaZipFileInfo objects or an empty list if there
470 was an error or if the archive is empty (call getZipError() to
471 figure out which).
472
473 This function doesn't support zip64, but will still work with zip64
474 archives, converting results using QuaZipFileInfo64::toQuaZipFileInfo().
475 If all file sizes are below 4 GB, it will work just fine.
476
477 \sa getFileNameList()
478 \sa getFileInfoList64()
479 */
480 QList<QuaZipFileInfo> getFileInfoList() const;
481 /// Returns information list about all files inside the archive.
482 /**
483 \overload
484
485 This function supports zip64.
486
487 \sa getFileNameList()
488 \sa getFileInfoList()
489 */
490 QList<QuaZipFileInfo64> getFileInfoList64() const;
491 /// Enables the zip64 mode.
492 /**
493 * @param zip64 If \c true, the zip64 mode is enabled, disabled otherwise.
494 *
495 * Once this is enabled, all new files (until the mode is disabled again)
496 * will be created in the zip64 mode, thus enabling the ability to write
497 * files larger than 4 GB. By default, the zip64 mode is off due to
498 * compatibility reasons.
499 *
500 * Note that this does not affect the ability to read zip64 archives in any
501 * way.
502 *
503 * \sa isZip64Enabled()
504 */
505 void setZip64Enabled(bool zip64);
506 /// Returns whether the zip64 mode is enabled.
507 /**
508 * @return \c true if and only if the zip64 mode is enabled.
509 *
510 * \sa setZip64Enabled()
511 */
512 bool isZip64Enabled() const;
513 /// Enables the use of UTF-8 encoding for file names and comments text.
514 /**
515 * @param utf8 If \c true, the UTF-8 mode is enabled, disabled otherwise.
516 *
517 * Once this is enabled, the names of all new files and comments text (until
518 * the mode is disabled again) will be encoded in UTF-8 encoding, and the
519 * version to extract will be set to 6.3 (63) in ZIP header. By default,
520 * the UTF-8 mode is off due to compatibility reasons.
521 *
522 * Note that when extracting ZIP archives, the UTF-8 mode is determined from
523 * ZIP file header, not from this flag.
524 *
525 * \sa isUtf8Enabled()
526 */
527 void setUtf8Enabled(bool utf8);
528 /// Returns whether the UTF-8 encoding mode is enabled.
529 /**
530 * @return \c true if and only if the UTF-8 mode is enabled.
531 *
532 * \sa setUtf8Enabled()
533 */
534 bool isUtf8Enabled() const;
535 /// Returns the auto-close flag.
536 /**
537 @sa setAutoClose()
538 */
539 bool isAutoClose() const;
540 /// Sets or unsets the auto-close flag.
541 /**
542 By default, QuaZIP opens the underlying QIODevice when open() is called,
543 and closes it when close() is called. In some cases, when the device
544 is set explicitly using setIoDevice(), it may be desirable to
545 leave the device open. If the auto-close flag is unset using this method,
546 then the device isn't closed automatically if it was set explicitly.
547
548 If it is needed to clear this flag, it is recommended to do so before
549 opening the archive because otherwise QuaZIP may close the device
550 during the open() call if an error is encountered after the device
551 is opened.
552
553 If the device was not set explicitly, but rather the setZipName() or
554 the appropriate constructor was used to set the ZIP file name instead,
555 then the auto-close flag has no effect, and the internal device
556 is closed nevertheless because there is no other way to close it.
557
558 @sa isAutoClose()
559 @sa setIoDevice()
560 */
561 void setAutoClose(bool autoClose) const;
562 /// Sets the default file name codec to use.
563 /**
564 * The default codec is used by the constructors, so calling this function
565 * won't affect the QuaZip instances already created at that moment.
566 *
567 * The codec specified here can be overriden by calling setFileNameCodec().
568 * If neither function is called, QTextCodec::codecForLocale() will be used
569 * to decode or encode file names. Use this function with caution if
570 * the application uses other libraries that depend on QuaZIP. Those
571 * libraries can either call this function by themselves, thus overriding
572 * your setting or can rely on the default encoding, thus failing
573 * mysteriously if you change it. For these reasons, it isn't recommended
574 * to use this function if you are developing a library, not an application.
575 * Instead, ask your library users to call it in case they need specific
576 * encoding.
577 *
578 * In most cases, using setFileNameCodec() instead is the right choice.
579 * However, if you depend on third-party code that uses QuaZIP, then the
580 * reasons stated above can actually become a reason to use this function
581 * in case the third-party code in question fails because it doesn't
582 * understand the encoding you need and doesn't provide a way to specify it.
583 * This applies to the JlCompress class as well, as it was contributed and
584 * doesn't support explicit encoding parameters.
585 *
586 * In short: use setFileNameCodec() when you can, resort to
587 * setDefaultFileNameCodec() when you don't have access to the QuaZip
588 * instance.
589 *
590 * @param codec The codec to use by default. If NULL, resets to default.
591 */
592 static void setDefaultFileNameCodec(QTextCodec *codec);
593 /**
594 * @overload
595 * Equivalent to calling
596 * setDefaultFileNameCodec(QTextCodec::codecForName(codecName)).
597 */
598 static void setDefaultFileNameCodec(const char *codecName);
599 /// Sets default OS code.
600 /**
601 * @sa setOsCode()
602 */
603 static void setDefaultOsCode(uint osCode);
604 /// Returns default OS code.
605 /**
606 * @sa getOsCode()
607 */
608 static uint getDefaultOsCode();
609};
610
611#endif