Improve doxygen documentation.
This commit is contained in:
+11
-10
@@ -6,37 +6,38 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
/** @file
|
||||
* dbuf is a generic buffer that will grow automatically.
|
||||
* call buf_ensure() to reserve space, and don't write more data
|
||||
* than you told buf_ensure() to reserve.
|
||||
* call uc_buf_ensure() to reserve space, and don't write more data
|
||||
* than you told uc_buf_ensure() to reserve.
|
||||
*
|
||||
* You write data to buf->end
|
||||
* When finished writing data
|
||||
* you call dbuf_added/( with the no. of bytes you've added.
|
||||
*
|
||||
* You read data from buf->start, the buffer has dbuf_len() bytes of data
|
||||
* When you've read and processed the data, call dbuf_take()
|
||||
* You read data from buf->start, the buffer has uc_dbuf_len() bytes of data
|
||||
* When you've read and processed the data, call uc_dbuf_take()
|
||||
* to indicate you're done with the data.
|
||||
*
|
||||
* typically(but add error checking)
|
||||
* @code
|
||||
* DBuf buf;
|
||||
* dbuf_init(&buf,4096);
|
||||
* uc_dbuf_init(&buf,4096);
|
||||
* for(;;) {
|
||||
* dbuf_ensure(buf,4096);
|
||||
* uc_dbuf_ensure(buf,4096);
|
||||
* size_t len = fread(buf,4096,1,f);
|
||||
* dbuf_added(&buf,len);
|
||||
* uc_dbuf_added(&buf,len);
|
||||
* char *end;
|
||||
* while((end = memchr(buf.start,'\n',dbuf_len(&dbuf))) != NULL) { //look for a newline
|
||||
* while((end = memchr(buf.start,'\n',uc_dbuf_len(&dbuf))) != NULL) { //look for a newline
|
||||
* ++end;
|
||||
* int linelen = end - buf.start;
|
||||
* process_line(buf.start,linelen);
|
||||
* dbuf_take(&dbuf,linelen);
|
||||
* uc_dbuf_take(&dbuf,linelen);
|
||||
* }
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
|
||||
typedef struct DBuf DBuf;
|
||||
struct DBuf {
|
||||
/** Start of user data */
|
||||
|
||||
Reference in New Issue
Block a user