Home | History | Annotate | Download | only in puffin
      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 #include "puffin/errors.h"
     13 
     14 namespace puffin {
     15 
     16 class BitWriterInterface;
     17 class PuffReaderInterface;
     18 class HuffmanTable;
     19 
     20 class PUFFIN_EXPORT Huffer {
     21  public:
     22   Huffer();
     23   ~Huffer();
     24 
     25   // Creates a deflate buffer from a puffed buffer. It is the reverse of
     26   // |PuffDeflate|.
     27   bool HuffDeflate(PuffReaderInterface* pr,
     28                    BitWriterInterface* bw,
     29                    Error* error) const;
     30 
     31  private:
     32   std::unique_ptr<HuffmanTable> dyn_ht_;
     33   std::unique_ptr<HuffmanTable> fix_ht_;
     34 
     35   DISALLOW_COPY_AND_ASSIGN(Huffer);
     36 };
     37 
     38 }  // namespace puffin
     39 
     40 #endif  // SRC_INCLUDE_PUFFIN_HUFFER_H_
     41