libzypp  12.16.5
Fd.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_BASE_FD_H
13 #define ZYPP_BASE_FD_H
14 
15 #include "zypp/Pathname.h"
16 
18 namespace zypp
19 {
20 
21  namespace base
22  {
23 
25  //
26  // CLASS NAME : Fd
27  //
44  class Fd
45  {
46  public:
50  Fd( const Pathname & file_r, int open_flags, mode_t mode = 0 );
51 
53  ~Fd()
54  { close(); }
55 
57  void close();
58 
60  bool isOpen() const
61  { return m_fd != -1; }
62 
64  int fd() const
65  { return m_fd; }
66 
67  private:
69  int m_fd;
71  Fd( const Fd & );
73  Fd & operator=( const Fd & );
74  };
76 
78  } // namespace base
81 } // namespace zypp
83 #endif // ZYPP_BASE_FD_H