Dan Sinclair | ae4656e | 2017-05-09 12:36:41 -0400 | [diff] [blame] | 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 | |
Dan Sinclair | ae4656e | 2017-05-09 12:36:41 -0400 | [diff] [blame] | 10 | #include "core/fxcrt/fx_stream.h" |
Dan Sinclair | 0b95042 | 2017-09-21 15:49:49 -0400 | [diff] [blame] | 11 | #include "core/fxcrt/retain_ptr.h" |
Dan Sinclair | ae4656e | 2017-05-09 12:36:41 -0400 | [diff] [blame] | 12 | #include "public/fpdf_save.h" |
| 13 | |
| 14 | class FSDK_FileWriteAdapter : public IFX_WriteStream { |
| 15 | public: |
| 16 | template <typename T, typename... Args> |
Dan Sinclair | 0b95042 | 2017-09-21 15:49:49 -0400 | [diff] [blame] | 17 | friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); |
Dan Sinclair | ae4656e | 2017-05-09 12:36:41 -0400 | [diff] [blame] | 18 | |
| 19 | bool WriteBlock(const void* data, size_t size) override; |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 20 | bool WriteString(const ByteStringView& str) override; |
Dan Sinclair | ae4656e | 2017-05-09 12:36:41 -0400 | [diff] [blame] | 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_ |