libzypp
13.10.6
|
Helper to create and pass std::istream. More...
#include <InputStream.h>
Public Member Functions | |
InputStream () | |
Default ctor providing std::cin . More... | |
InputStream (std::istream &stream_r, const std::string &name_r=std::string()) | |
Ctor providing an aleady existig std::istream . More... | |
InputStream (const Pathname &file_r) | |
Ctor for reading a (gziped) file. More... | |
InputStream (const Pathname &file_r, const std::string &name_r) | |
Ctor for reading a (gziped) file. More... | |
InputStream (const std::string &file_r) | |
Ctor for reading a (gziped) file. More... | |
InputStream (const std::string &file_r, const std::string &name_r) | |
Ctor for reading a (gziped) file. More... | |
InputStream (const char *file_r) | |
Ctor for reading a (gziped) file. More... | |
InputStream (const char *file_r, const std::string &name_r) | |
Ctor for reading a (gziped) file. More... | |
~InputStream () | |
Dtor. More... | |
std::istream & | stream () const |
The std::istream. More... | |
operator std::istream & () const | |
Allow implicit conversion to std::istream. More... | |
const std::string & | name () const |
Name of the std::istream. More... | |
const Pathname & | path () const |
Path to the input file or empty if no file. More... | |
std::streamoff | size () const |
Size of the input stream (informal). More... | |
void | setSize (std::streamoff val_r) |
Set the size of the input stream. More... | |
Private Attributes | |
Pathname | _path |
shared_ptr< std::istream > | _stream |
std::string | _name |
DefaultIntegral < std::streamoff,-1 > | _size |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &str, const InputStream &obj) |
Helper to create and pass std::istream.
The provided std::istream may either be std::cin, sone (gziped) file or an aleady existig std::istream
.
An optional name
arument may be passed to the ctor, to identify the stream in log messages, even if it is not a file.
Per default the name is "STDIN", the path to an input file or empty.
Definition at line 56 of file InputStream.h.
zypp::InputStream::InputStream | ( | ) |
Default ctor providing std::cin
.
Definition at line 47 of file InputStream.cc.
zypp::InputStream::InputStream | ( | std::istream & | stream_r, |
const std::string & | name_r = std::string() |
||
) |
Ctor providing an aleady existig std::istream
.
Definition at line 57 of file InputStream.cc.
zypp::InputStream::InputStream | ( | const Pathname & | file_r | ) |
Ctor for reading a (gziped) file.
Definition at line 68 of file InputStream.cc.
zypp::InputStream::InputStream | ( | const Pathname & | file_r, |
const std::string & | name_r | ||
) |
Ctor for reading a (gziped) file.
Definition at line 80 of file InputStream.cc.
zypp::InputStream::InputStream | ( | const std::string & | file_r | ) |
Ctor for reading a (gziped) file.
Definition at line 93 of file InputStream.cc.
zypp::InputStream::InputStream | ( | const std::string & | file_r, |
const std::string & | name_r | ||
) |
Ctor for reading a (gziped) file.
Definition at line 105 of file InputStream.cc.
zypp::InputStream::InputStream | ( | const char * | file_r | ) |
Ctor for reading a (gziped) file.
Definition at line 118 of file InputStream.cc.
zypp::InputStream::InputStream | ( | const char * | file_r, |
const std::string & | name_r | ||
) |
Ctor for reading a (gziped) file.
Definition at line 130 of file InputStream.cc.
zypp::InputStream::~InputStream | ( | ) |
Dtor.
Definition at line 143 of file InputStream.cc.
|
inline |
The std::istream.
const
. Definition at line 93 of file InputStream.h.
|
inline |
Allow implicit conversion to std::istream.
Definition at line 97 of file InputStream.h.
|
inline |
Name of the std::istream.
Per default this is "STDIN", the path to an input file or empty. A custom string may be provided to the ctor.
This may be used in log messages to identify the stream even even if it is not a file.
Definition at line 107 of file InputStream.h.
|
inline |
Path to the input file or empty if no file.
Definition at line 111 of file InputStream.h.
|
inline |
Size of the input stream (informal).
If constructed from an uncompressed file, the file size. Otherwise -1
. See setSize;
Definition at line 118 of file InputStream.h.
|
inline |
Set the size of the input stream.
You may set it to whatever vaule is appropriate. E.g. *=10
to compensate gzip comression. or the number of items, lines, ... The value is not used here, just provided.
Definition at line 127 of file InputStream.h.
|
related |
Stream output
Definition at line 151 of file InputStream.cc.
|
private |
Definition at line 131 of file InputStream.h.
|
private |
Definition at line 132 of file InputStream.h.
|
private |
Definition at line 133 of file InputStream.h.
|
private |
Definition at line 134 of file InputStream.h.