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 #include "core/fxcrt/fx_basic.h" 16 17 class CJBig2_Image; 18 19 class CJBig2_SymbolDict { 20 public: 21 CJBig2_SymbolDict(); 22 ~CJBig2_SymbolDict(); 23 24 std::unique_ptr<CJBig2_SymbolDict> DeepCopy() const; 25 26 // Takes ownership of |image|. AddImage(std::unique_ptr<CJBig2_Image> image)27 void AddImage(std::unique_ptr<CJBig2_Image> image) { 28 m_SDEXSYMS.push_back(std::move(image)); 29 } 30 NumImages()31 size_t NumImages() const { return m_SDEXSYMS.size(); } GetImage(size_t index)32 CJBig2_Image* GetImage(size_t index) const { return m_SDEXSYMS[index].get(); } 33 GbContext()34 const std::vector<JBig2ArithCtx>& GbContext() const { return m_gbContext; } GrContext()35 const std::vector<JBig2ArithCtx>& GrContext() const { return m_grContext; } 36 SetGbContext(const std::vector<JBig2ArithCtx> & gbContext)37 void SetGbContext(const std::vector<JBig2ArithCtx>& gbContext) { 38 m_gbContext = gbContext; 39 } SetGrContext(const std::vector<JBig2ArithCtx> & grContext)40 void SetGrContext(const std::vector<JBig2ArithCtx>& grContext) { 41 m_grContext = grContext; 42 } 43 44 private: 45 std::vector<JBig2ArithCtx> m_gbContext; 46 std::vector<JBig2ArithCtx> m_grContext; 47 std::vector<std::unique_ptr<CJBig2_Image>> m_SDEXSYMS; 48 }; 49 50 #endif // CORE_FXCODEC_JBIG2_JBIG2_SYMBOLDICT_H_ 51