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.

211 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1991-2000 Microsoft Corporation
  3. Module Name:
  4. PAGER
  5. Abstract:
  6. This module contains the definition for the PAGER class, used by
  7. the "More" utility
  8. Author:
  9. Ramon Juan San Andres (RamonSA) 15-Apr-1990
  10. Notes:
  11. --*/
  12. #if !defined (_PAGER_)
  13. #define _PAGER_
  14. #include "object.hxx"
  15. #include "wstring.hxx"
  16. #include "bstring.hxx"
  17. #include "stream.hxx"
  18. //
  19. // Forward references
  20. //
  21. DECLARE_CLASS( SCREEN );
  22. DECLARE_CLASS( PROGRAM );
  23. DECLARE_CLASS( PAGER );
  24. class PAGER : public OBJECT {
  25. public:
  26. DECLARE_CONSTRUCTOR( PAGER );
  27. DECLARE_CAST_MEMBER_FUNCTION( PAGER );
  28. NONVIRTUAL
  29. ~PAGER (
  30. );
  31. NONVIRTUAL
  32. BOOLEAN
  33. Initialize (
  34. IN PSTREAM Stream,
  35. IN PPROGRAM Program
  36. );
  37. NONVIRTUAL
  38. VOID
  39. ClearLine (
  40. );
  41. NONVIRTUAL
  42. VOID
  43. DisplayBlankLine (
  44. IN ULONG Lines,
  45. IN BOOLEAN NewLine DEFAULT TRUE
  46. );
  47. NONVIRTUAL
  48. BOOLEAN
  49. DisplayPage (
  50. IN ULONG LinesInPage,
  51. IN BOOLEAN ClearScreen,
  52. IN BOOLEAN SqueezeBlankLines,
  53. IN BOOLEAN ExpandFormFeed,
  54. IN ULONG TabExp
  55. );
  56. NONVIRTUAL
  57. VOID
  58. DisplayString (
  59. IN PWSTRING String,
  60. OUT PCHNUM Position,
  61. IN CHNUM Length,
  62. IN BOOLEAN NewLine DEFAULT TRUE
  63. );
  64. NONVIRTUAL
  65. BOOLEAN
  66. ThereIsMoreToPage (
  67. );
  68. NONVIRTUAL
  69. ULONGLONG
  70. QueryCurrentByte (
  71. );
  72. NONVIRTUAL
  73. ULONG
  74. QueryCurrentLine (
  75. );
  76. NONVIRTUAL
  77. USHORT
  78. QueryLinesPerPage (
  79. );
  80. NONVIRTUAL
  81. BOOLEAN
  82. SkipLines (
  83. IN ULONG LinesToSkip,
  84. IN ULONG TabExp
  85. );
  86. #ifdef FE_SB // v-junm - 09/24/93
  87. BOOLEAN
  88. IsLeadByte(
  89. IN BYTE c
  90. );
  91. #endif
  92. private:
  93. VOID
  94. Construct (
  95. );
  96. NONVIRTUAL
  97. BOOLEAN
  98. ReadNextString (
  99. IN ULONG TabExp
  100. );
  101. PSTREAM _Stream; // Stream to page
  102. ULONG _CurrentLineNumber; // Current line number
  103. ULONG _RowsInPage; // Rows per page
  104. USHORT _ColumnsInPage; // Columns per page
  105. USHORT _ColumnsInScreen; // Columns in screen
  106. PWSTRING _String; // String with line
  107. CHNUM _Position; // Position within String
  108. PSCREEN _Screen; // Pointer to screen
  109. PSTREAM _StandardOutput; // Standard output
  110. PWSTRING _Blanks; // Blank characters
  111. PWSTRING _BlankLine; // A line of blanks
  112. PBSTRING _BString; // Temp ASCII buffer by PAGER::ReadNextString
  113. };
  114. INLINE
  115. BOOLEAN
  116. PAGER::ThereIsMoreToPage (
  117. )
  118. /*++
  119. Routine Description:
  120. Finds out if there is more stuff to page
  121. Arguments:
  122. none
  123. Return Value:
  124. True if there is more to page
  125. FALSE otherwise
  126. --*/
  127. {
  128. return !(_Stream->IsAtEnd());
  129. }
  130. INLINE
  131. ULONG
  132. PAGER::QueryCurrentLine (
  133. )
  134. /*++
  135. Routine Description:
  136. Queries the current line number
  137. Arguments:
  138. none
  139. Return Value:
  140. The current line number
  141. --*/
  142. {
  143. return _CurrentLineNumber;
  144. }
  145. #endif // __PAGER__