• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CPDFSDK_FILEWRITEADAPTER_H_
8 #define FPDFSDK_CPDFSDK_FILEWRITEADAPTER_H_
9 
10 #include "core/fxcrt/fx_stream.h"
11 #include "core/fxcrt/retain_ptr.h"
12 #include "core/fxcrt/unowned_ptr.h"
13 #include "public/fpdf_save.h"
14 
15 class CPDFSDK_FileWriteAdapter final : public IFX_RetainableWriteStream {
16  public:
17   template <typename T, typename... Args>
18   friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
19 
20   // IFX_WriteStream:
21   bool WriteBlock(const void* data, size_t size) override;
22   bool WriteString(ByteStringView str) override;
23 
24  private:
25   explicit CPDFSDK_FileWriteAdapter(FPDF_FILEWRITE* file_write);
26   ~CPDFSDK_FileWriteAdapter() override;
27 
28   UnownedPtr<FPDF_FILEWRITE> file_write_;
29 };
30 
31 #endif  // FPDFSDK_CPDFSDK_FILEWRITEADAPTER_H_
32