Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1992 - 1994, Microsoft Corporation.
  4. //
  5. // File: fstrm.cxx
  6. //
  7. // Contents: Stream for transporting text from IFilter to cxx parser.
  8. //
  9. // Classes: CFilterTextStream
  10. //
  11. // History: 01-Aug-93 AmyA Created
  12. // 17-Oct-94 BartoszM Rewrote
  13. //
  14. //----------------------------------------------------------------------------
  15. #include <pch.cxx>
  16. #pragma hdrstop
  17. //+-------------------------------------------------------------------------
  18. //
  19. // Member: CFilterTextStream::CFilterTextStream, public
  20. //
  21. // Synopsis: Constructor
  22. //
  23. // History: 01-Aug-93 AmyA Created
  24. // 17-Oct-94 BartoszM Rewrote
  25. //
  26. //--------------------------------------------------------------------------
  27. CFilterTextStream::CFilterTextStream(IFilter* pIFilter)
  28. : CTextSource(_statChunk)
  29. {
  30. iEnd = 0;
  31. iCur = 0;
  32. Win4Assert (pIFilter != 0);
  33. awcBuffer = _awcFilterBuffer;
  34. _sc = pIFilter->GetChunk( &_statChunk );
  35. if (SUCCEEDED(_sc))
  36. {
  37. _pFilter = pIFilter;
  38. pfnFillTextBuffer = CTextSource::FillBuf;
  39. _mapper.NewChunk ( _statChunk.idChunk, 0 );
  40. _pMapper = &_mapper;
  41. _sc = CTextSource::FillBuf( this );
  42. }
  43. }
  44. //+---------------------------------------------------------------------------
  45. //
  46. // Member: CFilterTextStream::GetMore, public
  47. //
  48. // Synopsis: Try to replenish the buffer
  49. //
  50. // History: 16-Nov-94 BartoszM Created
  51. //
  52. //----------------------------------------------------------------------------
  53. int CFilterTextStream::GetMore()
  54. {
  55. if (iCur == iEnd - 1)
  56. {
  57. _sc = FillBuf( this );
  58. // if there was no more data
  59. // the last lookahead was moved
  60. // to the beginning and
  61. // iCur == iEnd - 1
  62. // next time around it will be
  63. // iCur == iEnd
  64. }
  65. else
  66. {
  67. Win4Assert(iCur == iEnd);
  68. return -1; // EOF
  69. }
  70. return awcBuffer[iCur++];
  71. }