OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PDF_PDFIUM_PDFIUM_MEM_BUFFER_FILE_WRITE_ | 5 #ifndef PDF_PDFIUM_PDFIUM_MEM_BUFFER_FILE_WRITE_ |
6 #define PDF_PDFIUM_PDFIUM_MEM_BUFFER_FILE_WRITE_ | 6 #define PDF_PDFIUM_PDFIUM_MEM_BUFFER_FILE_WRITE_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "third_party/pdfium/public/fpdf_save.h" | 12 #include "third_party/pdfium/public/fpdf_save.h" |
11 | 13 |
12 namespace chrome_pdf { | 14 namespace chrome_pdf { |
13 | 15 |
14 // Implementation of FPDF_FILEWRITE into a memory buffer. | 16 // Implementation of FPDF_FILEWRITE into a memory buffer. |
15 class PDFiumMemBufferFileWrite : public FPDF_FILEWRITE { | 17 class PDFiumMemBufferFileWrite : public FPDF_FILEWRITE { |
16 public: | 18 public: |
17 PDFiumMemBufferFileWrite(); | 19 PDFiumMemBufferFileWrite(); |
18 ~PDFiumMemBufferFileWrite(); | 20 ~PDFiumMemBufferFileWrite(); |
19 | 21 |
20 const std::basic_string<unsigned char>& buffer() { return buffer_; } | 22 const std::basic_string<unsigned char>& buffer() { return buffer_; } |
21 size_t size() { return buffer_.size(); } | 23 size_t size() { return buffer_.size(); } |
22 | 24 |
23 private: | 25 private: |
24 int DoWriteBlock(const void* data, unsigned long size); | 26 int DoWriteBlock(const void* data, unsigned long size); |
25 static int WriteBlockImpl(FPDF_FILEWRITE* this_file_write, const void* data, | 27 static int WriteBlockImpl(FPDF_FILEWRITE* this_file_write, const void* data, |
26 unsigned long size); | 28 unsigned long size); |
27 | 29 |
28 std::basic_string<unsigned char> buffer_; | 30 std::basic_string<unsigned char> buffer_; |
29 }; | 31 }; |
30 | 32 |
31 } // namespace chrome_pdf | 33 } // namespace chrome_pdf |
32 | 34 |
33 #endif // PDF_PDFIUM_PDFIUM_MEM_BUFFER_FILE_WRITE_ | 35 #endif // PDF_PDFIUM_PDFIUM_MEM_BUFFER_FILE_WRITE_ |
34 | 36 |
OLD | NEW |