1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/base/InputStream.cc
13 #include "zypp/base/LogTools.h"
15 #include "zypp/base/InputStream.h"
16 #include "zypp/base/GzStream.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////
26 // METHOD NAME : InputStream::InputStream
27 // METHOD TYPE : Constructor
29 InputStream::InputStream()
30 : _stream( &std::cin, NullDeleter() )
34 ///////////////////////////////////////////////////////////////////
36 // METHOD NAME : InputStream::InputStream
37 // METHOD TYPE : Constructor
39 InputStream::InputStream( std::istream & stream_r,
40 const std::string & name_r )
41 : _stream( &stream_r, NullDeleter() )
45 ///////////////////////////////////////////////////////////////////
47 // METHOD NAME : InputStream::InputStream
48 // METHOD TYPE : Constructor
50 InputStream::InputStream( const Pathname & file_r )
52 , _stream( new ifgzstream( _path.asString().c_str() ) )
53 , _name( _path.asString() )
56 ///////////////////////////////////////////////////////////////////
58 // METHOD NAME : InputStream::InputStream
59 // METHOD TYPE : Constructor
61 InputStream::InputStream( const Pathname & file_r,
62 const std::string & name_r )
64 , _stream( new ifgzstream( _path.asString().c_str() ) )
68 ///////////////////////////////////////////////////////////////////
70 // METHOD NAME : InputStream::InputStream
71 // METHOD TYPE : Constructor
73 InputStream::InputStream( const std::string & file_r )
75 , _stream( new ifgzstream( _path.asString().c_str() ) )
76 , _name( _path.asString() )
79 ///////////////////////////////////////////////////////////////////
81 // METHOD NAME : InputStream::InputStream
82 // METHOD TYPE : Constructor
84 InputStream::InputStream( const std::string & file_r,
85 const std::string & name_r )
87 , _stream( new ifgzstream( _path.asString().c_str() ) )
91 ///////////////////////////////////////////////////////////////////
93 // METHOD NAME : InputStream::InputStream
94 // METHOD TYPE : Constructor
96 InputStream::InputStream( const char * file_r )
98 , _stream( new ifgzstream( _path.asString().c_str() ) )
99 , _name( _path.asString() )
102 ///////////////////////////////////////////////////////////////////
104 // METHOD NAME : InputStream::InputStream
105 // METHOD TYPE : Constructor
107 InputStream::InputStream( const char * file_r,
108 const std::string & name_r )
110 , _stream( new ifgzstream( _path.asString().c_str() ) )
114 ///////////////////////////////////////////////////////////////////
116 // METHOD NAME : InputStream::~InputStream
117 // METHOD TYPE : Destructor
119 InputStream::~InputStream()
122 /******************************************************************
124 ** FUNCTION NAME : operator<<
125 ** FUNCTION TYPE : std::ostream &
127 std::ostream & operator<<( std::ostream & str, const InputStream & obj )
129 return str << obj.name() << obj.stream();
132 /////////////////////////////////////////////////////////////////
134 ///////////////////////////////////////////////////////////////////