libzypp  11.13.5
zypp::iostr::EachLine Class Reference

Simple lineparser: Traverse each line in a file. More...

#include <IOStream.h>

Inheritance diagram for zypp::iostr::EachLine:

List of all members.

Public Member Functions

 EachLine (std::istream &str_r, unsigned lineNo_r=0)
 Ctor taking a stream and reading the 1st line from it.
bool valid () const
 Whether this contains a valid line to consume.
unsigned lineNo () const
 Return the current line number.
std::streamoff lineStart () const
void setLineNo (unsigned lineNo_r)
 Set current line number.
const std::string & operator* () const
 Access the current line.
std::string & operator* ()
const std::string * operator-> () const
 Access the current line.
bool next ()
 Advance to next line.
bool next (unsigned num_r)
 Advance num_r lines.

Private Types

typedef base::SafeBool< EachLineSafeBool

Private Member Functions

friend SafeBool::operator bool_type () const
bool boolTest () const
- Private Member Functions inherited from zypp::base::SafeBool< EachLine >
 operator bool_type () const
 ~SafeBool ()

Private Attributes

std::istream & _str
std::string _line
std::streamoff _lineStart
unsigned _lineNo
bool _valid

Detailed Description

Simple lineparser: Traverse each line in a file.

std::ifstream infile( "somefile" );
for( iostr::EachLine in( infile ); in; in.next() )
{
DBG << *in << endl;
}

Definition at line 112 of file IOStream.h.


Member Typedef Documentation

Definition at line 114 of file IOStream.h.


Constructor & Destructor Documentation

zypp::iostr::EachLine::EachLine ( std::istream &  str_r,
unsigned  lineNo_r = 0 
)

Ctor taking a stream and reading the 1st line from it.

Definition at line 58 of file IOStream.cc.


Member Function Documentation

bool zypp::iostr::EachLine::valid ( ) const
inline

Whether this contains a valid line to consume.

Definition at line 124 of file IOStream.h.

unsigned zypp::iostr::EachLine::lineNo ( ) const
inline

Return the current line number.

Definition at line 128 of file IOStream.h.

std::streamoff zypp::iostr::EachLine::lineStart ( ) const
inline

Definition at line 131 of file IOStream.h.

void zypp::iostr::EachLine::setLineNo ( unsigned  lineNo_r)
inline

Set current line number.

Definition at line 135 of file IOStream.h.

const std::string& zypp::iostr::EachLine::operator* ( ) const
inline

Access the current line.

Definition at line 139 of file IOStream.h.

std::string& zypp::iostr::EachLine::operator* ( )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 142 of file IOStream.h.

const std::string* zypp::iostr::EachLine::operator-> ( ) const
inline

Access the current line.

Definition at line 146 of file IOStream.h.

bool zypp::iostr::EachLine::next ( )

Advance to next line.

Definition at line 72 of file IOStream.cc.

bool zypp::iostr::EachLine::next ( unsigned  num_r)
inline

Advance num_r lines.

Definition at line 153 of file IOStream.h.

zypp::iostr::EachLine::SafeBool::operator bool_type ( ) const
private
bool zypp::iostr::EachLine::boolTest ( ) const
inlineprivate

Definition at line 162 of file IOStream.h.


Member Data Documentation

std::istream& zypp::iostr::EachLine::_str
private

Definition at line 166 of file IOStream.h.

std::string zypp::iostr::EachLine::_line
private

Definition at line 167 of file IOStream.h.

std::streamoff zypp::iostr::EachLine::_lineStart
private

Definition at line 168 of file IOStream.h.

unsigned zypp::iostr::EachLine::_lineNo
private

Definition at line 169 of file IOStream.h.

bool zypp::iostr::EachLine::_valid
private

Definition at line 170 of file IOStream.h.


The documentation for this class was generated from the following files: