CnC_Remastered_Collection/REDALERT/RAMFILE.H

111 lines
4.1 KiB
C++
Raw Normal View History

//
// Copyright 2020 Electronic Arts Inc.
//
// TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
// software: you can redistribute it and/or modify it under the terms of
// the GNU General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
// TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
// in the hope that it will be useful, but with permitted additional restrictions
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
// distributed with this program. You should have received a copy of the
// GNU General Public License along with permitted additional restrictions
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
/* $Header: /CounterStrike/RAMFILE.H 1 3/03/97 10:25a Joe_bostic $ */
/***********************************************************************************************
*** 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 ***
***********************************************************************************************
* *
* Project Name : Command & Conquer *
* *
* File Name : RAMFILE.H *
* *
* Programmer : Joe L. Bostic *
* *
* Start Date : 06/30/96 *
* *
* Last Update : June 30, 1996 [JLB] *
* *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#ifndef RAMFILE_H
#define RAMFILE_H
#include "wwfile.h"
class RAMFileClass : public FileClass
{
public:
RAMFileClass(void * buffer, int len);
virtual ~RAMFileClass(void);
virtual char const * File_Name(void) const {return("UNKNOWN");}
virtual char const * Set_Name(char const * ) {return(File_Name());}
virtual int Create(void);
virtual int Delete(void);
virtual int Is_Available(int forced=false);
virtual int Is_Open(void) const;
virtual int Open(char const * filename, int access=READ);
virtual int Open(int access=READ);
virtual long Read(void * buffer, long size);
virtual long Seek(long pos, int dir=SEEK_CUR);
virtual long Size(void);
virtual long Write(void const * buffer, long size);
virtual void Close(void);
virtual unsigned long Get_Date_Time(void) {return(0);}
virtual bool Set_Date_Time(unsigned long ) {return(true);}
virtual void Error(int , int = false, char const * =NULL) {}
operator char const * () {return File_Name();}
private:
/*
** Pointer to the buffer that the "file" will reside in.
*/
char * Buffer;
/*
** The maximum size of the buffer. The file occupying the buffer
** may be smaller than this size.
*/
int MaxLength;
/*
** The number of bytes in the sub-file occupying the buffer.
*/
int Length;
/*
** The current file position offset within the buffer.
*/
int Offset;
/*
** The file was opened with this access mode.
*/
int Access;
/*
** Is the file currently open?
*/
bool IsOpen;
/*
** Was the file buffer allocated during construction of this object?
*/
bool IsAllocated;
};
#endif