]>
cygwin.com Git - cygwin-apps/setup.git/blob - archive.h
2 * Copyright (c) 2001, Robert Collins.
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 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by Robert Collins <rbtcollins@hotmail.com>
19 /* this is the parent class for all archive IO operations.
23 /* The read/write the archive stream to get the archive data is flawed.
24 * The problem is that you then need a *different* gzip etc class to be able
25 * to ungzip a gzip from within an archive.
26 * The correct way is to
27 * 1) retrieve the file name.
28 * 2) the user creates their own output object.
29 * 3) the user calls extract_file (output strea,).
36 ARCHIVE_FILE_HARDLINK
,
38 ARCHIVE_FILE_DIRECTORY
43 class archive
:public io_stream
46 /* get an archive child class from an io_stream */
47 static archive
*extract (io_stream
*);
48 /* get an ouput stream for the next files from the archive.
49 * returns NULL on failure.
50 * The stream is not taken over - it will not be automatically deleted
52 virtual io_stream
*extract_file () = NULL
;
53 /* extract the next file to the given prefixURL+Path in one step, and name it with the
55 * returns 1 on failure.
57 static int extract_file (archive
*, const char *, const char *, const char * = NULL
);
60 * To create a stream that will be compressed, you should open the url, and then get a new stream
61 * from compress::compress.
63 /* read data - not valid for archives (duh!)
64 * Could be made valid via the read-child-directly model
66 // virtual ssize_t read(void *buffer, size_t len) {return -1;};
67 /* provide data to (double duh!) */
68 // virtual ssize_t write(void *buffer, size_t len) { return -1;};
69 /* read data without removing it from the class's internal buffer */
70 // virtual ssize_t peek(void *buffer, size_t len);
71 // virtual long tell ();
72 /* try guessing this one */
73 // virtual int error ();
74 /* Find out the next stream name -
75 * ie for foo.tar.gz, at offset 0, next_file_name = foo.tar
76 * for foobar that is an compress, next_file_name is the next
77 * extractable filename.
78 * The way this works is that when read returns 0, you are at the end of *a* file.
79 * next_file_name will allow read to be called again, if it returns !NULL
81 virtual const char *next_file_name () = NULL
;
82 virtual archive_file_t
next_file_type () = ARCHIVE_FILE_INVALID
;
83 virtual const char *linktarget () = NULL
;
84 virtual int skip_file () = 0;
85 /* if you are still needing these hints... give up now! */
86 // virtual ~compress ();
88 void operator= (const archive
&);
90 archive (const archive
&);
95 #endif /* _ARCHIVE_H_ */
This page took 0.037874 seconds and 5 git commands to generate.