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
25 {
26 namespace FWFS
27 {
40 {
41 public:
42  virtual ~IBlockEncoder()
43  {
44  }
45 
54 };
55 
57 {
58 public:
60  {
61  }
62 
64  {
65  if(done) {
66  stream.reset();
67  return nullptr;
68  }
69 
70  done = true;
71  return stream.get();
72  }
73 
74 protected:
75  std::unique_ptr<IDataSourceStream> stream;
76  bool done{false};
77 };
78 
79 } // namespace FWFS
80 } // namespace IFS
Base class for read-only stream.
Definition: DataSourceStream.h:46
Definition: BlockEncoder.h:57
bool done
Definition: BlockEncoder.h:76
BasicEncoder(IDataSourceStream *stream)
Definition: BlockEncoder.h:59
IDataSourceStream * getNextStream() override
Definition: BlockEncoder.h:63
std::unique_ptr< IDataSourceStream > stream
Definition: BlockEncoder.h:75
Virtual base class to support (file) data encryption and compression.
Definition: BlockEncoder.h:40
virtual IDataSourceStream * getNextStream()=0
virtual ~IBlockEncoder()
Definition: BlockEncoder.h:42
Definition: DirectoryTemplate.h:37