GameScript: Move initialization out of constructor.
[gemrb.git] / gemrb / core / FileStream.h
blob2c5dd1d8546f5c0f0fe1a3828afdfac325521f7b
1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 /**
22 * @file FileStream.h
23 * Declares FileStream class, stream reading/writing data from/to a file in a filesystem.
24 * @author The GemRB Project
28 #ifndef FILESTREAM_H
29 #define FILESTREAM_H
31 #include "globals.h"
32 #include "exports.h"
34 /**
35 * @class FileStream
36 * Reads and writes data from/to files on a filesystem
39 class GEM_EXPORT FileStream : public DataStream {
40 private:
41 bool autoFree;
42 unsigned long startpos;
43 _FILE* str;
44 bool opened, created;
45 public:
46 FileStream(void);
47 ~FileStream(void);
49 bool Open(const char* filename, bool autoFree = true);
50 bool Open(_FILE* stream, int startpos, int size, bool autoFree = false);
51 bool Modify(const char* filename, bool autoFree = true);
52 bool Create(const char* folder, const char* filename, SClass_ID ClassID);
53 bool Create(const char* filename, SClass_ID ClassID);
54 int Read(void* dest, unsigned int length);
55 int Write(const void* src, unsigned int length);
56 int Seek(int pos, int startpos);
57 unsigned long GetStartPos() const;
58 int ReadLine(void* buf, unsigned int maxlen);
61 #endif // ! FILESTREAM_H