mupdf
Loading...
Searching...
No Matches
archive.h
Go to the documentation of this file.
1// Copyright (C) 2004-2024 Artifex Software, Inc.
2//
3// This file is part of MuPDF.
4//
5// MuPDF is free software: you can redistribute it and/or modify it under the
6// terms of the GNU Affero General Public License as published by the Free
7// Software Foundation, either version 3 of the License, or (at your option)
8// any later version.
9//
10// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
11// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13// details.
14//
15// You should have received a copy of the GNU Affero General Public License
16// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
17//
18// Alternative licensing terms are available from the licensor.
19// For commercial licensing, see <https://www.artifex.com/> or contact
20// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
21// CA 94129, USA, for further information.
22
23#ifndef MUPDF_FITZ_ARCHIVE_H
24#define MUPDF_FITZ_ARCHIVE_H
25
26#include "mupdf/fitz/system.h"
27#include "mupdf/fitz/context.h"
28#include "mupdf/fitz/buffer.h"
29#include "mupdf/fitz/stream.h"
30#include "mupdf/fitz/tree.h"
31
32/* PUBLIC API */
33
44
45typedef struct fz_archive fz_archive;
46
55fz_archive *fz_open_archive(fz_context *ctx, const char *filename);
56
64
73
86fz_archive *fz_open_directory(fz_context *ctx, const char *path);
87
88
95int fz_is_directory(fz_context *ctx, const char *path);
96
104
110
119const char *fz_archive_format(fz_context *ctx, fz_archive *arch);
120
130
141const char *fz_list_archive_entry(fz_context *ctx, fz_archive *arch, int idx);
142
152int fz_has_archive_entry(fz_context *ctx, fz_archive *arch, const char *name);
153
162fz_stream *fz_open_archive_entry(fz_context *ctx, fz_archive *arch, const char *name);
163
171
181fz_buffer *fz_read_archive_entry(fz_context *ctx, fz_archive *arch, const char *name);
182
194
198
205
212
219
229fz_archive *fz_open_tar_archive(fz_context *ctx, const char *filename);
230
242
252
262
271fz_archive *fz_open_cfb_archive(fz_context *ctx, const char *filename);
272
282
286
293
304
305
317
321fz_archive *fz_open_zip_archive_with_memory(fz_context *ctx, const unsigned char *data, size_t size);
322
328
330
337fz_zip_writer *fz_new_zip_writer(fz_context *ctx, const char *filename);
338
347
348
353void fz_write_zip_entry(fz_context *ctx, fz_zip_writer *zip, const char *name, fz_buffer *buf, int compress);
354
362
370
378
385void fz_tree_archive_add_buffer(fz_context *ctx, fz_archive *arch_, const char *name, fz_buffer *buf);
386
393void fz_tree_archive_add_data(fz_context *ctx, fz_archive *arch_, const char *name, const void *data, size_t size);
394
399
408void fz_mount_multi_archive(fz_context *ctx, fz_archive *arch_, fz_archive *sub, const char *path);
409
412
419
421
423
427
429{
430 int refs;
432
433 const char *format;
434
435 void (*drop_archive)(fz_context *ctx, fz_archive *arch);
437 const char *(*list_entry)(fz_context *ctx, fz_archive *arch, int idx);
438 int (*has_entry)(fz_context *ctx, fz_archive *arch, const char *name);
439 fz_buffer *(*read_entry)(fz_context *ctx, fz_archive *arch, const char *name);
440 fz_stream *(*open_entry)(fz_context *ctx, fz_archive *arch, const char *name);
441};
442
444
445#define fz_new_derived_archive(C,F,M) \
446 ((M*)Memento_label(fz_new_archive_of_size(C, F, sizeof(M)), #M))
447
448
449
450#endif
int fz_has_archive_entry(fz_context *ctx, fz_archive *arch, const char *name)
fz_archive * fz_open_directory(fz_context *ctx, const char *path)
const char * fz_list_archive_entry(fz_context *ctx, fz_archive *arch, int idx)
const char * fz_archive_format(fz_context *ctx, fz_archive *arch)
struct fz_zip_writer fz_zip_writer
Definition archive.h:329
void fz_mount_multi_archive(fz_context *ctx, fz_archive *arch_, fz_archive *sub, const char *path)
fz_archive * fz_open_zip_archive(fz_context *ctx, const char *path)
void fz_write_zip_entry(fz_context *ctx, fz_zip_writer *zip, const char *name, fz_buffer *buf, int compress)
fz_archive * fz_open_tar_archive(fz_context *ctx, const char *filename)
int fz_is_directory(fz_context *ctx, const char *path)
fz_buffer * fz_read_archive_entry(fz_context *ctx, fz_archive *arch, const char *name)
fz_archive * fz_open_archive_with_stream(fz_context *ctx, fz_stream *file)
int fz_is_zip_archive(fz_context *ctx, fz_stream *file)
fz_archive * fz_open_libarchive_archive(fz_context *ctx, const char *filename)
int fz_is_tar_archive(fz_context *ctx, fz_stream *file)
fz_archive * fz_open_tar_archive_with_stream(fz_context *ctx, fz_stream *file)
fz_archive * fz_open_archive_fn(fz_context *, fz_stream *)
Definition archive.h:411
FZ_DATA const fz_archive_handler fz_libarchive_archive_handler
void fz_close_zip_writer(fz_context *ctx, fz_zip_writer *zip)
int fz_recognize_archive_fn(fz_context *, fz_stream *)
Definition archive.h:410
fz_archive * fz_open_zip_archive_with_memory(fz_context *ctx, const unsigned char *data, size_t size)
void fz_register_archive_handler(fz_context *ctx, const fz_archive_handler *handler)
void fz_drop_zip_writer(fz_context *ctx, fz_zip_writer *zip)
fz_archive * fz_new_multi_archive(fz_context *ctx)
fz_archive * fz_keep_archive(fz_context *ctx, fz_archive *arch)
int fz_is_libarchive_archive(fz_context *ctx, fz_stream *file)
void fz_drop_archive(fz_context *ctx, fz_archive *arch)
int fz_is_cfb_archive(fz_context *ctx, fz_stream *file)
fz_zip_writer * fz_new_zip_writer_with_output(fz_context *ctx, fz_output *out)
fz_archive * fz_open_libarchive_archive_with_stream(fz_context *ctx, fz_stream *file)
fz_archive * fz_try_open_archive_with_stream(fz_context *ctx, fz_stream *file)
fz_zip_writer * fz_new_zip_writer(fz_context *ctx, const char *filename)
fz_archive * fz_open_zip_archive_with_stream(fz_context *ctx, fz_stream *file)
fz_archive * fz_open_archive(fz_context *ctx, const char *filename)
int fz_count_archive_entries(fz_context *ctx, fz_archive *arch)
fz_stream * fz_try_open_archive_entry(fz_context *ctx, fz_archive *arch, const char *name)
fz_archive * fz_open_cfb_archive(fz_context *ctx, const char *filename)
void fz_tree_archive_add_buffer(fz_context *ctx, fz_archive *arch_, const char *name, fz_buffer *buf)
fz_stream * fz_open_archive_entry(fz_context *ctx, fz_archive *arch, const char *name)
fz_archive * fz_new_tree_archive(fz_context *ctx, fz_tree *tree)
void fz_tree_archive_add_data(fz_context *ctx, fz_archive *arch_, const char *name, const void *data, size_t size)
fz_buffer * fz_try_read_archive_entry(fz_context *ctx, fz_archive *arch, const char *name)
fz_archive * fz_new_archive_of_size(fz_context *ctx, fz_stream *file, int size)
fz_archive * fz_open_cfb_archive_with_stream(fz_context *ctx, fz_stream *file)
#define FZ_DATA
Definition export.h:49
Definition archive.h:414
fz_recognize_archive_fn * recognize
Definition archive.h:415
fz_open_archive_fn * open
Definition archive.h:416
Definition archive.h:429
int refs
Definition archive.h:430
int(* count_entries)(fz_context *ctx, fz_archive *arch)
Definition archive.h:436
void(* drop_archive)(fz_context *ctx, fz_archive *arch)
Definition archive.h:435
const char * format
Definition archive.h:433
int(* has_entry)(fz_context *ctx, fz_archive *arch, const char *name)
Definition archive.h:438
fz_stream * file
Definition archive.h:431
Definition buffer.h:41
Definition context.h:886
Definition output.h:111
Definition stream.h:320
struct fz_tree fz_tree
Definition tree.h:33