WWFILE.H 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. ** Command & Conquer Red Alert(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. /* $Header: /CounterStrike/WWFILE.H 1 3/03/97 10:26a Joe_bostic $ */
  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 : Westwood Library *
  24. * *
  25. * File Name : WWFILE.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : August 8, 1994 *
  30. * *
  31. * Last Update : August 8, 1994 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef WWFILE_Hx
  37. #define WWFILE_Hx
  38. #define YEAR(dt) (((dt & 0xFE000000) >> (9 + 16)) + 1980)
  39. #define MONTH(dt) ((dt & 0x01E00000) >> (5 + 16))
  40. #define DAY(dt) ((dt & 0x001F0000) >> (0 + 16))
  41. #define HOUR(dt) ((dt & 0x0000F800) >> 11)
  42. #define MINUTE(dt) ((dt & 0x000007E0) >> 5)
  43. #define SECOND(dt) ((dt & 0x0000001F) << 1)
  44. #include <io.h>
  45. #include <stddef.h>
  46. #ifndef READ
  47. #define READ 1
  48. #endif
  49. #ifndef WRITE
  50. #define WRITE 2
  51. #endif
  52. /*
  53. ** The "bool" integral type was defined by the C++ committee in
  54. ** November of '94. Until the compiler supports this, use the following
  55. ** definition.
  56. */
  57. #ifndef __BORLANDC__
  58. #ifndef TRUE_FALSE_DEFINED
  59. #define TRUE_FALSE_DEFINED
  60. enum {false=0,true=1};
  61. typedef int bool;
  62. #endif
  63. #endif
  64. class FileClass
  65. {
  66. public:
  67. virtual ~FileClass(void) {};
  68. virtual char const * File_Name(void) const = 0;
  69. virtual char const * Set_Name(char const *filename) = 0;
  70. virtual int Create(void) = 0;
  71. virtual int Delete(void) = 0;
  72. virtual int Is_Available(int forced=false) = 0;
  73. virtual int Is_Open(void) const = 0;
  74. virtual int Open(char const *filename, int rights=READ) = 0;
  75. virtual int Open(int rights=READ) = 0;
  76. virtual long Read(void *buffer, long size) = 0;
  77. virtual long Seek(long pos, int dir=SEEK_CUR) = 0;
  78. virtual long Size(void) = 0;
  79. virtual long Write(void const *buffer, long size) = 0;
  80. virtual void Close(void) = 0;
  81. virtual unsigned long Get_Date_Time(void) {return(0);}
  82. virtual bool Set_Date_Time(unsigned long ) {return(false);}
  83. virtual void Error(int error, int canretry = false, char const * filename=NULL) = 0;
  84. operator char const * () {return File_Name();};
  85. };
  86. #endif