libzypp
10.5.0
|
00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_BASE_FD_H 00013 #define ZYPP_BASE_FD_H 00014 00015 #include "zypp/Pathname.h" 00016 00018 namespace zypp 00019 { 00020 00021 namespace base 00022 { 00023 00025 // 00026 // CLASS NAME : Fd 00027 // 00044 class Fd 00045 { 00046 public: 00050 Fd( const Pathname & file_r, int open_flags, mode_t mode = 0 ); 00051 00053 ~Fd() 00054 { close(); } 00055 00057 void close(); 00058 00060 bool isOpen() const 00061 { return m_fd != -1; } 00062 00064 int fd() const 00065 { return m_fd; } 00066 00067 private: 00069 int m_fd; 00071 Fd( const Fd & ); 00073 Fd & operator=( const Fd & ); 00074 }; 00076 00078 } // namespace base 00081 } // namespace zypp 00083 #endif // ZYPP_BASE_FD_H