7#include "core/fxcrt/widetext_buffer.h"
9#include "core/fxcrt/fx_safe_types.h"
10#include "core/fxcrt/fx_system.h"
15 return GetSize() /
sizeof(
wchar_t);
19 return pdfium::make_span(
reinterpret_cast<
wchar_t*>(m_buffer.data()),
23pdfium::span<
const wchar_t> WideTextBuffer::
GetWideSpan()
const {
24 return pdfium::make_span(
reinterpret_cast<
const wchar_t*>(m_buffer.data()),
33 return WideString(AsStringView());
37 pdfium::span<
wchar_t> new_span = ExpandWideBuf(1);
41void WideTextBuffer::
Delete(size_t start_index, size_t count) {
42 DeleteBuf(start_index *
sizeof(
wchar_t), count *
sizeof(
wchar_t));
45void WideTextBuffer::AppendWideString(WideStringView str) {
49WideTextBuffer& WideTextBuffer::operator<<(ByteStringView ascii) {
50 pdfium::span<
wchar_t> new_span = ExpandWideBuf(ascii.GetLength());
51 for (size_t i = 0; i < ascii.GetLength(); ++i)
52 new_span[i] = ascii[i];
56WideTextBuffer& WideTextBuffer::operator<<(WideStringView str) {
57 AppendWideString(str);
61WideTextBuffer& WideTextBuffer::operator<<(
const WideString& str) {
62 AppendWideString(str.AsStringView());
66WideTextBuffer& WideTextBuffer::operator<<(
const wchar_t* lpsz) {
67 AppendWideString(WideStringView(lpsz));
71WideTextBuffer& WideTextBuffer::operator<<(
const WideTextBuffer& buf) {
72 AppendWideString(buf.AsStringView());
76pdfium::span<
wchar_t> WideTextBuffer::ExpandWideBuf(size_t char_count) {
77 size_t original_count = GetLength();
78 FX_SAFE_SIZE_T safe_bytes = char_count;
79 safe_bytes *=
sizeof(
wchar_t);
80 size_t bytes = safe_bytes.ValueOrDie();
void AppendSpan(pdfium::span< const uint8_t > span)
pdfium::span< wchar_t > GetWideSpan()
void AppendChar(wchar_t wch)
void Delete(size_t start_index, size_t count)
pdfium::span< const wchar_t > GetWideSpan() const
WideString MakeString() const
WideStringView AsStringView() const
size_t GetLength() const override