![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cStream.h>
Public Member Functions | |
cStreamInput () noexcept | |
virtual | ~cStreamInput () |
virtual size_t | SetSeekSizeMin (size_t nSizeMin=k_FILE_BLOCK_SIZE) |
virtual HRESULT | ReadX (OUT void *pData, size_t nDataSize) |
HRESULT | ReadAll (OUT cHeapBlock &block, size_t nSizeExtra=0) |
virtual HRESULT | ReadStringLine (OUT char *pszBuffer, StrLen_t iSizeMax) |
virtual HRESULT | ReadStringLine (OUT wchar_t *pszBuffer, StrLen_t iSizeMax) |
HRESULT | ReadT (OUT void *pVal, size_t nSize) |
template<typename TYPE > | |
HRESULT | ReadT (OUT TYPE &val) |
template<typename TYPE > | |
HRESULT | ReadTN (OUT TYPE &val) |
HRESULT | ReadSize (OUT size_t &nSize) |
template<typename TYPE > | |
HRESULT | ReadSizeT (OUT TYPE &n) |
HRESULT | ReadHashCode (OUT UINT32 &nHashCode) |
HRESULT | ReadHashCode (OUT UINT64 &nHashCode) |
HRESULT | ReadN (OUT BYTE *pBuffer, size_t nSizeMax) |
template<typename _CH > | |
HRESULT | ReadStringN (OUT _CH *pszStr, StrLen_t iSizeMax) |
virtual HRESULT | ReadPeek (void *pData, size_t nDataSize) |
![]() | |
virtual | ~cStreamBase () |
virtual STREAM_SEEKRET_t | Seek (STREAM_OFFSET_t iOffset, SEEK_ORIGIN_TYPE eSeekOrigin=SEEK_Set) |
void | SeekToBegin () |
STREAM_POS_t | SeekToEnd () |
virtual STREAM_POS_t | GetPosition () const |
virtual STREAM_POS_t | GetLength () const |
Additional Inherited Members | |
![]() | |
static const BYTE | k_SIZE_MASK = 0x80 |
Used for WriteSize() More... | |
static const size_t | k_FILE_BLOCK_SIZE = (32 * 1024) |
default arbitrary transfer block size. more than this is NOT more efficient. More... | |
Generic input stream of data.
|
inlinenoexcept |
|
inlinevirtual |
|
inline |
Read the whole stream as a single allocated block in memory.
|
inline |
|
inline |
|
inline |
Read a block with a leading size field.
|
virtual |
Peek ahead in the stream if possible. Non blocking. just try to read data but not remove from the queue.
Reimplemented in GrayLib::cNetSocket, Gray::cStreamStatic, and Gray::cStreamQueue.
HRESULT Gray::cStreamInput::ReadSize | ( | OUT size_t & | nSize | ) |
Packed low to high values. Read a packed (variable length) unsigned size. <0 = error; Bit 7 reserved to indicate more bytes to come. opposite of WriteSize( size_t ) similar to ASN1 Length packing.
Read a string up until (including) a "\n" or "\r\n". end of line. FILE_EOL. Some streams can support this better than others. like fgets(FILE*)
Reimplemented in Gray::cStreamTextReader.
Read a string up until (including) a "\n" or "\r\n". end of line. FILE_EOL. Some streams can support this better than others. like fgets(FILE*).
|
inline |
Read a string that is prefixed by its size. iSizeMax = _countof(pszStr), includes space for '\0'. e.g. _countof("abc") = 4
|
inline |
Read all nSize or fail HRESULT_WIN32_C(ERROR_IO_INCOMPLETE).
Read a type value in network order. convert to host order.
|
inlinevirtual |
Just read a block from the stream. // must support this. Similar to MFC CFile::Read()
Reimplemented in GraySSL::cSSLCommon.
|
inlinevirtual |
similar to ReadCommit (put_AutoReadCommitSize) size. Used by cStreamTransaction. Leave a certain amount of data (max message size for current protocol) such that we could Seek() back for incomplete messages.
Reimplemented in GraySSL::cSSLCommon, GrayLib::cNetStream, Gray::cStreamQueue, and Gray::cStreamStatic.