Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2003-11-28 19:06:38


Firstly: apoligies for not doing this sooner. I have been busy with other
things.

http://groups.yahoo.com/group/boost/files/IOFmtManip/source.zip

The source and examples for the library. This contains some minor updates to
my last submission.

http://groups.yahoo.com/group/boost/files/IOFmtManip/documentation.zip

I have finally written the documentation! The main bulk of the documentation
is currently in text format (documentation.txt). I will move this over to my
DocumentML format (documentation.xml) and post the result as a HTML file.

The library is aimed at simplifying the output of data types like C-style
arrays and STL containers, while allowing the user to control the way the
data is formatted in a simple, intuitive way.

Example Usage:

#include <boost/io/stl_io.hpp>
#include <boost/io/formatlist.hpp>
#include <boost/io/formatob.hpp>

std::list< std::list< char > > tictactoe;

tictactoe.push_back( std::list< char >());
tictactoe.back().push_back( 'O' );
tictactoe.back().push_back( 'X' );
tictactoe.back().push_back( 'O' );
tictactoe.push_back( std::list< char >());
tictactoe.back().push_back( 'X' );
tictactoe.back().push_back( 'O' );
tictactoe.back().push_back( 'X' );
tictactoe.push_back( std::list< char >());
tictactoe.back().push_back( 'O' );
tictactoe.back().push_back( 'X' );
tictactoe.back().push_back( 'O' );

// needs partial template specialisation:
std::cout << "deduced output: " << boost::io::formatob( tictactoe ) << '\n';
// [results:] deduced output: [ [ O, X, O ], [ X, O, X ], [ O, X, O ] ]

std::vector< int > v( 4 );
v[ 0 ] = 3;
v[ 1 ] = 4;
v[ 2 ] = 5;
v[ 3 ] = 6;

std::cout << boost::io::formatlist( v ).format( "| ", " |" ).format( " : "
);
// [results]: | 3 : 4 : 5 : 6 |

std::cout << "vector< int > = " << v << '\n';
// [results]: [ 3, 4, 5, 6 ]

std::map< std::string, int > m;
m[ "hello" ] = 5;
m[ "world" ] = 5;
m[ "STL rules!" ] = 11;

std::cout << m << '\n';
// [results]: [ ( STL rules!, 11 ), ( hello, 5 ), ( world, 5 ) ]

Regards,
Reece H. Dunn

_________________________________________________________________
Express yourself with cool emoticons - download MSN Messenger today!
http://www.msn.co.uk/messenger


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk