diff options
author | Jay Berkenbilt <ejb@ql.org> | 2018-08-05 01:50:21 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2018-08-05 01:52:46 +0200 |
commit | 4f4c627b77a169e1729982fa03dd75d5035f0297 (patch) | |
tree | 50230823b7f82e2ffe059684dec1858f06b5be73 /include | |
parent | 7855e18ae2f535f7e1b6fa396e298511e66e6f94 (diff) | |
download | qpdf-4f4c627b77a169e1729982fa03dd75d5035f0297.tar.zst |
ClosedFileInputSource: add method to keep file open
During periods of intensive operation on a specific file, this method
can reduce the overhead of repeated open/close operations.
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/ClosedFileInputSource.hh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/qpdf/ClosedFileInputSource.hh b/include/qpdf/ClosedFileInputSource.hh index 1e3ff82f..fbd72df9 100644 --- a/include/qpdf/ClosedFileInputSource.hh +++ b/include/qpdf/ClosedFileInputSource.hh @@ -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,6 +83,7 @@ class ClosedFileInputSource: public InputSource std::string filename; qpdf_offset_t offset; FileInputSource* fis; + bool stay_open; }; PointerHolder<Members> m; }; |