home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_10_11 / 1011048a < prev    next >
Text File  |  1992-09-08  |  2KB  |  84 lines

  1.  
  2. **********************************************
  3.  
  4. // Listing 2 - VSMANIP.H
  5. #ifndef VSMANIP_H
  6. #define VSMANIP_H
  7. #include "window.h"
  8.  
  9. /* 1 integer manipulator object */
  10. class omanip_int1
  11.   {
  12. /* action function */
  13.   ostream& (*_fn)(ostream&,int);
  14. /* argument */
  15.   int a1;
  16. public:
  17.   omanip_int1(ostream& (*_f)(ostream&, int), int _a1) :
  18.       _fn(_f), a1(_a1) { }
  19.   friend ostream& operator<<(ostream& _s,
  20.                      omanip_int1& _f)
  21.     {
  22.     return (*_f._fn)(_s,_f.a1);
  23.     }
  24.   };
  25.  
  26.  
  27. /* Manipulator object for window ref */
  28. class omanip_winr
  29.   {
  30.   ostream& (*_fn)(ostream&,win&);
  31.   win& a1;
  32. public:
  33.   omanip_winr(ostream& (*_f)(ostream&, win&),
  34.                      win& _a1) :
  35.       _fn(_f), a1(_a1) { }
  36.   friend ostream& operator<<(ostream& _s,
  37.                      omanip_winr& _f)
  38.     {
  39.     return (*_f._fn)(_s,_f.a1);
  40.     }
  41.   };
  42.  
  43.  
  44. /* Manipulator object for two integer references */
  45. class omanip_intr2
  46.   {
  47.   ostream& (*_fn)(ostream&,int&,int&);
  48.   int& a1;
  49.   int& a2;
  50. public:
  51.   omanip_intr2(ostream& (*_f)(ostream&, int&, int&),
  52.        int& _a1, int& _a2) :
  53.       _fn(_f), a1(_a1), a2(_a2) { }
  54.   friend ostream& operator<<(ostream& _s,
  55.                      omanip_intr2& _f)
  56.     {
  57.     return (*_f._fn)(_s,_f.a1,_f.a2);
  58.     }
  59.   };
  60.  
  61.  
  62. /* 0 argument manipulatiors */
  63. extern ostream& beep(ostream& str);
  64. extern ostream& clear_screen(ostream& str);
  65. extern ostream& high_video(ostream& str);
  66. extern ostream& low_video(ostream& str);
  67. extern ostream& norm_video(ostream& str);
  68. extern ostream& del_line(ostream& str);
  69. extern ostream& ins_line(ostream& str);
  70.  
  71. /* 1 argument manipulators */
  72. extern omanip_int1 text_color(int c);
  73. extern omanip_int1 text_background(int c);
  74. extern omanip_int1 text_attr(int c);
  75. extern omanip_winr top_window(win& w);
  76.  
  77. /* 2 argument manipulators */
  78. extern omanip_intr2 go_xy(int& x,int& y);
  79. extern omanip_intr2 where_xy(int& x, int& y);
  80.  
  81.  
  82. #endif
  83.  
  84.