libstdc++
basic_file.h
Go to the documentation of this file.
1 // Wrapper of C-language FILE struct -*- C++ -*-
2 
3 // Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
4 // Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11 
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 
17 // Under Section 7 of GPL version 3, you are granted additional
18 // permissions described in the GCC Runtime Library Exception, version
19 // 3.1, as published by the Free Software Foundation.
20 
21 // You should have received a copy of the GNU General Public License and
22 // a copy of the GCC Runtime Library Exception along with this program;
23 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 // <http://www.gnu.org/licenses/>.
25 
26 //
27 // ISO C++ 14882: 27.8 File-based streams
28 //
29 
30 /** @file bits/basic_file.h
31  * This is an internal header file, included by other library headers.
32  * Do not attempt to use it directly. @headername{ios}
33  */
34 
35 #ifndef _GLIBCXX_BASIC_FILE_STDIO_H
36 #define _GLIBCXX_BASIC_FILE_STDIO_H 1
37 
38 #pragma GCC system_header
39 
40 #include <bits/c++config.h>
41 #include <bits/c++io.h> // for __c_lock and __c_file
42 #include <ios>
43 
44 namespace std _GLIBCXX_VISIBILITY(default)
45 {
46 _GLIBCXX_BEGIN_NAMESPACE_VERSION
47 
48  // Generic declaration.
49  template<typename _CharT>
50  class __basic_file;
51 
52  // Specialization.
53  template<>
54  class __basic_file<char>
55  {
56  // Underlying data source/sink.
57  __c_file* _M_cfile;
58 
59  // True iff we opened _M_cfile, and thus must close it ourselves.
60  bool _M_cfile_created;
61 
62  public:
63  __basic_file(__c_lock* __lock = 0) throw ();
64 
65  __basic_file*
66  open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
67 
68  __basic_file*
69  sys_open(__c_file* __file, ios_base::openmode);
70 
71  __basic_file*
72  sys_open(int __fd, ios_base::openmode __mode) throw ();
73 
74  __basic_file*
75  close();
76 
77  _GLIBCXX_PURE bool
78  is_open() const throw ();
79 
80  _GLIBCXX_PURE int
81  fd() throw ();
82 
83  _GLIBCXX_PURE __c_file*
84  file() throw ();
85 
86  ~__basic_file();
87 
88  streamsize
89  xsputn(const char* __s, streamsize __n);
90 
91  streamsize
92  xsputn_2(const char* __s1, streamsize __n1,
93  const char* __s2, streamsize __n2);
94 
95  streamsize
96  xsgetn(char* __s, streamsize __n);
97 
98  streamoff
99  seekoff(streamoff __off, ios_base::seekdir __way) throw ();
100 
101  int
102  sync();
103 
104  streamsize
105  showmanyc();
106  };
107 
108 _GLIBCXX_END_NAMESPACE_VERSION
109 } // namespace
110 
111 #endif
long long streamoff
Type used by fpos, char_traits<char>, and char_traits<wchar_t>.
Definition: postypes.h:96
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
Definition: postypes.h:100