26#ifndef MUTT_MUTT_BUFFER_H
27#define MUTT_MUTT_BUFFER_H
68 __attribute__((__format__(__printf__, 2, 3)));
76size_t buf_concatn_path (struct
Buffer *dst, const
char *dir,
size_t dirlen, const
char *fname,
size_t fnamelen);
79 __attribute__((__format__(__printf__, 2, 3)));
98 if (!buf || !buf->
data)
int buf_coll(const struct Buffer *a, const struct Buffer *b)
Collate two strings (compare using locale)
bool buf_istr_equal(const struct Buffer *a, const struct Buffer *b)
Return if two buffers are equal, case insensitive.
int buf_printf(struct Buffer *buf, const char *fmt,...) __attribute__((__format__(__printf__
void buf_seek(struct Buffer *buf, size_t offset)
Set current read/write position to offset from beginning.
size_t buf_addstr_n(struct Buffer *buf, const char *s, size_t len)
Add a string to a Buffer, expanding it if necessary.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
const char * buf_find_string(const struct Buffer *buf, const char *s)
Return a pointer to a substring found in the buffer.
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
void buf_alloc(struct Buffer *buf, size_t size)
Make sure a buffer can store at least new_size bytes.
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
void buf_dequote_comment(struct Buffer *buf)
Un-escape characters in an email address comment.
char buf_at(const struct Buffer *buf, size_t offset)
Return the character at the given offset.
int void buf_join_str(struct Buffer *str, const char *item, char sep)
Join a buffer with a string separated by sep.
void buf_free(struct Buffer **ptr)
Deallocates a buffer.
void buf_inline_replace(struct Buffer *buf, size_t pos, size_t len, const char *str)
struct Buffer * buf_init(struct Buffer *buf)
Initialise a new Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
size_t buf_strcpy_n(struct Buffer *buf, const char *s, size_t len)
Copy a string into a Buffer.
struct Buffer * buf_new(const char *str)
Allocate a new Buffer.
int size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
size_t buf_concatn_path(struct Buffer *dst, const char *dir, size_t dirlen, const char *fname, size_t fnamelen)
Join a directory name and a filename.
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
bool buf_str_equal(const struct Buffer *a, const struct Buffer *b)
Return if two buffers are equal.
const char * buf_rfind(const struct Buffer *buf, const char *str)
Find last instance of a substring.
struct Buffer * buf_dup(const struct Buffer *buf)
Copy a Buffer into a new allocated buffer.
int buf_add_printf(struct Buffer *buf, const char *fmt,...) __attribute__((__format__(__printf__
const char * buf_find_char(const struct Buffer *buf, const char c)
Return a pointer to a char found in the buffer.
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
size_t buf_insert(struct Buffer *buf, size_t offset, const char *s)
Add a string in the middle of a buffer.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
size_t buf_concat_path(struct Buffer *buf, const char *dir, const char *fname)
Join a directory name and a filename.
void buf_lower(struct Buffer *buf)
Sets a buffer to lowercase.
size_t buf_startswith(const struct Buffer *buf, const char *prefix)
Check whether a buffer starts with a prefix.
size_t buf_substrcpy(struct Buffer *buf, const char *beg, const char *end)
Copy a partial string into a Buffer.
String manipulation buffer.
char * dptr
Current read/write position.
size_t dsize
Length of data.
char * data
Pointer to data.