ReactOS 0.4.15-dev-7942-gd23573b
_fstream.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1999
3 * Silicon Graphics Computer Systems, Inc.
4 *
5 * Copyright (c) 1999
6 * Boris Fomitchev
7 *
8 * This material is provided "as is", with absolutely no warranty expressed
9 * or implied. Any use is at your own risk.
10 *
11 * Permission to use or copy this software for any purpose is hereby granted
12 * without fee, provided the above notices are retained on all copies.
13 * Permission to modify the code and to distribute modified code is granted,
14 * provided the above notices are retained, and a notice that the code was
15 * modified is included with the above copyright notice.
16 *
17 */
18// This header defines classes basic_filebuf, basic_ifstream,
19// basic_ofstream, and basic_fstream. These classes represent
20// streambufs and streams whose sources or destinations are files.
21
22#ifndef _STLP_INTERNAL_FSTREAM_H
23#define _STLP_INTERNAL_FSTREAM_H
24
25#if defined(__sgi) && !defined(__GNUC__) && !defined(_STANDARD_C_PLUS_PLUS)
26# error This header file requires the -LANG:std option
27#endif
28
29#ifndef _STLP_INTERNAL_STREAMBUF
30# include <stl/_streambuf.h>
31#endif
32
33#ifndef _STLP_INTERNAL_ISTREAM
34# include <stl/_istream.h>
35#endif
36
37#ifndef _STLP_INTERNAL_CODECVT_H
38# include <stl/_codecvt.h>
39#endif
40
41#if defined (_STLP_USE_WIN32_IO)
42typedef void* _STLP_fd;
43#elif defined (_STLP_USE_UNIX_EMULATION_IO) || defined (_STLP_USE_STDIO_IO) || defined (_STLP_USE_UNIX_IO)
44typedef int _STLP_fd;
45#else
46# error "Configure i/o !"
47#endif
48
50
51//----------------------------------------------------------------------
52// Class _Filebuf_base, a private base class to factor out the system-
53// dependent code from basic_filebuf<>.
54
56public: // Opening and closing files.
58
59 bool _M_open(const char*, ios_base::openmode, long __protection);
60 bool _M_open(const char*, ios_base::openmode);
61 bool _M_open(int __id, ios_base::openmode = ios_base::__default_mode);
62#if defined (_STLP_USE_STDIO_IO)
63 bool _M_open(FILE *file, ios_base::openmode = ios_base::__default_mode);
64#endif /* _STLP_USE_STDIO_IO */
65#if defined (_STLP_USE_WIN32_IO)
66 bool _M_open(_STLP_fd __id, ios_base::openmode = ios_base::__default_mode);
67#endif /* _STLP_USE_WIN32_IO */
68 bool _M_close();
69
70public: // Low-level I/O, like Unix read/write
71 ptrdiff_t _M_read(char* __buf, ptrdiff_t __n);
72 streamoff _M_seek(streamoff __offset, ios_base::seekdir __dir);
73 streamoff _M_file_size();
74 bool _M_write(char* __buf, ptrdiff_t __n);
75
76public: // Memory-mapped I/O.
77 void* _M_mmap(streamoff __offset, streamoff __len);
78 void _M_unmap(void* __mmap_base, streamoff __len);
79
80public:
81 // Returns a value n such that, if pos is the file pointer at the
82 // beginning of the range [first, last), pos + n is the file pointer at
83 // the end. On many operating systems n == __last - __first.
84 // In Unix, writing n characters always bumps the file position by n.
85 // In Windows text mode, however, it bumps the file position by n + m,
86 // where m is the number of newlines in the range. That's because an
87 // internal \n corresponds to an external two-character sequence.
88 streamoff _M_get_offset(char* __first, char* __last) {
89#if defined (_STLP_UNIX) || defined (_STLP_MAC)
90 return __last - __first;
91#else // defined (_STLP_WIN32)
92 return ( (_M_openmode & ios_base::binary) != 0 )
93 ? (__last - __first)
94 : count(__first, __last, '\n') + (__last - __first);
95#endif
96 }
97
98 // Returns true if we're in binary mode or if we're using an OS or file
99 // system where there is no distinction between text and binary mode.
100 bool _M_in_binary_mode() const {
101#if defined (_STLP_UNIX) || defined (_STLP_MAC) || defined(__BEOS__) || defined (__amigaos__)
102 return true;
103#elif defined (_STLP_WIN32) || defined (_STLP_VM)
104 return (_M_openmode & ios_base::binary) != 0;
105#else
106# error "Port!"
107#endif
108 }
109
110 static void _S_initialize();
111
112protected: // Static data members.
113 static size_t _M_page_size;
114
115protected: // Data members.
116 _STLP_fd _M_file_id;
117#if defined (_STLP_USE_STDIO_IO)
118 // for stdio, the whole FILE* is being kept here
119 FILE* _M_file;
120#endif
122 unsigned char _M_is_open ;
123 unsigned char _M_should_close ;
124 unsigned char _M_regular_file ;
125
126#if defined (_STLP_USE_WIN32_IO)
127 _STLP_fd _M_view_id;
128#endif
129
130public :
131 static size_t _STLP_CALL __page_size() { return _M_page_size; }
132 int __o_mode() const { return (int)_M_openmode; }
133 bool __is_open() const { return (_M_is_open !=0 ); }
134 bool __should_close() const { return (_M_should_close != 0); }
135 bool __regular_file() const { return (_M_regular_file != 0); }
136 _STLP_fd __get_fd() const { return _M_file_id; }
137};
138
139//----------------------------------------------------------------------
140// Class basic_filebuf<>.
141
142// Forward declaration of two helper classes.
143template <class _Traits> class _Noconv_input;
144template <class _Traits> class _Noconv_output;
145
146// There is a specialized version of underflow, for basic_filebuf<char>,
147// in fstream.cpp.
148template <class _CharT, class _Traits>
149class _Underflow;
150
151template <class _CharT, class _Traits>
152class basic_filebuf : public basic_streambuf<_CharT, _Traits> {
153public: // Types.
154 typedef _CharT char_type;
155 typedef typename _Traits::int_type int_type;
156 typedef typename _Traits::pos_type pos_type;
157 typedef typename _Traits::off_type off_type;
158 typedef _Traits traits_type;
159
160 typedef typename _Traits::state_type _State_type;
163
164public: // Constructors, destructor.
167
168public: // Opening and closing files.
169 bool is_open() const { return _M_base.__is_open(); }
170
171 _Self* open(const char* __s, ios_base::openmode __m) {
172 return _M_base._M_open(__s, __m) ? this : 0;
173 }
174
175#if !defined (_STLP_NO_EXTENSIONS)
176 // These two version of open() and file descriptor getter are extensions.
177 _Self* open(const char* __s, ios_base::openmode __m,
178 long __protection) {
179 return _M_base._M_open(__s, __m, __protection) ? this : 0;
180 }
181
182 _STLP_fd fd() const { return _M_base.__get_fd(); }
183
184 _Self* open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
185 return this->_M_open(__id, _Init_mode);
186 }
187
188# if defined (_STLP_USE_STDIO_IO)
189 _Self* open(FILE *file, ios_base::openmode _Init_mode = ios_base::__default_mode) {
190 return _M_base._M_open(file, _Init_mode) ? this : 0;
191 }
192# endif /* _STLP_USE_STDIO_IO */
193
194# if defined (_STLP_USE_WIN32_IO)
195 _Self* open(_STLP_fd __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
196 return _M_base._M_open(__id, _Init_mode) ? this : 0;
197 }
198# endif /* _STLP_USE_WIN32_IO */
199
200#endif
201
202 _Self* _M_open(int __id, ios_base::openmode _Init_mode = ios_base::__default_mode) {
203 return _M_base._M_open(__id, _Init_mode) ? this : 0;
204 }
205
206 _Self* close();
207
208protected: // Virtual functions from basic_streambuf.
209 virtual streamsize showmanyc();
210 virtual int_type underflow();
211
212 virtual int_type pbackfail(int_type = traits_type::eof());
213 virtual int_type overflow(int_type = traits_type::eof());
214
217 ios_base::openmode = ios_base::in | ios_base::out);
218 virtual pos_type seekpos(pos_type,
219 ios_base::openmode = ios_base::in | ios_base::out);
220
221 virtual int sync();
222 virtual void imbue(const locale&);
223
224private: // Helper functions.
225
226 // Precondition: we are currently in putback input mode. Effect:
227 // switches back to ordinary input mode.
230 _M_in_putback_mode = false;
231 }
233 void _M_exit_input_mode();
235
236 int_type _M_input_error();
238 friend class _Underflow<_CharT, _Traits>;
239
241 bool _M_unshift();
242
243 bool _M_allocate_buffers(_CharT* __buf, streamsize __n);
244 bool _M_allocate_buffers();
246
248 if (__off != -1) {
251 _M_in_input_mode = false;
252 _M_in_output_mode = false;
253 _M_in_putback_mode = false;
254 _M_in_error_mode = false;
255 this->setg(0, 0, 0);
256 this->setp(0, 0);
257 }
258
259 pos_type __result(__off);
260 __result.state(__state);
261 return __result;
262 }
263
264 bool _M_seek_init(bool __do_unshift);
265
266 void _M_setup_codecvt(const locale&, bool __on_imbue = true);
267
268private: // Data members used in all modes.
269
271
272private: // Locale-related information.
273
274 unsigned char _M_constant_width;
275 unsigned char _M_always_noconv;
276
277 // private: // Mode flags.
278 unsigned char _M_int_buf_dynamic; // True if internal buffer is heap allocated,
279 // false if it was supplied by the user.
280 unsigned char _M_in_input_mode;
281 unsigned char _M_in_output_mode;
282 unsigned char _M_in_error_mode;
283 unsigned char _M_in_putback_mode;
284
285 // Internal buffer: characters seen by the filebuf's clients.
286 _CharT* _M_int_buf;
288
289 // External buffer: characters corresponding to the external file.
292
293 // The range [_M_ext_buf, _M_ext_buf_converted) contains the external
294 // characters corresponding to the sequence in the internal buffer. The
295 // range [_M_ext_buf_converted, _M_ext_buf_end) contains characters that
296 // have been read into the external buffer but have not been converted
297 // to an internal sequence.
300
301 // State corresponding to beginning of internal buffer.
303
304private: // Data members used only in input mode.
305
306 // Similar to _M_state except that it corresponds to
307 // the end of the internal buffer instead of the beginning.
309
310 // This is a null pointer unless we are in mmap input mode.
313
314private: // Data members used only in putback mode.
318
321
322 int _M_width; // Width of the encoding (if constant), else 1
323 int _M_max_width; // Largest possible width of single character.
324
325
326 enum { _S_pback_buf_size = 8 };
328
329 // for _Noconv_output
330public:
331 bool _M_write(char* __buf, ptrdiff_t __n) {return _M_base._M_write(__buf, __n); }
332
333public:
338 return traits_type::to_int_type(*_M_ext_buf);
339 }
340};
341
342#if defined (_STLP_USE_TEMPLATE_EXPORT)
344# if ! defined (_STLP_NO_WCHAR_T)
346# endif
347#endif /* _STLP_USE_TEMPLATE_EXPORT */
348
349//
350// This class had to be designed very carefully to work
351// with Visual C++.
352//
353template <class _Traits>
355public:
356 typedef typename _Traits::char_type char_type;
359 { return false; }
360};
361
364public:
365 static bool _STLP_CALL
367 char* __first, char* __last) {
368 ptrdiff_t __n = __last - __first;
369 return (__buf->_M_write(__first, __n));
370 }
371};
372
373//----------------------------------------------------------------------
374// basic_filebuf<> helper functions.
375
376
377//----------------------------------------
378// Helper functions for switching between modes.
379
380//
381// This class had to be designed very carefully to work
382// with Visual C++.
383//
384template <class _Traits>
386public:
387 typedef typename _Traits::int_type int_type;
388 typedef typename _Traits::char_type char_type;
389
390 static inline int_type _STLP_CALL
392 { return _Traits::eof(); }
393};
394
397public:
398 static inline int _STLP_CALL
400 return __buf->_M_do_noconv_input();
401 }
402};
403
404// underflow() may be called for one of two reasons. (1) We've
405// been going through the special putback buffer, and we need to move back
406// to the regular internal buffer. (2) We've exhausted the internal buffer,
407// and we need to replentish it.
408template <class _CharT, class _Traits>
410public:
411 typedef typename _Traits::int_type int_type;
412 typedef _Traits traits_type;
413
414 // There is a specialized version of underflow, for basic_filebuf<char>,
415 // in fstream.cpp.
417 if (!__this->_M_in_input_mode) {
418 if (!__this->_M_switch_to_input_mode())
419 return traits_type::eof();
420 }
421 else if (__this->_M_in_putback_mode) {
422 __this->_M_exit_putback_mode();
423 if (__this->gptr() != __this->egptr()) {
424 int_type __c = traits_type::to_int_type(*__this->gptr());
425 return __c;
426 }
427 }
428
429 return __this->_M_underflow_aux();
430 }
431};
432
433// Specialization of underflow: if the character type is char, maybe
434// we can use mmap instead of read.
437{
438 public:
442};
443
444#if defined (_STLP_USE_TEMPLATE_EXPORT) && !defined (_STLP_NO_WCHAR_T)
446#endif
447
448//----------------------------------------------------------------------
449// Class basic_ifstream<>
450
451template <class _CharT, class _Traits>
452class basic_ifstream : public basic_istream<_CharT, _Traits> {
453public: // Types
454 typedef _CharT char_type;
455 typedef typename _Traits::int_type int_type;
456 typedef typename _Traits::pos_type pos_type;
457 typedef typename _Traits::off_type off_type;
458 typedef _Traits traits_type;
459
463
464public: // Constructors, destructor.
465
467 basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
468 this->init(&_M_buf);
469 }
470
471 explicit basic_ifstream(const char* __s, ios_base::openmode __mod = ios_base::in) :
472 basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0),
473 _M_buf() {
474 this->init(&_M_buf);
475 if (!_M_buf.open(__s, __mod | ios_base::in))
476 this->setstate(ios_base::failbit);
477 }
478
479#if !defined (_STLP_NO_EXTENSIONS)
480 explicit basic_ifstream(int __id, ios_base::openmode __mod = ios_base::in) :
481 basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
482 this->init(&_M_buf);
483 if (!_M_buf.open(__id, __mod | ios_base::in))
484 this->setstate(ios_base::failbit);
485 }
486 basic_ifstream(const char* __s, ios_base::openmode __m,
487 long __protection) :
488 basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
489 this->init(&_M_buf);
490 if (!_M_buf.open(__s, __m | ios_base::in, __protection))
491 this->setstate(ios_base::failbit);
492 }
493
494# if defined (_STLP_USE_WIN32_IO)
495 explicit basic_ifstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::in) :
496 basic_ios<_CharT, _Traits>(), basic_istream<_CharT, _Traits>(0), _M_buf() {
497 this->init(&_M_buf);
498 if (!_M_buf.open(__id, __mod | ios_base::in))
499 this->setstate(ios_base::failbit);
500 }
501# endif /* _STLP_USE_WIN32_IO */
502#endif
503
505
506public: // File and buffer operations.
508 { return __CONST_CAST(_Buf*,&_M_buf); }
509
510 bool is_open() {
511 return this->rdbuf()->is_open();
512 }
513
514 void open(const char* __s, ios_base::openmode __mod = ios_base::in) {
515 if (!this->rdbuf()->open(__s, __mod | ios_base::in))
516 this->setstate(ios_base::failbit);
517 }
518
519 void close() {
520 if (!this->rdbuf()->close())
521 this->setstate(ios_base::failbit);
522 }
523
524private:
526};
527
528
529//----------------------------------------------------------------------
530// Class basic_ofstream<>
531
532template <class _CharT, class _Traits>
533class basic_ofstream : public basic_ostream<_CharT, _Traits> {
534public: // Types
535 typedef _CharT char_type;
536 typedef typename _Traits::int_type int_type;
537 typedef typename _Traits::pos_type pos_type;
538 typedef typename _Traits::off_type off_type;
539 typedef _Traits traits_type;
540
544
545public: // Constructors, destructor.
547 basic_ios<_CharT, _Traits>(),
548 basic_ostream<_CharT, _Traits>(0), _M_buf() {
549 this->init(&_M_buf);
550 }
551 explicit basic_ofstream(const char* __s, ios_base::openmode __mod = ios_base::out)
552 : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() {
553 this->init(&_M_buf);
554 if (!_M_buf.open(__s, __mod | ios_base::out))
555 this->setstate(ios_base::failbit);
556 }
557
558#if !defined (_STLP_NO_EXTENSIONS)
559 explicit basic_ofstream(int __id, ios_base::openmode __mod = ios_base::out)
560 : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0),
561 _M_buf() {
562 this->init(&_M_buf);
563 if (!_M_buf.open(__id, __mod | ios_base::out))
564 this->setstate(ios_base::failbit);
565 }
566 basic_ofstream(const char* __s, ios_base::openmode __m, long __protection) :
567 basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0), _M_buf() {
568 this->init(&_M_buf);
569 if (!_M_buf.open(__s, __m | ios_base::out, __protection))
570 this->setstate(ios_base::failbit);
571 }
572# if defined (_STLP_USE_WIN32_IO)
573 explicit basic_ofstream(_STLP_fd __id, ios_base::openmode __mod = ios_base::out)
574 : basic_ios<_CharT, _Traits>(), basic_ostream<_CharT, _Traits>(0),
575 _M_buf() {
576 this->init(&_M_buf);
577 if (!_M_buf.open(__id, __mod | ios_base::out))
578 this->setstate(ios_base::failbit);
579 }
580# endif /* _STLP_USE_WIN32_IO */
581#endif
582
584
585public: // File and buffer operations.
587 { return __CONST_CAST(_Buf*,&_M_buf); }
588
589 bool is_open() {
590 return this->rdbuf()->is_open();
591 }
592
593 void open(const char* __s, ios_base::openmode __mod= ios_base::out) {
594 if (!this->rdbuf()->open(__s, __mod | ios_base::out))
595 this->setstate(ios_base::failbit);
596 }
597
598 void close() {
599 if (!this->rdbuf()->close())
600 this->setstate(ios_base::failbit);
601 }
602
603private:
605};
606
607
608//----------------------------------------------------------------------
609// Class basic_fstream<>
610
611template <class _CharT, class _Traits>
612class basic_fstream : public basic_iostream<_CharT, _Traits> {
613public: // Types
614 typedef _CharT char_type;
615 typedef typename _Traits::int_type int_type;
616 typedef typename _Traits::pos_type pos_type;
617 typedef typename _Traits::off_type off_type;
618 typedef _Traits traits_type;
619
623
624public: // Constructors, destructor.
625
627 : basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
628 this->init(&_M_buf);
629 }
630
631 explicit basic_fstream(const char* __s,
632 ios_base::openmode __mod = ios_base::in | ios_base::out) :
633 basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
634 this->init(&_M_buf);
635 if (!_M_buf.open(__s, __mod))
636 this->setstate(ios_base::failbit);
637 }
638
639#if !defined (_STLP_NO_EXTENSIONS)
640 explicit basic_fstream(int __id,
641 ios_base::openmode __mod = ios_base::in | ios_base::out) :
642 basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
643 this->init(&_M_buf);
644 if (!_M_buf.open(__id, __mod))
645 this->setstate(ios_base::failbit);
646 }
647 basic_fstream(const char* __s, ios_base::openmode __m, long __protection) :
648 basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
649 this->init(&_M_buf);
650 if (!_M_buf.open(__s, __m, __protection))
651 this->setstate(ios_base::failbit);
652 }
653# if defined (_STLP_USE_WIN32_IO)
654 explicit basic_fstream(_STLP_fd __id,
655 ios_base::openmode __mod = ios_base::in | ios_base::out) :
656 basic_ios<_CharT, _Traits>(), basic_iostream<_CharT, _Traits>(0), _M_buf() {
657 this->init(&_M_buf);
658 if (!_M_buf.open(__id, __mod))
659 this->setstate(ios_base::failbit);
660 }
661# endif /* _STLP_USE_WIN32_IO */
662#endif
664
665public: // File and buffer operations.
666
668 { return __CONST_CAST(_Buf*,&_M_buf); }
669
670 bool is_open() {
671 return this->rdbuf()->is_open();
672 }
673
674 void open(const char* __s,
675 ios_base::openmode __mod =
676 ios_base::in | ios_base::out) {
677 if (!this->rdbuf()->open(__s, __mod))
678 this->setstate(ios_base::failbit);
679 }
680
681 void close() {
682 if (!this->rdbuf()->close())
683 this->setstate(ios_base::failbit);
684 }
685
686private:
688
689#if defined (_STLP_MSVC) && (_STLP_MSVC >= 1300 && _STLP_MSVC <= 1310)
691 //explicitely defined as private to avoid warnings:
692 basic_fstream(_Self const&);
693 _Self& operator = (_Self const&);
694#endif
695};
696
698
699#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
700# include <stl/_fstream.c>
701#endif
702
704
705#if defined (_STLP_USE_TEMPLATE_EXPORT)
709# if ! defined (_STLP_NO_WCHAR_T)
713# endif
714#endif /* _STLP_USE_TEMPLATE_EXPORT */
715
717
718#endif /* _STLP_FSTREAM */
719
720
721// Local Variables:
722// mode:C++
723// End:
_STLP_INLINE_LOOP _InputIter __last
Definition: _algo.h:68
return __n
Definition: _algo.h:75
#define _STLP_CALL
Definition: _bc.h:131
#define open
Definition: acwin.h:95
off_t streamoff
Definition: char_traits.h:74
ptrdiff_t streamsize
Definition: char_traits.h:81
bool __is_open() const
Definition: _fstream.h:133
bool _M_write(char *__buf, ptrdiff_t __n)
bool __should_close() const
Definition: _fstream.h:134
bool __regular_file() const
Definition: _fstream.h:135
ios_base::openmode _M_openmode
Definition: _fstream.h:121
unsigned char _M_regular_file
Definition: _fstream.h:124
_STLP_fd _M_file_id
Definition: _fstream.h:116
static size_t _M_page_size
Definition: _fstream.h:113
unsigned char _M_is_open
Definition: _fstream.h:122
unsigned char _M_should_close
Definition: _fstream.h:123
_STLP_fd __get_fd() const
Definition: _fstream.h:136
int __o_mode() const
Definition: _fstream.h:132
streamoff _M_get_offset(char *__first, char *__last)
Definition: _fstream.h:88
static size_t _STLP_CALL __page_size()
Definition: _fstream.h:131
bool _M_in_binary_mode() const
Definition: _fstream.h:100
bool _M_open(const char *, ios_base::openmode, long __protection)
static int _STLP_CALL _M_doit(basic_filebuf< char, char_traits< char > > *__buf)
Definition: _fstream.h:399
static int_type _STLP_CALL _M_doit(basic_filebuf< char_type, _Traits > *)
Definition: _fstream.h:391
_Traits::int_type int_type
Definition: _fstream.h:387
_Traits::char_type char_type
Definition: _fstream.h:388
static bool _STLP_CALL _M_doit(basic_filebuf< char, char_traits< char > > *__buf, char *__first, char *__last)
Definition: _fstream.h:366
static bool _STLP_CALL _M_doit(basic_filebuf< char_type, _Traits > *, char_type *, char_type *)
Definition: _fstream.h:357
_Traits::char_type char_type
Definition: _fstream.h:356
char_traits< char >::int_type int_type
Definition: _fstream.h:439
_Traits traits_type
Definition: _fstream.h:412
_Traits::int_type int_type
Definition: _fstream.h:411
static int_type _STLP_CALL _M_doit(basic_filebuf< _CharT, _Traits > *__this)
Definition: _fstream.h:416
bool _M_unshift()
Definition: _fstream.c:593
_CharT char_type
Definition: _fstream.h:154
virtual int_type underflow()
Definition: _fstream.c:75
_CharT * _M_saved_gptr
Definition: _fstream.h:316
void * _M_mmap_base
Definition: _fstream.h:311
void _M_deallocate_buffers()
Definition: _fstream.c:685
const _Codecvt * _M_codecvt
Definition: _fstream.h:320
virtual basic_streambuf< _CharT, _Traits > * setbuf(char_type *, streamsize)
Definition: _fstream.c:268
char * _M_ext_buf_end
Definition: _fstream.h:299
bool _M_switch_to_input_mode()
Definition: _fstream.c:429
_Self * open(const char *__s, ios_base::openmode __m, long __protection)
Definition: _fstream.h:177
unsigned char _M_in_error_mode
Definition: _fstream.h:282
_CharT * _M_int_buf_EOS
Definition: _fstream.h:287
int_type _M_underflow_aux()
Definition: _fstream.c:495
unsigned char _M_int_buf_dynamic
Definition: _fstream.h:278
streamoff _M_mmap_len
Definition: _fstream.h:312
pos_type _M_seek_return(off_type __off, _State_type __state)
Definition: _fstream.h:247
unsigned char _M_always_noconv
Definition: _fstream.h:275
_Self * open(int __id, ios_base::openmode _Init_mode=ios_base::__default_mode)
Definition: _fstream.h:184
_Self * close()
Definition: _fstream.c:81
@ _S_pback_buf_size
Definition: _fstream.h:326
~basic_filebuf()
Definition: _fstream.c:67
_CharT * _M_saved_eback
Definition: _fstream.h:315
virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode=ios_base::in|ios_base::out)
Definition: _fstream.c:291
_Filebuf_base _M_base
Definition: _fstream.h:270
void _M_exit_putback_mode()
Definition: _fstream.h:228
bool _M_seek_init(bool __do_unshift)
Definition: _fstream.c:700
bool _M_allocate_buffers()
Definition: _fstream.c:676
virtual int sync()
Definition: _fstream.c:402
bool is_open() const
Definition: _fstream.h:169
unsigned char _M_in_putback_mode
Definition: _fstream.h:283
bool _M_switch_to_output_mode()
Definition: _fstream.c:452
void _M_exit_input_mode()
Definition: _fstream.c:118
_Traits::pos_type pos_type
Definition: _fstream.h:156
basic_filebuf< _CharT, _Traits > _Self
Definition: _fstream.h:162
int_type _M_do_noconv_input()
Definition: _fstream.h:335
_STLP_fd fd() const
Definition: _fstream.h:182
int_type _M_input_error()
Definition: _fstream.c:485
virtual streamsize showmanyc()
Definition: _fstream.c:132
_CharT * _M_saved_egptr
Definition: _fstream.h:317
virtual int_type overflow(int_type=traits_type::eof())
Definition: _fstream.c:208
_CharT _M_pback_buf[_S_pback_buf_size]
Definition: _fstream.h:327
basic_streambuf< _CharT, _Traits > _Base
Definition: _fstream.h:161
char * _M_ext_buf_converted
Definition: _fstream.h:298
_State_type _M_state
Definition: _fstream.h:302
_Self * open(const char *__s, ios_base::openmode __m)
Definition: _fstream.h:171
codecvt< _CharT, char, _State_type > _Codecvt
Definition: _fstream.h:319
_State_type _M_end_state
Definition: _fstream.h:308
char * _M_ext_buf
Definition: _fstream.h:290
unsigned char _M_in_output_mode
Definition: _fstream.h:281
_Traits::int_type int_type
Definition: _fstream.h:155
_Traits::off_type off_type
Definition: _fstream.h:157
bool _M_write(char *__buf, ptrdiff_t __n)
Definition: _fstream.h:331
_Traits::state_type _State_type
Definition: _fstream.h:160
_Self * _M_open(int __id, ios_base::openmode _Init_mode=ios_base::__default_mode)
Definition: _fstream.h:202
char * _M_ext_buf_EOS
Definition: _fstream.h:291
int _M_max_width
Definition: _fstream.h:323
_CharT * _M_int_buf
Definition: _fstream.h:286
int_type _M_output_error()
Definition: _fstream.c:579
virtual int_type pbackfail(int_type=traits_type::eof())
Definition: _fstream.c:157
void _M_setup_codecvt(const locale &, bool __on_imbue=true)
Definition: _fstream.c:735
virtual pos_type seekpos(pos_type, ios_base::openmode=ios_base::in|ios_base::out)
Definition: _fstream.c:384
unsigned char _M_constant_width
Definition: _fstream.h:274
unsigned char _M_in_input_mode
Definition: _fstream.h:280
virtual void imbue(const locale &)
Definition: _fstream.c:413
_Traits traits_type
Definition: _fstream.h:158
_Traits::pos_type pos_type
Definition: _fstream.h:616
basic_filebuf< _CharT, _Traits > * rdbuf() const
Definition: _fstream.h:667
basic_fstream(const char *__s, ios_base::openmode __m, long __protection)
Definition: _fstream.h:647
basic_filebuf< _CharT, _Traits > _Buf
Definition: _fstream.h:622
basic_ios< _CharT, _Traits > _Basic_ios
Definition: _fstream.h:620
void open(const char *__s, ios_base::openmode __mod=ios_base::in|ios_base::out)
Definition: _fstream.h:674
_Traits::int_type int_type
Definition: _fstream.h:615
_Traits::off_type off_type
Definition: _fstream.h:617
basic_fstream(const char *__s, ios_base::openmode __mod=ios_base::in|ios_base::out)
Definition: _fstream.h:631
_Traits traits_type
Definition: _fstream.h:618
basic_filebuf< _CharT, _Traits > _M_buf
Definition: _fstream.h:687
_CharT char_type
Definition: _fstream.h:614
void close()
Definition: _fstream.h:681
basic_iostream< _CharT, _Traits > _Base
Definition: _fstream.h:621
bool is_open()
Definition: _fstream.h:670
basic_fstream(int __id, ios_base::openmode __mod=ios_base::in|ios_base::out)
Definition: _fstream.h:640
basic_filebuf< _CharT, _Traits > _M_buf
Definition: _fstream.h:525
basic_ifstream(int __id, ios_base::openmode __mod=ios_base::in)
Definition: _fstream.h:480
_Traits::pos_type pos_type
Definition: _fstream.h:456
bool is_open()
Definition: _fstream.h:510
basic_ifstream(const char *__s, ios_base::openmode __mod=ios_base::in)
Definition: _fstream.h:471
basic_filebuf< _CharT, _Traits > _Buf
Definition: _fstream.h:462
void open(const char *__s, ios_base::openmode __mod=ios_base::in)
Definition: _fstream.h:514
_CharT char_type
Definition: _fstream.h:454
_Traits traits_type
Definition: _fstream.h:458
basic_ios< _CharT, _Traits > _Basic_ios
Definition: _fstream.h:460
_Traits::off_type off_type
Definition: _fstream.h:457
basic_filebuf< _CharT, _Traits > * rdbuf() const
Definition: _fstream.h:507
basic_istream< _CharT, _Traits > _Base
Definition: _fstream.h:461
_Traits::int_type int_type
Definition: _fstream.h:455
void close()
Definition: _fstream.h:519
basic_ifstream(const char *__s, ios_base::openmode __m, long __protection)
Definition: _fstream.h:486
Definition: _ios.h:48
void setstate(iostate __state)
Definition: _ios.h:95
basic_istream< _CharT, _Traits > _Self
Definition: _istream.h:64
_Traits::off_type off_type
Definition: _fstream.h:538
bool is_open()
Definition: _fstream.h:589
_Traits traits_type
Definition: _fstream.h:539
basic_ostream< _CharT, _Traits > _Base
Definition: _fstream.h:542
_Traits::int_type int_type
Definition: _fstream.h:536
basic_ofstream(const char *__s, ios_base::openmode __mod=ios_base::out)
Definition: _fstream.h:551
_Traits::pos_type pos_type
Definition: _fstream.h:537
basic_filebuf< _CharT, _Traits > * rdbuf() const
Definition: _fstream.h:586
void close()
Definition: _fstream.h:598
_CharT char_type
Definition: _fstream.h:535
basic_ofstream(int __id, ios_base::openmode __mod=ios_base::out)
Definition: _fstream.h:559
void open(const char *__s, ios_base::openmode __mod=ios_base::out)
Definition: _fstream.h:593
basic_ofstream(const char *__s, ios_base::openmode __m, long __protection)
Definition: _fstream.h:566
basic_ios< _CharT, _Traits > _Basic_ios
Definition: _fstream.h:541
basic_filebuf< _CharT, _Traits > _M_buf
Definition: _fstream.h:604
basic_filebuf< _CharT, _Traits > _Buf
Definition: _fstream.h:543
char_type * egptr() const
Definition: _streambuf.h:89
char_type * gptr() const
Definition: _streambuf.h:88
void setp(char_type *__pbegin, char_type *__pend)
Definition: _streambuf.h:116
void setg(char_type *__gbegin, char_type *__gnext, char_type *__gend)
Definition: _streambuf.h:92
void operator=(const ios_base &)
int openmode
Definition: _ios_base.h:59
int seekdir
Definition: _ios_base.h:60
Definition: _locale.h:75
unsigned char
Definition: typeof.h:29
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
#define _STLP_TEMPLATE_NULL
Definition: features.h:652
#define __CONST_CAST(__x, __y)
Definition: features.h:584
#define _STLP_CLASS_DECLSPEC
Definition: features.h:983
#define _STLP_EXPORT_TEMPLATE_CLASS
Definition: features.h:987
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
#define _STLP_END_NAMESPACE
Definition: features.h:503
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define __c
Definition: schilyio.h:209
Definition: fci.c:127
static int init
Definition: wintirpc.c:33