Gadget
src
include
commentstream.h
Go to the documentation of this file.
1
#ifndef commentstream_h
2
#define commentstream_h
3
4
#include "
gadget.h
"
5
6
class
CommentStream
;
7
typedef
CommentStream
& (*__commentmanip)(
CommentStream
&);
8
13
class
Whitespace
{
14
public
:
18
Whitespace
() { v = 0; };
22
~Whitespace
() {};
28
friend
istream&
operator >>
(istream& istr,
Whitespace
&
ws
);
29
private
:
33
int
v;
34
};
35
40
class
CommentStream
{
41
public
:
42
friend
CommentStream
&
ws
(
CommentStream
& ins);
46
CommentStream
() {
istrptr
= NULL; };
51
CommentStream
(istream& istr) {
istrptr
= &istr; };
55
~CommentStream
() {};
60
void
setStream
(istream& istr) {
istrptr
= &istr; };
65
CommentStream
&
operator >>
(
int
& a);
70
CommentStream
&
operator >>
(
double
& a);
75
CommentStream
&
operator >>
(
char
* a);
76
CommentStream
&
operator >>
(
__commentmanip
func);
81
char
peek
();
86
int
eof
() {
return
istrptr
->eof(); };
91
int
fail
() {
return
istrptr
->fail(); };
96
int
operator !
() {
return
istrptr
->fail(); };
101
CommentStream
&
seekg
(streampos pos) {
istrptr
->seekg(pos);
return
*
this
; };
106
streampos
tellg
() {
return
istrptr
->tellg(); };
111
CommentStream
&
get
(
char
& c);
117
CommentStream
&
getLine
(
char
* text,
int
length);
118
protected
:
122
void
killComments
();
126
istream*
istrptr
;
127
};
128
129
CommentStream
&
ws
(
CommentStream
& ins);
130
131
#endif
CommentStream
This is the class used to strip comments (and whitespace) from any input stream.
Definition:
commentstream.h:40
CommentStream::get
CommentStream & get(char &c)
This function will read the next character from the input stream.
Definition:
commentstream.cc:52
CommentStream::operator>>
CommentStream & operator>>(int &a)
This operator will read data from the CommentStream and store it as an integer.
Definition:
commentstream.cc:77
CommentStream::operator!
int operator!()
This function will check to see if the input stream has failed.
Definition:
commentstream.h:96
CommentStream::eof
int eof()
This function will check to see if the input stream has reached the end of file marker.
Definition:
commentstream.h:86
CommentStream::~CommentStream
~CommentStream()
This is the default CommentStream destructor.
Definition:
commentstream.h:55
CommentStream::istrptr
istream * istrptr
This is the input stream that will have the comments and whitespace removed.
Definition:
commentstream.h:126
CommentStream::setStream
void setStream(istream &istr)
This function will store a given input stream.
Definition:
commentstream.h:60
CommentStream::ws
friend CommentStream & ws(CommentStream &ins)
Definition:
commentstream.cc:11
CommentStream::fail
int fail()
This function will check to see if the input stream has failed.
Definition:
commentstream.h:91
CommentStream::tellg
streampos tellg()
This function will return the current position in the input stream.
Definition:
commentstream.h:106
CommentStream::getLine
CommentStream & getLine(char *text, int length)
This function will read the next line from the input stream.
Definition:
commentstream.cc:65
CommentStream::peek
char peek()
This function will inspect (but not read) the next character in the input stream.
Definition:
commentstream.cc:33
CommentStream::CommentStream
CommentStream()
This is the default CommentStream constructor.
Definition:
commentstream.h:46
CommentStream::killComments
void killComments()
This function will remove the comments and whitespace from the input stream.
Definition:
commentstream.cc:16
CommentStream::CommentStream
CommentStream(istream &istr)
This is the CommentStream constructor for a given input stream.
Definition:
commentstream.h:51
CommentStream::seekg
CommentStream & seekg(streampos pos)
This function will find the specified position in the input stream.
Definition:
commentstream.h:101
Whitespace
This is the dummy class used to strip white space from any input stream.
Definition:
commentstream.h:13
Whitespace::~Whitespace
~Whitespace()
This is the default Whitespace destructor.
Definition:
commentstream.h:22
Whitespace::operator>>
friend istream & operator>>(istream &istr, Whitespace &ws)
This operator will strip white space from a given input istream.
Definition:
commentstream.cc:5
Whitespace::Whitespace
Whitespace()
This is the default Whitespace constructor.
Definition:
commentstream.h:18
__commentmanip
CommentStream &(* __commentmanip)(CommentStream &)
Definition:
commentstream.h:7
ws
CommentStream & ws(CommentStream &ins)
Definition:
commentstream.cc:11
gadget.h
Generated by
1.9.1