CnC_Remastered_Collection

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

XPIPE.H (4025B)


      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/XPIPE.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 : XPIPE.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 #ifndef XPIPE_H
     36 #define XPIPE_H
     37 
     38 #include	"pipe.h"
     39 #include	"wwfile.h"
     40 #include	"buff.h"
     41 
     42 /*
     43 **	This is a simple store-into-buffer pipe terminator. Use it as the final link in a pipe process
     44 **	that needs to store the data into a memory buffer. This can only serve as the final
     45 **	link in the chain of pipe segments.
     46 */
     47 class BufferPipe : public Pipe
     48 {
     49 	public:
     50 		BufferPipe(Buffer const & buffer) : BufferPtr(buffer), Index(0) {}
     51 		BufferPipe(void * buffer, int length) : BufferPtr(buffer, length), Index(0) {}
     52 		virtual int Put(void const * source, int slen);
     53 
     54 	private:
     55 		Buffer BufferPtr;
     56 		int Index;
     57 
     58 //		void * Buffer;
     59 //		int Length;
     60 
     61 		bool Is_Valid(void) {return(BufferPtr.Is_Valid());}
     62 		BufferPipe(BufferPipe & rvalue);
     63 		BufferPipe & operator = (BufferPipe const & pipe);
     64 };
     65 
     66 
     67 /*
     68 **	This is a store-to-file pipe terminator. Use it as the final link in a pipe process that
     69 **	needs to store the data to a file. This can only serve as the last link in the chain
     70 **	of pipe segments.
     71 */
     72 class FilePipe : public Pipe
     73 {
     74 	public:
     75 		FilePipe(FileClass * file) : File(file), HasOpened(false) {}
     76 		FilePipe(FileClass & file) : File(&file), HasOpened(false) {}
     77 		virtual ~FilePipe(void);
     78 
     79 		virtual int Put(void const * source, int slen);
     80 		virtual int End(void);
     81 
     82 	private:
     83 		FileClass * File;
     84 		bool HasOpened;
     85 
     86 		bool Valid_File(void) {return(File != NULL);}
     87 		FilePipe(FilePipe & rvalue);
     88 		FilePipe & operator = (FilePipe const & pipe);
     89 
     90 };
     91 
     92 #endif