named_istream.hh

Go to the documentation of this file.
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___named_istream_hh___included
00029 #define lestes__lang__cplus__lex___named_istream_hh___included
00030 
00031 /*! \file
00032   \brief Named input stream.
00033   
00034   Declaration of named_istream class representing named input stream.
00035   \author pt
00036 */
00037 #include <lestes/common.hh>
00038 
00039 package(lestes);
00040 
00041 package(std);
00042 // forward declaration to avoid cycle
00043 class istream_wrapper;
00044 end_package(std);
00045 
00046 package(lang);
00047 package(cplus);
00048 package(lex);
00049 
00050 /*!
00051   \brief Named input stream.
00052  
00053   Represents input stream with associated file name
00054   and print name of the stream.
00055 */
00056 class named_istream: public ::lestes::std::object {
00057 public:
00058         //! Returns file name of the source file. 
00059         lstring file_name_get(void) const;
00060         //! Returns print name of the stream.
00061         lstring print_name_get(void) const;
00062         //! Returns the stream.
00063         ptr<istream_wrapper> stream_get(void) const;
00064         //! Returns new instance.
00065         static ptr<named_istream> create(const ptr<istream_wrapper> &a_stream,
00066                         const lstring &a_file_name, const lstring &a_print_name);
00067 protected:
00068         //! Creates the object.
00069         named_istream(const ptr<istream_wrapper> &a_stream,
00070                         const lstring &a_file_name, const lstring &a_print_name);
00071         //! Marks the object.
00072         virtual void gc_mark(void);
00073 private:
00074         //! The input stream. 
00075         srp<istream_wrapper> stream;
00076         //! The file path and name.
00077         lstring file_name;
00078         //! The print name of the stream.
00079         lstring print_name;
00080         //! Hides copy constructor.
00081         named_istream(const named_istream &);
00082         //! Hides assignment operator.
00083         named_istream &operator=(const named_istream &);
00084 };
00085 
00086 end_package(lex);
00087 end_package(cplus);
00088 end_package(lang);
00089 end_package(lestes);
00090 
00091 #endif
00092 /* vim: set ft=lestes : */

Generated on Mon Feb 12 18:22:41 2007 for lestes by doxygen 1.5.1-20070107