00001 // Wrapper of C-language FILE struct -*- C++ -*- 00002 00003 // Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 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 _BASIC_FILE_STDIO_H 00041 #define _BASIC_FILE_STDIO_H 1 00042 00043 #pragma GCC system_header 00044 00045 #include <bits/c++config.h> 00046 #include <ios> 00047 00048 _GLIBCXX_BEGIN_NAMESPACE(std) 00049 00050 // Generic declaration. 00051 template<typename _CharT> 00052 class __basic_file; 00053 00054 // Specialization. 00055 template<> 00056 class __basic_file<char> 00057 { 00058 // Underlying data source/sink. 00059 __c_file* _M_cfile; 00060 00061 // True iff we opened _M_cfile, and thus must close it ourselves. 00062 bool _M_cfile_created; 00063 00064 public: 00065 __basic_file(__c_lock* __lock = 0); 00066 00067 __basic_file* 00068 open(const char* __name, ios_base::openmode __mode, int __prot = 0664); 00069 00070 __basic_file* 00071 sys_open(__c_file* __file, ios_base::openmode); 00072 00073 __basic_file* 00074 sys_open(int __fd, ios_base::openmode __mode); 00075 00076 __basic_file* 00077 close(); 00078 00079 bool 00080 is_open() const; 00081 00082 int 00083 fd(); 00084 00085 __c_file* 00086 file(); 00087 00088 ~__basic_file(); 00089 00090 streamsize 00091 xsputn(const char* __s, streamsize __n); 00092 00093 streamsize 00094 xsputn_2(const char* __s1, streamsize __n1, 00095 const char* __s2, streamsize __n2); 00096 00097 streamsize 00098 xsgetn(char* __s, streamsize __n); 00099 00100 streamoff 00101 seekoff(streamoff __off, ios_base::seekdir __way); 00102 00103 int 00104 sync(); 00105 00106 streamsize 00107 showmanyc(); 00108 }; 00109 00110 _GLIBCXX_END_NAMESPACE 00111 00112 #endif