zip_io.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**************************************************************************/
  2. /* zip_io.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef ZIP_IO_H
  31. #define ZIP_IO_H
  32. #include "core/io/file_access.h"
  33. // Not directly used in this header, but assumed available in downstream users
  34. // like platform/*/export/export.cpp. Could be fixed, but probably better to have
  35. // thirdparty includes in as little headers as possible.
  36. #include "thirdparty/minizip/unzip.h"
  37. #include "thirdparty/minizip/zip.h"
  38. // Get the current file info and safely convert the full filepath to a String.
  39. int godot_unzip_get_current_file_info(unzFile p_zip_file, unz_file_info64 &r_file_info, String &r_filepath);
  40. // Try to locate the file in the archive specified by the filepath (works with large paths and Unicode).
  41. int godot_unzip_locate_file(unzFile p_zip_file, const String &p_filepath, bool p_case_sensitive = true);
  42. //
  43. void *zipio_open(voidpf opaque, const char *p_fname, int mode);
  44. uLong zipio_read(voidpf opaque, voidpf stream, void *buf, uLong size);
  45. uLong zipio_write(voidpf opaque, voidpf stream, const void *buf, uLong size);
  46. long zipio_tell(voidpf opaque, voidpf stream);
  47. long zipio_seek(voidpf opaque, voidpf stream, uLong offset, int origin);
  48. int zipio_close(voidpf opaque, voidpf stream);
  49. int zipio_testerror(voidpf opaque, voidpf stream);
  50. voidpf zipio_alloc(voidpf opaque, uInt items, uInt size);
  51. void zipio_free(voidpf opaque, voidpf address);
  52. zlib_filefunc_def zipio_create_io(Ref<FileAccess> *p_data);
  53. #endif // ZIP_IO_H