cpp-mate  0.7
Helpful library for C++.
CppMate::WriteStream Class Referencefinal

Represents the byte stream reader with custom byte order. More...

#include <WriteStream.hpp>

Public Member Functions

 WriteStream (std::shared_ptr< BinarySink > sink, ByteOrder byteOrder=ByteOrder::Unknown)
 Constructor. More...
 
 WriteStream (BinarySink *sink, ByteOrder byteOrder=ByteOrder::Unknown)
 Constructor. More...
 
ByteOrder getByteOrder () const
 Returns byte order of the stream. More...
 
template<typename T >
void write (T value)
 Writes item to stream. More...
 
template<typename T >
WriteStreamoperator<< (T value)
 operator << More...
 
void writeString (const char *str)
 Writes string into the stream. More...
 
WriteStreamoperator<< (const char *value)
 operator << More...
 
void writeString (const std::string &str)
 Writes string into the stream. More...
 
WriteStreamoperator<< (const std::string &value)
 operator << More...
 
void writeBytes (const void *data, uint64_t size)
 Writes raw bytes to the stream. More...
 

Detailed Description

Represents the byte stream reader with custom byte order.

Constructor & Destructor Documentation

◆ WriteStream() [1/2]

CppMate::WriteStream::WriteStream ( std::shared_ptr< BinarySink sink,
ByteOrder  byteOrder = ByteOrder::Unknown 
)
inline

Constructor.

Parameters
sinkthe output binary sink.
byteOrderthe byte order of the stream. If the byte order is ByteOrder::Unknown the platform byte order will be used.
Exceptions
std::invalid_argument

◆ WriteStream() [2/2]

CppMate::WriteStream::WriteStream ( BinarySink sink,
ByteOrder  byteOrder = ByteOrder::Unknown 
)
inline

Constructor.

Parameters
sinkthe output binary sink.
byteOrderthe byte order of the stream. If the byte order is ByteOrder::Unknown the platform byte order will be used.
Exceptions
std::invalid_argument

Member Function Documentation

◆ getByteOrder()

ByteOrder CppMate::WriteStream::getByteOrder ( ) const
inline

Returns byte order of the stream.

Returns
byte order of the stream.

◆ operator<<() [1/3]

WriteStream& CppMate::WriteStream::operator<< ( const char *  value)
inline

operator <<

Parameters
valuethe string value to write.
Returns
this

◆ operator<<() [2/3]

WriteStream& CppMate::WriteStream::operator<< ( const std::string &  value)
inline

operator <<

Parameters
valuethe string value to write.
Returns
this

◆ operator<<() [3/3]

template<typename T >
WriteStream& CppMate::WriteStream::operator<< ( value)
inline

operator <<

Parameters
valuethe value to write.
Returns
this

◆ write()

template<typename T >
void CppMate::WriteStream::write ( value)
inline

Writes item to stream.

Parameters
valuethe value to write.
Exceptions
std::ostream::failure

◆ writeBytes()

void CppMate::WriteStream::writeBytes ( const void *  data,
uint64_t  size 
)
inline

Writes raw bytes to the stream.

Parameters
datathe data to write.
sizethe number of bytes to write.
Exceptions
std::invalid_argument,std::ostream::failure

◆ writeString() [1/2]

void CppMate::WriteStream::writeString ( const char *  str)
inline

Writes string into the stream.

Parameters
strthe string to write.
Exceptions
std::invalid_argument,std::ostream::failure

◆ writeString() [2/2]

void CppMate::WriteStream::writeString ( const std::string &  str)
inline

Writes string into the stream.

Parameters
strthe string to write.
Exceptions
std::ostream::failure

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