2ee0b828ab12aa1a690ea9b616ce1b384c4d36b7
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 * true initialize success
33 * false initialize failure
35 bool tv_init_reader(void);
37 /* finalize the reader module */
38 void tv_finalize_reader(void);
41 * return the file size
46 * Note: when the file is UTF-8 file with BOM, if the encoding of the text viewer is UTF-8,
47 * then file size decreases only BOM size.
49 off_t
tv_get_file_size(void);
52 * return the whether is the end of file or not
61 * return the current file position
64 * the current file position
66 off_t
tv_get_current_file_pos(void);
69 * return the bufer which store text data
75 * the pointer of the buffer
77 const unsigned char *tv_get_buffer(ssize_t
*bufsize
);
80 * seek to the given offset
86 * SEEK_CUR seek to the current position + offset.
87 * SEEK_SET seek to the offset.
89 * Note: whence supports SEEK_CUR and SEEK_SET only.
91 void tv_seek(off_t offset
, int whence
);