Refactor, separate docs from headers, add ru docs
Doxygen kind'a sucks and I need multilanguage documentation, so I did that. Also, separated massive Math.h file into smaller files.
This commit is contained in:
154
include/BH/IO.h
154
include/BH/IO.h
@@ -81,231 +81,77 @@ typedef struct BH_IOSeekInfo
|
||||
} BH_IOSeekInfo;
|
||||
|
||||
|
||||
/**
|
||||
* Creates an input/output device representing a file at the given \a path.
|
||||
*
|
||||
* \param path File path
|
||||
* \param mode Open mode
|
||||
* \param result Result code
|
||||
*
|
||||
* \return On success, returns IO device pointer.
|
||||
* \return On failure, returns NULL pointer.
|
||||
*/
|
||||
BH_IO *BH_FileNew(const char *path,
|
||||
int mode,
|
||||
int *result);
|
||||
|
||||
|
||||
/**
|
||||
* Creates an input/output deivce that buffers access to other \a device.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
* \param size Buffer size
|
||||
* \param result Result code
|
||||
*
|
||||
* \return On success, returns IO device pointer.
|
||||
* \return On failure, returns NULL pointer.
|
||||
*/
|
||||
BH_IO *BH_BufferNew(BH_IO *device,
|
||||
size_t size,
|
||||
int *result);
|
||||
|
||||
|
||||
/**
|
||||
* Creates an input/output devices that access memory buffer.
|
||||
*
|
||||
* \param data Buffer pointer
|
||||
* \param size Buffer size
|
||||
* \param result Result code
|
||||
*
|
||||
* \return On success, returns IO device pointer.
|
||||
* \return On failure, returns NULL pointer.
|
||||
*/
|
||||
BH_IO *BH_BytesNew(char *data,
|
||||
size_t size,
|
||||
int *result);
|
||||
|
||||
|
||||
/**
|
||||
* Destroys the input/output \a device.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
*/
|
||||
void BH_IOFree(BH_IO *device);
|
||||
|
||||
|
||||
/**
|
||||
* Reads up to \a size bytes from the \a device into \a buffer.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
* \param buffer Buffer pointer
|
||||
* \param size Buffer size
|
||||
* \param actual Bytes read (optional)
|
||||
*
|
||||
* \return On success, returns zero.
|
||||
* \return On failure, returns error code.
|
||||
*/
|
||||
int BH_IORead(BH_IO *device,
|
||||
char *buffer,
|
||||
size_t size,
|
||||
size_t *actual);
|
||||
|
||||
|
||||
/**
|
||||
* Writes up to \a size bytes to the \a device from \a buffer.
|
||||
*
|
||||
* \param io IO device pointer
|
||||
* \param buffer Buffer pointer
|
||||
* \param size Buffer size
|
||||
* \param actual Bytes written (optional)
|
||||
*
|
||||
* \return On success, returns zero.
|
||||
* \return On failure, returns error code.
|
||||
*/
|
||||
int BH_IOWrite(BH_IO *io,
|
||||
const char *buffer,
|
||||
size_t size,
|
||||
size_t *actual);
|
||||
|
||||
|
||||
/**
|
||||
* Manupulates an input/output \a device with specific \a op and and \a arg.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
* \param op Operation
|
||||
* \param arg Argument
|
||||
*
|
||||
* \return On success, returns zero.
|
||||
* \return On failure, returns error code.
|
||||
*/
|
||||
int BH_IOCtl(BH_IO *device,
|
||||
int op,
|
||||
void *arg);
|
||||
|
||||
|
||||
/**
|
||||
* Checks if an input/output \a device supports specific \a op.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
* \param op Operation
|
||||
*
|
||||
* \return On success, returns zero.
|
||||
* \return On failure, returns error code.
|
||||
*/
|
||||
int BH_IOCap(BH_IO *device,
|
||||
int op);
|
||||
|
||||
|
||||
/**
|
||||
* Peeks up to \a size bytes from the \a device into \a buffer.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
* \param buffer Buffer pointer
|
||||
* \param size Buffer size
|
||||
* \param actial Bytes peeked (optional)
|
||||
*
|
||||
* \return On success, returns zero.
|
||||
* \return On failure, returns error code.
|
||||
*/
|
||||
int BH_IOPeek(BH_IO *device,
|
||||
char *buffer,
|
||||
size_t size,
|
||||
size_t *actual);
|
||||
|
||||
|
||||
/**
|
||||
* Tells current \a offset in the \a device.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
* \param offset Position
|
||||
*
|
||||
* \return On success, returns zero.
|
||||
* \return On failure, returns error code.
|
||||
*/
|
||||
int BH_IOTell(BH_IO *device,
|
||||
int64_t *offset);
|
||||
|
||||
|
||||
/**
|
||||
* Seeks to specified \a offset and \a whence in the \a device.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
* \param offset Position
|
||||
* \param whence Direction
|
||||
*
|
||||
* \return On success, returns zero.
|
||||
* \return On failure, returns error code.
|
||||
*/
|
||||
int BH_IOSeek(BH_IO *device,
|
||||
int64_t offset,
|
||||
int whence);
|
||||
|
||||
|
||||
/**
|
||||
* Flushes the internal buffers of the \a device.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
*
|
||||
* \return On success, returns zero.
|
||||
* \return On failure, returns error code.
|
||||
*/
|
||||
int BH_IOFlush(BH_IO *device);
|
||||
|
||||
|
||||
/**
|
||||
* Returns total or available size of the \a device.
|
||||
*
|
||||
* \param device IO pointer
|
||||
* \param size Available/total size
|
||||
*
|
||||
* \return On success, returns zero.
|
||||
* \return On failure, returns error code.
|
||||
*/
|
||||
int BH_IOSize(BH_IO *device,
|
||||
int64_t *size);
|
||||
|
||||
|
||||
/**
|
||||
* Returns flags of the \a device.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
* \param flags Flags
|
||||
*
|
||||
* \return On success, returns zero.
|
||||
* \return On failure, returns error code.
|
||||
*/
|
||||
int BH_IOFlags(BH_IO *device,
|
||||
int *flags);
|
||||
|
||||
|
||||
/**
|
||||
* Returns error flag of the \a device.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
*
|
||||
* \return Returns error flag.
|
||||
*/
|
||||
int BH_IOError(BH_IO *device);
|
||||
|
||||
|
||||
/**
|
||||
* Returns end-of-file flag of the \a device.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
*
|
||||
* \return Returns end-of-file flag.
|
||||
*/
|
||||
int BH_IOEndOfFile(BH_IO *device);
|
||||
|
||||
|
||||
/**
|
||||
* Clears errors of the \a device.
|
||||
*
|
||||
* \param device IO device pointer
|
||||
*
|
||||
* \return On success, returns zero.
|
||||
* \return On failure, returns error code.
|
||||
*/
|
||||
int BH_IOClear(BH_IO *device);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user