本文整理汇总了C++中CBuffer::ReadString方法的典型用法代码示例。如果您正苦于以下问题:C++ CBuffer::ReadString方法的具体用法?C++ CBuffer::ReadString怎么用?C++ CBuffer::ReadString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBuffer
的用法示例。
在下文中一共展示了CBuffer::ReadString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadDC
BOOL CHostBrowser::LoadDC(LPCTSTR pszFile, CQueryHit*& pHits)
{
CFile pFile;
if ( ! pFile.Open( pszFile, CFile::modeRead | CFile::shareDenyWrite ) )
return FALSE; // File open error
UINT nInSize = (UINT)pFile.GetLength();
if ( ! nInSize )
return FALSE; // Empty file
CBuffer pBuffer;
if ( ! pBuffer.EnsureBuffer( nInSize ) )
return FALSE; // Out of memory
if ( pFile.Read( pBuffer.GetData(), nInSize ) != nInSize )
return FALSE; // File read error
pBuffer.m_nLength = nInSize;
if ( ! pBuffer.UnBZip() )
return FALSE; // Decompression error
augment::auto_ptr< CXMLElement > pXML ( CXMLElement::FromString( pBuffer.ReadString( pBuffer.m_nLength, CP_UTF8 ), TRUE ) );
if ( ! pXML.get() )
return FALSE; // XML decoding error
// <FileListing Version="1" CID="SKCB4ZF4PZUDF7RKQ5LX6SVAARQER7QEVELZ2TY" Base="/" Generator="DC++ 0.762">
if ( ! pXML->IsNamed( L"FileListing" ) )
return FALSE; // Invalid XML file format
// CString strTitle = pXML->GetAttributeValue( L"CID" );
return LoadDCDirectory( pXML.get(), pHits );
}
示例2: LoadDC
BOOL CCollectionFile::LoadDC(LPCTSTR pszFile)
{
m_nType = SimpleCollection;
// ToDo: Add schema detection
m_sThisURI = CSchema::uriFolder;
m_sParentURI = CSchema::uriCollectionsFolder;
CFile pFile;
if ( ! pFile.Open( pszFile, CFile::modeRead | CFile::shareDenyWrite ) )
return FALSE; // File open error
UINT nInSize = (UINT)pFile.GetLength();
if ( ! nInSize )
return FALSE; // Empty file
CBuffer pBuffer;
if ( ! pBuffer.EnsureBuffer( nInSize ) )
return FALSE; // Out of memory
if ( pFile.Read( pBuffer.GetData(), nInSize ) != nInSize )
return FALSE; // File read error
pBuffer.m_nLength = nInSize;
if ( ! pBuffer.UnBZip() )
return FALSE; // Decompression error
augment::auto_ptr< CXMLElement > pXML ( CXMLElement::FromString( pBuffer.ReadString( pBuffer.m_nLength, CP_UTF8 ), TRUE ) );
if ( ! pXML.get() )
return FALSE; // XML decoding error
// <FileListing Version="1" CID="SKCB4ZF4PZUDF7RKQ5LX6SVAARQER7QEVELZ2TY" Base="/" Generator="DC++ 0.762">
if ( ! pXML->IsNamed( L"FileListing" ) )
return FALSE; // Invalid XML file format
m_sTitle = pXML->GetAttributeValue( L"CID" );
LoadDC( pXML.get() );
return ( m_pFiles.GetCount() != 0 );
}