basic_file.h

Go to the documentation of this file.
00001 // Wrapper of C-language FILE struct -*- C++ -*-
00002 
00003 // Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
00004 // Free Software Foundation, Inc.
00005 //
00006 // This file is part of the GNU ISO C++ Library.  This library is free
00007 // software; you can redistribute it and/or modify it under the
00008 // terms of the GNU General Public License as published by the
00009 // Free Software Foundation; either version 2, or (at your option)
00010 // any later version.
00011 
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 
00017 // You should have received a copy of the GNU General Public License along
00018 // with this library; see the file COPYING.  If not, write to the Free
00019 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
00020 // USA.
00021 
00022 // As a special exception, you may use this file as part of a free software
00023 // library without restriction.  Specifically, if other files instantiate
00024 // templates or use macros or inline functions from this file, or you compile
00025 // this file and link it with other files to produce an executable, this
00026 // file does not by itself cause the resulting executable to be covered by
00027 // the GNU General Public License.  This exception does not however
00028 // invalidate any other reasons why the executable file might be covered by
00029 // the GNU General Public License.
00030 
00031 //
00032 // ISO C++ 14882: 27.8  File-based streams
00033 //
00034 
00035 /** @file basic_file.h
00036  *  This is an internal header file, included by other library headers.
00037  *  You should not attempt to use it directly.
00038  */
00039 
00040 #ifndef _GLIBCXX_BASIC_FILE_STDIO_H
00041 #define _GLIBCXX_BASIC_FILE_STDIO_H 1
00042 
00043 #pragma GCC system_header
00044 
00045 #include <bits/c++config.h>
00046 #include <bits/c++io.h>  // for __c_lock and __c_file
00047 #include <ios>
00048 
00049 _GLIBCXX_BEGIN_NAMESPACE(std)
00050 
00051   // Generic declaration.
00052   template<typename _CharT>
00053     class __basic_file; 
00054 
00055   // Specialization.
00056   template<>
00057     class __basic_file<char>
00058     {
00059       // Underlying data source/sink.
00060       __c_file*     _M_cfile;
00061 
00062       // True iff we opened _M_cfile, and thus must close it ourselves.
00063       bool      _M_cfile_created;
00064 
00065     public:
00066       __basic_file(__c_lock* __lock = 0);
00067 
00068       __basic_file* 
00069       open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
00070 
00071       __basic_file*
00072       sys_open(__c_file* __file, ios_base::openmode);
00073 
00074       __basic_file*
00075       sys_open(int __fd, ios_base::openmode __mode);
00076 
00077       __basic_file* 
00078       close(); 
00079 
00080       bool 
00081       is_open() const;
00082 
00083       int 
00084       fd();
00085 
00086       __c_file*
00087       file();
00088 
00089       ~__basic_file();
00090 
00091       streamsize 
00092       xsputn(const char* __s, streamsize __n);
00093 
00094       streamsize 
00095       xsputn_2(const char* __s1, streamsize __n1,
00096            const char* __s2, streamsize __n2);
00097 
00098       streamsize 
00099       xsgetn(char* __s, streamsize __n);
00100 
00101       streamoff
00102       seekoff(streamoff __off, ios_base::seekdir __way);
00103 
00104       int 
00105       sync();
00106 
00107       streamsize
00108       showmanyc();
00109     };
00110 
00111 _GLIBCXX_END_NAMESPACE
00112 
00113 #endif  

Generated on Sat Dec 12 09:40:08 2009 for libstdc++ by  doxygen 1.5.6