Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
bufffile.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/Code/wwlib/bufffile.h $*
26 * *
27 * $Author:: Ian_l $*
28 * *
29 * $Modtime:: 10/31/01 3:33p $*
30 * *
31 * $Revision:: 3 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * RawFileClass::File_Name -- Returns with the filename associate with the file object. *
36 * RawFileClass::RawFileClass -- Default constructor for a file object. *
37 * RawFileClass::~RawFileClass -- Default deconstructor for a file object. *
38 * RawFileClass::Is_Open -- Checks to see if the file is open or not. *
39 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
40
41#if _MSC_VER >= 1000
42#pragma once
43#endif // _MSC_VER >= 1000
44
45#ifndef BUFFFILE_H
46#define BUFFFILE_H
47
48#include "rawfile.h"
49
50
51/*
52** This is the definition of a buffered read raw file class.
53*/
55{
56 typedef RawFileClass BASECLASS;
57
58 public:
59
60 BufferedFileClass(char const *filename);
64 virtual ~BufferedFileClass(void);
65
66 virtual int Read(void *buffer, int size);
67 virtual int Seek(int pos, int dir=SEEK_CUR);
68 virtual int Write(void const *buffer, int size);
69 virtual void Close(void);
70
71 protected:
72
73 static void Set_Desired_Buffer_Size( int size ) { _DesiredBufferSize = size; }
74
75 void Reset_Buffer( void );
76
77 private:
78 unsigned char * Buffer; // The read buffer
79 unsigned int BufferSize; // The allocated size of the read buffer
80 int BufferAvailable; // The amount of data in the read buffer
81 int BufferOffset; // The data already given out
82 static int _DesiredBufferSize;
83};
84
85#endif
#define SEEK_CUR
Definition WWFILE.H:56
char dir[_MAX_DIR]
Definition autorun.cpp:215
Definition BUFF.H:57
static void Set_Desired_Buffer_Size(int size)
Definition bufffile.h:73
virtual void Close(void)
Definition bufffile.cpp:79
void Reset_Buffer(void)
Definition bufffile.cpp:243
BufferedFileClass(RawFileClass const &f)
BufferedFileClass(char const *filename)
Definition bufffile.cpp:59
BufferedFileClass & operator=(BufferedFileClass const &f)
virtual ~BufferedFileClass(void)
Definition bufffile.cpp:71
BufferedFileClass(void)
Definition bufffile.cpp:47
virtual int Write(void const *buffer, int size)
Definition bufffile.cpp:189
virtual int Seek(int pos, int dir=SEEK_CUR)
Definition bufffile.cpp:220
virtual int Read(void *buffer, int size)
Definition bufffile.cpp:109
RawFileClass(char const *filename)
Definition rawfile.cpp:246