This class encapsulates UNIX file and socket descriptors. More...
#include <DwmDescriptor.hh>
Public Member Functions | |
| Descriptor () | |
| Constructor. | |
| Descriptor (const Descriptor &d) | |
Copy constructor. Will dup() the descriptor of d. | |
| Descriptor (int d) | |
| Descriptor & | operator= (const Descriptor &d) |
| operator = (assignment operator). | |
| virtual | ~Descriptor () |
| Destructor. Note this will close the underlying UNIX descriptor. | |
| virtual bool | Close () |
| Closes the Descriptor. Returns true on success, false on failure. | |
| virtual bool | Attach (int fd) |
Associates the Descriptor with an existing UNIX descriptor fd. | |
| virtual bool | Detach () |
| Disassociates the Descriptor from the underlying UNIX descriptor. | |
| virtual bool | SetNonBlocking () |
| Sets the Descriptor to non-blocking. | |
| virtual bool | SetBlocking () |
| Sets the soccket to blocking. | |
| virtual | operator int () const |
| This completely blows encapsulation, but is needed so that Descriptor may be used in place of a UNIX descriptor in retrofitted code. | |
| virtual bool | FdSet (fd_set &fdSet) |
If Descriptor is valid, sets it in fdSet and returns true. | |
| virtual bool | FdClr (fd_set &fdSet) |
If Descriptor is valid, clears it in fdSet and returns true. | |
| virtual bool | FdIsSet (fd_set &fdSet) |
If Descriptor is valid and is set in fdSet, returns true. | |
| virtual bool | ReadWouldBlock () |
Protected Attributes | |
| int | _fd |
This class encapsulates UNIX file and socket descriptors.
It only abstracts those functions which have common interfaces, so that applications may use this interface to handle both file and socket descriptor I/O in the same place.
|
virtual |
Associates the Descriptor with an existing UNIX descriptor fd.
Note this will cause the Descriptor to automatically close fd when destructed. Returns true if fd is a valid descriptor, else returns false.
|
virtual |
Disassociates the Descriptor from the underlying UNIX descriptor.
Returns true on success, false on failure.
|
virtual |
If Descriptor is valid, clears it in fdSet and returns true.
Else returns false.
|
virtual |
If Descriptor is valid and is set in fdSet, returns true.
Else returns false.
|
virtual |
If Descriptor is valid, sets it in fdSet and returns true.
Else returns false.
| Descriptor & Dwm::Descriptor::operator= | ( | const Descriptor & | d | ) |
operator = (assignment operator).
Will close this and then dup() the descriptor of d.
|
virtual |
Sets the soccket to blocking.
Returns true on success, false on failure.
|
virtual |
Sets the Descriptor to non-blocking.
Returns true on success, false on failure.