00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef FILE_H
00010 #define FILE_H
00011
00012
00013 #include <iostream>
00014 #include <cstring>
00015 #include <string>
00016 #include <unistd.h>
00017
00018 #include <fcntl.h>
00019 #include <sys/types.h>
00020 #include <sys/stat.h>
00021 #include <unistd.h>
00022
00023 #include "ComPlusPlus/Comm.h"
00024
00025 namespace compp {
00026
00030 class File : public Comm {
00031
00032 protected:
00033
00034 std::string FN;
00035
00036 public:
00037
00038
00039 ~File () ;
00040
00041
00042 File ( ) ;
00043 File (const std::string & FileName) ;
00044
00045
00046 void SetName (const std::string & FileName);
00047
00048 void OpenWR();
00049 void OpenRD();
00050 void OpenRW();
00051
00052 void Truncate();
00053 void Create ();
00054 void Lock ();
00055 void UnLock ();
00056 void Delete ();
00057 void SetPerm ();
00058
00059
00060 void SetOwnerRD ();
00061 void SetOwnerWR ();
00062 void SetOwnerRW ();
00063
00064 void SetGroupRD ();
00065 void SetGroupWR ();
00066 void SetGroupRW ();
00067
00068 void SetOthersRD ();
00069 void SetOthersWR ();
00070 void SetOthersRW ();
00071
00072 void Chmod (mode_t val);
00073
00074
00075 static bool Exist ( const std::string & FileName );
00076 static bool IsWriteable ( const std::string & FileName );
00077 static bool IsReadable ( const std::string & FileName );
00078 static void SetOwnerRD ( const std::string & FileName );
00079 static void SetOwnerWR ( const std::string & FileName );
00080 static void SetOwnerRW ( const std::string & FileName );
00081 static void SetGroupRD ( const std::string & FileName );
00082 static void SetGroupWR ( const std::string & FileName );
00083 static void SetGroupRW ( const std::string & FileName );
00084 static void SetOthersRD ( const std::string & FileName );
00085 static void SetOthersWR ( const std::string & FileName );
00086 static void SetOthersRW ( const std::string & FileName );
00087 static void Delete ( const std::string & FileName );
00088 static void Chmod (const std::string & FileName, mode_t val);
00089 } ;
00090 }
00091
00092 #endif