![]() |
The Simons
|
00001 00002 // 00003 // SCL : Simons Component Library 00004 // 00006 // 00007 // Filename: FileStream.h 00008 // Contents: FileStream class 00009 // Author: Anthony J H Simons 00010 // Revised: 6 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_FILE_STREAM 00020 #define SCL_FILE_STREAM 00021 00022 #include "Stream.h" // Include the superclass type 00023 #include "FileStreamID.h" // Include the pointer type 00024 00025 #include "StringID.h" // Depend on the pointer type 00026 00045 00046 class FileStream : public Stream { 00047 protected: 00048 static Boolean locking; 00049 StringID pathName; 00050 FileStream(const FileStream&); 00051 Boolean acquireLock() const; 00052 Boolean releaseLock() const; 00053 Void fileNotFound() const; 00054 Void accessDenied() const; 00055 public: 00056 static Void setLocking(Boolean); 00057 FileStream(); 00058 FileStream(StringID); 00059 virtual ~FileStream(); 00060 virtual StringID name() const; 00061 virtual Boolean log() const; 00062 virtual Void openOn(StringID); 00063 virtual Void openLogOn(StringID); 00064 virtual Void openLog(); 00065 }; 00066 00068 00078 inline Void FileStream::setLocking(Boolean setting) { 00079 locking = setting; 00080 } 00081 00083 00086 inline FileStreamID::FileStreamID() {} 00087 00089 inline FileStreamID::~FileStreamID() {} 00090 00094 inline FileStreamID::FileStreamID(const Null* null) : 00095 StreamID(null) {} 00096 00100 inline FileStreamID::FileStreamID(const FileStream* stream) : 00101 StreamID(stream) {} 00102 00106 inline FileStreamID::FileStreamID(const FileStreamID& pointer) : 00107 StreamID(pointer) {} 00108 00112 inline FileStreamID& FileStreamID::operator=(const FileStream* stream) { 00113 assign(stream); 00114 return *this; 00115 } 00116 00121 inline FileStreamID& FileStreamID::operator=(const FileStreamID& pointer) { 00122 assign(pointer); 00123 return *this; 00124 } 00125 00126 00127 #endif 00128