C++ Rest SDK
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Public Types | Public Member Functions | Protected Member Functions | List of all members
Concurrency::streams::basic_ostream< CharType > Class Template Reference

Base interface for all asynchronous output streams. More...

#include <streams.h>

Inheritance diagram for Concurrency::streams::basic_ostream< CharType >:
Concurrency::streams::stdio_ostream< CharType >

Public Types

typedef Concurrency::streams::char_traits< CharType > traits
 
typedef traits::int_type int_type
 
typedef traits::pos_type pos_type
 
typedef traits::off_type off_type
 

Public Member Functions

 basic_ostream ()
 Default constructor More...
 
 basic_ostream (const basic_ostream &other)
 Copy constructor More...
 
basic_ostreamoperator= (const basic_ostream &other)
 Assignment operator More...
 
 basic_ostream (streams::streambuf< CharType > buffer)
 Constructor More...
 
pplx::task< void > close () const
 Close the stream, preventing further write operations. More...
 
pplx::task< void > close (std::exception_ptr eptr) const
 Close the stream with exception, preventing further write operations. More...
 
pplx::task< int_type > write (CharType ch) const
 Put a single character into the stream. More...
 
template<typename T >
pplx::task< size_t > write (T value) const
 Write a single value of "blittable" type T into the stream. More...
 
pplx::task< size_t > write (streams::streambuf< CharType > source, size_t count) const
 Write a number of characters from a given stream buffer into the stream. More...
 
pplx::task< size_t > print (const std::basic_string< CharType > &str) const
 Write the specified string to the output stream. More...
 
template<typename T >
pplx::task< size_t > print (const T &val) const
 Write a value of type T to the output stream. More...
 
template<typename T >
pplx::task< size_t > print_line (const T &val) const
 Write a value of type T to the output stream and append a newline character. More...
 
pplx::task< void > flush () const
 Flush any buffered output data. More...
 
pos_type seek (pos_type pos) const
 Seeks to the specified write position. More...
 
pos_type seek (off_type off, std::ios_base::seekdir way) const
 Seeks to the specified write position. More...
 
pos_type tell () const
 Get the current write position, i.e. the offset from the beginning of the stream. More...
 
bool can_seek () const
 can_seek is used to determine whether the stream supports seeking. More...
 
bool is_valid () const
 Test whether the stream has been initialized with a valid stream buffer. More...
 
 operator bool () const
 Test whether the stream has been initialized or not. More...
 
bool is_open () const
 Test whether the stream is open for writing. More...
 
concurrency::streams::streambuf< CharType > streambuf () const
 Get the underlying stream buffer. More...
 

Protected Member Functions

void set_helper (std::shared_ptr< details::basic_ostream_helper< CharType >> helper)
 

Detailed Description

template<typename CharType>
class Concurrency::streams::basic_ostream< CharType >

Base interface for all asynchronous output streams.

Constructor & Destructor Documentation

template<typename CharType>
Concurrency::streams::basic_ostream< CharType >::basic_ostream ( )
inline

Default constructor

template<typename CharType>
Concurrency::streams::basic_ostream< CharType >::basic_ostream ( const basic_ostream< CharType > &  other)
inline

Copy constructor

Parameters
otherThe source object
template<typename CharType>
Concurrency::streams::basic_ostream< CharType >::basic_ostream ( streams::streambuf< CharType >  buffer)
inline

Constructor

Parameters
bufferA stream buffer.

Member Function Documentation

template<typename CharType>
bool Concurrency::streams::basic_ostream< CharType >::can_seek ( ) const
inline

can_seek is used to determine whether the stream supports seeking.

Returns
true if the stream supports seeking, false otherwise.
template<typename CharType>
pplx::task<void> Concurrency::streams::basic_ostream< CharType >::close ( ) const
inline

Close the stream, preventing further write operations.

template<typename CharType>
pplx::task<void> Concurrency::streams::basic_ostream< CharType >::close ( std::exception_ptr  eptr) const
inline

Close the stream with exception, preventing further write operations.

Parameters
eptrPointer to the exception.
template<typename CharType>
pplx::task<void> Concurrency::streams::basic_ostream< CharType >::flush ( ) const
inline

Flush any buffered output data.

template<typename CharType>
bool Concurrency::streams::basic_ostream< CharType >::is_open ( ) const
inline

Test whether the stream is open for writing.

Returns
true if the stream is open for writing, false otherwise.
template<typename CharType>
bool Concurrency::streams::basic_ostream< CharType >::is_valid ( ) const
inline

Test whether the stream has been initialized with a valid stream buffer.

Returns
true if the stream has been initialized with a valid stream buffer, false otherwise.
template<typename CharType>
Concurrency::streams::basic_ostream< CharType >::operator bool ( ) const
inline

Test whether the stream has been initialized or not.

template<typename CharType>
basic_ostream& Concurrency::streams::basic_ostream< CharType >::operator= ( const basic_ostream< CharType > &  other)
inline

Assignment operator

Parameters
otherThe source object
Returns
A reference to the stream object that contains the result of the assignment.
template<typename CharType>
pplx::task<size_t> Concurrency::streams::basic_ostream< CharType >::print ( const std::basic_string< CharType > &  str) const
inline

Write the specified string to the output stream.

Parameters
strInput string.
template<typename CharType>
template<typename T >
pplx::task<size_t> Concurrency::streams::basic_ostream< CharType >::print ( const T &  val) const
inline

Write a value of type T to the output stream.

Template Parameters
TThe data type of the object to be written to the stream
Parameters
valInput object.
template<typename CharType>
template<typename T >
pplx::task<size_t> Concurrency::streams::basic_ostream< CharType >::print_line ( const T &  val) const
inline

Write a value of type T to the output stream and append a newline character.

Template Parameters
TThe data type of the object to be written to the stream
Parameters
valInput object.
template<typename CharType>
pos_type Concurrency::streams::basic_ostream< CharType >::seek ( pos_type  pos) const
inline

Seeks to the specified write position.

Parameters
posAn offset relative to the beginning of the stream.
Returns
The new position in the stream.
template<typename CharType>
pos_type Concurrency::streams::basic_ostream< CharType >::seek ( off_type  off,
std::ios_base::seekdir  way 
) const
inline

Seeks to the specified write position.

Parameters
offAn offset relative to the beginning, current write position, or the end of the stream.
wayThe starting point (beginning, current, end) for the seek.
Returns
The new position in the stream.
template<typename CharType>
concurrency::streams::streambuf<CharType> Concurrency::streams::basic_ostream< CharType >::streambuf ( ) const
inline

Get the underlying stream buffer.

Returns
The underlying stream buffer.
template<typename CharType>
pos_type Concurrency::streams::basic_ostream< CharType >::tell ( ) const
inline

Get the current write position, i.e. the offset from the beginning of the stream.

Returns
The current write position.
template<typename CharType>
pplx::task<int_type> Concurrency::streams::basic_ostream< CharType >::write ( CharType  ch) const
inline

Put a single character into the stream.

Parameters
chA character
template<typename CharType>
template<typename T >
pplx::task<size_t> Concurrency::streams::basic_ostream< CharType >::write ( value) const
inline

Write a single value of "blittable" type T into the stream.

Parameters
valueA value of type T.

This is not a replacement for a proper binary serialization solution, but it may form the foundation for one. Writing data bit-wise to a stream is a primitive operation of binary serialization. Currently, no attention is paid to byte order. All data is written in the platform's native byte order, which means little-endian on all platforms that have been tested. This function is only available for streams using a single-byte character size.

template<typename CharType>
pplx::task<size_t> Concurrency::streams::basic_ostream< CharType >::write ( streams::streambuf< CharType >  source,
size_t  count 
) const
inline

Write a number of characters from a given stream buffer into the stream.

Parameters
sourceA source stream buffer.
countThe number of characters to write.

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