LOOS  v2.3.2
loos::LineReader Class Reference

Class for reading line-by-line from a file while tracking line numbers and stripping comments. More...

#include <LineReader.hpp>

Collaboration diagram for loos::LineReader:

Public Member Functions

 LineReader (std::istream &is)
 
 LineReader (std::istream &is, const std::string &name)
 
void setCommentCharacter (const char c)
 Set the character to use for comments. More...
 
void setLeadingCharacters (const std::string &s)
 Set the characters to strip from the start of each line. More...
 
virtual std::istream & stream () const
 Access the internal stream pointer.
 
virtual void stream (std::istream &is)
 Set the internal stream pointer.
 
virtual std::string name () const
 Access the name associated with the internal stream.
 
virtual void name (const std::string &name)
 Set the name associated with the internal stream.
 
virtual bool getNext ()
 Get the next line from the file, returning true if successful.
 
virtual void push_back (const std::string &s)
 Put a line back onto the file (virtually)
 
virtual std::string line () const
 The currently read line.
 
virtual uint lineNumber () const
 The current line number into the file.
 
virtual void resetLineNumber ()
 

Protected Member Functions

virtual void checkState () const
 
virtual void stripComment (std::string &s) const
 
virtual void stripLeadingWhitespace (std::string &s) const
 
virtual bool skipLine (const std::string &s) const
 

Protected Attributes

std::istream * _is
 
unsigned int _lineno
 
std::string _name
 
char _comment_char
 
std::string _leading_chars
 
std::string _current_line
 
std::list< std::string > _lines
 

Detailed Description

Class for reading line-by-line from a file while tracking line numbers and stripping comments.

Definition at line 39 of file LineReader.hpp.

Member Function Documentation

void loos::LineReader::setCommentCharacter ( const char  c)
inline

Set the character to use for comments.

Setting this to a null char will disable stripping of comments

Definition at line 59 of file LineReader.hpp.

void loos::LineReader::setLeadingCharacters ( const std::string &  s)
inline

Set the characters to strip from the start of each line.

Setting this to an empty string will result in no leading chars being stripped

Definition at line 66 of file LineReader.hpp.


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