Back to index

courier  0.68.2
afx.h
Go to the documentation of this file.
00001 #ifndef       afx_h
00002 #define       afx_h
00003 
00004 /*
00005 ** Copyright 1998 - 2007 Double Precision, Inc.
00006 ** See COPYING for distribution information.
00007 */
00008 
00009 #include      "afx/config.h"
00010 
00011 #if    HAVE_UNISTD_H
00012 #include      <unistd.h>
00013 #endif
00014 
00015 #include      <iostream>
00016 #include      <istream>
00017 #include      <ostream>
00018 
00019 
00021 //
00022 // Some wanker in ISO got rid of ifstream(int), ofstream(int), and
00023 // fstream(int).  Twit.
00024 
00025 class afxpipestreambuf : public std::streambuf {
00026        int fd;
00027        char buffer[8192];
00028 
00029  public:
00030 
00031        std::ios *iosp;
00032 
00033        afxpipestreambuf(int);
00034        ~afxpipestreambuf();
00035        void close();
00036        void seekg(std::streampos);
00037        void seekp(std::streampos);
00038        int handle() { return (fd); }
00039        void handle(int f);
00040        int sync();
00041  protected:
00042        int overflow(int);
00043        int underflow();
00044 } ;
00045 
00046 class afxipipestream : public std::istream {
00047        afxpipestreambuf fd_;
00048  public:
00049        afxipipestream(int = -1);
00050        ~afxipipestream();
00051 
00052        void close() { fd_.close(); }
00053        void seekg(std::streampos p) { fd_.seekg(p); }
00054        void seekp(std::streampos p) { fd_.seekp(p); }
00055        int fd() { return (fd_.handle()); }
00056        void fd(int f) { fd_.handle(f); }
00057        void sync() { fd_.sync(); }
00058 } ;
00059 
00060 class afxopipestream: public std::ostream {
00061        afxpipestreambuf fd_;
00062  public:
00063        afxopipestream(int = -1);
00064        ~afxopipestream();
00065        void close() { fd_.close(); }
00066        void seekg(std::streampos p) { fd_.seekg(p); }
00067        void seekp(std::streampos p) { fd_.seekp(p); }
00068        int fd() { return (fd_.handle()); }
00069        void fd(int f) { fd_.handle(f); }
00070        void sync() { fd_.sync(); }
00071 } ;
00072 
00073 class afxiopipestream: public std::iostream {
00074        afxpipestreambuf fd_;
00075  public:
00076        afxiopipestream(int = -1);
00077        ~afxiopipestream();
00078        void close() { fd_.close(); }
00079        void seekg(std::streampos p) { fd_.seekg(p); }
00080        void seekp(std::streampos p) { fd_.seekp(p); }
00081        int fd() { return (fd_.handle()); }
00082        void fd(int f) { fd_.handle(f); }
00083        void sync() { fd_.sync(); }
00084 } ;
00085 
00086 #endif