QFileInfo.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                          Information about a file                             *
00004 *                                                                               *
00005 *********************************************************************************
00006 *        Copyright (C) 2003 by Niall Douglas.   All Rights Reserved.            *
00007 *       NOTE THAT I DO NOT PERMIT ANY OF MY CODE TO BE PROMOTED TO THE GPL      *
00008 *********************************************************************************
00009 * This code is free software; you can redistribute it and/or modify it under    *
00010 * the terms of the GNU Library General Public License v2.1 as published by the  *
00011 * Free Software Foundation EXCEPT that clause 3 does not apply ie; you may not  *
00012 * "upgrade" this code to the GPL without my prior written permission.           *
00013 * Please consult the file "License_Addendum2.txt" accompanying this file.       *
00014 *                                                                               *
00015 * This code is distributed in the hope that it will be useful,                  *
00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                          *
00018 *********************************************************************************
00019 * $Id:                                                                          *
00020 ********************************************************************************/
00021 
00022 #ifndef QFILEINFO_H
00023 #define QFILEINFO_H
00024 
00025 #include "FXTime.h"
00026 #include "QDir.h"
00027 #include "FXACL.h"
00028 
00029 namespace FX {
00030 
00035 class QFile;
00036 
00061 struct QFileInfoPrivate;
00062 class FXAPIR QFileInfo
00063 {
00064     QFileInfoPrivate *p;
00065 public:
00067     QFileInfo();
00069     QFileInfo(const FXString &path);
00071     QFileInfo(const QFile &file);
00073     QFileInfo(const QDir &dir, const FXString &leafname);
00074     QFileInfo(const QFileInfo &o);
00075     QFileInfo &operator=(const QFileInfo &o);
00076     ~QFileInfo();
00077     bool operator<(const QFileInfo &o) const;
00078     bool operator==(const QFileInfo &o) const;
00079     bool operator!=(const QFileInfo &o) const { return !(*this==o); }
00080     bool operator>(const QFileInfo &o) const;
00081 
00083     void setFile(const FXString &path);
00085     void setFile(const QFile &file);
00087     void setFile(const QDir &dir, const FXString &leafname);
00089     bool exists() const;
00091     void refresh();
00093     bool caching() const;
00095     void setCaching(bool newon);
00097     const FXString &filePath() const;
00099     FXString fileName() const;
00101     FXString absFilePath() const;
00105     FXString baseName(bool complete=false) const;
00109     FXString extension(bool complete=true) const;
00111     FXString dirPath(bool absPath=false) const;
00113     QDir dir(bool absPath=false) const { return QDir(absPath ? absFilePath() : fileName()); }
00115     bool isReadable() const;
00117     bool isWriteable() const;
00119     bool isWritable() const { return isWriteable(); }
00121     bool isExecutable() const;
00123     FXuint metaFlags() const;
00125     bool isHidden() const;
00127     bool isRelative() const;
00129     bool convertToAbs();
00131     bool isFile() const;
00133     bool isDir() const;
00135     bool isSymLink() const;
00137     FXString readLink() const;
00139     const FXACLEntity &owner() const;
00141     const FXACL &permissions() const;
00143     bool permission(FXACL::Perms what) const;
00145     FXString permissionsAsString() const;
00147     FXfval size() const;
00149     FXString sizeAsString() const;
00151     FXTime created() const;
00153     FXString createdAsString(const FXString &format="%Y/%b/%d %H:%M:%S.%F %Z", bool inLocalTime=true) const;
00155     FXTime lastModified() const;
00157     FXString lastModifiedAsString(const FXString &format="%Y/%b/%d %H:%M:%S.%F %Z", bool inLocalTime=true) const;
00159     FXTime lastRead() const;
00161     FXString lastReadAsString(const FXString &format="%Y/%b/%d %H:%M:%S.%F %Z", bool inLocalTime=true) const;
00162 };
00163 
00164 } // namespace
00165 
00166 #endif

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