• 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 #include "fpdfsdk/fsdk_filewriteadapter.h"
8 
FSDK_FileWriteAdapter(FPDF_FILEWRITE * fileWriteStruct)9 FSDK_FileWriteAdapter::FSDK_FileWriteAdapter(FPDF_FILEWRITE* fileWriteStruct)
10     : fileWriteStruct_(fileWriteStruct) {
11   ASSERT(fileWriteStruct_);
12 }
13 
~FSDK_FileWriteAdapter()14 FSDK_FileWriteAdapter::~FSDK_FileWriteAdapter() {}
15 
WriteBlock(const void * data,size_t size)16 bool FSDK_FileWriteAdapter::WriteBlock(const void* data, size_t size) {
17   return fileWriteStruct_->WriteBlock(fileWriteStruct_, data, size) != 0;
18 }
19 
WriteString(const ByteStringView & str)20 bool FSDK_FileWriteAdapter::WriteString(const ByteStringView& str) {
21   return WriteBlock(str.unterminated_c_str(), str.GetLength());
22 }
23