#include <stream_source.hh>
Inheritance diagram for lestes::lang::cplus::lex::stream_source:

Public Member Functions | |
| ptr< ucn_token > | read (void) |
| Reads one token from file. | |
Static Public Member Functions | |
| static ptr< stream_source > | create (const ptr< istream_wrapper > &a_wrapper) |
| Returns new file source, initializes with input stream. | |
Protected Member Functions | |
| stream_source (const ptr< istream_wrapper > &a_wrapper) | |
| Creates new object, initializes with input stream. | |
| virtual void | gc_mark (void) |
| Marks the object. | |
Private Member Functions | |
| stream_source (const stream_source &) | |
| Hides copy constructor. | |
| stream_source & | operator= (const stream_source &) |
| Hides assignment operator. | |
Private Attributes | |
| srp< istream_wrapper > | wrapper |
| Stream to read from. | |
| ::std::istream * | stream |
| Direct reference to the stream. | |
Represents data source reading from stream.
Definition at line 59 of file stream_source.hh.
| lestes::lang::cplus::lex::stream_source::stream_source | ( | const ptr< istream_wrapper > & | a_wrapper | ) | [protected] |
Creates new object, initializes with input stream.
Creates the object, initializes with wrapper.
| a_wrapper | The stream wrapper. |
Definition at line 51 of file stream_source.cc.
Referenced by create().
| lestes::lang::cplus::lex::stream_source::stream_source | ( | const stream_source & | ) | [private] |
Hides copy constructor.
| ptr< ucn_token > lestes::lang::cplus::lex::stream_source::read | ( | void | ) | [virtual] |
Reads one token from file.
Reads next token from stream.
Implements lestes::lang::cplus::lex::ucn_filter.
Definition at line 61 of file stream_source.cc.
References lestes::lang::cplus::lex::ucn_token::create(), stream, lestes::lang::cplus::lex::ucn_token::TOK_EOF, and lestes::lang::cplus::lex::ucn_token::TOK_NOT_EOF.
00062 { 00063 ptr<ucn_token> t; 00064 int c; 00065 00066 if ((c = stream->get()) == EOF) { 00067 // TODO pt not necessary to set value, but looks better when debugging 00068 t = ucn_token::create(ucn_token::TOK_EOF,character::create_external(0)); 00069 } else { 00070 // note that the meaning of real types is not clear at this stage 00071 t = ucn_token::create(ucn_token::TOK_NOT_EOF,character::create_external(static_cast<ulint>(c))); 00072 } 00073 00074 return t; 00075 }
| ptr< stream_source > lestes::lang::cplus::lex::stream_source::create | ( | const ptr< istream_wrapper > & | a_wrapper | ) | [static] |
Returns new file source, initializes with input stream.
Returns new instance, initializes with stream and file info.
| a_wrapper | The stream wrapper. |
Definition at line 91 of file stream_source.cc.
References stream_source().
Referenced by lestes::lang::cplus::lex::evaluator::push_stream().
00092 { 00093 return new stream_source(a_wrapper); 00094 }
| void lestes::lang::cplus::lex::stream_source::gc_mark | ( | void | ) | [protected, virtual] |
Marks the object.
Marks the object.
Reimplemented from lestes::lang::cplus::lex::ucn_filter.
Definition at line 80 of file stream_source.cc.
References lestes::lang::cplus::lex::ucn_filter::gc_mark(), and wrapper.
00081 { 00082 wrapper.gc_mark(); 00083 data_source::gc_mark(); 00084 }
| stream_source& lestes::lang::cplus::lex::stream_source::operator= | ( | const stream_source & | ) | [private] |
Hides assignment operator.
srp<istream_wrapper> lestes::lang::cplus::lex::stream_source::wrapper [private] |
::std::istream* lestes::lang::cplus::lex::stream_source::stream [private] |
Direct reference to the stream.
Definition at line 78 of file stream_source.hh.
Referenced by read().
1.5.1-20070107