| OLD | NEW |
| 1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 PDFium 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 TESTING_TEST_SUPPORT_H_ | 5 #ifndef TESTING_TEST_SUPPORT_H_ |
| 6 #define TESTING_TEST_SUPPORT_H_ | 6 #define TESTING_TEST_SUPPORT_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> |
| 11 | 12 |
| 12 #include "public/fpdf_save.h" | 13 #include "public/fpdf_save.h" |
| 13 #include "public/fpdfview.h" | 14 #include "public/fpdfview.h" |
| 14 | 15 |
| 15 #ifdef PDF_ENABLE_V8 | 16 #ifdef PDF_ENABLE_V8 |
| 16 #include "v8/include/v8.h" | 17 #include "v8/include/v8.h" |
| 17 #endif // PDF_ENABLE_V8 | 18 #endif // PDF_ENABLE_V8 |
| 18 | 19 |
| 19 namespace pdfium { | 20 namespace pdfium { |
| 20 | 21 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 struct FreeDeleter { | 57 struct FreeDeleter { |
| 57 inline void operator()(void* ptr) const { free(ptr); } | 58 inline void operator()(void* ptr) const { free(ptr); } |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 } // namespace pdfium | 61 } // namespace pdfium |
| 61 | 62 |
| 62 // Reads the entire contents of a file into a newly alloc'd buffer. | 63 // Reads the entire contents of a file into a newly alloc'd buffer. |
| 63 std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename, | 64 std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename, |
| 64 size_t* retlen); | 65 size_t* retlen); |
| 65 | 66 |
| 67 std::vector<std::string> StringSplit(const std::string& str, char delimiter); |
| 68 |
| 66 // Converts a FPDF_WIDESTRING to a std::wstring. | 69 // Converts a FPDF_WIDESTRING to a std::wstring. |
| 67 // Deals with differences between UTF16LE and wchar_t. | 70 // Deals with differences between UTF16LE and wchar_t. |
| 68 std::wstring GetPlatformWString(const FPDF_WIDESTRING wstr); | 71 std::wstring GetPlatformWString(const FPDF_WIDESTRING wstr); |
| 69 | 72 |
| 70 // Returns a newly allocated FPDF_WIDESTRING. | 73 // Returns a newly allocated FPDF_WIDESTRING. |
| 71 // Deals with differences between UTF16LE and wchar_t. | 74 // Deals with differences between UTF16LE and wchar_t. |
| 72 std::unique_ptr<unsigned short, pdfium::FreeDeleter> GetFPDFWideString( | 75 std::unique_ptr<unsigned short, pdfium::FreeDeleter> GetFPDFWideString( |
| 73 const std::wstring& wstr); | 76 const std::wstring& wstr); |
| 74 | 77 |
| 75 #ifdef PDF_ENABLE_V8 | 78 #ifdef PDF_ENABLE_V8 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 106 | 109 |
| 107 private: | 110 private: |
| 108 static int WriteBlockCallback(FPDF_FILEWRITE* pFileWrite, | 111 static int WriteBlockCallback(FPDF_FILEWRITE* pFileWrite, |
| 109 const void* data, | 112 const void* data, |
| 110 unsigned long size); | 113 unsigned long size); |
| 111 | 114 |
| 112 std::string m_String; | 115 std::string m_String; |
| 113 }; | 116 }; |
| 114 | 117 |
| 115 #endif // TESTING_TEST_SUPPORT_H_ | 118 #endif // TESTING_TEST_SUPPORT_H_ |
| OLD | NEW |