
**********************************************

// Listing 2 - VSMANIP.H
#ifndef VSMANIP_H
#define VSMANIP_H
#include "window.h"

/* 1 integer manipulator object */
class omanip_int1
  {
/* action function */
  ostream& (*_fn)(ostream&,int);
/* argument */
  int a1;
public:
  omanip_int1(ostream& (*_f)(ostream&, int), int _a1) :
      _fn(_f), a1(_a1) { }
  friend ostream& operator<<(ostream& _s,
                     omanip_int1& _f)
    {
    return (*_f._fn)(_s,_f.a1);
    }
  };


/* Manipulator object for window ref */
class omanip_winr
  {
  ostream& (*_fn)(ostream&,win&);
  win& a1;
public:
  omanip_winr(ostream& (*_f)(ostream&, win&),
                     win& _a1) :
      _fn(_f), a1(_a1) { }
  friend ostream& operator<<(ostream& _s,
                     omanip_winr& _f)
    {
    return (*_f._fn)(_s,_f.a1);
    }
  };


/* Manipulator object for two integer references */
class omanip_intr2
  {
  ostream& (*_fn)(ostream&,int&,int&);
  int& a1;
  int& a2;
public:
  omanip_intr2(ostream& (*_f)(ostream&, int&, int&),
       int& _a1, int& _a2) :
      _fn(_f), a1(_a1), a2(_a2) { }
  friend ostream& operator<<(ostream& _s,
                     omanip_intr2& _f)
    {
    return (*_f._fn)(_s,_f.a1,_f.a2);
    }
  };


/* 0 argument manipulatiors */
extern ostream& beep(ostream& str);
extern ostream& clear_screen(ostream& str);
extern ostream& high_video(ostream& str);
extern ostream& low_video(ostream& str);
extern ostream& norm_video(ostream& str);
extern ostream& del_line(ostream& str);
extern ostream& ins_line(ostream& str);

/* 1 argument manipulators */
extern omanip_int1 text_color(int c);
extern omanip_int1 text_background(int c);
extern omanip_int1 text_attr(int c);
extern omanip_winr top_window(win& w);

/* 2 argument manipulators */
extern omanip_intr2 go_xy(int& x,int& y);
extern omanip_intr2 where_xy(int& x, int& y);


#endif

