00001 // LICENSE: (Please see the file COPYING for details) 00002 // 00003 // NUS - Nemesis Utilities System: A C++ application development framework 00004 // Copyright (C) 2006, 2008 Otavio Rodolfo Piske 00005 // 00006 // This file is part of NUS 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 version 2.1 00011 // of the License. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 // 00022 #ifndef NFILEINFO_H_ 00023 #define NFILEINFO_H_ 00024 00025 #include <sys/types.h> 00026 #include <sys/stat.h> 00027 #include <unistd.h> 00028 00029 #include "ndefs.h" 00030 #include "nobject.h" 00031 #include "nstring.h" 00032 #include "nioexception.h" 00033 00034 00046 class NFileInfo: public NObject { 00047 public: 00051 NFileInfo(const NString &path); 00052 00056 ~NFileInfo(void); 00057 00058 00063 bool isFile(void) const; 00064 00069 bool isDir(void) const; 00070 00075 bool isDevice(void) const; 00076 00081 bool isFifo(void) const; 00082 00087 bool isLink(void) const; 00088 00093 bool exists(void) const; 00094 00099 bool ownerRead(void) const; 00100 00105 bool groupRead(void) const; 00106 00111 bool othersRead(void) const; 00112 00117 bool ownerWrite(void) const; 00118 00123 bool groupWrite(void) const; 00124 00129 bool othersWrite(void) const; 00130 00135 bool ownerExecute(void) const; 00136 00141 bool groupExecute(void) const; 00142 00147 bool othersExecute(void) const; 00148 00154 static bool isFile(const NString &path); 00155 00161 static bool isDir(const NString &path); 00162 00168 static bool isDevice(const NString &path); 00169 00175 static bool isFifo(const NString &path); 00176 00182 static bool isLink(const NString &path); 00183 00189 static bool exists(const NString &path); 00190 00196 static bool ownerRead(const NString &path); 00197 00203 static bool groupRead(const NString &path); 00204 00210 static bool othersRead(const NString &path); 00211 00217 static bool ownerWrite(const NString &path); 00218 00224 static bool groupWrite(const NString &path); 00225 00231 static bool othersWrite(const NString &path); 00232 00238 static bool ownerExecute(const NString &path); 00239 00245 static bool groupExecute(const NString &path); 00246 00252 static bool othersExecute(const NString &path); 00253 00254 private: 00255 NString m_path; 00256 }; 00257 00258 #endif // NFILEINFO_H_