![]() |
The Simons
|
00001 00002 // 00003 // SCL : Simons Component Library 00004 // 00006 // 00007 // Filename: Writer.h 00008 // Contents: Writer class 00009 // Author: Anthony J H Simons 00010 // Revised: 7 November 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_WRITER 00020 #define SCL_WRITER 00021 00022 #include "FormatStream.h" // Include my superclass type 00023 #include "WriterID.h" // Include my pointer type 00024 00025 #include "StringID.h" // Depends on the pointer types 00026 #include "TextOutputID.h" 00027 00037 00038 class Writer : public FormatStream { 00039 protected: 00040 TextOutputID output; 00041 Writer(const Writer&); 00042 virtual FileStreamID fileStream() const; 00043 public: 00044 Writer(); 00045 virtual ~Writer(); 00046 Writer(StringID); 00047 OutputID stream() const; 00048 virtual WriterID put(ObjectID); 00049 virtual WriterID putField(StringID, ObjectID); 00050 }; 00051 00053 00059 inline OutputID Writer::stream() const { 00060 return output; 00061 } 00062 00067 inline FileStreamID Writer::fileStream() const { 00068 return output; 00069 } 00070 00072 00075 inline WriterID::WriterID() {} 00076 00078 inline WriterID::~WriterID() {} 00079 00083 inline WriterID::WriterID(const Null* null) : 00084 FormatStreamID(null) {} 00085 00089 inline WriterID::WriterID(const Writer* stream) : 00090 FormatStreamID(stream) {} 00091 00095 inline WriterID::WriterID(const WriterID& pointer) : 00096 FormatStreamID(pointer) {} 00097 00101 inline WriterID& WriterID::operator=(const Writer* stream) { 00102 assign(stream); 00103 return *this; 00104 } 00105 00110 inline WriterID& WriterID::operator=(const WriterID& pointer) { 00111 assign(pointer); 00112 return *this; 00113 } 00114 00115 00116 #endif 00117 00118 00119