1 /* This is part of libio/iostream, providing -*- C++ -*- input/output. 2 Copyright (C) 1993 Free Software Foundation 3 4 This file is part of the GNU IO Library. This library is free 5 software; you can redistribute it and/or modify it under the 6 terms of the GNU General Public License as published by the 7 Free Software Foundation; either version 2, or (at your option) 8 any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this library; see the file COPYING. If not, write to the Free 17 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 As a special exception, if you link this library with files 20 compiled with a GNU compiler to produce an executable, this does not cause 21 the resulting executable to be covered by the GNU General Public License. 22 This exception does not however invalidate any other reasons why 23 the executable file might be covered by the GNU General Public License. */ 24 25 /* 26 a very simple implementation of a class to output unix "plot" 27 format plotter files. See corresponding unix man pages for 28 more details. 29 30 written by Doug Lea (dl@rocky.oswego.edu) 31 converted to use iostream library by Per Bothner (bothner@cygnus.com) 32 */ 33 34 #ifndef _PlotFile_h 35 #ifdef __GNUG__ 36 #pragma interface 37 #endif 38 #define _PlotFile_h 39 40 #include <fstream.h> 41 42 /* 43 Some plot libraries have the `box' command to draw boxes. Some don't. 44 `box' is included here via moves & lines to allow both possiblilties. 45 */ 46 47 extern "C++" { 48 class PlotFile : public ofstream 49 { 50 protected: 51 PlotFile& cmd(char c); 52 PlotFile& operator << (const int x); 53 PlotFile& operator << (const char *s); 54 55 public: 56 57 PlotFile() : ofstream() { } 58 PlotFile(int fd) : ofstream(fd) { } 59 PlotFile(const char *name, int mode=ios::out, int prot=0664) 60 : ofstream(name, mode, prot) { } 61 62 // PlotFile& remove() { ofstream::remove(); return *this; } 63 64 // int filedesc() { return ofstream::filedesc(); } 65 // const char* name() { return File::name(); } 66 // void setname(const char* newname) { File::setname(newname); } 67 // int iocount() { return File::iocount(); } 68 69 PlotFile& arc(const int xi, const int yi, 70 const int x0, const int y0, 71 const int x1, const int y1); 72 PlotFile& box(const int x0, const int y0, 73 const int x1, const int y1); 74 PlotFile& circle(const int x, const int y, const int r); 75 PlotFile& cont(const int xi, const int yi); 76 PlotFile& dot(const int xi, const int yi, const int dx, 77 int n, const int* pat); 78 PlotFile& erase(); 79 PlotFile& label(const char* s); 80 PlotFile& line(const int x0, const int y0, 81 const int x1, const int y1); 82 PlotFile& linemod(const char* s); 83 PlotFile& move(const int xi, const int yi); 84 PlotFile& point(const int xi, const int yi); 85 PlotFile& space(const int x0, const int y0, 86 const int x1, const int y1); 87 }; 88 } // extern "C++" 89 #endif 90