xpipe.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. ** Command & Conquer Renegade(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. /***********************************************************************************************
  19. *** 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 ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Command & Conquer *
  23. * *
  24. * $Archive:: /G/wwlib/XPIPE.H $*
  25. * *
  26. * $Author:: Eric_c $*
  27. * *
  28. * $Modtime:: 4/02/99 12:01p $*
  29. * *
  30. * $Revision:: 2 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if _MSC_VER >= 1000
  36. #pragma once
  37. #endif // _MSC_VER >= 1000
  38. #ifndef XPIPE_H
  39. #define XPIPE_H
  40. #include "buff.h"
  41. #include "pipe.h"
  42. #include "wwfile.h"
  43. /*
  44. ** This is a simple store-into-buffer pipe terminator. Use it as the final link in a pipe process
  45. ** that needs to store the data into a memory buffer. This can only serve as the final
  46. ** link in the chain of pipe segments.
  47. */
  48. class BufferPipe : public Pipe
  49. {
  50. public:
  51. BufferPipe(Buffer const & buffer) : BufferPtr(buffer), Index(0) {}
  52. BufferPipe(void * buffer, int length) : BufferPtr(buffer, length), Index(0) {}
  53. virtual int Put(void const * source, int slen);
  54. private:
  55. Buffer BufferPtr;
  56. int Index;
  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