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> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 struct FreeDeleter { | 56 struct FreeDeleter { |
57 inline void operator()(void* ptr) const { free(ptr); } | 57 inline void operator()(void* ptr) const { free(ptr); } |
58 }; | 58 }; |
59 | 59 |
60 } // namespace pdfium | 60 } // namespace pdfium |
61 | 61 |
62 // Reads the entire contents of a file into a newly alloc'd buffer. | 62 // Reads the entire contents of a file into a newly alloc'd buffer. |
63 std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename, | 63 std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename, |
64 size_t* retlen); | 64 size_t* retlen); |
65 | 65 |
| 66 std::vector<std::string> StringSplit(const std::string& str, char delimiter); |
| 67 |
66 // Converts a FPDF_WIDESTRING to a std::wstring. | 68 // Converts a FPDF_WIDESTRING to a std::wstring. |
67 // Deals with differences between UTF16LE and wchar_t. | 69 // Deals with differences between UTF16LE and wchar_t. |
68 std::wstring GetPlatformWString(const FPDF_WIDESTRING wstr); | 70 std::wstring GetPlatformWString(const FPDF_WIDESTRING wstr); |
69 | 71 |
70 // Returns a newly allocated FPDF_WIDESTRING. | 72 // Returns a newly allocated FPDF_WIDESTRING. |
71 // Deals with differences between UTF16LE and wchar_t. | 73 // Deals with differences between UTF16LE and wchar_t. |
72 std::unique_ptr<unsigned short, pdfium::FreeDeleter> GetFPDFWideString( | 74 std::unique_ptr<unsigned short, pdfium::FreeDeleter> GetFPDFWideString( |
73 const std::wstring& wstr); | 75 const std::wstring& wstr); |
74 | 76 |
75 #ifdef PDF_ENABLE_V8 | 77 #ifdef PDF_ENABLE_V8 |
(...skipping 30 matching lines...) Expand all Loading... |
106 | 108 |
107 private: | 109 private: |
108 static int WriteBlockCallback(FPDF_FILEWRITE* pFileWrite, | 110 static int WriteBlockCallback(FPDF_FILEWRITE* pFileWrite, |
109 const void* data, | 111 const void* data, |
110 unsigned long size); | 112 unsigned long size); |
111 | 113 |
112 std::string m_String; | 114 std::string m_String; |
113 }; | 115 }; |
114 | 116 |
115 #endif // TESTING_TEST_SUPPORT_H_ | 117 #endif // TESTING_TEST_SUPPORT_H_ |
OLD | NEW |