ScummVM API documentation
ifstream.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program 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  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef GRAPHICS_MFC_IFSTREAM_H
23 #define GRAPHICS_MFC_IFSTREAM_H
24 
25 #include "common/file.h"
26 
27 namespace Graphics {
28 namespace MFC {
29 
30 namespace ios {
31 enum openmode {
32  in = 1 << 0,
33  binary = 1 << 1
34 };
35 } // namespace ios
36 
37 class ifstream {
38 private:
39  Common::SeekableReadStream *_file = nullptr;
40  size_t _cCount = 0;
41 
42 public:
43  ifstream();
44  ifstream(const char *filename, ios::openmode mode = ios::in);
45  virtual ~ifstream() {
46  close();
47  }
48 
49  virtual void open(const char *filename, ios::openmode mode = ios::in);
50  virtual bool is_open() const;
51  virtual void close();
52 
53  virtual ifstream &getline(char *buffer, size_t count);
54  virtual ifstream &read(char *buffer, size_t count);
55  virtual size_t gcount() const;
56 
57  virtual bool good() const;
58  virtual bool eof() const;
59  virtual bool fail() const;
60  virtual bool bad() const;
61 
62  // Positioning
63  virtual size_t tellg();
64  virtual ifstream &seekg(size_t pos);
65  virtual ifstream &seekg(int32 off, int dir);
66 };
67 
68 } // namespace MFC
69 } // namespace Graphics
70 
71 #endif
Definition: stream.h:745
Definition: ifstream.h:37
Definition: formatinfo.h:28