FXStat.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                        F i l e   S t a t i s t i c s                          *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2005,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXStat.h,v 1.24 2006/01/22 17:58:10 fox Exp $                            *
00023 ********************************************************************************/
00024 #ifndef FXSTAT_H
00025 #define FXSTAT_H
00026 
00027 #include "FXTime.h"
00028 
00029 
00030 namespace FX {
00031 
00032 
00033 class FXFile;
00034 
00035 
00037 class FXAPI FXStat {
00038   friend class FXFile;
00039 private:
00040   FXuint  modeFlags;            
00041   FXuint  userNumber;           
00042   FXuint  groupNumber;          
00043   FXTime  createTime;           
00044   FXTime  accessTime;           
00045   FXTime  modifyTime;           
00046   FXfval  fileSize;             
00047 public:
00049     enum MetaFileFlags
00050     {
00051         IsFile=1,               
00052         IsDirectory=2,          
00053         IsLink=4,               
00054 
00055         IsCompressed=64,        
00056         IsHidden=128            
00057     };
00061     static bool readMetadata(const FXString &path, FXuint *FXRESTRICT flags, FXfval *FXRESTRICT size, FXTime *FXRESTRICT created, FXTime *FXRESTRICT lastModified, FXTime *FXRESTRICT lastAccessed, FXfval *FXRESTRICT compressedSize=0, FXuint *FXRESTRICT hardLinks=0);
00065     static void writeMetadata(const FXString &path, const FXTime *created, const FXTime *lastModified, const FXTime *lastAccessed);
00067     static FXuint metaFlags(const FXString &path);
00068 
00069 
00071   static bool statFile(const FXString& file,FXStat& info);
00072 
00074   static bool statLink(const FXString& file,FXStat& info);
00075 
00077   //static bool stat(const FXFile& file,FXStat& info);
00078 
00080   FXuint mode() const { return modeFlags; }
00081 
00083   FXfval size() const { return fileSize; }
00084 
00086   FXDEPRECATEDEXT FXuint user() const { return userNumber; }
00087 
00089   FXDEPRECATEDEXT FXuint group() const { return groupNumber; }
00090 
00092   FXTime modified() const { return modifyTime; }
00093 
00095   FXTime accessed() const { return accessTime; }
00096 
00098   FXTime created() const { return createTime; }
00099 
00101   FXTime touched() const;
00102 
00104   bool isHidden() const;
00105 
00107   bool isFile() const;
00108 
00110   bool isLink() const;
00111 
00113   bool isCharacter() const;
00114 
00116   bool isBlock() const;
00117 
00119   bool isSocket() const;
00120 
00122   bool isFifo() const;
00123 
00125   bool isDirectory() const;
00126 
00128   bool isReadable() const;
00129 
00131   bool isWritable() const;
00132 
00134   bool isExecutable() const;
00135 
00136 #ifdef FX_FOXCOMPAT
00138   bool isOwnerReadWriteExecute() const;
00139 
00141   bool isOwnerReadable() const;
00142 
00144   bool isOwnerWritable() const;
00145 
00147   bool isOwnerExecutable() const;
00148 
00150   bool isGroupReadWriteExecute() const;
00151 
00153   bool isGroupReadable() const;
00154 
00156   bool isGroupWritable() const;
00157 
00159   bool isGroupExecutable() const;
00160 
00162   bool isOtherReadWriteExecute() const;
00163 
00165   bool isOtherReadable() const;
00166 
00168   bool isOtherWritable() const;
00169 
00171   bool isOtherExecutable() const;
00172 
00174   bool isSetUid() const;
00175 
00177   bool isSetGid() const;
00178 
00180   bool isSetSticky() const;
00181 
00183   static FXuint mode(const FXString& file);
00184 
00186   static bool mode(const FXString& file,FXuint perm);
00187 #endif
00188 
00190   static bool exists(const FXString& file);
00191 
00193   static FXfval size(const FXString& file);
00194 
00200   static FXTime modified(const FXString& file);
00201 
00206   static FXTime accessed(const FXString& file);
00207 
00214   static FXTime created(const FXString& file);
00215 
00222   static FXTime touched(const FXString& file);
00223 
00225   static bool isHidden(const FXString& file);
00226 
00228   static bool isFile(const FXString& file);
00229 
00231   static bool isLink(const FXString& file);
00232 
00234   static bool isDirectory(const FXString& file);
00235 
00237   static bool isReadable(const FXString& file);
00238 
00240   static bool isWritable(const FXString& file);
00241 
00243   static bool isExecutable(const FXString& file);
00244 
00245 #ifdef FX_FOXCOMPAT
00247   static bool isOwnerReadWriteExecute(const FXString& file);
00248 
00250   static bool isOwnerReadable(const FXString& file);
00251 
00253   static bool isOwnerWritable(const FXString& file);
00254 
00256   static bool isOwnerExecutable(const FXString& file);
00257 
00259   static bool isGroupReadWriteExecute(const FXString& file);
00260 
00262   static bool isGroupReadable(const FXString& file);
00263 
00265   static bool isGroupWritable(const FXString& file);
00266 
00268   static bool isGroupExecutable(const FXString& file);
00269 
00271   static bool isOtherReadWriteExecute(const FXString& file);
00272 
00274   static bool isOtherReadable(const FXString& file);
00275 
00277   static bool isOtherWritable(const FXString& file);
00278 
00280   static bool isOtherExecutable(const FXString& file);
00281 
00283   static bool isSetUid(const FXString& file);
00284 
00286   static bool isSetGid(const FXString& file);
00287 
00289   static bool isSetSticky(const FXString& file);
00290 #endif
00291   };
00292 
00293 
00294 }
00295 
00296 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:24 2009 for TnFOX by doxygen v1.4.7