1 // Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
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
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.
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.
30 // ---------------------------------------------------------------------------
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
37 #ifndef CEF_INCLUDE_CAPI_CEF_ZIP_READER_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_ZIP_READER_CAPI_H_
41 #include "include/capi/cef_base_capi.h"
42 #include "include/capi/cef_stream_capi.h"
50 // Structure that supports the reading of zip archives via the zlib unzip API.
51 // The functions of this structure should only be called on the thread that
52 // creates the object.
54 typedef struct _cef_zip_reader_t {
61 // Moves the cursor to the first file in the archive. Returns true (1) if the
62 // cursor position was set successfully.
64 int (CEF_CALLBACK *move_to_first_file)(struct _cef_zip_reader_t* self);
67 // Moves the cursor to the next file in the archive. Returns true (1) if the
68 // cursor position was set successfully.
70 int (CEF_CALLBACK *move_to_next_file)(struct _cef_zip_reader_t* self);
73 // Moves the cursor to the specified file in the archive. If |caseSensitive|
74 // is true (1) then the search will be case sensitive. Returns true (1) if the
75 // cursor position was set successfully.
77 int (CEF_CALLBACK *move_to_file)(struct _cef_zip_reader_t* self,
78 const cef_string_t* fileName, int caseSensitive);
81 // Closes the archive. This should be called directly to ensure that cleanup
82 // occurs on the correct thread.
84 int (CEF_CALLBACK *close)(struct _cef_zip_reader_t* self);
87 // The below functions act on the file at the current cursor position.
90 // Returns the name of the file.
92 // The resulting string must be freed by calling cef_string_userfree_free().
93 cef_string_userfree_t (CEF_CALLBACK *get_file_name)(
94 struct _cef_zip_reader_t* self);
97 // Returns the uncompressed size of the file.
99 int64 (CEF_CALLBACK *get_file_size)(struct _cef_zip_reader_t* self);
102 // Returns the last modified timestamp for the file.
104 time_t (CEF_CALLBACK *get_file_last_modified)(struct _cef_zip_reader_t* self);
107 // Opens the file for reading of uncompressed data. A read password may
108 // optionally be specified.
110 int (CEF_CALLBACK *open_file)(struct _cef_zip_reader_t* self,
111 const cef_string_t* password);
116 int (CEF_CALLBACK *close_file)(struct _cef_zip_reader_t* self);
119 // Read uncompressed file contents into the specified buffer. Returns < 0 if
120 // an error occurred, 0 if at the end of file, or the number of bytes read.
122 int (CEF_CALLBACK *read_file)(struct _cef_zip_reader_t* self, void* buffer,
126 // Returns the current offset in the uncompressed file contents.
128 int64 (CEF_CALLBACK *tell)(struct _cef_zip_reader_t* self);
131 // Returns true (1) if at end of the file contents.
133 int (CEF_CALLBACK *eof)(struct _cef_zip_reader_t* self);
138 // Create a new cef_zip_reader_t object. The returned object's functions can
139 // only be called from the thread that created the object.
141 CEF_EXPORT cef_zip_reader_t* cef_zip_reader_create(
142 struct _cef_stream_reader_t* stream);
149 #endif // CEF_INCLUDE_CAPI_CEF_ZIP_READER_CAPI_H_