All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
txtbuf.h
Go to the documentation of this file.
1 /*
2  * txtbuf.h - APme: Aion Automatic Abyss Point Tracker
3  *
4  * Copyright (C) 2012 Mitja Horvat <pinkfluid@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or (at
9  * your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19  */
20 
26 #ifndef TXTBUF_H_INCLUDED
27 #define TXTBUF_H_INCLUDED
28 
29 #include <stdbool.h>
30 
38 struct txtbuf
39 {
40  size_t tb_size;
41  size_t tb_head;
42  size_t tb_tail;
43  char *tb_text;
44 };
45 
46 extern void tb_init(struct txtbuf *tb, char *txt, size_t txt_sz);
47 extern bool tb_put(struct txtbuf *tb, void *buf, size_t buf_sz);
48 extern void tb_strtrim(struct txtbuf *tb);
49 extern bool tb_strput(struct txtbuf *tb, char *str);
50 extern int tb_strnum(struct txtbuf *tb);
51 extern bool tb_strget(struct txtbuf *tb, int index, char *dst, size_t dst_sz);
52 extern bool tb_strlast(struct txtbuf *tb, int index, char *dst, size_t dst_sz);
53 
57 #endif /* TXTBUF_H_INCLUDED */