Dv::Util::nocommentstream Class Reference

A nocommentstream is an istream that strips '#' comments. More...

#include <nocomment.h>

Collaboration diagram for Dv::Util::nocommentstream:
Collaboration graph
[legend]

List of all members.

Classes

class  NoCommentFilter
 Implements Filter interface for filterstreambuf. More...

Public Member Functions

 nocommentstream (std::istream &is)
 Constructor.
 ~nocommentstream ()
 Destructor.

Private Attributes

NoCommentFilter filter_
 Filter.

Detailed Description

A nocommentstream is an istream that strips '#' comments.

All characters following (and including) a '#' are ignored up to (but not including) the next newline character.

Example usage:

 std::ifstream ifs("config.txt");
 if (!ifs)
   throw std::runtime_error("config.txt: cannot open");
 Dv::Util::nocommentstream nocifs(ifs);
 std::string line;
 while ( std::getline(nocifs, line) ) {
   // line does not contain comments
   }

Definition at line 34 of file nocomment.h.


Constructor & Destructor Documentation

Dv::Util::nocommentstream::nocommentstream ( std::istream &  is  ) 

Constructor.

Parameters:
is open stream from which original input is taken
Dv::Util::nocommentstream::~nocommentstream (  ) 

Destructor.


Member Data Documentation

Filter.

Definition at line 59 of file nocomment.h.


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

dvutil-1.0.10 [ 5 December, 2009]