Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(809)

Unified Diff: core/fxcrt/fx_basic_buffer.cpp

Issue 1980293004: Pass objects instead of strings for undo/redo records. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fxcrt/include/fx_basic.h » ('j') | xfa/fwl/basewidget/fwl_editimp.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/fx_basic_buffer.cpp
diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp
index 2762497e5cf987392e5dc17fac698f6c6933c1b3..91ca6dad7c3572629b6a5f54924e64305c1c6133 100644
--- a/core/fxcrt/fx_basic_buffer.cpp
+++ b/core/fxcrt/fx_basic_buffer.cpp
@@ -182,133 +182,6 @@ CFX_WideTextBuf& CFX_WideTextBuf::operator<<(const CFX_WideTextBuf& buf) {
return *this;
}
-#ifdef PDF_ENABLE_XFA
-CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(uint8_t i) {
- if (m_pStream) {
- m_pStream->WriteBlock(&i, 1);
- } else {
- m_SavingBuf.AppendByte(i);
- }
- return *this;
-}
-CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(int i) {
- if (m_pStream) {
- m_pStream->WriteBlock(&i, sizeof(int));
- } else {
- m_SavingBuf.AppendBlock(&i, sizeof(int));
- }
- return *this;
-}
-CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(uint32_t i) {
- if (m_pStream) {
- m_pStream->WriteBlock(&i, sizeof(uint32_t));
- } else {
- m_SavingBuf.AppendBlock(&i, sizeof(uint32_t));
- }
- return *this;
-}
-CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(FX_FLOAT f) {
- if (m_pStream) {
- m_pStream->WriteBlock(&f, sizeof(FX_FLOAT));
- } else {
- m_SavingBuf.AppendBlock(&f, sizeof(FX_FLOAT));
- }
- return *this;
-}
-CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(const CFX_ByteStringC& bstr) {
- int len = bstr.GetLength();
- if (m_pStream) {
- m_pStream->WriteBlock(&len, sizeof(int));
- m_pStream->WriteBlock(bstr.raw_str(), len);
- } else {
- m_SavingBuf.AppendBlock(&len, sizeof(int));
- m_SavingBuf.AppendBlock(bstr.raw_str(), len);
- }
- return *this;
-}
-CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(const FX_WCHAR* wstr) {
- FX_STRSIZE len = FXSYS_wcslen(wstr);
- if (m_pStream) {
- m_pStream->WriteBlock(&len, sizeof(int));
- m_pStream->WriteBlock(wstr, len);
- } else {
- m_SavingBuf.AppendBlock(&len, sizeof(int));
- m_SavingBuf.AppendBlock(wstr, len);
- }
- return *this;
-}
-CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(const CFX_WideString& wstr) {
- CFX_ByteString encoded = wstr.UTF16LE_Encode();
- return operator<<(encoded.AsStringC());
-}
-void CFX_ArchiveSaver::Write(const void* pData, FX_STRSIZE dwSize) {
- if (m_pStream) {
- m_pStream->WriteBlock(pData, dwSize);
- } else {
- m_SavingBuf.AppendBlock(pData, dwSize);
- }
-}
-CFX_ArchiveLoader::CFX_ArchiveLoader(const uint8_t* pData, uint32_t dwSize) {
- m_pLoadingBuf = pData;
- m_LoadingPos = 0;
- m_LoadingSize = dwSize;
-}
-FX_BOOL CFX_ArchiveLoader::IsEOF() {
- return m_LoadingPos >= m_LoadingSize;
-}
-CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(uint8_t& i) {
- if (m_LoadingPos >= m_LoadingSize) {
- return *this;
- }
- i = m_pLoadingBuf[m_LoadingPos++];
- return *this;
-}
-CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(int& i) {
- Read(&i, sizeof(int));
- return *this;
-}
-CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(uint32_t& i) {
- Read(&i, sizeof(uint32_t));
- return *this;
-}
-CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(FX_FLOAT& i) {
- Read(&i, sizeof(FX_FLOAT));
- return *this;
-}
-CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(CFX_ByteString& str) {
- if (m_LoadingPos + 4 > m_LoadingSize) {
- return *this;
- }
- int len;
- operator>>(len);
- str.clear();
- if (len <= 0 || m_LoadingPos + len > m_LoadingSize) {
- return *this;
- }
- FX_CHAR* buffer = str.GetBuffer(len);
- FXSYS_memcpy(buffer, m_pLoadingBuf + m_LoadingPos, len);
- str.ReleaseBuffer(len);
- m_LoadingPos += len;
- return *this;
-}
-CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(CFX_WideString& str) {
- CFX_ByteString encoded;
- operator>>(encoded);
- str = CFX_WideString::FromUTF16LE(
- reinterpret_cast<const unsigned short*>(encoded.c_str()),
- encoded.GetLength() / sizeof(unsigned short));
- return *this;
-}
-FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, uint32_t dwSize) {
- if (m_LoadingPos + dwSize > m_LoadingSize) {
- return FALSE;
- }
- FXSYS_memcpy(pBuf, m_pLoadingBuf + m_LoadingPos, dwSize);
- m_LoadingPos += dwSize;
- return TRUE;
-}
-#endif // PDF_ENABLE_XFA
-
void CFX_BitStream::Init(const uint8_t* pData, uint32_t dwSize) {
m_pData = pData;
m_BitSize = dwSize * 8;
« no previous file with comments | « no previous file | core/fxcrt/include/fx_basic.h » ('j') | xfa/fwl/basewidget/fwl_editimp.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698