1// Copyright 2014 PDFium 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// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef CORE_FXCODEC_JBIG2_JBIG2_SYMBOLDICT_H_
8#define CORE_FXCODEC_JBIG2_JBIG2_SYMBOLDICT_H_
9
10#include <memory>
11#include <utility>
12#include <vector>
13
14#include "core/fxcodec/jbig2/JBig2_ArithDecoder.h"
15
16class CJBig2_Image;
17
18class CJBig2_SymbolDict {
19 public:
20  CJBig2_SymbolDict();
21  ~CJBig2_SymbolDict();
22
23  std::unique_ptr<CJBig2_SymbolDict> DeepCopy() const;
24
25  // Takes ownership of |image|.
26  void AddImage(std::unique_ptr<CJBig2_Image> image) {
27    m_SDEXSYMS.push_back(std::move(image));
28  }
29
30  size_t NumImages() const { return m_SDEXSYMS.size(); }
31  CJBig2_Image* GetImage(size_t index) const { return m_SDEXSYMS[index].get(); }
32
33  const std::vector<JBig2ArithCtx>& GbContext() const { return m_gbContext; }
34  const std::vector<JBig2ArithCtx>& GrContext() const { return m_grContext; }
35
36  void SetGbContext(const std::vector<JBig2ArithCtx>& gbContext) {
37    m_gbContext = gbContext;
38  }
39  void SetGrContext(const std::vector<JBig2ArithCtx>& grContext) {
40    m_grContext = grContext;
41  }
42
43 private:
44  std::vector<JBig2ArithCtx> m_gbContext;
45  std::vector<JBig2ArithCtx> m_grContext;
46  std::vector<std::unique_ptr<CJBig2_Image>> m_SDEXSYMS;
47};
48
49#endif  // CORE_FXCODEC_JBIG2_JBIG2_SYMBOLDICT_H_
50