aboutsummaryrefslogtreecommitdiff
path: root/src/include/puffin/huffer.h
blob: 967b3e8cc744c4127fdbff458e39bb683275296f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SRC_INCLUDE_PUFFIN_HUFFER_H_
#define SRC_INCLUDE_PUFFIN_HUFFER_H_

#include <cstddef>
#include <memory>

#include "puffin/common.h"

namespace puffin {

class BitWriterInterface;
class PuffReaderInterface;
class HuffmanTable;

class Huffer {
 public:
  Huffer();
  ~Huffer();

  // Creates a deflate buffer from a puffed buffer. It is the reverse of
  // |PuffDeflate|.
  bool HuffDeflate(PuffReaderInterface* pr, BitWriterInterface* bw) const;

 private:
  std::unique_ptr<HuffmanTable> dyn_ht_;
  std::unique_ptr<HuffmanTable> fix_ht_;

  DISALLOW_COPY_AND_ASSIGN(Huffer);
};

}  // namespace puffin

#endif  // SRC_INCLUDE_PUFFIN_HUFFER_H_