# 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
    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 basic_file.h
    00031  *  This is an internal header file, included by other library headers.
    00032  *  You should not attempt to use it directly.
    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 _GLIBCXX_BEGIN_NAMESPACE(std)
    00045
    00046   // Generic declaration.
    00047   template<typename _CharT>
    00048     class __basic_file;
    00049
    00050   // Specialization.
    00051   template<>
    00052     class __basic_file<char>
    00053     {
    00054       // Underlying data source/sink.
    00055       __c_file*     _M_cfile;
    00056
    00057       // True iff we opened _M_cfile, and thus must close it ourselves.
    00058       bool      _M_cfile_created;
    00059
    00060     public:
    00061       __basic_file(__c_lock* __lock = 0) throw ();
    00062
    00063       __basic_file*
    00064       open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
    00065
    00066       __basic_file*
    00067       sys_open(__c_file* __file, ios_base::openmode);
    00068
    00069       __basic_file*
    00070       sys_open(int __fd, ios_base::openmode __mode) throw ();
    00071
    00072       __basic_file*
    00073       close();
    00074
    00075       _GLIBCXX_PURE bool
    00076       is_open() const throw ();
    00077
    00078       _GLIBCXX_PURE int
    00079       fd() throw ();
    00080
    00081       _GLIBCXX_PURE __c_file*
    00082       file() throw ();
    00083
    00084       ~__basic_file();
    00085
    00086       streamsize
    00087       xsputn(const char* __s, streamsize __n);
    00088
    00089       streamsize
    00090       xsputn_2(const char* __s1, streamsize __n1,
    00091            const char* __s2, streamsize __n2);
    00092
    00093       streamsize
    00094       xsgetn(char* __s, streamsize __n);
    00095
    00096       streamoff
    00097       seekoff(streamoff __off, ios_base::seekdir __way) throw ();
    00098
    00099       int
    00100       sync();
    00101
    00102       streamsize
    00103       showmanyc();
    00104     };
    00105
    00106 _GLIBCXX_END_NAMESPACE
    00107
    00108 #endif