2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-12 15:12:22 +00:00
qpdf/include/qpdf/FileInputSource.hh
Jay Berkenbilt 296b679d6e Implement findFirst and findLast in InputSource
Preparing to refactor some pattern searching code to use these instead
of their own memchr loops. This should simplify the code that replaces
PCRE.
2017-08-10 21:30:32 -04:00

52 lines
1.3 KiB
C++

/* Copyright (c) 2005-2015 Jay Berkenbilt
*
* This file is part of qpdf. This software may be distributed under
* the terms of version 2 of the Artistic License which may be found
* in the source distribution. It is provided "as is" without express
* or implied warranty.
*/
#ifndef __QPDF_FILEINPUTSOURCE_HH__
#define __QPDF_FILEINPUTSOURCE_HH__
#include <qpdf/InputSource.hh>
class FileInputSource: public InputSource
{
public:
QPDF_DLL
FileInputSource();
QPDF_DLL
void setFilename(char const* filename);
QPDF_DLL
void setFile(char const* description, FILE* filep, bool close_file);
QPDF_DLL
virtual ~FileInputSource();
QPDF_DLL
virtual qpdf_offset_t findAndSkipNextEOL();
QPDF_DLL
virtual std::string const& getName() const;
QPDF_DLL
virtual qpdf_offset_t tell();
QPDF_DLL
virtual void seek(qpdf_offset_t offset, int whence);
QPDF_DLL
virtual void rewind();
QPDF_DLL
virtual size_t read(char* buffer, size_t length);
QPDF_DLL
virtual void unreadCh(char ch);
private:
FileInputSource(FileInputSource const&);
FileInputSource& operator=(FileInputSource const&);
void destroy();
bool close_file;
std::string filename;
FILE* file;
};
#endif // __QPDF_FILEINPUTSOURCE_HH__