BlockEncoder.h
Go to the documentation of this file.
1 /****
2  * ArchiveStream.h
3  *
4  * Copyright 2021 mikee47 <mike@sillyhouse.net>
5  *
6  * This file is part of the IFS Library
7  *
8  * This library is free software: you can redistribute it and/or modify it under the terms of the
9  * GNU General Public License as published by the Free Software Foundation, version 3 or later.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with this library.
16  * If not, see <https://www.gnu.org/licenses/>.
17  *
18  ****/
19 
20 #pragma once
21 
23 
24 namespace IFS::FWFS
25 {
38 {
39 public:
40  virtual ~IBlockEncoder() = default;
41 
50 };
51 
53 {
54 public:
56  {
57  }
58 
60  {
61  if(done) {
62  stream.reset();
63  return nullptr;
64  }
65 
66  done = true;
67  return stream.get();
68  }
69 
70 protected:
71  std::unique_ptr<IDataSourceStream> stream;
72  bool done{false};
73 };
74 
75 } // namespace IFS::FWFS
Base class for read-only stream.
Definition: DataSourceStream.h:46
Definition: BlockEncoder.h:53
bool done
Definition: BlockEncoder.h:72
BasicEncoder(IDataSourceStream *stream)
Definition: BlockEncoder.h:55
IDataSourceStream * getNextStream() override
Definition: BlockEncoder.h:59
std::unique_ptr< IDataSourceStream > stream
Definition: BlockEncoder.h:71
Virtual base class to support (file) data encryption and compression.
Definition: BlockEncoder.h:38
virtual IDataSourceStream * getNextStream()=0
virtual ~IBlockEncoder()=default
Definition: Components/IFS/src/include/IFS/FWFS/ArchiveStream.h:28