FS#11399 by me: fix r26998 for text_viewer
[kugel-rb.git] / apps / plugins / text_viewer / tv_reader.h
blob0b079edddbf043b9b7a740f983c4f40135e85c32
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 Gilles Roux
11 * 2003 Garrett Derner
12 * 2010 Yoshihisa Uchida
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
22 ****************************************************************************/
23 #ifndef PLUGIN_TEXT_VIEWER_READER_H
24 #define PLUGIN_TEXT_VIEWER_READER_H
26 /* stuff for the reading file */
29 * initialize the reader module
31 * [In/Out] buf
32 * the start pointer of the buffer
34 * [In/Out] size
35 * enabled buffer size
37 * return
38 * true initialize success
39 * false initialize failure
41 bool tv_init_reader(unsigned char **buf, size_t *bufsize);
43 /* finalize the reader module */
44 void tv_finalize_reader(void);
47 * return the file size
49 * return
50 * file size
52 * Note: when the file is UTF-8 file with BOM, if the encoding of the text viewer is UTF-8,
53 * then file size decreases only BOM size.
55 off_t tv_get_file_size(void);
58 * return the whether is the end of file or not
60 * return
61 * true EOF
62 * false not EOF
64 bool tv_is_eof(void);
67 * return the current file position
69 * return
70 * the current file position
72 off_t tv_get_current_file_pos(void);
75 * return the bufer which store text data
77 * [Out] bufsize
78 * buffer size
80 * return
81 * the pointer of the buffer
83 const unsigned char *tv_get_buffer(ssize_t *bufsize);
86 * seek to the given offset
88 * [In] offset
89 * offset size
91 * [In] whence
92 * SEEK_CUR seek to the current position + offset.
93 * SEEK_SET seek to the offset.
95 * Note: whence supports SEEK_CUR and SEEK_SET only.
97 void tv_seek(off_t offset, int whence);
99 #endif