text_viewer: cleanup & bugfix
[kugel-rb.git] / apps / plugins / text_viewer / tv_reader.h
blob2ee0b828ab12aa1a690ea9b616ce1b384c4d36b7
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 * return
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
43 * return
44 * 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
54 * return
55 * true EOF
56 * false not EOF
58 bool tv_is_eof(void);
61 * return the current file position
63 * return
64 * the current file position
66 off_t tv_get_current_file_pos(void);
69 * return the bufer which store text data
71 * [Out] bufsize
72 * buffer size
74 * return
75 * the pointer of the buffer
77 const unsigned char *tv_get_buffer(ssize_t *bufsize);
80 * seek to the given offset
82 * [In] offset
83 * offset size
85 * [In] whence
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);
93 #endif