CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

XSTRAW.H (3905B)


      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 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /* $Header: /CounterStrike/XSTRAW.H 1     3/03/97 10:26a Joe_bostic $ */
     17 /***********************************************************************************************
     18  ***              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               ***
     19  ***********************************************************************************************
     20  *                                                                                             *
     21  *                 Project Name : Command & Conquer                                            *
     22  *                                                                                             *
     23  *                    File Name : XSTRAW.H                                                     *
     24  *                                                                                             *
     25  *                   Programmer : Joe L. Bostic                                                *
     26  *                                                                                             *
     27  *                   Start Date : 07/04/96                                                     *
     28  *                                                                                             *
     29  *                  Last Update : July 4, 1996 [JLB]                                           *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * Functions:                                                                                  *
     33  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     34 
     35 
     36 #ifndef XSTRAW_H
     37 #define XSTRAW_H
     38 
     39 #include	"straw.h"
     40 #include	"buff.h"
     41 #include	"wwfile.h"
     42 #include	<stddef.h>
     43 
     44 /*
     45 **	This class is used to manage a buffer as a data source. Data requests will draw from the
     46 **	buffer supplied until the buffer is exhausted.
     47 */
     48 class BufferStraw : public Straw
     49 {
     50 	public:
     51 		BufferStraw(Buffer const & buffer) : BufferPtr(buffer), Index(0) {}
     52 		BufferStraw(void const * buffer, int length) : BufferPtr((void*)buffer, length), Index(0) {}
     53 		virtual int Get(void * source, int slen);
     54 
     55 	private:
     56 		Buffer BufferPtr;
     57 		int Index;
     58 //		void const * BufferPtr;
     59 //		int Length;
     60 
     61 		bool Is_Valid(void) {return(BufferPtr.Is_Valid());}
     62 		BufferStraw(BufferStraw & rvalue);
     63 		BufferStraw & operator = (BufferStraw const & pipe);
     64 };
     65 
     66 /*
     67 **	This class is used to manage a file as a data source. Data requests will draw from the
     68 **	file until the file has been completely read.
     69 */
     70 class FileStraw : public Straw
     71 {
     72 	public:
     73 		FileStraw(FileClass * file) : File(file), HasOpened(false) {}
     74 		FileStraw(FileClass & file) : File(&file), HasOpened(false) {}
     75 		virtual ~FileStraw(void);
     76 		virtual int Get(void * source, int slen);
     77 
     78 	private:
     79 		FileClass * File;
     80 		bool HasOpened;
     81 
     82 		bool Valid_File(void) {return(File != NULL);}
     83 		FileStraw(FileStraw & rvalue);
     84 		FileStraw & operator = (FileStraw const & pipe);
     85 };
     86 
     87 
     88 #endif