diff options
| author | milla <marc.illa@dolby.com> | 2021-05-26 13:32:55 +0200 |
|---|---|---|
| committer | milla <marc.illa@dolby.com> | 2021-06-03 13:50:11 +0200 |
| commit | facf4f4c7a8ed65d59baed9020d5fa061b952874 (patch) | |
| tree | 8c718f4b7690db47315ebf70b6443f3fba540cf7 /src/KM_fileio.cpp | |
| parent | 7a085ad0d445ffc63ec42a2faa69a82138931575 (diff) | |
FileReader pluggable at runtime
Diffstat (limited to 'src/KM_fileio.cpp')
| -rw-r--r-- | src/KM_fileio.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/KM_fileio.cpp b/src/KM_fileio.cpp index b24c7db..c753012 100644 --- a/src/KM_fileio.cpp +++ b/src/KM_fileio.cpp @@ -816,6 +816,17 @@ Kumu::utf8_to_wbstr(const std::string& in, Kumu::ByteString& out) //------------------------------------------------------------------------------------------ // +Kumu::FileReader::FileReader() +{ + m_Handle = INVALID_HANDLE_VALUE; + assert(sizeof(off_t) <= sizeof(int64_t)); +} + +Kumu::FileReader::~FileReader() +{ + Kumu::FileReader::Close(); +} + Kumu::Result_t Kumu::FileReader::OpenRead(const std::string& filename) const { @@ -1066,6 +1077,18 @@ Kumu::FileWriter::Write(const byte_t* buf, ui32_t buf_len, ui32_t* bytes_written // POSIX // +Kumu::FileReader::FileReader() +{ + m_Handle = INVALID_HANDLE_VALUE; + assert(sizeof(off_t) <= sizeof(int64_t)); +} + +// +Kumu::FileReader::~FileReader() +{ + Kumu::FileReader::Close(); +} + Kumu::Result_t Kumu::FileReader::OpenRead(const std::string& filename) const { @@ -1140,7 +1163,6 @@ Kumu::FileReader::Read(byte_t* buf, ui32_t buf_len, ui32_t* read_count) const return (tmp_count == 0 ? RESULT_ENDOFFILE : RESULT_OK); } - //------------------------------------------------------------------------------------------ // @@ -1233,6 +1255,11 @@ Kumu::FileWriter::Write(const byte_t* buf, ui32_t buf_len, ui32_t* bytes_written //------------------------------------------------------------------------------------------ +// +IFileReader* FileReaderFactory::CreateFileReader() const +{ + return new FileReader(); +} // Kumu::Result_t |
