00001 /* 00002 The lestes compiler suite 00003 Copyright (C) 2002, 2003, 2004, 2005 Miroslav Tichy 00004 Copyright (C) 2002, 2003, 2004, 2005 Petr Zika 00005 Copyright (C) 2002, 2003, 2004, 2005 Vojtech Hala 00006 Copyright (C) 2002, 2003, 2004, 2005 Jiri Kosina 00007 Copyright (C) 2002, 2003, 2004, 2005 Pavel Sanda 00008 Copyright (C) 2002, 2003, 2004, 2005 Jan Zouhar 00009 Copyright (C) 2002, 2003, 2004, 2005 Rudolf Thomas 00010 00011 This program is free software; you can redistribute it and/or modify 00012 it under the terms of the GNU General Public License as published by 00013 the Free Software Foundation; version 2 of the License. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 See the full text of the GNU General Public License version 2, and 00021 the limitations in the file doc/LICENSE. 00022 00023 By accepting the license the licensee waives any and all claims 00024 against the copyright holder(s) related in whole or in part to the 00025 work, its use, and/or the inability to use it. 00026 00027 */ 00028 #ifndef lestes__lang__cplus__lex___stream_source_hh___included 00029 #define lestes__lang__cplus__lex___stream_source_hh___included 00030 00031 /*! \file 00032 \brief Stream data source. 00033 00034 Declaration of stream_source class representing data source reading from stream. 00035 \author pt 00036 */ 00037 00038 #include <lestes/common.hh> 00039 #include <lestes/lang/cplus/lex/data_source.hh> 00040 #include <istream> 00041 00042 package(lestes); 00043 package(std); 00044 // forward declaration to avoid cycle 00045 class istream_wrapper; 00046 end_package(std); 00047 package(lang); 00048 package(cplus); 00049 package(lex); 00050 00051 // forward declaration to avoid cycle 00052 class ucn_token; 00053 00054 /*! 00055 \brief Stream data source. 00056 00057 Represents data source reading from stream. 00058 */ 00059 class stream_source: public data_source { 00060 public: 00061 //! Reads one token from file. 00062 ptr<ucn_token> read(void); 00063 //! Returns new file source, initializes with input stream. 00064 static ptr<stream_source> create(const ptr<istream_wrapper> &a_wrapper); 00065 protected: 00066 //! Creates new object, initializes with input stream. 00067 stream_source(const ptr<istream_wrapper> &a_wrapper); 00068 //! Marks the object. 00069 virtual void gc_mark(void); 00070 private: 00071 //! Hides copy constructor. 00072 stream_source(const stream_source &); 00073 //! Hides assignment operator. 00074 stream_source &operator=(const stream_source &); 00075 //! Stream to read from. 00076 srp<istream_wrapper> wrapper; 00077 //! Direct reference to the stream. 00078 ::std::istream *stream; 00079 }; 00080 00081 end_package(lex); 00082 end_package(cplus); 00083 end_package(lang); 00084 end_package(lestes); 00085 00086 #endif 00087 /* vim: set ft=lestes : */
1.5.1-20070107