zypp::iostr::EachLine Class Reference

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

#include <IOStream.h>

Inheritance diagram for zypp::iostr::EachLine:
[legend]

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.
bool next ()
 Advance to next line.
bool next (unsigned num_r)
 Advance num_r lines.

Private Types

typedef
base::SafeBool
< EachLine
SafeBool

Private Member Functions

friend SafeBool::operator bool_type () const
bool boolTest () const

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 60 of file IOStream.h.


Member Typedef Documentation

typedef base::SafeBool<EachLine> zypp::iostr::EachLine::SafeBool [private]

Definition at line 62 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 56 of file IOStream.cc.

References next().


Member Function Documentation

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

Whether this contains a valid line to consume.

Definition at line 72 of file IOStream.h.

References boolTest().

Referenced by next().

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

Return the current line number.

Definition at line 76 of file IOStream.h.

References _lineNo.

Referenced by zypp::parser::TagParser::parse(), and zypp::parser::susetags::ContentFileReader::parse().

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

Definition at line 79 of file IOStream.h.

References _lineStart.

Referenced by zypp::parser::TagParser::parse().

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

Set current line number.

Definition at line 83 of file IOStream.h.

References _lineNo.

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

Access the current line.

Definition at line 87 of file IOStream.h.

References _line.

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

Advance to next line.

Definition at line 70 of file IOStream.cc.

References _line, _lineNo, _lineStart, _str, _valid, and zypp::str::getline().

Referenced by EachLine(), next(), zypp::parser::TagParser::parse(), zypp::parser::susetags::ContentFileReader::parse(), and zypp::parser::IniParser::parse().

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

Advance num_r lines.

Definition at line 94 of file IOStream.h.

References next(), and valid().

zypp::iostr::EachLine::SafeBool::operator bool_type (  )  const [private]

bool zypp::iostr::EachLine::boolTest (  )  const [inline, private]

Definition at line 103 of file IOStream.h.

References _valid.

Referenced by valid().


Member Data Documentation

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

Definition at line 107 of file IOStream.h.

Referenced by next().

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

Definition at line 108 of file IOStream.h.

Referenced by next(), and operator *().

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

Definition at line 109 of file IOStream.h.

Referenced by lineStart(), and next().

unsigned zypp::iostr::EachLine::_lineNo [private]

Definition at line 110 of file IOStream.h.

Referenced by lineNo(), next(), and setLineNo().

bool zypp::iostr::EachLine::_valid [private]

Definition at line 111 of file IOStream.h.

Referenced by boolTest(), and next().


The documentation for this class was generated from the following files:
Generated on Tue Sep 25 19:23:20 2007 for libzypp by  doxygen 1.5.3