1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/base/Fd.h
12 #ifndef ZYPP_BASE_FD_H
13 #define ZYPP_BASE_FD_H
15 #include "zypp/Pathname.h"
17 ///////////////////////////////////////////////////////////////////
19 { /////////////////////////////////////////////////////////////////
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////
28 /** Assert \c close called on open filedescriptor.
31 * scoped_ptr<Fd> fd; // calls close when going out of scope
33 * fd.reset( new Fd( "/some/file" ) );
37 * read( fd->fd(), ... ),
41 * \todo It's dumb. Openflags and more related functions (read/write..)
48 * \throw EXCEPTION If open fails.
50 Fd( const Pathname & file_r, int open_flags, mode_t mode = 0 );
52 /** Dtor closes file. */
56 /** Explicitly close the file. */
59 /** Test for valid filedescriptor. */
61 { return m_fd != -1; }
63 /** Return the filedescriptor. */
68 /** The filedescriptor. */
73 Fd & operator=( const Fd & );
75 ///////////////////////////////////////////////////////////////////
77 /////////////////////////////////////////////////////////////////
79 ///////////////////////////////////////////////////////////////////
80 /////////////////////////////////////////////////////////////////
82 ///////////////////////////////////////////////////////////////////
83 #endif // ZYPP_BASE_FD_H