diff options
Diffstat (limited to 'core/src/fxcrt')
-rw-r--r-- | core/src/fxcrt/fx_basic_buffer.cpp | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index 9fc400e183..d6225b46f2 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -242,145 +242,6 @@ CFX_WideStringC CFX_WideTextBuf::GetWideString() const { return CFX_WideStringC((const FX_WCHAR*)m_pBuffer, m_DataSize / sizeof(FX_WCHAR)); } -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 << (FX_DWORD i) -{ - if (m_pStream) { - m_pStream->WriteBlock(&i, sizeof(FX_DWORD)); - } else { - m_SavingBuf.AppendBlock(&i, sizeof(FX_DWORD)); - } - 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.GetPtr(), len); - } else { - m_SavingBuf.AppendBlock(&len, sizeof(int)); - m_SavingBuf.AppendBlock(bstr.GetPtr(), 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); -} -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, FX_DWORD 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 >> (FX_DWORD& i) -{ - Read(&i, sizeof(FX_DWORD)); - 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.Empty(); - 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((const unsigned short*)encoded.c_str(), encoded.GetLength()); - return *this; -} -FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) -{ - if (m_LoadingPos + dwSize > m_LoadingSize) { - return FALSE; - } - FXSYS_memcpy(pBuf, m_pLoadingBuf + m_LoadingPos, dwSize); - m_LoadingPos += dwSize; - return TRUE; -} void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) { m_pData = pData; |