libstdc++
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, 2009, 2010
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 3, 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 // Under Section 7 of GPL version 3, you are granted additional
00018 // permissions described in the GCC Runtime Library Exception, version
00019 // 3.1, as published by the Free Software Foundation.
00020 
00021 // You should have received a copy of the GNU General Public License and
00022 // a copy of the GCC Runtime Library Exception along with this program;
00023 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00024 // <http://www.gnu.org/licenses/>.
00025 
00026 //
00027 // ISO C++ 14882: 27.8  File-based streams
00028 //
00029 
00030 /** @file bits/basic_file.h
00031  *  This is an internal header file, included by other library headers.
00032  *  Do not attempt to use it directly. @headername{ios}
00033  */
00034 
00035 #ifndef _GLIBCXX_BASIC_FILE_STDIO_H
00036 #define _GLIBCXX_BASIC_FILE_STDIO_H 1
00037 
00038 #pragma GCC system_header
00039 
00040 #include <bits/c++config.h>
00041 #include <bits/c++io.h>  // for __c_lock and __c_file
00042 #include <ios>
00043 
00044 namespace std _GLIBCXX_VISIBILITY(default)
00045 {
00046 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00047 
00048   // Generic declaration.
00049   template<typename _CharT>
00050     class __basic_file; 
00051 
00052   // Specialization.
00053   template<>
00054     class __basic_file<char>
00055     {
00056       // Underlying data source/sink.
00057       __c_file*     _M_cfile;
00058 
00059       // True iff we opened _M_cfile, and thus must close it ourselves.
00060       bool      _M_cfile_created;
00061 
00062     public:
00063       __basic_file(__c_lock* __lock = 0) throw ();
00064 
00065       __basic_file* 
00066       open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
00067 
00068       __basic_file*
00069       sys_open(__c_file* __file, ios_base::openmode);
00070 
00071       __basic_file*
00072       sys_open(int __fd, ios_base::openmode __mode) throw ();
00073 
00074       __basic_file* 
00075       close(); 
00076 
00077       _GLIBCXX_PURE bool 
00078       is_open() const throw ();
00079 
00080       _GLIBCXX_PURE int 
00081       fd() throw ();
00082 
00083       _GLIBCXX_PURE __c_file*
00084       file() throw ();
00085 
00086       ~__basic_file();
00087 
00088       streamsize 
00089       xsputn(const char* __s, streamsize __n);
00090 
00091       streamsize 
00092       xsputn_2(const char* __s1, streamsize __n1,
00093            const char* __s2, streamsize __n2);
00094 
00095       streamsize 
00096       xsgetn(char* __s, streamsize __n);
00097 
00098       streamoff
00099       seekoff(streamoff __off, ios_base::seekdir __way) throw ();
00100 
00101       int 
00102       sync();
00103 
00104       streamsize
00105       showmanyc();
00106     };
00107 
00108 _GLIBCXX_END_NAMESPACE_VERSION
00109 } // namespace
00110 
00111 #endif