1 // Copyright 2017 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef SRC_INCLUDE_PUFFIN_HUFFER_H_ 6 #define SRC_INCLUDE_PUFFIN_HUFFER_H_ 7 8 #include <cstddef> 9 #include <memory> 10 11 #include "puffin/common.h" 12 13 namespace puffin { 14 15 class BitWriterInterface; 16 class PuffReaderInterface; 17 class HuffmanTable; 18 19 class Huffer { 20 public: 21 Huffer(); 22 ~Huffer(); 23 24 // Creates a deflate buffer from a puffed buffer. It is the reverse of 25 // |PuffDeflate|. 26 bool HuffDeflate(PuffReaderInterface* pr, BitWriterInterface* bw) const; 27 28 private: 29 std::unique_ptr<HuffmanTable> dyn_ht_; 30 std::unique_ptr<HuffmanTable> fix_ht_; 31 32 DISALLOW_COPY_AND_ASSIGN(Huffer); 33 }; 34 35 } // namespace puffin 36 37 #endif // SRC_INCLUDE_PUFFIN_HUFFER_H_ 38