ScummVM API documentation
fileio.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 DIRECTOR_LINGO_XLIBS_FILEIO_H
23 #define DIRECTOR_LINGO_XLIBS_FILEIO_H
24 
25 namespace Common {
26 class SeekableReadStream;
27 typedef SeekableReadStream InSaveFile;
28 class OutSaveFile;
29 class MemoryWriteStreamDynamic;
30 class String;
31 }
32 
33 namespace Director {
34 
35 enum FileIOError {
36  kErrorNone = 0,
37  kErrorMemAlloc = 1,
38  kErrorEOF = -1,
39  kErrorDirectoryFull = -33,
40  kErrorVolumeFull = -34,
41  kErrorVolumeNotFound = -35,
42  kErrorIO = -36,
43  kErrorBadFileName = -37,
44  kErrorFileNotOpen = -38,
45  kErrorInvalidPos = -39, // undocumented
46  kErrorTooManyFilesOpen = -42,
47  kErrorFileNotFound = -43,
48  kErrorNoSuchDrive = -56,
49  kErrorReadOnly = -61, // undocumented
50  kErrorNoDiskInDrive = -65,
51  kErrorDirectoryNotFound = -120
52 };
53 
54 class FileObject : public Object<FileObject> {
55 public:
56  Common::String *_filename;
57  Common::SeekableReadStream *_inStream;
58  Common::OutSaveFile *_outFile;
60  FileIOError _lastError;
61 
62 public:
63  FileObject(ObjectType objType);
64  FileObject(const FileObject &obj);
65  ~FileObject() override;
66 
67  bool hasProp(const Common::String &propName) override;
68  Datum getProp(const Common::String &propName) override;
69 
70  FileIOError open(const Common::String &origpath, const Common::String &mode);
71  void clear();
72  FileIOError saveFileError();
73  void dispose() override;
74 };
75 
76 namespace FileIO {
77  extern const char *xlibName;
78  extern const XlibFileDesc fileNames[];
79 
80  void open(ObjectType type, const Common::Path &path);
81  void close(ObjectType type);
82 
83  bool charInMatchString(char ch, const Common::String &matchString);
84  void m_delete(int nargs);
85  void m_dispose(int nargs);
86  void m_error(int nargs);
87  void m_fileName(int nargs);
88  void m_getFinderInfo(int nargs);
89  void m_getLength(int nargs);
90  void m_getPosition(int nargs);
91  void m_new(int nargs);
92  void m_readChar(int nargs);
93  void m_readFile(int nargs);
94  void m_readLine(int nargs);
95  void m_readPict(int nargs);
96  void m_readToken(int nargs);
97  void m_readWord(int nargs);
98  void m_setFinderInfo(int nargs);
99  void m_setPosition(int nargs);
100  void m_status(int nargs);
101  void m_writeChar(int nargs);
102  void m_writeString(int nards);
103 
104  void m_setOverrideDrive(int nargs);
105 
106  void m_closeFile(int nargs);
107  void m_createFile(int nargs);
108  void m_displayOpen(int nargs);
109  void m_displaySave(int nargs);
110  void m_openFile(int nargs);
111  void m_setFilterMask(int nargs);
112  void m_getOSDirectory(int nargs);
113 
114 } // End of namespace FileIO
115 
116 } // End of namespace Director
117 
118 #endif
Definition: str.h:59
Definition: savefile.h:54
Definition: fileio.h:54
Definition: memstream.h:194
Definition: path.h:52
Definition: stream.h:745
bool matchString(const char *str, const char *pat, bool ignoreCase=false, const char *wildcardExclusions=NULL)
Definition: lingo-object.h:37
Definition: archive.h:35
Definition: lingo-object.h:71
Definition: algorithm.h:29
Definition: lingo.h:130
SeekableReadStream InSaveFile
Definition: savefile.h:47