aboutsummaryrefslogtreecommitdiff
path: root/include/io/ostream.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/io/ostream.h')
-rw-r--r--include/io/ostream.h78
1 files changed, 28 insertions, 50 deletions
diff --git a/include/io/ostream.h b/include/io/ostream.h
index 9cc37ad..8fc8cef 100644
--- a/include/io/ostream.h
+++ b/include/io/ostream.h
@@ -19,12 +19,40 @@
typedef struct ostream_t {
sqfs_object_t base;
+ /**
+ * @brief Append a block of data to an output stream.
+ *
+ * @param strm A pointer to an output stream.
+ * @param data A pointer to the data block to append.
+ * @param size The number of bytes to append.
+ *
+ * @return Zero on success, -1 on failure.
+ */
int (*append)(struct ostream_t *strm, const void *data, size_t size);
int (*append_sparse)(struct ostream_t *strm, size_t size);
+ /**
+ * @brief Process all pending, buffered data and flush it to disk.
+ *
+ * If the stream performs some kind of transformation (e.g. transparent
+ * data compression), flushing caues the wrapped format to insert a
+ * termination token. Only call this function when you are absolutely
+ * DONE appending data, shortly before destroying the stream.
+ *
+ * @param strm A pointer to an output stream.
+ *
+ * @return Zero on success, -1 on failure.
+ */
int (*flush)(struct ostream_t *strm);
+ /**
+ * @brief Get the underlying filename of a output stream.
+ *
+ * @param strm The output stream to get the filename from.
+ *
+ * @return A string holding the underlying filename.
+ */
const char *(*get_filename)(struct ostream_t *strm);
} ostream_t;
@@ -38,23 +66,6 @@ extern "C" {
#endif
/**
- * @brief Append a block of data to an output stream.
- *
- * @memberof ostream_t
- *
- * @param strm A pointer to an output stream.
- * @param data A pointer to the data block to append.
- * @param size The number of bytes to append.
- *
- * @return Zero on success, -1 on failure.
- */
-SQFS_INLINE int ostream_append(ostream_t *strm, const void *data,
- size_t size)
-{
- return strm->append(strm, data, size);
-}
-
-/**
* @brief Append a number of zero bytes to an output stream.
*
* @memberof ostream_t
@@ -70,39 +81,6 @@ SQFS_INLINE int ostream_append(ostream_t *strm, const void *data,
*/
SQFS_INTERNAL int ostream_append_sparse(ostream_t *strm, size_t size);
-/**
- * @brief Process all pending, buffered data and flush it to disk.
- *
- * @memberof ostream_t
- *
- * If the stream performs some kind of transformation (e.g. transparent data
- * compression), flushing caues the wrapped format to insert a termination
- * token. Only call this function when you are absolutely DONE appending data,
- * shortly before destroying the stream.
- *
- * @param strm A pointer to an output stream.
- *
- * @return Zero on success, -1 on failure.
- */
-SQFS_INLINE int ostream_flush(ostream_t *strm)
-{
- return strm->flush(strm);
-}
-
-/**
- * @brief Get the underlying filename of a output stream.
- *
- * @memberof ostream_t
- *
- * @param strm The output stream to get the filename from.
- *
- * @return A string holding the underlying filename.
- */
-SQFS_INLINE const char *ostream_get_filename(ostream_t *strm)
-{
- return strm->get_filename(strm);
-}
-
#ifdef __cplusplus
}
#endif