named_istream.cc

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 /*! \file
00029   \brief Named input stream.
00030   
00031   Definition of named_istream class representing named input stream.
00032   \author pt
00033 */
00034 #include <lestes/common.hh>
00035 #include <lestes/std/istream_wrapper.hh>
00036 #include <lestes/lang/cplus/lex/named_istream.hh>
00037 
00038 package(lestes);
00039 package(lang);
00040 package(cplus);
00041 package(lex);
00042 
00043 /*!
00044   Creates the object.
00045   \param a_stream  The represented stream.
00046   \param a_file_name  The path and name of the associated file.
00047   \param a_print_name  The print name of the associated file.
00048 */
00049 named_istream::named_istream(const ptr<istream_wrapper> &a_stream,
00050                 const lstring &a_file_name, const lstring &a_print_name):
00051         stream(checked(a_stream)),
00052         file_name(a_file_name),
00053         print_name(a_print_name)
00054 {
00055 }
00056 
00057 /*!
00058   Returns the name of the associated file.
00059   \return  The path and file name.
00060 */
00061 lstring named_istream::file_name_get(void) const
00062 {
00063         return file_name;
00064 }
00065 
00066 /*!
00067   Returns the print name of the stream
00068   \return  The print name, usually the file name itself.
00069 */
00070 lstring named_istream::print_name_get(void) const
00071 {
00072         return print_name;
00073 }
00074 
00075 /*!
00076   Returns the represented stream.
00077   \return  The stream.
00078 */
00079 ptr<istream_wrapper> named_istream::stream_get(void) const
00080 {
00081         return stream;
00082 }
00083 
00084 /*!
00085   Marks the object.
00086 */
00087 void named_istream::gc_mark(void)
00088 {
00089         stream.gc_mark();
00090         object::gc_mark();
00091 }
00092 
00093 /*!
00094   Returns the named input stream.
00095   \pre a_stream != NULL
00096   \param a_stream  The represented stream.
00097   \param a_file_name  The name of the associated file.
00098   \param a_print_name  The print name of the associated file.
00099 */
00100 ptr<named_istream> named_istream::create(const ptr<istream_wrapper> &a_stream,
00101                 const lstring &a_file_name, const lstring &a_print_name)
00102 {
00103         return new named_istream(a_stream,a_file_name,a_print_name);
00104 }
00105 
00106 end_package(lex);
00107 end_package(cplus);
00108 end_package(lang);
00109 end_package(lestes);
00110 
00111 /* vim: set ft=lestes : */

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