1 // Copyright 2017 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FXCRT_WIDETEXT_BUFFER_H_ 8 #define CORE_FXCRT_WIDETEXT_BUFFER_H_ 9 10 #include <stddef.h> 11 12 #include "core/fxcrt/binary_buffer.h" 13 #include "core/fxcrt/fx_string.h" 14 #include "third_party/base/containers/span.h" 15 16 namespace fxcrt { 17 18 class WideTextBuffer final : public BinaryBuffer { 19 public: 20 // BinaryBuffer: 21 size_t GetLength() const override; 22 23 pdfium::span<wchar_t> GetWideSpan(); 24 pdfium::span<const wchar_t> GetWideSpan() const; 25 WideStringView AsStringView() const; 26 WideString MakeString() const; 27 28 void AppendChar(wchar_t wch); 29 void Delete(size_t start_index, size_t count); 30 31 WideTextBuffer& operator<<(ByteStringView ascii); 32 WideTextBuffer& operator<<(const wchar_t* lpsz); 33 WideTextBuffer& operator<<(WideStringView str); 34 WideTextBuffer& operator<<(const WideString& str); 35 WideTextBuffer& operator<<(const WideTextBuffer& buf); 36 37 private: 38 void AppendWideString(WideStringView str); 39 40 // Returned span is the newly-expanded space. 41 pdfium::span<wchar_t> ExpandWideBuf(size_t char_count); 42 }; 43 44 } // namespace fxcrt 45 46 using fxcrt::WideTextBuffer; 47 48 #endif // CORE_FXCRT_WIDETEXT_BUFFER_H_ 49