byteme
C++ wrappers for buffered inputs
All Classes Namespaces Files Functions Pages
byteme::OstreamWriter< Pointer_ > Class Template Reference

Read bytes from a std::ostream. More...

#include <OstreamWriter.hpp>

Inheritance diagram for byteme::OstreamWriter< Pointer_ >:
Collaboration diagram for byteme::OstreamWriter< Pointer_ >:

Public Member Functions

 OstreamWriter (Pointer_ output)
 
void write (const unsigned char *buffer, size_t n)
 
void finish ()
 
void write (const std::string &x)
 
void write (const char *x)
 
void write (char x)
 
- Public Member Functions inherited from byteme::Writer
void write (const std::string &x)
 
void write (const char *x)
 
void write (char x)
 

Detailed Description

template<class Pointer_ = std::ostream*>
class byteme::OstreamWriter< Pointer_ >

Read bytes from a std::ostream.

Template Parameters
Pointer_A (possibly smart) pointer to an std::ostream object.

This is just a wrapper around std::ostream::write for compatibility.

Constructor & Destructor Documentation

◆ OstreamWriter()

template<class Pointer_ = std::ostream*>
byteme::OstreamWriter< Pointer_ >::OstreamWriter ( Pointer_ output)
inline
Parameters
outputPointer to an output stream. This is assumed to live until finish() is called.

Member Function Documentation

◆ finish()

template<class Pointer_ = std::ostream*>
void byteme::OstreamWriter< Pointer_ >::finish ( )
inlinevirtual

Indicate that the writing has finished and that the relevant clean-up (buffer flushing, file closing, etc.) should be performed. This should be called exactly once, after which no further calls to write() or finish() should be performed.

Implements byteme::Writer.

◆ write() [1/4]

template<class Pointer_ = std::ostream*>
void byteme::Writer::write ( char x)
inline

Write a single character to the output sink.

Parameters
xCharacter to be written.

◆ write() [2/4]

template<class Pointer_ = std::ostream*>
void byteme::Writer::write ( const char * x)
inline

Write a null-terminated C-string to the output sink.

Parameters
[in]xPointer to the string to be written.

◆ write() [3/4]

template<class Pointer_ = std::ostream*>
void byteme::Writer::write ( const std::string & x)
inline

Write a string to the output sink.

Parameters
xString to be written.

◆ write() [4/4]

template<class Pointer_ = std::ostream*>
void byteme::OstreamWriter< Pointer_ >::write ( const unsigned char * buffer,
size_t n )
inlinevirtual

Write the next chunk of bytes to the output sink. This may or may not be internally buffered at the discretion of the concrete class.

Parameters
[in]bufferPointer to the start of an array containing the bytes to be written.
nLength of the array in buffer.

Implements byteme::Writer.


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