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 FPDFSDK_FSDK_FILEWRITEADAPTER_H_ 8 #define FPDFSDK_FSDK_FILEWRITEADAPTER_H_ 9 10 #include "core/fxcrt/fx_stream.h" 11 #include "core/fxcrt/retain_ptr.h" 12 #include "public/fpdf_save.h" 13 14 class FSDK_FileWriteAdapter : public IFX_WriteStream { 15 public: 16 template <typename T, typename... Args> 17 friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); 18 19 bool WriteBlock(const void* data, size_t size) override; 20 bool WriteString(const ByteStringView& str) override; 21 22 private: 23 explicit FSDK_FileWriteAdapter(FPDF_FILEWRITE* fileWriteStruct); 24 ~FSDK_FileWriteAdapter() override; 25 26 FPDF_FILEWRITE* fileWriteStruct_; 27 }; 28 29 #endif // FPDFSDK_FSDK_FILEWRITEADAPTER_H_ 30