jigdo API

ConfigFile::iterator Class Reference

The iterators hide the fact that a ConfigFile is not a list<string>. More...

#include <configfile.hh>

List of all members.


Public Member Functions

 iterator ()
 iterator (const iterator &i)
iteratoroperator= (const iterator &i)
reference operator* () const
reference operator* ()
string * operator-> () const
string * operator-> ()
iteratoroperator++ ()
iteratoroperator-- ()
bool operator== (const iterator i) const
bool operator!= (const iterator i) const
bool isSection () const
 Is this line a [section] line?
bool isSection (const string &sectName) const
 Is this line a [section] line with the given name?
iteratornextSection ()
 Advance iterator to next [section] line.
iteratornextSection (const string &sectName)
 Advance iterator to next [section] line with given section name.
bool nextLabel ()
 Advance iterator to next non-empty, non-comment line.
bool prevLabel ()
 Advance to previous non-empty, non-comment line.
size_t nextLabel (const string &labelName)
 Advance iterator to next label line with given label name, or to next [section] line, whichever comes first.
bool setLabelOffsets (size_t &begin, size_t &end, size_t &value)
 Overwrite arguments with offset of first character of label name, offset of first character after label name, and offset of first character after the '='.

Friends

class ConfigFile

Detailed Description

The iterators hide the fact that a ConfigFile is not a list<string>.


Constructor & Destructor Documentation

ConfigFile::iterator::iterator (  )  [inline]

ConfigFile::iterator::iterator ( const iterator i  )  [inline]


Member Function Documentation

iterator& ConfigFile::iterator::operator= ( const iterator i  )  [inline]

References p.

reference ConfigFile::iterator::operator* (  )  const [inline]

reference ConfigFile::iterator::operator* (  )  [inline]

string* ConfigFile::iterator::operator-> (  )  const [inline]

string* ConfigFile::iterator::operator-> (  )  [inline]

iterator& ConfigFile::iterator::operator++ (  )  [inline]

iterator& ConfigFile::iterator::operator-- (  )  [inline]

bool ConfigFile::iterator::operator== ( const iterator  i  )  const [inline]

References p.

bool ConfigFile::iterator::operator!= ( const iterator  i  )  const [inline]

References p.

bool ConfigFile::iterator::isSection (  )  const [inline]

Is this line a [section] line?

Referenced by ConfigFile::find(), isSection(), nextLabel(), nextSection(), prevLabel(), and setLabelOffsets().

bool ConfigFile::iterator::isSection ( const string &  sectName  )  const

Is this line a [section] line with the given name?

References ConfigFile::advanceWhitespace(), Assert, isSection(), and x.

ConfigFile::iterator & ConfigFile::iterator::nextSection (  )  [inline]

Advance iterator to next [section] line.

Efficient only if current line is also a [section] line - otherwise, does linear search. Results in *this == end() if no more sections. Does not look at the string; only relies on the info created during rescan().

References isSection().

Referenced by ConfigFile::find(), ConfigFile::firstSection(), main(), ConfigFile::Find::next(), nextSection(), and JigdoConfig::rescan().

ConfigFile::iterator & ConfigFile::iterator::nextSection ( const string &  sectName  ) 

Advance iterator to next [section] line with given section name.

Assumes that rescan() has been called, if it hasn't then assertions will fail. sectName should be a correct section name, i.e. no whitespace at start or end.

References isSection(), and nextSection().

bool ConfigFile::iterator::nextLabel (  )  [inline]

Advance iterator to next non-empty, non-comment line.

If it is a label line, return true. Otherwise (a [section] line, or at end()), return false.

References ConfigFile::advanceWhitespace(), isSection(), and x.

Referenced by ConfigFile::Find::next(), and JigdoConfig::rescan().

bool ConfigFile::iterator::prevLabel (  )  [inline]

Advance to previous non-empty, non-comment line.

References ConfigFile::advanceWhitespace(), isSection(), and x.

size_t ConfigFile::iterator::nextLabel ( const string &  labelName  ) 

Advance iterator to next label line with given label name, or to next [section] line, whichever comes first.

Results in this == end() if no more sections and label not found. Returns 0 if unsuccessful, i.e. iterator points to [section] line or to end(). Otherwise, returns offset to the entry's value; offset in line of first character after '='. labelName must not start or end with spaces.

References ConfigFile::advanceWhitespace(), isSection(), and x.

bool ConfigFile::iterator::setLabelOffsets ( size_t &  begin,
size_t &  end,
size_t &  value 
)

Overwrite arguments with offset of first character of label name, offset of first character after label name, and offset of first character after the '='.

Returns false if this is not a label line.

References ConfigFile::advanceWhitespace(), isSection(), and x.

Referenced by JigdoConfig::rescan().


Friends And Related Function Documentation

friend class ConfigFile [friend]


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

Generated on Tue Sep 23 14:27:42 2008 for jigdo by  doxygen 1.5.6