#include <Puma/FdSource.h>
File descriptor wrapper implementing the Source interface.
|
| FdSource () |
| Construct a new file descriptor wrapper with invalid file descriptor.
|
|
| FdSource (int fdesc) |
| Construct a new wrapper for the given file descriptor.
|
|
virtual | ~FdSource () |
| Destroy the wrapper.
|
|
virtual int | read (char *dest, int n) |
| Read n bytes from the file into the given string.
|
|
void | fd (int fdesc) |
| Set the wrapped file descriptor.
|
|
int | fd () |
| Get the wrapped file descriptor.
|
|
int | size () |
| Get the size of the file.
|
|
| Source () |
| Constructs an empty source object.
|
|
virtual | ~Source () |
| Destroys the source object.
|
|
◆ FdSource() [1/2]
Puma::FdSource::FdSource |
( |
| ) |
|
|
inline |
Construct a new file descriptor wrapper with invalid file descriptor.
◆ FdSource() [2/2]
Puma::FdSource::FdSource |
( |
int | fdesc | ) |
|
|
inline |
Construct a new wrapper for the given file descriptor.
- Parameters
-
fdesc | The file descriptor. |
◆ ~FdSource()
virtual Puma::FdSource::~FdSource |
( |
| ) |
|
|
inlinevirtual |
Destroy the wrapper.
Does not close the file descriptor.
◆ fd() [1/2]
int Puma::FdSource::fd |
( |
| ) |
|
|
inline |
Get the wrapped file descriptor.
- Returns
- The file descriptor, or -1 if no file descriptor set.
◆ fd() [2/2]
void Puma::FdSource::fd |
( |
int | fdesc | ) |
|
|
inline |
Set the wrapped file descriptor.
- Parameters
-
fdesc | The file descriptor. |
◆ read()
virtual int Puma::FdSource::read |
( |
char * | dest, |
|
|
int | n ) |
|
inlinevirtual |
Read n bytes from the file into the given string.
- Parameters
-
dest | The string used as buffer for the bytes read. |
n | The number of bytes to read. |
- Returns
- The number of bytes read, or -1 in case of errors.
Implements Puma::Source.
Reimplemented in Puma::FileSource.
◆ size()
int Puma::FdSource::size |
( |
| ) |
|
|
inlinevirtual |
Get the size of the file.
- Returns
- The size of the file, or -1 if size could not be determined.
Reimplemented from Puma::Source.