1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
/*
* tardy - a tar post-processor
* Copyright (C) 1998, 1999, 2002, 2004 Peter Miller;
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
* MANIFEST: interface definition for common/tar/input.cc
*/
#ifndef COMMON_TAR_INPUT_H
#define COMMON_TAR_INPUT_H
#include <tar/header.h>
/**
* The tar_input class represents an abstract archive input source.
* It was originally tar(5) formatted archives, but has since been
* generalized to cpio(1) archives and even list of file names.
*/
class tar_input
{
public:
/**
* The destructor.
*/
virtual ~tar_input();
/**
* The default constructor.
*/
tar_input();
/**
* The read_data method is used to read a block of data from
* the input. The `buffer_length' argument specifies the
* maximum number of bytes in the `buffer'. Returns the number
* of bytes read, or 0 at end of file.
*/
virtual int read_data(void *buffer, int buffer_length) = 0;
/**
* The read_data_padding is used to read any extra data between
* files. By default, this method does nothing.
*/
virtual void read_data_padding();
/**
* The read_header method is used to read file information from
* the input. Returns 0 at end of input.
*/
virtual int read_header(tar_header &) = 0;
/**
* The read_header_padding is used to read any extra data between
* headers. By default, this method does nothing.
*/
virtual void read_header_padding();
/**
* The `filename' method is used to obtain the name of the
* input file (not the current archiove member file name).
*/
virtual const char *filename() const = 0;
/**
* The fatal method is used to print a fatal error message.
* This method does not return.
*/
void fatal(char *, ...) const ATTR_PRINTF(2, 3);
/**
* The warning method is used to print a warning message.
*/
void warning(char *, ...) const ATTR_PRINTF(2, 3);
private:
/**
* The copy constructor. Do not use.
*/
tar_input(const tar_input &);
/**
* The assignment operator. Do not use.
*/
tar_input &operator=(const tar_input &);
};
#endif /* COMMON_TAR_INPUT_H */
|