conexus/file.h

00001 /***************************************************************************
00002 *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003 *   rvinyard@cs.nmsu.edu                                                  *
00004 *                                                                         *
00005 *   This program is free software; you can redistribute it and/or modify  *
00006 *   it under the terms of the GNU Lesser General Public License as        *
00007 *   published by the Free Software Foundation version 2.1.                *
00008 *                                                                         *
00009 *   This program is distributed in the hope that it will be useful,       *
00010 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012 *   GNU General Public License for more details.                          *
00013 *                                                                         *
00014 *   You should have received a copy of the GNU Lesser General Public      *
00015 *   License along with this library; if not, write to the                 *
00016 *   Free Software Foundation, Inc.,                                       *
00017 *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
00018 ***************************************************************************/
00019 #ifndef CONEXUSFILE_H
00020 #define CONEXUSFILE_H
00021 
00022 #include <conexus/enums.h>
00023 #include <conexus/filedescriptor.h>
00024 
00029 namespace Conexus
00030 {
00031 
00038   class File : public FileDescriptor
00039   {
00040     protected:
00041 
00042       File( const std::string& filename,
00043             long unsigned mode );
00044 
00045     public:
00046       typedef ConexusPointer<File> pointer;
00047 
00048       static File::pointer create( const std::string& filename = std::string(),
00049                                    long unsigned mode = FILE_READ | FILE_WRITE | FILE_CREATE | FILE_TRUNCATE );
00050 
00051       virtual ~File();
00052 
00056       virtual void open( const std::string name,
00057                          long unsigned mode = FILE_UNCHANGED )
00058           throw ( open_exception);
00059 
00064       virtual void open() throw ( open_exception );
00065 
00067       std::string filename();
00068 
00069       long unsigned mode();
00070 
00071       bool eof();
00072 
00073       bool throw_eof();
00074 
00075       void set_throw_eof( bool teof = true );
00076 
00089       void set_filename( std::string d, long unsigned mode = FILE_UNCHANGED ) throw ( open_exception );
00090 
00091       sigc::signal<void> signal_filename_changed();
00092 
00093     protected:
00094       std::string m_filename;
00095       long unsigned m_mode;
00096       bool m_eof;
00097       bool m_throw_eof;
00098 
00099       sigc::signal<void> m_signal_filename_changed;
00100 
00101       virtual Data read_data( long int timeout, size_t s = 0 ) throw ( read_exception );
00102 
00103   };
00104 
00105 }
00106 
00107 #endif

Generated on Tue Mar 13 19:54:43 2007 by  doxygen 1.5.1