5#include "testing/fx_string_testhelpers.h"
11#include "core/fxcrt/cfx_datetime.h"
12#include "core/fxcrt/fx_string.h"
13#include "fpdfsdk/cpdfsdk_helpers.h"
14#include "third_party/base/check_op.h"
15#include "third_party/base/containers/span.h"
27 std::vector<std::string> result;
30 size_t found = str.find(delimiter, pos);
31 if (found == std::string::npos)
34 result.push_back(str.substr(pos, found - pos));
37 result.push_back(str.substr(pos));
48 return std::wstring();
50 size_t characters = 0;
51 while (wstr[characters])
54 std::wstring platform_string;
55 platform_string.reserve(characters);
56 for (size_t i = 0; i < characters; ++i) {
57 const unsigned char* ptr =
reinterpret_cast<
const unsigned char*>(&wstr[i]);
58 platform_string.push_back(ptr[0] + 256 * ptr[1]);
60 return platform_string;
64 size_t length =
sizeof(uint16_t) * (wstr.size() + 1);
65 ScopedFPDFWideString result(
static_cast<FPDF_WCHAR*>(malloc(length)));
66 pdfium::span<uint8_t> result_span(
reinterpret_cast<uint8_t*>(result.get()),
69 for (
wchar_t w : wstr) {
70 result_span[i++] = w & 0xff;
71 result_span[i++] = (w >> 8) & 0xff;
79 DCHECK_EQ(length_bytes %
sizeof(FPDF_WCHAR), 0u);
80 return std::vector<FPDF_WCHAR>(length_bytes /
sizeof(FPDF_WCHAR));
uint8_t GetSecond() const
uint8_t GetMinute() const
uint16_t GetMillisecond() const
const char * c_str() const
ByteString ToUTF8() const
WideString WideStringFromFPDFWideString(FPDF_WIDESTRING wide_string)
std::vector< std::string > StringSplit(const std::string &str, char delimiter)
ScopedFPDFWideString GetFPDFWideString(const std::wstring &wstr)
std::vector< FPDF_WCHAR > GetFPDFWideStringBuffer(size_t length_bytes)
std::string GetPlatformString(FPDF_WIDESTRING wstr)
std::wstring GetPlatformWString(FPDF_WIDESTRING wstr)