Public Member Functions | Private Attributes | Friends

ana::serializer::bostream Class Reference

Output stream serialization. More...

#include <binary_streams.hpp>

Collaboration diagram for ana::serializer::bostream:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 bostream ()
 Standard constructor.
template<class T >
bostreamoperator<< (T x)
 Insert any object to the stream.
bostreamoperator<< (const std::string &s)
 Insert a string to the stream.
template<class Other >
bostreamoperator<< (const std::vector< Other > &vec)
 Insert a vector of elements.
bostreamoperator<< (const char *cs)
 Insert a literal string.
const std::string & str () const
 Obtain the string representing the stream.
void clear ()
 Clear the stream.

Private Attributes

std::string _s
 The representation of the stream in memory.

Friends

struct _inserter_helper

Detailed Description

Output stream serialization.

This class provides stream functionality to serialize objects in a way similar to that of std::cout or std::ostringstream.

Extracted from MiLi (mili.googlecode.com).

An extensive example of its usage can be seen in: http://code.google.com/p/mili/source/browse/trunk/example_binary-streams.cpp

Definition at line 89 of file binary_streams.hpp.


Constructor & Destructor Documentation

ana::serializer::bostream::bostream (  )  [inline]

Standard constructor.

Definition at line 100 of file binary_streams.hpp.


Member Function Documentation

void ana::serializer::bostream::clear (  )  [inline]

Clear the stream.

Enables the user to use it several times.

Definition at line 155 of file binary_streams.hpp.

References _s.

template<class Other >
bostream& ana::serializer::bostream::operator<< ( const std::vector< Other > &  vec  )  [inline]

Insert a vector of elements.

Definition at line 131 of file binary_streams.hpp.

bostream& ana::serializer::bostream::operator<< ( const std::string &  s  )  [inline]

Insert a string to the stream.

Definition at line 120 of file binary_streams.hpp.

References _s.

bostream& ana::serializer::bostream::operator<< ( const char *  cs  )  [inline]

Insert a literal string.

Definition at line 142 of file binary_streams.hpp.

References operator<<().

Here is the call graph for this function:

template<class T >
bostream& ana::serializer::bostream::operator<< ( x  )  [inline]

Insert any object to the stream.

Parameters:
x : A copy of the object being inserted.

Definition at line 111 of file binary_streams.hpp.

Referenced by operator<<().

Here is the caller graph for this function:

const std::string& ana::serializer::bostream::str (  )  const [inline]

Obtain the string representing the stream.

Definition at line 149 of file binary_streams.hpp.

References _s.

Referenced by ana_network_manager::create_client_and_connect(), ana_network_manager::handle_receive(), and asio_sender::send().

Here is the caller graph for this function:


Friends And Related Function Documentation

friend struct _inserter_helper [friend]

Definition at line 92 of file binary_streams.hpp.


Member Data Documentation

std::string ana::serializer::bostream::_s [private]

The representation of the stream in memory.

Definition at line 163 of file binary_streams.hpp.

Referenced by clear(), operator<<(), and str().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:19:18 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs