Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

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.

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

NoCommentFilter Dv::Util::nocommentstream::filter_ [private]
 

Filter.

Definition at line 59 of file nocomment.h.


The documentation for this class was generated from the following file:
dvutil-0.13.15 [30 December, 2004]