Public Types | Public Member Functions | Public Attributes | List of all members
MemoryStream Struct Reference

Represents an in-memory input byte stream. More...

#include <memorystream.h>

Public Types

typedef char Ch
 

Public Member Functions

void Flush ()
 
 MemoryStream (const Ch *src, size_t size)
 
Ch Peek () const
 
const ChPeek4 () const
 
void Put (Ch)
 
ChPutBegin ()
 
size_t PutEnd (Ch *)
 
Ch Take ()
 
size_t Tell () const
 

Public Attributes

const Chbegin_
 Original head of the string. More...
 
const Chend_
 End of stream. More...
 
size_t size_
 Size of the stream. More...
 
const Chsrc_
 Current read position. More...
 

Detailed Description

Represents an in-memory input byte stream.

This class is mainly for being wrapped by EncodedInputStream or AutoUTFInputStream.

It is similar to FileReadBuffer but the source is an in-memory buffer instead of a file.

Differences between MemoryStream and StringStream:

  1. StringStream has encoding but MemoryStream is a byte stream.
  2. MemoryStream needs size of the source buffer and the buffer don't need to be null terminated. StringStream assume null-terminated string as source.
  3. MemoryStream supports Peek4() for encoding detection. StringStream is specified with an encoding so it should not have Peek4().
    Note
    implements Stream concept

Definition at line 42 of file memorystream.h.

Member Typedef Documentation

typedef char MemoryStream::Ch

Definition at line 44 of file memorystream.h.

Constructor & Destructor Documentation

MemoryStream::MemoryStream ( const Ch src,
size_t  size 
)
inline

Definition at line 46 of file memorystream.h.

Member Function Documentation

void MemoryStream::Flush ( )
inline

Definition at line 72 of file memorystream.h.

Ch MemoryStream::Peek ( ) const
inline

Definition at line 50 of file memorystream.h.

const Ch* MemoryStream::Peek4 ( ) const
inline

Definition at line 83 of file memorystream.h.

void MemoryStream::Put ( Ch  )
inline

Definition at line 68 of file memorystream.h.

Ch* MemoryStream::PutBegin ( )
inline

Definition at line 63 of file memorystream.h.

size_t MemoryStream::PutEnd ( Ch )
inline

Definition at line 76 of file memorystream.h.

Ch MemoryStream::Take ( )
inline

Definition at line 54 of file memorystream.h.

size_t MemoryStream::Tell ( ) const
inline

Definition at line 58 of file memorystream.h.

Member Data Documentation

const Ch* MemoryStream::begin_

Original head of the string.

Definition at line 89 of file memorystream.h.

const Ch* MemoryStream::end_

End of stream.

Definition at line 90 of file memorystream.h.

size_t MemoryStream::size_

Size of the stream.

Definition at line 91 of file memorystream.h.

const Ch* MemoryStream::src_

Current read position.

Definition at line 88 of file memorystream.h.


The documentation for this struct was generated from the following file:


xbot_talker
Author(s): wangxiaoyun
autogenerated on Sat Oct 10 2020 03:27:54