1 // Copyright 2014 The PDFium Authors 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 16 class CJBig2_Image; 17 18 class CJBig2_SymbolDict { 19 public: 20 CJBig2_SymbolDict(); 21 ~CJBig2_SymbolDict(); 22 23 std::unique_ptr<CJBig2_SymbolDict> DeepCopy() const; 24 AddImage(std::unique_ptr<CJBig2_Image> image)25 void AddImage(std::unique_ptr<CJBig2_Image> image) { 26 m_SDEXSYMS.push_back(std::move(image)); 27 } 28 NumImages()29 size_t NumImages() const { return m_SDEXSYMS.size(); } GetImage(size_t index)30 CJBig2_Image* GetImage(size_t index) const { return m_SDEXSYMS[index].get(); } 31 GbContexts()32 const std::vector<JBig2ArithCtx>& GbContexts() const { return m_gbContexts; } GrContexts()33 const std::vector<JBig2ArithCtx>& GrContexts() const { return m_grContexts; } 34 SetGbContexts(std::vector<JBig2ArithCtx> gbContexts)35 void SetGbContexts(std::vector<JBig2ArithCtx> gbContexts) { 36 m_gbContexts = std::move(gbContexts); 37 } SetGrContexts(std::vector<JBig2ArithCtx> grContexts)38 void SetGrContexts(std::vector<JBig2ArithCtx> grContexts) { 39 m_grContexts = std::move(grContexts); 40 } 41 42 private: 43 std::vector<JBig2ArithCtx> m_gbContexts; 44 std::vector<JBig2ArithCtx> m_grContexts; 45 std::vector<std::unique_ptr<CJBig2_Image>> m_SDEXSYMS; 46 }; 47 48 #endif // CORE_FXCODEC_JBIG2_JBIG2_SYMBOLDICT_H_ 49