InputStream.cc

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #include <iostream>
00013 #include "zypp/base/LogTools.h"
00014 
00015 #include "zypp/base/InputStream.h"
00016 #include "zypp/base/GzStream.h"
00017 
00018 using std::endl;
00019 
00021 namespace zypp
00022 { 
00023 
00025   //
00026   //    METHOD NAME : InputStream::InputStream
00027   //    METHOD TYPE : Constructor
00028   //
00029   InputStream::InputStream()
00030   : _stream( &std::cin, NullDeleter() )
00031   , _name( "STDIN" )
00032   {}
00033 
00035   //
00036   //    METHOD NAME : InputStream::InputStream
00037   //    METHOD TYPE : Constructor
00038   //
00039   InputStream::InputStream( std::istream & stream_r,
00040                             const std::string & name_r )
00041   : _stream( &stream_r, NullDeleter() )
00042   , _name( name_r )
00043   {}
00044 
00046   //
00047   //    METHOD NAME : InputStream::InputStream
00048   //    METHOD TYPE : Constructor
00049   //
00050   InputStream::InputStream( const Pathname & file_r )
00051   : _path( file_r )
00052   , _stream( new ifgzstream( _path.asString().c_str() ) )
00053   , _name( _path.asString() )
00054   {}
00055 
00057   //
00058   //    METHOD NAME : InputStream::InputStream
00059   //    METHOD TYPE : Constructor
00060   //
00061   InputStream::InputStream( const Pathname & file_r,
00062                             const std::string & name_r )
00063   : _path( file_r )
00064   , _stream( new ifgzstream( _path.asString().c_str() ) )
00065   , _name( name_r )
00066   {}
00067 
00069   //
00070   //    METHOD NAME : InputStream::InputStream
00071   //    METHOD TYPE : Constructor
00072   //
00073   InputStream::InputStream( const std::string & file_r )
00074   : _path( file_r )
00075   , _stream( new ifgzstream( _path.asString().c_str() ) )
00076   , _name( _path.asString() )
00077   {}
00078 
00080   //
00081   //    METHOD NAME : InputStream::InputStream
00082   //    METHOD TYPE : Constructor
00083   //
00084   InputStream::InputStream( const std::string & file_r,
00085                             const std::string & name_r )
00086   : _path( file_r )
00087   , _stream( new ifgzstream( _path.asString().c_str() ) )
00088   , _name( name_r )
00089   {}
00090 
00092   //
00093   //    METHOD NAME : InputStream::InputStream
00094   //    METHOD TYPE : Constructor
00095   //
00096   InputStream::InputStream( const char * file_r )
00097   : _path( file_r )
00098   , _stream( new ifgzstream( _path.asString().c_str() ) )
00099   , _name( _path.asString() )
00100   {}
00101 
00103   //
00104   //    METHOD NAME : InputStream::InputStream
00105   //    METHOD TYPE : Constructor
00106   //
00107   InputStream::InputStream( const char * file_r,
00108                             const std::string & name_r )
00109   : _path( file_r )
00110   , _stream( new ifgzstream( _path.asString().c_str() ) )
00111   , _name( name_r )
00112   {}
00113 
00115   //
00116   //    METHOD NAME : InputStream::~InputStream
00117   //    METHOD TYPE : Destructor
00118   //
00119   InputStream::~InputStream()
00120   {}
00121 
00122   /******************************************************************
00123    **
00124    **   FUNCTION NAME : operator<<
00125    **   FUNCTION TYPE : std::ostream &
00126   */
00127   std::ostream & operator<<( std::ostream & str, const InputStream & obj )
00128   {
00129     return str << obj.name() << obj.stream();
00130   }
00131 
00133 } // namespace zypp

Generated on Tue Nov 28 16:49:28 2006 for zypp by  doxygen 1.5.0