1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Gilles Roux
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
32 * the start pointer of the buffer
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
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
67 * return the current file position
70 * the current file position
72 off_t
tv_get_current_file_pos(void);
75 * return the bufer which store text data
81 * the pointer of the buffer
83 const unsigned char *tv_get_buffer(ssize_t
*bufsize
);
86 * seek to the given offset
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
);