Uninline CFX_WideTextBuf methods. Move them into cfx_widetextbuf.cpp, and group the getters together. Change-Id: I875b9a589e4a56f3b5842ee6718d7b15ba3754c3 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/67810 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/cfx_widetextbuf.cpp b/core/fxcrt/cfx_widetextbuf.cpp index dea620c..8e91d68 100644 --- a/core/fxcrt/cfx_widetextbuf.cpp +++ b/core/fxcrt/cfx_widetextbuf.cpp
@@ -10,6 +10,24 @@ return m_DataSize / sizeof(wchar_t); } +wchar_t* CFX_WideTextBuf::GetBuffer() const { + return reinterpret_cast<wchar_t*>(m_pBuffer.get()); +} + +WideStringView CFX_WideTextBuf::AsStringView() const { + return WideStringView(reinterpret_cast<const wchar_t*>(m_pBuffer.get()), + m_DataSize / sizeof(wchar_t)); +} + +WideString CFX_WideTextBuf::MakeString() const { + return WideString(reinterpret_cast<const wchar_t*>(m_pBuffer.get()), + m_DataSize / sizeof(wchar_t)); +} + +void CFX_WideTextBuf::Delete(int start_index, int count) { + CFX_BinaryBuf::Delete(start_index * sizeof(wchar_t), count * sizeof(wchar_t)); +} + void CFX_WideTextBuf::AppendChar(wchar_t ch) { ExpandBuf(sizeof(wchar_t)); *reinterpret_cast<wchar_t*>(m_pBuffer.get() + m_DataSize) = ch;
diff --git a/core/fxcrt/cfx_widetextbuf.h b/core/fxcrt/cfx_widetextbuf.h index 0f89197..6739d73 100644 --- a/core/fxcrt/cfx_widetextbuf.h +++ b/core/fxcrt/cfx_widetextbuf.h
@@ -13,25 +13,15 @@ class CFX_WideTextBuf final : public CFX_BinaryBuf { public: - void AppendChar(wchar_t wch); + // CFX_BinaryBuf: size_t GetLength() const override; - wchar_t* GetBuffer() const { - return reinterpret_cast<wchar_t*>(m_pBuffer.get()); - } - WideStringView AsStringView() const { - return WideStringView(reinterpret_cast<const wchar_t*>(m_pBuffer.get()), - m_DataSize / sizeof(wchar_t)); - } - WideString MakeString() const { - return WideString(reinterpret_cast<const wchar_t*>(m_pBuffer.get()), - m_DataSize / sizeof(wchar_t)); - } + wchar_t* GetBuffer() const; + WideStringView AsStringView() const; + WideString MakeString() const; - void Delete(int start_index, int count) { - CFX_BinaryBuf::Delete(start_index * sizeof(wchar_t), - count * sizeof(wchar_t)); - } + void AppendChar(wchar_t wch); + void Delete(int start_index, int count); CFX_WideTextBuf& operator<<(int i); CFX_WideTextBuf& operator<<(double f);