Leaked source code of windows server 2003
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.

78 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name :
  4. InStrm.h
  5. Abstract:
  6. A lightweight implementation of input streams. This class provides
  7. the interface, as well as a basic skeleton for input streams.
  8. Author:
  9. Neil Allain ( a-neilal ) August-1997
  10. Revision History:
  11. --*/
  12. #pragma once
  13. #include "MyString.h"
  14. struct CharCheck
  15. {
  16. virtual bool operator()( _TCHAR )=0;
  17. };
  18. struct IsWhiteSpace : public CharCheck
  19. {
  20. virtual bool operator()( _TCHAR );
  21. };
  22. struct IsNewLine : public CharCheck
  23. {
  24. virtual bool operator()( _TCHAR );
  25. };
  26. class InStream
  27. {
  28. public:
  29. enum{
  30. EndOfFile = E_FAIL
  31. };
  32. InStream();
  33. bool eof() const { return m_bEof; }
  34. HRESULT lastError() const { return m_lastError; }
  35. virtual HRESULT skip( CharCheck& )=0;
  36. virtual HRESULT back( size_t )=0;
  37. virtual HRESULT read( CharCheck&, String& )=0;
  38. virtual HRESULT readChar( _TCHAR& )=0;
  39. virtual HRESULT readInt16( SHORT& );
  40. virtual HRESULT readInt( int& );
  41. virtual HRESULT readInt32( LONG& );
  42. virtual HRESULT readUInt32( ULONG& );
  43. virtual HRESULT readFloat( float& );
  44. virtual HRESULT readDouble( double& );
  45. virtual HRESULT readString( String& );
  46. virtual HRESULT readLine( String& );
  47. virtual HRESULT skipWhiteSpace();
  48. InStream& operator>>( _TCHAR& );
  49. InStream& operator>>( SHORT& );
  50. InStream& operator>>( int& );
  51. InStream& operator>>( LONG& );
  52. InStream& operator>>( ULONG& );
  53. InStream& operator>>( float& );
  54. InStream& operator>>( double& );
  55. InStream& operator>>( String& );
  56. protected:
  57. void setLastError( HRESULT );
  58. private:
  59. bool m_bEof;
  60. HRESULT m_lastError;
  61. };