RAMFILE.H 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/RAMFILE.H 1 3/03/97 10:25a Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** 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 ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : RAMFILE.H *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : 06/30/96 *
  26. * *
  27. * Last Update : June 30, 1996 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #ifndef RAMFILE_H
  33. #define RAMFILE_H
  34. #include "wwfile.h"
  35. class RAMFileClass : public FileClass
  36. {
  37. public:
  38. RAMFileClass(void * buffer, int len);
  39. virtual ~RAMFileClass(void);
  40. virtual char const * File_Name(void) const {return("UNKNOWN");}
  41. virtual char const * Set_Name(char const * ) {return(File_Name());}
  42. virtual int Create(void);
  43. virtual int Delete(void);
  44. virtual int Is_Available(int forced=false);
  45. virtual int Is_Open(void) const;
  46. virtual int Open(char const * filename, int access=READ);
  47. virtual int Open(int access=READ);
  48. virtual long Read(void * buffer, long size);
  49. virtual long Seek(long pos, int dir=SEEK_CUR);
  50. virtual long Size(void);
  51. virtual long Write(void const * buffer, long size);
  52. virtual void Close(void);
  53. virtual unsigned long Get_Date_Time(void) {return(0);}
  54. virtual bool Set_Date_Time(unsigned long ) {return(true);}
  55. virtual void Error(int , int = false, char const * =NULL) {}
  56. operator char const * () {return File_Name();}
  57. private:
  58. /*
  59. ** Pointer to the buffer that the "file" will reside in.
  60. */
  61. char * Buffer;
  62. /*
  63. ** The maximum size of the buffer. The file occupying the buffer
  64. ** may be smaller than this size.
  65. */
  66. int MaxLength;
  67. /*
  68. ** The number of bytes in the sub-file occupying the buffer.
  69. */
  70. int Length;
  71. /*
  72. ** The current file position offset within the buffer.
  73. */
  74. int Offset;
  75. /*
  76. ** The file was opened with this access mode.
  77. */
  78. int Access;
  79. /*
  80. ** Is the file currently open?
  81. */
  82. bool IsOpen;
  83. /*
  84. ** Was the file buffer allocated during construction of this object?
  85. */
  86. bool IsAllocated;
  87. };
  88. #endif