// -*- C++ -*- /* Light-weight streams. These are meant to be used with the same syntax as the C++ streams classes, but are much more economical. (Use of iostreams makes the executable files much bigger, e.g., over 300K on UNIX.)
Author: John Collins, collins@phys.psu.edu. 22 Jan 96
(C) John Collins & Penn State University.
*/
// 13. March 1997 // Included into the LyX source three, began working on making this // use more low-level functions than the ones from stdio.h. Deleted // all of the code written by John Collins, only the names are left. // A first shoot at this is an unbuffered version. The buffered one // will have to wait a bit. // // I want these classes sos, isos, osos, ifsos, ofsos in this class three // sos // / \ // isos osos (this figure is // | | not correct // ifsos ofsos anymore) // // I look closely on ch. 10 of Bjarne Stroustups: The C++ Programming Language // when doing this. // // Lgb
// Flag that I've been included: #ifndef _SOS_H #define _SOS_H
// ============== Standard streams: class osos; extern osos lite_cout, lite_cerr;
typedefunsignedchar sos__iostate;
// struct _sos_fields
{ // The datamembers of an sos. // Fill in more if needed
sos__iostate _state;
};
class sos : public _sos_fields { public: typedefint iostate; enum open_mode {
in = 1, // open for reading
out = 2, // open for output
ate = 4, // open and seek to end of file
app = 010, // append
trunc = 020, // truncate file to 0-length
nocreate = 040, // fail if file does not exist
noreplace = 0100, // file if file exist
bin = 0200
};
class iosos : public isos, public osos { public:
iosos() { }
};
class fsosbase : public sos { //streambuf _str_buf; int fd; // the filedesriptor public:
fsosbase();
fsosbase(int fd);
fsosbase(int fd, char *p, int l); /* Deprecated */
fsosbase(constchar *name, int mode, int prot=0664); void close(); void open(constchar *name, int mode, int prot=0664); //int is_open() const { return rdbuf()->is_open(); } int filedesc() { return fd; }
};
class ofsos : public fsosbase, public osos { public:
ofsos() : fsosbase() { }
ofsos(int fd) : fsosbase(fd) { }
ofsos(constchar *name, int mode=sos::out, int prot=0664)
: fsosbase(name, mode, prot) { } void open(constchar *name, int mode=sos::out, int prot=0664)
{ fsosbase::open(name, mode, prot); }
};
class ifsos : public fsosbase, public isos { public:
ifsos() : fsosbase() { }
ifsos(int fd) : fsosbase(fd) { }
ifsos(constchar *name, int mode=sos::in, int prot=0664)
: fsosbase(name, mode, prot) { } void open(constchar *name, int mode=sos::in, int prot=0664)
{ fsosbase::open(name, mode, prot); }
};
#endif
¤ Dauer der Verarbeitung: 0.27 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.