Marine Library  1.0
C++ library for Linux Networking Development
Public Member Functions | Static Public Attributes | List of all members
CDataStreamBase Class Reference

Base class of CInByteStream, COutByteStreamBasic. More...

#include <data_stream_impl.hh>

Public Member Functions

void status (int code)
 Set error status. More...
 
int status () const
 Get error status. More...
 
bool operator! () const
 Test if current error status is NOT 0. More...
 
 operator __SafeBool () const
 Test if current error status is 0, same as good(). More...
 
bool good () const
 Test if current error status is 0, same as operator __SafeBool(). More...
 
void netByteOrder (bool nb)
 Set byte order. More...
 
void littleEndian (bool endian)
 Set byte order. More...
 
bool littleEndian () const
 Get byte order. More...
 

Static Public Attributes

static const bool kByteOrderDefault = true
 Byte order of the underlying data buffer, default Net Byte Order. More...
 

Detailed Description

Base class of CInByteStream, COutByteStreamBasic.

Warning
This class is NOT intended for direct use.

Member Function Documentation

bool CDataStreamBase::good ( ) const
inline

Test if current error status is 0, same as operator __SafeBool().

Sample code:

CInByteStream in(buf);
if(in.good(){
// 'in' is in good status
}
Returns
  • true: Status is 0
  • false: Status is NOT 0
void CDataStreamBase::littleEndian ( bool  endian)
inline

Set byte order.

Parameters
endian
  • true: Little endian (Net Byte Order)
  • false: Big endian
bool CDataStreamBase::littleEndian ( ) const
inline

Get byte order.

Returns
  • true: Little endian
  • false: Big endian
void CDataStreamBase::netByteOrder ( bool  nb)
inline

Set byte order.

Parameters
nb
  • true: Net Byte Order (Little Endian)
  • false: Host Byte Order
CDataStreamBase::operator __SafeBool ( ) const
inline

Test if current error status is 0, same as good().

Sample code:

CInByteStream in(buf);
if(in){
// 'in' is in good status
}
Returns
  • true: Status is 0
  • false: Status is NOT 0
See also
good()
bool CDataStreamBase::operator! ( ) const
inline

Test if current error status is NOT 0.

Sample code:

CInByteStream in(buf);
if(!in){
// 'in' is in error status, something is wrong
}
Returns
  • true: Status is NOT 0
  • false: Status is 0
void CDataStreamBase::status ( int  code)
inline

Set error status.

If status is NOT 0, all packing/unpacking operations will fail.

Parameters
codeNew status
int CDataStreamBase::status ( ) const
inline

Get error status.

Returns
Current status

Member Data Documentation

const bool CDataStreamBase::kByteOrderDefault = true
static

Byte order of the underlying data buffer, default Net Byte Order.


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