EBOOK-TOOLS
Main Page
Classes
Files
File List
File Members
src
libepub
epub.h
Go to the documentation of this file.
1
#ifndef EPUB_H
2
#define EPUB_H 1
3
4
#include <
epub_shared.h
>
5
/** \struct epub is a private struct containting information about the epub file */
6
struct
epub
;
7
8
/** \struct eiterator is a private iterator struct */
9
struct
eiterator
;
10
struct
titerator
;
11
12
#ifdef __cplusplus
13
extern
"C"
{
14
#endif
/* C++ */
15
16
/**
17
This function accepts an epub filename. It then parses its information and
18
returns it as an epub struct.
19
20
@param filename the name of the file to open
21
@param debug is the debug level (0=none, 1=errors, 2=warnings, 3=info)
22
@return epub struct with the information of the file or NULL on error
23
24
*/
25
EPUB_EXPORT
struct
epub
*
epub_open
(
const
char
*filename,
int
debug
);
26
27
/**
28
This function sets the debug level to the given level.
29
30
@param filename is the name of the file to open
31
@param debug is the debug level (0=none, 1=errors, 2=warnings, 3=info)
32
*/
33
EPUB_EXPORT
void
epub_set_debug
(
struct
epub
*
epub
,
int
debug
);
34
35
/**
36
returns the file with the give filename
37
38
@param epub struct of the epub file we want to read from
39
@param filename the name of the file we want to read
40
@param pointer to where the file data is stored
41
@return the number of bytes read
42
*/
43
EPUB_EXPORT
int
epub_get_ocf_file
(
struct
epub
*
epub
,
const
char
*filename,
char
**data);
44
45
/**
46
Frees the memory held by the given iterator
47
48
@param it the iterator
49
*/
50
EPUB_EXPORT
void
epub_free_iterator
(
struct
eiterator
*it);
51
52
/**
53
This function closes a given epub. It also frees the epub struct.
54
So you can use it after calling this function.
55
56
@param epub the struct of the epub to close.
57
*/
58
EPUB_EXPORT
int
epub_close
(
struct
epub
*
epub
);
59
60
/**
61
Debugging function dumping various file information.
62
63
@param epub the struct of the epub to close.
64
*/
65
EPUB_EXPORT
void
epub_dump
(
struct
epub
*
epub
);
66
67
68
/**
69
(Bad xml might cause some of it to be NULL).
70
71
@param epub the struct .
72
*/
73
EPUB_EXPORT
unsigned
char
**
epub_get_metadata
(
struct
epub
*
epub
,
enum
epub_metadata
type,
74
int
*size);
75
76
/**
77
returns the file with the give filename. The file is looked
78
for in the data directory. (Useful for getting book files).
79
80
@param epub struct of the epub file we want to read from
81
@param filename the name of the file we want to read
82
@param pointer to where the file data is stored
83
@return the number of bytes read
84
*/
85
EPUB_EXPORT
int
epub_get_data
(
struct
epub
*
epub
,
const
char
*name,
char
**data);
86
87
88
/**
89
Returns a book iterator of the requested type
90
for the given epub struct.
91
92
@param epub struct of the epub file
93
@param type the iterator type
94
@param opt other options (ignored for now)
95
@return eiterator to the epub book
96
*/
97
EPUB_EXPORT
struct
eiterator
*
epub_get_iterator
(
struct
epub
*
epub
,
98
enum
eiterator_type
type
,
int
opt
);
99
100
/**
101
updates the iterator to the next element and returns a pointer
102
to the data. the iterator handles the freeing of the memory.
103
104
@param it the iterator
105
@return pointer to the data
106
*/
107
EPUB_EXPORT
char
*
epub_it_get_next
(
struct
eiterator
*it);
108
109
/**
110
Returns a pointer to the iterator's data. the iterator handles
111
the freeing of the memory.
112
113
@param it the iterator
114
@return pointer to the data
115
*/
116
EPUB_EXPORT
char
*
epub_it_get_curr
(
struct
eiterator
*it);
117
118
/**
119
Returns a pointer to the url of the iterator's current data.
120
the iterator handles the freeing of the memory.
121
122
@param it the iterator
123
@return pointer to the current data's url
124
*/
125
EPUB_EXPORT
char
*
epub_it_get_curr_url
(
struct
eiterator
*it);
126
127
/**
128
Returns a book toc iterator of the requested type
129
for the given epub struct.
130
131
@param epub struct of the epub file
132
@param type the iterator type
133
@param opt other options (ignored for now)
134
@return toc iterator to the epub book
135
*/
136
EPUB_EXPORT
struct
titerator
*
epub_get_titerator
(
struct
epub
*
epub
,
137
enum
titerator_type
type
,
int
opt
);
138
139
140
/**
141
Returns 1 if the current entry is valid and 0 otherwise.
142
143
@param tit the iterator
144
@return 1 if the current entry is valid and 0 otherwise
145
*/
146
EPUB_EXPORT
int
epub_tit_curr_valid
(
struct
titerator
*tit);
147
148
/**
149
Returns a pointer to the depth of the toc iterator's current entry.
150
the iterator handles the freeing of the memory.
151
152
@param tit the iterator
153
@return pointer to the current entry's depth
154
*/
155
EPUB_EXPORT
int
epub_tit_get_curr_depth
(
struct
titerator
*tit);
156
157
/**
158
Returns a pointer to the link of the toc iterator's current entry.
159
the iterator handles the freeing of the memory.
160
161
@param tit the iterator
162
@return the current entry's depth
163
*/
164
EPUB_EXPORT
char
*
epub_tit_get_curr_link
(
struct
titerator
*tit);
165
166
/**
167
Returns a pointer to the label of the toc iterator's current entry.
168
the iterator handles the freeing of the memory.
169
170
@param tit the iterator
171
@return pointer to the current entry's lable
172
*/
173
EPUB_EXPORT
char
*
epub_tit_get_curr_label
(
struct
titerator
*tit);
174
175
/**
176
Frees the memory held by the given iterator
177
178
@param tit the iterator
179
*/
180
EPUB_EXPORT
void
epub_free_titerator
(
struct
titerator
*tit);
181
182
/**
183
updates the iterator to the next element.
184
185
@param tit the iterator
186
@return 1 on success and 0 otherwise
187
*/
188
EPUB_EXPORT
int
epub_tit_next
(
struct
titerator
*tit);
189
190
/**
191
Cleans up after the library. Call this when you are done with the library.
192
*/
193
EPUB_EXPORT
void
epub_cleanup
();
194
195
#ifdef __cplusplus
196
}
197
#endif
/* C++ */
198
199
#endif
/* EPUB_H */
Generated on Tue Feb 26 2013 11:08:53 for EBOOK-TOOLS by
1.8.2