github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_zip_reader_capi.h (about) 1 // Copyright (c) 2014 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 37 #ifndef CEF_INCLUDE_CAPI_CEF_ZIP_READER_CAPI_H_ 38 #define CEF_INCLUDE_CAPI_CEF_ZIP_READER_CAPI_H_ 39 #pragma once 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 #include "include/capi/cef_base_capi.h" 46 #include "include/capi/cef_stream_capi.h" 47 48 49 /// 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. 53 /// 54 typedef struct _cef_zip_reader_t { 55 /// 56 // Base structure. 57 /// 58 cef_base_t base; 59 60 /// 61 // Moves the cursor to the first file in the archive. Returns true (1) if the 62 // cursor position was set successfully. 63 /// 64 int (CEF_CALLBACK *move_to_first_file)(struct _cef_zip_reader_t* self); 65 66 /// 67 // Moves the cursor to the next file in the archive. Returns true (1) if the 68 // cursor position was set successfully. 69 /// 70 int (CEF_CALLBACK *move_to_next_file)(struct _cef_zip_reader_t* self); 71 72 /// 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. 76 /// 77 int (CEF_CALLBACK *move_to_file)(struct _cef_zip_reader_t* self, 78 const cef_string_t* fileName, int caseSensitive); 79 80 /// 81 // Closes the archive. This should be called directly to ensure that cleanup 82 // occurs on the correct thread. 83 /// 84 int (CEF_CALLBACK *close)(struct _cef_zip_reader_t* self); 85 86 87 // The below functions act on the file at the current cursor position. 88 89 /// 90 // Returns the name of the file. 91 /// 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); 95 96 /// 97 // Returns the uncompressed size of the file. 98 /// 99 int64 (CEF_CALLBACK *get_file_size)(struct _cef_zip_reader_t* self); 100 101 /// 102 // Returns the last modified timestamp for the file. 103 /// 104 time_t (CEF_CALLBACK *get_file_last_modified)(struct _cef_zip_reader_t* self); 105 106 /// 107 // Opens the file for reading of uncompressed data. A read password may 108 // optionally be specified. 109 /// 110 int (CEF_CALLBACK *open_file)(struct _cef_zip_reader_t* self, 111 const cef_string_t* password); 112 113 /// 114 // Closes the file. 115 /// 116 int (CEF_CALLBACK *close_file)(struct _cef_zip_reader_t* self); 117 118 /// 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. 121 /// 122 int (CEF_CALLBACK *read_file)(struct _cef_zip_reader_t* self, void* buffer, 123 size_t bufferSize); 124 125 /// 126 // Returns the current offset in the uncompressed file contents. 127 /// 128 int64 (CEF_CALLBACK *tell)(struct _cef_zip_reader_t* self); 129 130 /// 131 // Returns true (1) if at end of the file contents. 132 /// 133 int (CEF_CALLBACK *eof)(struct _cef_zip_reader_t* self); 134 } cef_zip_reader_t; 135 136 137 /// 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. 140 /// 141 CEF_EXPORT cef_zip_reader_t* cef_zip_reader_create( 142 struct _cef_stream_reader_t* stream); 143 144 145 #ifdef __cplusplus 146 } 147 #endif 148 149 #endif // CEF_INCLUDE_CAPI_CEF_ZIP_READER_CAPI_H_