1 /* PSPP - a program for statistical analysis.
2 Copyright (C) 2011, 2013 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #define ZIP_READER_H 1
25 /* Create zip reader to read the file called FILENAME.
26 If ERRS is non-null if will be used to contain any error messages
27 which the reader wishes to report.
29 struct zip_reader *zip_reader_create (const char *filename, struct string *errs);
31 /* Destroy the zip reader */
32 void zip_reader_destroy (struct zip_reader *zr);
34 /* Returns the name of ZR's member IDX, IDX >= 0. Returns NULL if ZR has fewer
35 than (IDX + 1) members. */
36 const char *zip_reader_get_member_name(const struct zip_reader *zr,
39 /* Returns true if ZR contains a member named MEMBER, false otherwise. */
40 bool zip_reader_contains_member (const struct zip_reader *zr,
43 /* Return the zip member in the reader ZR, called MEMBER */
44 struct zip_member *zip_member_open (struct zip_reader *zr, const char *member);
46 /* Read up to N bytes from ZM, storing them in BUF.
47 Returns the number of bytes read, or -1 on error */
48 int zip_member_read (struct zip_member *zm, void *buf, size_t n);
50 /* Read all of ZM into memory, storing the data in *DATAP and its size in *NP.
51 Returns NULL if successful, otherwise an error string that the caller
52 must eventually free(). */
53 char *zip_member_read_all (struct zip_reader *, const char *member_name,
54 void **datap, size_t *np) WARN_UNUSED_RESULT;
56 void zip_member_finish (struct zip_member *zm);