InputStream.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00012 #ifndef ZYPP_BASE_INPUTSTREAM_H
00013 #define ZYPP_BASE_INPUTSTREAM_H
00014
00015 #include <iosfwd>
00016
00017 #include "zypp/base/PtrTypes.h"
00018 #include "zypp/base/DefaultIntegral.h"
00019 #include "zypp/Pathname.h"
00020
00022 namespace zypp
00023 {
00024
00026
00027
00028
00056 class InputStream
00057 {
00058 public:
00060 InputStream();
00061
00063 InputStream( std::istream & stream_r,
00064 const std::string & name_r = std::string() );
00065
00067 InputStream( const Pathname & file_r );
00068
00070 InputStream( const Pathname & file_r,
00071 const std::string & name_r );
00072
00074 InputStream( const std::string & file_r );
00075
00077 InputStream( const std::string & file_r,
00078 const std::string & name_r );
00079
00081 InputStream( const char * file_r );
00082
00084 InputStream( const char * file_r,
00085 const std::string & name_r );
00086
00088 ~InputStream();
00089
00093 std::istream & stream() const
00094 { return *_stream; }
00095
00097 operator std::istream &() const
00098 { return *_stream; }
00099
00107 const std::string & name() const
00108 { return _name; }
00109
00111 const Pathname & path() const
00112 { return _path; }
00113
00118 std::streamoff size() const
00119 { return _size; }
00120
00127 void setSize( std::streamoff val_r )
00128 { _size = val_r; }
00129
00130 private:
00131 Pathname _path;
00132 shared_ptr<std::istream> _stream;
00133 std::string _name;
00134 DefaultIntegral<std::streamoff,-1> _size;
00135 };
00137
00139 std::ostream & operator<<( std::ostream & str, const InputStream & obj );
00140
00142 }
00144 #endif // ZYPP_BASE_INPUTSTREAM_H