Gadget
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
CommentStream Class Reference

This is the class used to strip comments (and whitespace) from any input stream. More...

#include <commentstream.h>

Collaboration diagram for CommentStream:
Collaboration graph

Public Member Functions

 CommentStream ()
 This is the default CommentStream constructor. More...
 
 CommentStream (istream &istr)
 This is the CommentStream constructor for a given input stream. More...
 
 ~CommentStream ()
 This is the default CommentStream destructor. More...
 
void setStream (istream &istr)
 This function will store a given input stream. More...
 
CommentStreamoperator>> (int &a)
 This operator will read data from the CommentStream and store it as an integer. More...
 
CommentStreamoperator>> (double &a)
 This operator will read data from the CommentStream and store it as a double. More...
 
CommentStreamoperator>> (char *a)
 This operator will read data from the CommentStream and store it as a char*. More...
 
CommentStreamoperator>> (__commentmanip func)
 
char peek ()
 This function will inspect (but not read) the next character in the input stream. More...
 
int eof ()
 This function will check to see if the input stream has reached the end of file marker. More...
 
int fail ()
 This function will check to see if the input stream has failed. More...
 
int operator! ()
 This function will check to see if the input stream has failed. More...
 
CommentStreamseekg (streampos pos)
 This function will find the specified position in the input stream. More...
 
streampos tellg ()
 This function will return the current position in the input stream. More...
 
CommentStreamget (char &c)
 This function will read the next character from the input stream. More...
 
CommentStreamgetLine (char *text, int length)
 This function will read the next line from the input stream. More...
 

Protected Member Functions

void killComments ()
 This function will remove the comments and whitespace from the input stream. More...
 

Protected Attributes

istream * istrptr
 This is the input stream that will have the comments and whitespace removed. More...
 

Friends

CommentStreamws (CommentStream &ins)
 

Detailed Description

This is the class used to strip comments (and whitespace) from any input stream.

Constructor & Destructor Documentation

◆ CommentStream() [1/2]

CommentStream::CommentStream ( )
inline

This is the default CommentStream constructor.

◆ CommentStream() [2/2]

CommentStream::CommentStream ( istream &  istr)
inline

This is the CommentStream constructor for a given input stream.

Parameters
istris the given input stream

◆ ~CommentStream()

CommentStream::~CommentStream ( )
inline

This is the default CommentStream destructor.

Member Function Documentation

◆ eof()

int CommentStream::eof ( )
inline

This function will check to see if the input stream has reached the end of file marker.

Returns
1 if the input stream has reached the end of file marker, 0 otherwise

◆ fail()

int CommentStream::fail ( )
inline

This function will check to see if the input stream has failed.

Returns
1 if the input stream has failed, 0 otherwise

◆ get()

CommentStream & CommentStream::get ( char &  c)

This function will read the next character from the input stream.

Parameters
cwill store the next character in the input stream

◆ getLine()

CommentStream & CommentStream::getLine ( char *  text,
int  length 
)

This function will read the next line from the input stream.

Parameters
textwill store the next line in the input stream
lengthis the length of the line to be read from the input stream

◆ killComments()

void CommentStream::killComments ( )
protected

This function will remove the comments and whitespace from the input stream.

◆ operator!()

int CommentStream::operator! ( )
inline

This function will check to see if the input stream has failed.

Returns
1 if the input stream has failed, 0 otherwise

◆ operator>>() [1/4]

CommentStream & CommentStream::operator>> ( __commentmanip  func)

◆ operator>>() [2/4]

CommentStream & CommentStream::operator>> ( char *  a)

This operator will read data from the CommentStream and store it as a char*.

Parameters
ais the char* used to store the data that has been read

◆ operator>>() [3/4]

CommentStream & CommentStream::operator>> ( double &  a)

This operator will read data from the CommentStream and store it as a double.

Parameters
ais the double used to store the data that has been read

◆ operator>>() [4/4]

CommentStream & CommentStream::operator>> ( int &  a)

This operator will read data from the CommentStream and store it as an integer.

Parameters
ais the integer used to store the data that has been read

◆ peek()

char CommentStream::peek ( )

This function will inspect (but not read) the next character in the input stream.

Returns
the next character in the input stream

◆ seekg()

CommentStream& CommentStream::seekg ( streampos  pos)
inline

This function will find the specified position in the input stream.

Parameters
posis the position in the input stream to be found

◆ setStream()

void CommentStream::setStream ( istream &  istr)
inline

This function will store a given input stream.

Parameters
istris the given input stream

◆ tellg()

streampos CommentStream::tellg ( )
inline

This function will return the current position in the input stream.

Returns
pos, the current position in the input stream

Friends And Related Function Documentation

◆ ws

CommentStream& ws ( CommentStream ins)
friend

Member Data Documentation

◆ istrptr

istream* CommentStream::istrptr
protected

This is the input stream that will have the comments and whitespace removed.


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