diff options
Diffstat (limited to 'include/qpdf/ClosedFileInputSource.hh')
-rw-r--r-- | include/qpdf/ClosedFileInputSource.hh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/qpdf/ClosedFileInputSource.hh b/include/qpdf/ClosedFileInputSource.hh index 1e3ff82f..ee8557fc 100644 --- a/include/qpdf/ClosedFileInputSource.hh +++ b/include/qpdf/ClosedFileInputSource.hh @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2018 Jay Berkenbilt +// Copyright (c) 2005-2019 Jay Berkenbilt // // This file is part of qpdf. // @@ -19,8 +19,8 @@ // continue to consider qpdf to be licensed under those terms. Please // see the manual for additional information. -#ifndef __QPDF_CLOSEDFILEINPUTSOURCE_HH__ -#define __QPDF_CLOSEDFILEINPUTSOURCE_HH__ +#ifndef QPDF_CLOSEDFILEINPUTSOURCE_HH +#define QPDF_CLOSEDFILEINPUTSOURCE_HH // This is an input source that reads from files, like // FileInputSource, except that it opens and close the file @@ -55,6 +55,13 @@ class ClosedFileInputSource: public InputSource QPDF_DLL virtual void unreadCh(char ch); + // The file stays open between calls to stayOpen(true) and + // stayOpen(false). You can use this to surround multiple + // operations on a single ClosedFileInputSource to reduce the + // overhead of a separate open/close on each call. + QPDF_DLL + void stayOpen(bool); + private: ClosedFileInputSource(ClosedFileInputSource const&); ClosedFileInputSource& operator=(ClosedFileInputSource const&); @@ -76,8 +83,9 @@ class ClosedFileInputSource: public InputSource std::string filename; qpdf_offset_t offset; FileInputSource* fis; + bool stay_open; }; PointerHolder<Members> m; }; -#endif // __QPDF_CLOSEDFILEINPUTSOURCE_HH__ +#endif // QPDF_CLOSEDFILEINPUTSOURCE_HH |