XPIPE.H 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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/XPIPE.H 1 3/03/97 10:26a 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 : XPIPE.H *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : 07/04/96 *
  26. * *
  27. * Last Update : July 4, 1996 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #ifndef XPIPE_H
  33. #define XPIPE_H
  34. #include "pipe.h"
  35. #include "wwfile.h"
  36. #include "buff.h"
  37. /*
  38. ** This is a simple store-into-buffer pipe terminator. Use it as the final link in a pipe process
  39. ** that needs to store the data into a memory buffer. This can only serve as the final
  40. ** link in the chain of pipe segments.
  41. */
  42. class BufferPipe : public Pipe
  43. {
  44. public:
  45. BufferPipe(Buffer const & buffer) : BufferPtr(buffer), Index(0) {}
  46. BufferPipe(void * buffer, int length) : BufferPtr(buffer, length), Index(0) {}
  47. virtual int Put(void const * source, int slen);
  48. private:
  49. Buffer BufferPtr;
  50. int Index;
  51. // void * Buffer;
  52. // int Length;
  53. bool Is_Valid(void) {return(BufferPtr.Is_Valid());}
  54. BufferPipe(BufferPipe & rvalue);
  55. BufferPipe & operator = (BufferPipe const & pipe);
  56. };
  57. /*
  58. ** This is a store-to-file pipe terminator. Use it as the final link in a pipe process that
  59. ** needs to store the data to a file. This can only serve as the last link in the chain
  60. ** of pipe segments.
  61. */
  62. class FilePipe : public Pipe
  63. {
  64. public:
  65. FilePipe(FileClass * file) : File(file), HasOpened(false) {}
  66. FilePipe(FileClass & file) : File(&file), HasOpened(false) {}
  67. virtual ~FilePipe(void);
  68. virtual int Put(void const * source, int slen);
  69. virtual int End(void);
  70. private:
  71. FileClass * File;
  72. bool HasOpened;
  73. bool Valid_File(void) {return(File != NULL);}
  74. FilePipe(FilePipe & rvalue);
  75. FilePipe & operator = (FilePipe const & pipe);
  76. };
  77. #endif