|
|
1.1 root 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 GNU CC; see the file COPYING. If not, write to
17: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, 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 ([email protected])
31: converted to use iostream library by Per Bothner ([email protected])
32: */
33:
34: #ifndef _PlotFile_h
35: #ifdef __GNUG__
36: #pragma interface
37: #pragma cplusplus
38: #endif
39: #define _PlotFile_h
40:
41: #include <fstream.h>
42:
43: /*
44: Some plot libraries have the `box' command to draw boxes. Some don't.
45: `box' is included here via moves & lines to allow both possiblilties.
46: */
47:
48:
49: class PlotFile : public ofstream
50: {
51: protected:
52: PlotFile& cmd(char c);
53: PlotFile& operator << (const int x);
54: PlotFile& operator << (const char *s);
55:
56: public:
57:
58: PlotFile() : ofstream() { }
59: PlotFile(int fd) : ofstream(fd) { }
60: PlotFile(const char *name, int mode=ios::out, int prot=0664)
61: : ofstream(name, mode, prot) { }
62:
63: // PlotFile& remove() { ofstream::remove(); return *this; }
64:
65: // int filedesc() { return ofstream::filedesc(); }
66: // const char* name() { return File::name(); }
67: // void setname(const char* newname) { File::setname(newname); }
68: // int iocount() { return File::iocount(); }
69:
70: PlotFile& arc(const int xi, const int yi,
71: const int x0, const int y0,
72: const int x1, const int y1);
73: PlotFile& box(const int x0, const int y0,
74: const int x1, const int y1);
75: PlotFile& circle(const int x, const int y, const int r);
76: PlotFile& cont(const int xi, const int yi);
77: PlotFile& dot(const int xi, const int yi, const int dx,
78: int n, const int* pat);
79: PlotFile& erase();
80: PlotFile& label(const char* s);
81: PlotFile& line(const int x0, const int y0,
82: const int x1, const int y1);
83: PlotFile& linemod(const char* s);
84: PlotFile& move(const int xi, const int yi);
85: PlotFile& point(const int xi, const int yi);
86: PlotFile& space(const int x0, const int y0,
87: const int x1, const int y1);
88: };
89: #endif
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.