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

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.

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.
  • output The new object.
  • name The filename.



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>
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.

  • output The new object.
  • name The filename.

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

Definition at line 171 of file stream_wrapper.hh.

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 Thu Apr 15 20:16:29 2004 for Olena by doxygen 1.3.6-20040222