1 // Copyright 2017 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_FPDFAPI_EDIT_CPDF_FLATEENCODER_H_ 8 #define CORE_FPDFAPI_EDIT_CPDF_FLATEENCODER_H_ 9 10 #include "core/fpdfapi/parser/cpdf_dictionary.h" 11 #include "core/fpdfapi/parser/cpdf_stream_acc.h" 12 #include "core/fxcrt/fx_memory.h" 13 #include "core/fxcrt/maybe_owned.h" 14 #include "core/fxcrt/retain_ptr.h" 15 16 class CPDF_Stream; 17 18 class CPDF_FlateEncoder { 19 public: 20 CPDF_FlateEncoder(CPDF_Stream* pStream, bool bFlateEncode); 21 ~CPDF_FlateEncoder(); 22 23 void CloneDict(); 24 GetSize()25 uint32_t GetSize() const { return m_dwSize; } GetData()26 uint8_t* GetData() const { return m_pData.Get(); } 27 GetDict()28 CPDF_Dictionary* GetDict() { return m_pDict.Get(); } 29 30 private: 31 uint32_t m_dwSize; 32 MaybeOwned<uint8_t, FxFreeDeleter> m_pData; 33 MaybeOwned<CPDF_Dictionary> m_pDict; 34 RetainPtr<CPDF_StreamAcc> m_pAcc; 35 }; 36 37 #endif // CORE_FPDFAPI_EDIT_CPDF_FLATEENCODER_H_ 38