Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
bfiofile.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : Command & Conquer *
24 * *
25 * $Archive:: /Commando/Library/BFIOFILE.H $*
26 * *
27 * $Author:: Greg_h $*
28 * *
29 * $Modtime:: 7/22/97 11:37a $*
30 * *
31 * $Revision:: 1 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37#ifndef BFIOFILE_H
38#define BFIOFILE_H
39
40#include "rawfile.h"
41
42/*
43** This derivation of the raw file class handles buffering the input/output in order to
44** achieve greater speed. The buffering is not active by default. It must be activated
45** by setting the appropriate buffer through the Cache() function.
46*/
48{
49 typedef RawFileClass BASECLASS;
50
51 public:
52
53 BufferIOFileClass(char const * filename);
55 virtual ~BufferIOFileClass(void);
56
57 bool Cache( long size=0, void * ptr=NULL);
58 void Free( void);
59 bool Commit( void);
60 virtual char const * Set_Name(char const * filename);
61 virtual bool Is_Available(int forced=false);
62 virtual bool Is_Open(void) const;
63 virtual int Open(char const * filename, int rights=READ);
64 virtual int Open(int rights=READ);
65 virtual int Read(void * buffer, int size);
66 virtual int Seek(int pos, int dir=SEEK_CUR);
67 virtual int Size(void);
68 virtual int Write(void const * buffer, int size);
69 virtual void Close(void);
70
72
73 private:
74
75 bool IsAllocated;
76 bool IsOpen;
77 bool IsDiskOpen;
78 bool IsCached;
79 bool IsChanged;
80 bool UseBuffer;
81
82 int BufferRights;
83
84 void *Buffer;
85
86 long BufferSize;
87 long BufferPos;
88 long BufferFilePos;
89 long BufferChangeBeg;
90 long BufferChangeEnd;
91 long FileSize;
92 long FilePos;
93 long TrueFileStart;
94};
95
96#endif
#define NULL
Definition BaseType.h:92
#define SEEK_CUR
Definition WWFILE.H:56
char dir[_MAX_DIR]
Definition autorun.cpp:215
Definition BUFF.H:57
virtual int Write(void const *buffer, int size)
Definition bfiofile.cpp:585
virtual bool Is_Available(int forced=false)
Definition bfiofile.cpp:439
virtual int Read(void *buffer, int size)
Definition bfiofile.cpp:728
virtual int Seek(int pos, int dir=SEEK_CUR)
Definition bfiofile.cpp:852
void Free(void)
Definition bfiofile.cpp:328
virtual int Open(char const *filename, int rights=READ)
Definition bfiofile.cpp:495
virtual ~BufferIOFileClass(void)
Definition bfiofile.cpp:146
bool Commit(void)
Definition bfiofile.cpp:361
virtual void Close(void)
Definition bfiofile.cpp:961
bool Cache(long size=0, void *ptr=NULL)
Definition bfiofile.cpp:165
virtual int Size(void)
Definition bfiofile.cpp:936
virtual bool Is_Open(void) const
Definition bfiofile.cpp:464
BufferIOFileClass(char const *filename)
Definition bfiofile.cpp:75
virtual char const * Set_Name(char const *filename)
Definition bfiofile.cpp:410
RawFileClass(char const *filename)
Definition rawfile.cpp:246