oln::io::internal::try_stream_wrappers_in< W, T, Reader > Struct Template Reference

Read a stream. More...

#include <stream_wrapper.hh>

List of all members.

Static Public Member Functions

static bool by_extension (T &output, const std::string &name, const std::string &ext)
 Open file as a stream, take extension and call the "real" reader. If the extension is not known, reiterate with a stream_id - 1.
static bool by_data (T &output, const std::string &name)
 Open file as a stream, take extension and call the "real" reader. If the extension is not known, reiterate with a stream_id - 1.


Detailed Description

template<stream_id W, typename T, class Reader>
struct oln::io::internal::try_stream_wrappers_in< W, T, Reader >

Read a stream.

Parameters:
W The type of stream
Reader The real reader of this stream.

Definition at line 135 of file stream_wrapper.hh.


Member Function Documentation

template<stream_id W, typename T, class Reader>
static bool oln::io::internal::try_stream_wrappers_in< W, T, Reader >::by_data ( T &  output,
const std::string &  name 
) [inline, static]

Open file as a stream, take extension and call the "real" reader. If the extension is not known, reiterate with a stream_id - 1.

Todo:
FIXME: it sounds strange to read wrapped file without matching its extension.

Definition at line 171 of file stream_wrapper.hh.

References oln::io::internal::utils::extension().

00172         {
00173           std::string wrapped_name = name;
00174           if (std::istream* in = stream_wrapper<W>::wrap_in(wrapped_name))
00175             {
00176               std::string wrapped_ext = utils::extension(wrapped_name);
00177               bool result = Reader::doit(output, *in, wrapped_ext);
00178               delete in;
00179               if (result)
00180                 return true;
00181             }
00182           return try_stream_wrappers_in<stream_id(unsigned(W)-1), T, Reader>
00183 	           ::by_data(output, name);
00184         }


The documentation for this struct was generated from the following file:
Generated on Tue Feb 20 20:27:27 2007 for Olena by  doxygen 1.5.1