PageRenderTime 320ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/cef1/include/capi/cef_zip_reader_capi.h

http://chromiumembedded.googlecode.com/
C++ Header | 148 lines | 32 code | 24 blank | 92 comment | 0 complexity | dfe775a5a607f18295bc2914d688afb3 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. // Copyright (c) 2013 Marshall A. Greenblatt. All rights reserved.
  2. //
  3. // Redistribution and use in source and binary forms, with or without
  4. // modification, are permitted provided that the following conditions are
  5. // met:
  6. //
  7. // * Redistributions of source code must retain the above copyright
  8. // notice, this list of conditions and the following disclaimer.
  9. // * Redistributions in binary form must reproduce the above
  10. // copyright notice, this list of conditions and the following disclaimer
  11. // in the documentation and/or other materials provided with the
  12. // distribution.
  13. // * Neither the name of Google Inc. nor the name Chromium Embedded
  14. // Framework nor the names of its contributors may be used to endorse
  15. // or promote products derived from this software without specific prior
  16. // written permission.
  17. //
  18. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. //
  30. // ---------------------------------------------------------------------------
  31. //
  32. // This file was generated by the CEF translator tool and should not edited
  33. // by hand. See the translator.README.txt file in the tools directory for
  34. // more information.
  35. //
  36. #ifndef CEF_INCLUDE_CAPI_CEF_ZIP_READER_CAPI_H_
  37. #define CEF_INCLUDE_CAPI_CEF_ZIP_READER_CAPI_H_
  38. #pragma once
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. #include "include/capi/cef_base_capi.h"
  43. ///
  44. // Structure that supports the reading of zip archives via the zlib unzip API.
  45. // The functions of this structure should only be called on the thread that
  46. // creates the object.
  47. ///
  48. typedef struct _cef_zip_reader_t {
  49. ///
  50. // Base structure.
  51. ///
  52. cef_base_t base;
  53. ///
  54. // Moves the cursor to the first file in the archive. Returns true (1) if the
  55. // cursor position was set successfully.
  56. ///
  57. int (CEF_CALLBACK *move_to_first_file)(struct _cef_zip_reader_t* self);
  58. ///
  59. // Moves the cursor to the next file in the archive. Returns true (1) if the
  60. // cursor position was set successfully.
  61. ///
  62. int (CEF_CALLBACK *move_to_next_file)(struct _cef_zip_reader_t* self);
  63. ///
  64. // Moves the cursor to the specified file in the archive. If |caseSensitive|
  65. // is true (1) then the search will be case sensitive. Returns true (1) if the
  66. // cursor position was set successfully.
  67. ///
  68. int (CEF_CALLBACK *move_to_file)(struct _cef_zip_reader_t* self,
  69. const cef_string_t* fileName, int caseSensitive);
  70. ///
  71. // Closes the archive. This should be called directly to ensure that cleanup
  72. // occurs on the correct thread.
  73. ///
  74. int (CEF_CALLBACK *close)(struct _cef_zip_reader_t* self);
  75. // The below functions act on the file at the current cursor position.
  76. ///
  77. // Returns the name of the file.
  78. ///
  79. // The resulting string must be freed by calling cef_string_userfree_free().
  80. cef_string_userfree_t (CEF_CALLBACK *get_file_name)(
  81. struct _cef_zip_reader_t* self);
  82. ///
  83. // Returns the uncompressed size of the file.
  84. ///
  85. int64 (CEF_CALLBACK *get_file_size)(struct _cef_zip_reader_t* self);
  86. ///
  87. // Returns the last modified timestamp for the file.
  88. ///
  89. time_t (CEF_CALLBACK *get_file_last_modified)(struct _cef_zip_reader_t* self);
  90. ///
  91. // Opens the file for reading of uncompressed data. A read password may
  92. // optionally be specified.
  93. ///
  94. int (CEF_CALLBACK *open_file)(struct _cef_zip_reader_t* self,
  95. const cef_string_t* password);
  96. ///
  97. // Closes the file.
  98. ///
  99. int (CEF_CALLBACK *close_file)(struct _cef_zip_reader_t* self);
  100. ///
  101. // Read uncompressed file contents into the specified buffer. Returns < 0 if
  102. // an error occurred, 0 if at the end of file, or the number of bytes read.
  103. ///
  104. int (CEF_CALLBACK *read_file)(struct _cef_zip_reader_t* self, void* buffer,
  105. size_t bufferSize);
  106. ///
  107. // Returns the current offset in the uncompressed file contents.
  108. ///
  109. int64 (CEF_CALLBACK *tell)(struct _cef_zip_reader_t* self);
  110. ///
  111. // Returns true (1) if at end of the file contents.
  112. ///
  113. int (CEF_CALLBACK *eof)(struct _cef_zip_reader_t* self);
  114. } cef_zip_reader_t;
  115. ///
  116. // Create a new cef_zip_reader_t object. The returned object's functions can
  117. // only be called from the thread that created the object.
  118. ///
  119. CEF_EXPORT cef_zip_reader_t* cef_zip_reader_create(
  120. struct _cef_stream_reader_t* stream);
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #endif // CEF_INCLUDE_CAPI_CEF_ZIP_READER_CAPI_H_