mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
feature(FileStream): Allow using Poco::FileStream to wrap arbitrary file handles/descriptors as C++ streams (#4424)
* Allow using Poco::FileStream to wrap arbitrary file handles/descriptors as C++ streams (#3444). * Allow opening a file descriptor/HANDLE as C++ stream. * FileStream: treat read from closed pipe as EOF. * chore(Filestream): conde style (naming) Co-Authored-By: Alex Fabijanic <alex@pocoproject.org> Co-Authored-By: Matej Kenda <matejken@gmail.com> * enh(FileStream): make FileIOS::open a virtual function. (#3444) * test(FileStream): unit test for FileStream::openHandle (#3444) * Update CONTRIBUTORS. * test(FileStream): Win32 unit test fix. * build(CMake): Require policy minimum version 3.15. --------- Co-authored-by: Daniel Grunwald <grunwald@axivion.com> Co-authored-by: Alex Fabijanic <alex@pocoproject.org>
This commit is contained in:
@@ -56,6 +56,16 @@ public:
|
||||
~FileIOS();
|
||||
/// Destroys the stream.
|
||||
|
||||
virtual void open(const std::string& path, std::ios::openmode mode);
|
||||
/// Opens the file specified by path, using the given mode.
|
||||
///
|
||||
/// Throws a FileException (or a similar exception) if the file
|
||||
/// does not exist or is not accessible for other reasons and
|
||||
/// a new file cannot be created.
|
||||
|
||||
void openHandle(NativeHandle handle, std::ios::openmode mode);
|
||||
/// Takes ownership of the handle.
|
||||
|
||||
void close();
|
||||
/// Closes the file stream.
|
||||
///
|
||||
@@ -108,7 +118,7 @@ public:
|
||||
~FileInputStream();
|
||||
/// Destroys the stream.
|
||||
|
||||
void open(const std::string& path, std::ios::openmode mode = std::ios::in);
|
||||
void open(const std::string& path, std::ios::openmode mode = std::ios::in) override;
|
||||
/// Opens the file specified by path, using the given mode, which
|
||||
/// will always include std::ios::in (even if not specified).
|
||||
///
|
||||
@@ -151,7 +161,7 @@ public:
|
||||
~FileOutputStream();
|
||||
/// Destroys the FileOutputStream.
|
||||
|
||||
void open(const std::string& path, std::ios::openmode mode = std::ios::out | std::ios::trunc);
|
||||
void open(const std::string& path, std::ios::openmode mode = std::ios::out | std::ios::trunc) override;
|
||||
/// Opens the file specified by path, using the given mode, which
|
||||
/// always includes std::ios::out, even if not specified.
|
||||
///
|
||||
@@ -196,7 +206,7 @@ public:
|
||||
~FileStream();
|
||||
/// Destroys the FileOutputStream.
|
||||
|
||||
void open(const std::string& path, std::ios::openmode mode = std::ios::out | std::ios::in);
|
||||
void open(const std::string& path, std::ios::openmode mode = std::ios::out | std::ios::in) override;
|
||||
/// Opens the file specified by path, using the given mode.
|
||||
///
|
||||
/// Throws a FileException (or a similar exception) if the file
|
||||
|
||||
Reference in New Issue
Block a user