* Copyright (C) 2012 xaizek.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef VIFM__ENGINE__TEXT_BUFFER_H__
#define VIFM__ENGINE__TEXT_BUFFER_H__
#include "../utils/macros.h"
*
* vle_textbuf *msg = vle_tb_create();
* if(*msg != NULL)
* {
* vle_tb_append_line(msg, "line1");
* ...
* vle_tb_append_line(msg, "lineN");
* output(vle_tb_get_data(msg));
* vle_tb_free(msg);
* }
*
* or
*
* vle_textbuf *msg = vle_tb_create();
* if(*msg != NULL)
* {
* vle_tb_append_line(msg, "line1");
* ...
* vle_tb_append_line(msg, "lineN");
* return vle_tb_release(msg);
* } */
typedef struct vle_textbuf vle_textbuf;
extern vle_textbuf *const vle_err;
* or NULL on memory allocation error. */
vle_textbuf * vle_tb_create(void);
void vle_tb_free(vle_textbuf *tb);
* NULL. Returns the data. */
char * vle_tb_release(vle_textbuf *tb);
void vle_tb_clear(vle_textbuf *tb);
void vle_tb_append(vle_textbuf *tb, const char str[]);
void vle_tb_appendf(vle_textbuf *tb, const char format[], ...)
_gnuc_printf(2, 3);
void vle_tb_append(vle_textbuf *tb, const char str[]);
void vle_tb_append_line(vle_textbuf *tb, const char str[]);
* buffer. */
void vle_tb_append_linef(vle_textbuf *tb, const char format[], ...)
_gnuc_printf(2, 3);
* call of functions in this module. Never returns NULL, only empty string. */
const char * vle_tb_get_data(vle_textbuf *tb);
size_t vle_tb_get_len(vle_textbuf *tb);
#endif