cstraw.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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/cstraw.h $*
  25. * *
  26. * $Author:: Eric_c $*
  27. * *
  28. * $Modtime:: 4/02/99 11:59a $*
  29. * *
  30. * $Revision:: 2 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if _MSC_VER >= 1000
  36. #pragma once
  37. #endif // _MSC_VER >= 1000
  38. #ifndef CSTRAW_H
  39. #define CSTRAW_H
  40. #include "buff.h"
  41. #include "straw.h"
  42. /*
  43. ** This class handles transfer of data by perform regulated requests for data from the next
  44. ** class in the chain. It performs no translation on the data. By using this segment in a
  45. ** straw chain, data throughput can be regulated. This can yield great performance increases
  46. ** when dealing with a file source.
  47. */
  48. class CacheStraw : public Straw
  49. {
  50. public:
  51. CacheStraw(Buffer const & buffer) : BufferPtr(buffer), Index(0), Length(0) {}
  52. CacheStraw(int length=4096) : BufferPtr(length), Index(0), Length(0) {}
  53. virtual int Get(void * source, int slen);
  54. private:
  55. Buffer BufferPtr;
  56. int Index;
  57. int Length;
  58. bool Is_Valid(void) {return(BufferPtr.Is_Valid());}
  59. CacheStraw(CacheStraw & rvalue);
  60. CacheStraw & operator = (CacheStraw const & pipe);
  61. };
  62. #endif