00001 // ============================================================================ 00029 // ============================================================================ 00030 #ifndef __TFILEPROPERTY_HH 00031 #define __TFILEPROPERTY_HH 00032 00033 #include "Tglobals.h" 00034 00035 00055 class TFileProperty 00056 { 00057 00058 private: 00059 Tstring thePathName; 00060 Tstring theDirectoryName; 00061 Tstring theFileName; 00062 Tstring theFileRootName; 00063 Tstring theFileExtensionName; 00064 Tint theDeviceNumber; 00065 Tint theDeviceMajorNumber; 00066 Tint theDeviceMiorNumber; 00067 Tint theInodeNumber; 00068 Tint theProtection; 00069 Tint theNumberOfHardLinks; 00070 Tint theDeviceType; 00071 Tint theTotalSize; 00072 Tint theBlockSize; 00073 Tint theNumberOfBlocks; 00074 Tint theUserID; 00075 Tint theGroupID; 00076 Tint theLastAccess; 00077 Tint theLastModification; 00078 Tint theLastChange; 00079 Tstring theStringUserID; 00080 Tstring theStringGroupID; 00081 Tstring theStringLastAccess; 00082 Tstring theStringLastModification; 00083 Tstring theStringLastChange; 00084 00085 public: 00086 TFileProperty(); 00087 TFileProperty( const Tstring& path ); 00088 TFileProperty( const TFileProperty& right ); 00089 ~TFileProperty(); 00090 00091 public: 00092 const TFileProperty& operator=( const TFileProperty& right ); 00093 Tbool operator==( const TFileProperty& right ) const; 00094 Tbool operator!=( const TFileProperty& right ) const; 00095 00096 public: 00097 const Tstring& GetPathName() const; 00098 const Tstring& GetDirectoryName() const; 00099 const Tstring& GetFileName() const; 00100 const Tstring& GetFileRootName() const; 00101 const Tstring& GetFileExtensionName() const; 00102 Tint GetDeviceNumber() const; 00103 Tint GetDeviceMajorNumber() const; 00104 Tint GetDeviceMiorNumber() const; 00105 Tint GetInodeNumber() const; 00106 Tint GetProtection() const; 00107 Tint GetNumberOfHardLinks() const; 00108 Tint GetDeviceType() const; 00109 Tint GetTotalSize() const; 00110 Tint GetBlockSize() const; 00111 Tint GetNumberOfBlocks() const; 00112 Tint GetUserID() const; 00113 Tint GetGroupID() const; 00114 Tint GetLastAccess() const; 00115 Tint GetLastModification() const; 00116 Tint GetLastChange() const; 00117 const Tstring& GetStringUserID() const; 00118 const Tstring& GetStringGroupID() const; 00119 const Tstring& GetStringLastAccess() const; 00120 const Tstring& GetStringLastModification() const; 00121 const Tstring& GetStringLastChange() const; 00122 00123 public: 00124 Tvoid SetPathName( const Tstring& path ); 00125 Tvoid Analyse(); 00126 Tvoid Update(); 00127 // ChangeMode とか Rename をする SetProtection(), SetUserID() 00128 00129 public: 00130 Tbool IsCharacterDevice() const; 00131 Tbool IsBlockDevice() const; 00132 Tbool IsFIFO() const; 00133 Tbool IsSocket() const; 00134 Tbool IsSymbolicLink() const; 00135 Tbool IsRegularFile() const; 00136 Tbool IsDirectory() const; 00137 Tbool IsReadable() const; 00138 Tbool IsWritable() const; 00139 Tbool IsExecutable() const; 00140 00141 public: 00142 friend Tostream& operator<<( Tostream& tos, const TFileProperty& right ); 00143 00144 }; 00145 00146 inline const Tstring& TFileProperty::GetPathName() const 00147 { 00148 return thePathName; 00149 } 00150 00151 inline const Tstring& TFileProperty::GetDirectoryName() const 00152 { 00153 return theDirectoryName; 00154 } 00155 00156 inline const Tstring& TFileProperty::GetFileName() const 00157 { 00158 return theFileName; 00159 } 00160 00161 inline const Tstring& TFileProperty::GetFileRootName() const 00162 { 00163 return theFileRootName; 00164 } 00165 00166 inline const Tstring& TFileProperty::GetFileExtensionName() const 00167 { 00168 return theFileExtensionName; 00169 } 00170 00171 inline Tint TFileProperty::GetDeviceNumber() const 00172 { 00173 return theDeviceNumber; 00174 } 00175 00176 inline Tint TFileProperty::GetDeviceMajorNumber() const 00177 { 00178 return theDeviceMajorNumber; 00179 } 00180 00181 inline Tint TFileProperty::GetDeviceMiorNumber() const 00182 { 00183 return theDeviceMiorNumber; 00184 } 00185 00186 inline Tint TFileProperty::GetInodeNumber() const 00187 { 00188 return theInodeNumber; 00189 } 00190 00191 inline Tint TFileProperty::GetProtection() const 00192 { 00193 return theProtection; 00194 } 00195 00196 inline Tint TFileProperty::GetNumberOfHardLinks() const 00197 { 00198 return theNumberOfHardLinks; 00199 } 00200 00201 inline Tint TFileProperty::GetDeviceType() const 00202 { 00203 return theDeviceType; 00204 } 00205 00206 inline Tint TFileProperty::GetTotalSize() const 00207 { 00208 return theTotalSize; 00209 } 00210 00211 inline Tint TFileProperty::GetBlockSize() const 00212 { 00213 return theBlockSize; 00214 } 00215 00216 inline Tint TFileProperty::GetNumberOfBlocks() const 00217 { 00218 return theNumberOfBlocks; 00219 } 00220 00221 inline Tint TFileProperty::GetUserID() const 00222 { 00223 return theUserID; 00224 } 00225 00226 inline Tint TFileProperty::GetGroupID() const 00227 { 00228 return theGroupID; 00229 } 00230 00231 inline Tint TFileProperty::GetLastAccess() const 00232 { 00233 return theLastAccess; 00234 } 00235 00236 inline Tint TFileProperty::GetLastModification() const 00237 { 00238 return theLastModification; 00239 } 00240 00241 inline Tint TFileProperty::GetLastChange() const 00242 { 00243 return theLastChange; 00244 } 00245 00246 inline const Tstring& TFileProperty::GetStringUserID() const 00247 { 00248 return theStringUserID; 00249 } 00250 00251 inline const Tstring& TFileProperty::GetStringGroupID() const 00252 { 00253 return theStringGroupID; 00254 } 00255 00256 inline const Tstring& TFileProperty::GetStringLastAccess() const 00257 { 00258 return theStringLastAccess; 00259 } 00260 00261 inline const Tstring& TFileProperty::GetStringLastModification() const 00262 { 00263 return theStringLastModification; 00264 } 00265 00266 inline const Tstring& TFileProperty::GetStringLastChange() const 00267 { 00268 return theStringLastChange; 00269 } 00270 00271 inline Tvoid TFileProperty::SetPathName( const Tstring& path ) 00272 { 00273 thePathName = path; 00274 Analyse(); 00275 return; 00276 } 00277 00278 inline Tvoid TFileProperty::Update() 00279 { 00280 Analyse(); 00281 return; 00282 } 00283 00284 #endif