XPIPE.H 3.8 KB

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