home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / g__inc / xplotfil.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-23  |  3.9 KB  |  116 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988 Free Software Foundation
  4.     written by Doug Lea (dl@rocky.oswego.edu)
  5.  
  6. This file is part of the GNU C++ Library.  This library is free
  7. software; you can redistribute it and/or modify it under the terms of
  8. the GNU Library General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.  This library is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE.  See the GNU Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19. /* 
  20.    a very simple implementation of a class to output unix "plot"
  21.    format plotter files. See corresponding unix man pages for
  22.    more details. 
  23. */
  24.  
  25. #ifndef _PlotFile_h
  26. #ifdef __GNUG__
  27. #pragma once
  28. #pragma interface
  29. #endif
  30. #define _PlotFile_h
  31.  
  32. #include <xfile.h>
  33.  
  34. /*   
  35.    Some plot libraries have the `box' command to draw boxes. Some don't.
  36.    `box' is included here via moves & lines to allow both possiblilties.
  37. */
  38.  
  39.  
  40. class PlotFile : private File
  41. {
  42. protected:
  43.   PlotFile& cmd(char c);
  44.   PlotFile& operator << (const int x);
  45.   PlotFile& operator << (const char *s);
  46.   
  47. public:
  48.   
  49.   PlotFile();
  50.   PlotFile(const char* filename, io_mode m, access_mode a);
  51.   PlotFile(const char* filename, const char* m);
  52.   PlotFile(int filedesc, const io_mode m = io_writeonly);
  53.   PlotFile(FILE* fileptr);
  54.   
  55.   ~PlotFile();
  56.   
  57.   operator void*();
  58.   
  59.   PlotFile& close() { File::close(); return *this; }
  60.   PlotFile& remove() { File::remove(); return *this; }
  61.   
  62.   int           filedesc() { return File::filedesc(); }
  63.   const char*   name() { return File::name(); }
  64.   void          setname(const char* newname) { File::setname(newname); }
  65.   int           iocount() { return File::iocount(); }
  66.   
  67.   int           rdstate() { return File::rdstate(); }
  68.   int           eof() { return File::eof(); }
  69.   int           fail() { return File::fail(); }
  70.   int           bad() { return File::bad(); }
  71.   int           good() { return File::good(); }
  72.   
  73.   // other status queries
  74.   
  75.   int           readable() { return File::readable(); }
  76.   int           writable() { return File::writable(); }
  77.   int           is_open() { return File::is_open(); }
  78.   
  79.   void          error() {  File::error(); }
  80.   void          clear(state_value f = _good) {  File::clear(f); }
  81.   void          set(state_value f) { File::set(f); }
  82.   void          unset(state_value f) { File::unset(f); }
  83.   PlotFile&     failif(int cond) {  File::failif(cond); return *this; }
  84.   void          check_state() { File::check_state(); }
  85.   
  86.   PlotFile&     raw() { File::raw(); return *this; }
  87.   
  88.   PlotFile& open(const char* filename, io_mode m, access_mode a);
  89.   PlotFile& open(const char* filename, const char* m);
  90.   PlotFile& open(int  filedesc,  io_mode m);
  91.   PlotFile& open(FILE* fileptr);
  92.   PlotFile& setbuf(const int buffer_kind); // vals: _IONBF, _IOFBF, _IOLBF
  93.   PlotFile& setbuf(const int size, char* buf);
  94.   
  95.   PlotFile& arc(const int xi, const int yi,
  96.                 const int x0, const int y0,
  97.                 const int x1, const int y1);
  98.   PlotFile& box(const int x0, const int y0,
  99.                 const int x1, const int y1);
  100.   PlotFile& circle(const int x, const int y, const int r);
  101.   PlotFile& cont(const int xi, const int yi);
  102.   PlotFile& dot(const int xi, const int yi, const int dx,
  103.                 int n, const int* pat);
  104.   PlotFile& erase(); 
  105.   PlotFile& label(const char* s);
  106.   PlotFile& line(const int x0, const int y0,
  107.                  const int x1, const int y1);
  108.   PlotFile& linemod(const char* s);
  109.   PlotFile& move(const int xi, const int yi);
  110.   PlotFile& point(const int xi, const int yi);
  111.   PlotFile& space(const int x0, const int y0,
  112.                   const int x1, const int y1);
  113. };
  114.  
  115. #endif
  116.