00001
00002
00003
00004
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
00027
00028
00029 InputStream::InputStream()
00030 : _stream( &std::cin, NullDeleter() )
00031 , _name( "STDIN" )
00032 {}
00033
00035
00036
00037
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
00048
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
00059
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
00071
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
00082
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
00094
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
00105
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
00117
00118
00119 InputStream::~InputStream()
00120 {}
00121
00122
00123
00124
00125
00126
00127 std::ostream & operator<<( std::ostream & str, const InputStream & obj )
00128 {
00129 return str << obj.name() << obj.stream();
00130 }
00131
00133 }