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.

96 lines
2.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1997
  6. //
  7. // File: parsfile.h
  8. //
  9. //--------------------------------------------------------------------------
  10. //
  11. // parsfile.h: abstract classes for parser I/O
  12. //
  13. // This abstraction layer allows parser input and output to be
  14. // redirected as needed.
  15. //
  16. #ifndef _PARSFILE_H_
  17. #define _PARSFILE_H_
  18. #include <stdio.h>
  19. #include <stdarg.h>
  20. #include "zstr.h"
  21. typedef const char * SZC;
  22. //
  23. // PARSIN: abstract base class for parser input file handling
  24. //
  25. class PARSIN
  26. {
  27. public:
  28. PARSIN () {}
  29. virtual ~ PARSIN ();
  30. virtual void Close () = 0;
  31. virtual bool Open ( SZC szcFileName, SZC szcMode = "r") = 0;
  32. virtual int Getch () = 0;
  33. virtual bool BEof () = 0;
  34. virtual bool BOpen () = 0;
  35. const ZSTR & ZsFn () const
  36. { return _zsFn; }
  37. protected:
  38. ZSTR _zsFn;
  39. };
  40. //
  41. // PARSOUT: abstract base class for parser output file
  42. //
  43. class PARSOUT
  44. {
  45. public:
  46. PARSOUT () {}
  47. virtual ~ PARSOUT ();
  48. // Print generic formatted information
  49. virtual void Vsprint ( SZC szcFmt, va_list valist ) = 0;
  50. // Notify about error and warning information
  51. virtual void ErrWarn ( bool bErr, int iLine ) {}
  52. virtual void Flush () {}
  53. // Simple output
  54. void Fprint ( SZC szcFmt, ... );
  55. };
  56. //
  57. // PARSIN_DSC: parser DSC file input based on stdio.h
  58. //
  59. class PARSIN_DSC : public PARSIN
  60. {
  61. public:
  62. PARSIN_DSC ();
  63. ~ PARSIN_DSC ();
  64. void Close ();
  65. bool Open ( SZC szcFileName, SZC szcMode = "r" );
  66. int Getch ();
  67. bool BEof ();
  68. bool BOpen ();
  69. protected:
  70. FILE * _pfile;
  71. };
  72. //
  73. // PARSOUT_STD: parser output data stream based on stdio.h
  74. //
  75. class PARSOUT_STD : public PARSOUT
  76. {
  77. public:
  78. PARSOUT_STD ( FILE * pfile = NULL );
  79. virtual ~ PARSOUT_STD ();
  80. void Vsprint ( SZC szcFmt, va_list valist );
  81. void Flush ();
  82. protected:
  83. FILE * _pfile;
  84. };
  85. #endif // _PARSFILE_H_