bzip_source.h
1 // Copyright 2013, Beeri 15. All rights reserved.
2 // Author: Roman Gershman (romange@gmail.com)
3 //
4 #ifndef BZIP_SOURCE_H
5 #define BZIP_SOURCE_H
6 
7 #include <memory>
8 #include "util/sinksource.h"
9 
10 namespace util {
11 
12 class BzipSource : public Source {
13 public:
14  // Takes ownership over sub_source
15  BzipSource(Source* sub_source);
16  ~BzipSource() override;
17 
18  static bool IsBzipSource(Source* source);
19 private:
20  StatusObject<size_t> ReadInternal(const strings::MutableByteRange& range) override;
21 
22  struct Rep;
23 
24  std::unique_ptr<Source> sub_stream_;
25  std::unique_ptr<Rep> rep_;
26 };
27 
28 } // namespace util
29 
30 #endif // BZIP_SOURCE_H