00001 /* **************************************************************** 00002 **************************************************************** 00003 * Com++ Professional (c) 2009 C++ World 00004 * http://www.cplusplusworld.com/ mailto:compp@cplusplusworld.com 00005 **************************************************************** 00006 **************************************************************** 00007 */ 00008 00009 #ifndef _DIRENTRY_H 00010 #define _DIRENTRY_H 00011 00012 #include <string> 00013 #include "SysPlusPlus/ComException.h" 00014 #include <sys/types.h> 00015 #include <dirent.h> 00016 #include <sys/stat.h> 00017 #include <unistd.h> 00018 00019 #include "File.h" 00020 00021 namespace compp { 00022 class DirEntry { 00023 00024 public: 00025 00026 DirEntry(const struct dirent & Entry ); 00027 DirEntry(); 00028 00029 DirEntry(const unsigned int Inode ); 00030 DirEntry( const std::string & Path ); 00031 00032 void setPath(const std::string & Path); 00033 virtual ~DirEntry(); 00034 00035 static bool lessName ( const compp::DirEntry & LeftEntry, const compp::DirEntry & RightEntry ) ; 00036 static bool greaterName ( const compp::DirEntry & LeftEntry, const compp::DirEntry & RightEntry ) ; 00037 00038 00039 const bool isDirectory () const; 00040 const bool isRegularFile () const; 00041 const bool isCharDevice () const; 00042 const bool isBlockDevice () const; 00043 const bool isFIFO () const; 00044 const bool isSocket () const; 00045 const bool isSymLink () const; 00046 00047 static bool Exist ( const std::string & Path ); 00048 00049 00050 const std::string getName () const; 00051 const int getInode () const; 00052 const int getAccessTime() const; 00053 const int getChangeTime() const; 00054 const int getLastModificationTime() const; 00055 const int getSize() const; 00056 const int getUid() const; 00057 const int getGid() const; 00058 const int getNumLinks() const; 00059 00060 compp::File * getFile (); 00061 00062 protected: 00063 00064 std::string Name; 00065 int Inode; 00066 struct stat StatStructure; 00067 00068 }; 00069 } 00070 #endif 00071 00072
1.6.3