diff options
author | Denis Loh <denis.loh@gmail.com> | 2009-11-19 12:21:55 +0100 |
---|---|---|
committer | Denis Loh <denis.loh@gmail.com> | 2009-11-19 12:21:55 +0100 |
commit | 2d245fcabb385347359759de8e6c40ce16e43cab (patch) | |
tree | ee6d718e2be089c50a1f0f6ca6fb89cc3c3161b0 /receiver/filehandle.h | |
parent | 4510b4d123a4f62c49c55fa517f15df4fa90ebec (diff) | |
download | vdr-plugin-upnp-2d245fcabb385347359759de8e6c40ce16e43cab.tar.gz vdr-plugin-upnp-2d245fcabb385347359759de8e6c40ce16e43cab.tar.bz2 |
Added options for verbosity level and auto detect settings
Diffstat (limited to 'receiver/filehandle.h')
-rw-r--r-- | receiver/filehandle.h | 90 |
1 files changed, 86 insertions, 4 deletions
diff --git a/receiver/filehandle.h b/receiver/filehandle.h index 37f06e8..1dc57bf 100644 --- a/receiver/filehandle.h +++ b/receiver/filehandle.h @@ -11,12 +11,94 @@ #include <upnp/upnp.h> #include "../common.h" +/** + * Interface for File Handles + * + * This class is a pure virtual class to act as an interface for file handles + * used by the webserver. + */ class cFileHandle { public: - virtual void open(UpnpOpenFileMode mode) = 0; - virtual int read(char* buf, size_t buflen) = 0; - virtual int write(char* buf, size_t buflen) = 0; - virtual int seek(off_t offset, int whence) = 0; + /** + * Opens the file + * + * Opens the file at the given mode. These can be: + * - \b UPNP_READ, to read from the file + * - \b UPNP_WRITE, to write to the file + * + * @param mode The file mode, i.e. one of the following + * - \b UPNP_READ + * - \b UPNP_WRITE + */ + virtual void open( + UpnpOpenFileMode mode ///< The file mode, i.e. one of the following + ///< - \b UPNP_READ + ///< - \b UPNP_WRITE + ) = 0; + /** + * Reads from the file + * + * Reads from the file a certain amount of bytes and stores them in a buffer + * + * @return returns + * - \b <0, in case of an error + * - \b 0, when reading was successful + * + * @param buf The char buffer + * @param buflen The size of the buffer + */ + virtual int read( + char* buf, ///< The char buffer + size_t buflen ///< The size of the buffer + ) = 0; + /** + * Writes to the file + * + * Writes to the file a certain amount of bytes which are stored in a buffer + * + * @return returns + * - \b <0, in case of an error + * - \b 0, when reading was successful + * + * @param buf The char buffer + * @param buflen The size of the buffer + */ + virtual int write( + char* buf, ///< The char buffer + size_t buflen ///< The size of the buffer + ) = 0; + /** + * Seeks in the file + * + * Seeks in the file where the offset is the relativ position depending on + * the second parameter. This means, in case of + * + * - \b SEEK_SET, the offset is relative to the beginning of the file + * - \b SEEK_CUR, it is relative to the current position or + * - \b SEEK_END, relative to the end of the file. + * + * @return returns + * - \b <0, in case of an error + * - \b 0, when reading was successful + * + * @param offset The byte offset in the file + * @param whence one of the following + * - \b SEEK_SET, + * - \b SEEK_CUR, + * - \b SEEK_END + */ + virtual int seek( + off_t offset, ///< The byte offset in the file + int whence ///< one of the following + ///< - \b SEEK_SET, + ///< - \b SEEK_CUR, + ///< - \b SEEK_END + ) = 0; + /** + * Closes the open file + * + * This will close open file handles and frees the memory obtained by it. + */ virtual void close() = 0; virtual ~cFileHandle(){}; private: |