LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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:
Collaboration graph
[legend]

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.
 
void setLeadingCharacters (const std::string &s)
 Set the characters to strip from the start of each line.
 
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.

Member Function Documentation

◆ setCommentCharacter()

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

◆ setLeadingCharacters()

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


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