![]() |
The Simons
|
00001 00002 // 00003 // SCL : Simons Component Library 00004 // 00006 // 00007 // Filename: Output.h 00008 // Contents: Output class 00009 // Author: Anthony J H Simons 00010 // Revised: 5 December 2005 00011 00012 // This software is distributed free in the hope that others will 00013 // find it useful. However, it comes WITHOUT ANY WARRANTY. No 00014 // liability can be accepted for software failure, merchantability 00015 // or fitness for a particular purpose. You can redistribute this 00016 // software in its original form, or in a modified form, provided 00017 // that this disclaimer is retained in the file banner. 00018 00019 #ifndef SCL_OUTPUT 00020 #define SCL_OUTPUT 00021 00022 #include "FileStream.h" // Include my superclass type 00023 #include "OutputID.h" // Include my pointer type 00024 00025 #include "StringID.h" // Depend on the pointer type 00026 00027 #include <iosfwd> // In ANSI standard C++; cannot forward 00028 // declare 'class ostream;' because it is a 00029 // 'typedef basic_ostream<char> ostream;' 00030 00043 00044 class Output : public FileStream { 00045 private: 00046 static std::ostream closed; 00047 protected: 00048 std::ostream* filesystem; 00049 private: 00050 Boolean logging; 00051 protected: 00052 Output(const Output&); 00053 public: 00054 Output(); 00055 virtual ~Output(); 00056 Output(StringID); 00057 virtual Void open(); 00058 virtual Void close(); 00059 virtual Void openLog(); 00060 virtual Boolean exists() const; 00061 virtual Boolean log() const; 00062 virtual Boolean ready() const; 00063 virtual Boolean failed() const; 00064 virtual Boolean sink() const; 00065 virtual OutputID put(Boolean); 00066 virtual OutputID put(Character); 00067 virtual OutputID put(Natural); 00068 virtual OutputID put(Integer); 00069 virtual OutputID put(Decimal); 00070 virtual OutputID put(StringID); 00071 virtual OutputID put(Character[]); 00072 virtual OutputID line(); 00073 virtual OutputID space(); 00074 virtual OutputID tab(); 00075 }; 00076 00078 00081 inline OutputID::OutputID() {} 00082 00084 inline OutputID::~OutputID() {} 00085 00089 inline OutputID::OutputID(const Null* null) : 00090 FileStreamID(null) {} 00091 00095 inline OutputID::OutputID(const Output* stream) : 00096 FileStreamID(stream) {} 00097 00101 inline OutputID::OutputID(const OutputID& pointer) : 00102 FileStreamID(pointer) {} 00103 00107 inline OutputID& OutputID::operator=(const Output* stream) { 00108 assign(stream); 00109 return *this; 00110 } 00111 00116 inline OutputID& OutputID::operator=(const OutputID& pointer) { 00117 assign(pointer); 00118 return *this; 00119 } 00120 00121 #endif 00122