summaryrefslogtreecommitdiff
path: root/apps/plugins/text_viewer/tv_reader.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/text_viewer/tv_reader.h')
-rw-r--r--apps/plugins/text_viewer/tv_reader.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/apps/plugins/text_viewer/tv_reader.h b/apps/plugins/text_viewer/tv_reader.h
new file mode 100644
index 0000000000..464af1027a
--- /dev/null
+++ b/apps/plugins/text_viewer/tv_reader.h
@@ -0,0 +1,102 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 Gilles Roux
11 * 2003 Garrett Derner
12 * 2010 Yoshihisa Uchida
13 *
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.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23#ifndef PLUGIN_TEXT_VIEWER_READER_H
24#define PLUGIN_TEXT_VIEWER_READER_H
25
26/* stuff for the reading file */
27
28/*
29 * initialize the reader module
30 *
31 * [In] buf
32 * the start pointer of the buffer
33 *
34 * [In] size
35 * enabled buffer size
36 *
37 * [Out] used_size
38 * the size of the buffer which the pager uses
39 *
40 * return
41 * true initialize success
42 * false initialize failure
43 */
44bool tv_init_reader(unsigned char *buf, size_t bufsize, size_t *used_size);
45
46/* finalize the reader module */
47void tv_finalize_reader(void);
48
49/*
50 * return the file size
51 *
52 * return
53 * file size
54 *
55 * Note: when the file is UTF-8 file with BOM, if the encoding of the text viewer is UTF-8,
56 * then file size decreases only BOM size.
57 */
58off_t tv_get_file_size(void);
59
60/*
61 * return the whether is the end of file or not
62 *
63 * return
64 * true EOF
65 * false not EOF
66 */
67bool tv_is_eof(void);
68
69/*
70 * return the current file position
71 *
72 * return
73 * the current file position
74 */
75off_t tv_get_current_file_pos(void);
76
77/*
78 * return the bufer which store text data
79 *
80 * [Out] bufsize
81 * buffer size
82 *
83 * return
84 * the pointer of the buffer
85 */
86const unsigned char *tv_get_buffer(ssize_t *bufsize);
87
88/*
89 * seek to the given offset
90 *
91 * [In] offset
92 * offset size
93 *
94 * [In] whence
95 * SEEK_CUR seek to the current position + offset.
96 * SEEK_SET seek to the offset.
97 *
98 * Note: whence supports SEEK_CUR and SEEK_SET only.
99 */
100void tv_seek(off_t offset, int whence);
101
102#endif