Functions

epub.h File Reference

#include <epub_shared.h>
Include dependency graph for epub.h:

Go to the source code of this file.

Functions

EPUB_EXPORT void epub_cleanup ()
 Cleans up after the library.
EPUB_EXPORT int epub_close (struct epub *epub)
 This function closes a given epub.
EPUB_EXPORT void epub_dump (struct epub *epub)
 Debugging function dumping various file information.
EPUB_EXPORT void epub_free_iterator (struct eiterator *it)
 Frees the memory held by the given iterator.
EPUB_EXPORT void epub_free_titerator (struct titerator *tit)
 Frees the memory held by the given iterator.
EPUB_EXPORT int epub_get_data (struct epub *epub, const char *name, char **data)
 returns the file with the give filename.
EPUB_EXPORT struct eiteratorepub_get_iterator (struct epub *epub, enum eiterator_type type, int opt)
 Returns a book iterator of the requested type for the given epub struct.
EPUB_EXPORT unsigned char ** epub_get_metadata (struct epub *epub, enum epub_metadata type, int *size)
 (Bad xml might cause some of it to be NULL).
EPUB_EXPORT int epub_get_ocf_file (struct epub *epub, const char *filename, char **data)
 returns the file with the give filename
EPUB_EXPORT struct titeratorepub_get_titerator (struct epub *epub, enum titerator_type type, int opt)
 Returns a book toc iterator of the requested type for the given epub struct.
EPUB_EXPORT char * epub_it_get_curr (struct eiterator *it)
 Returns a pointer to the iterator's data.
EPUB_EXPORT char * epub_it_get_curr_url (struct eiterator *it)
 Returns a pointer to the url of the iterator's current data.
EPUB_EXPORT char * epub_it_get_next (struct eiterator *it)
 updates the iterator to the next element and returns a pointer to the data.
EPUB_EXPORT struct epubepub_open (const char *filename, int debug)
 This function accepts an epub filename.
EPUB_EXPORT void epub_set_debug (struct epub *epub, int debug)
 This function sets the debug level to the given level.
EPUB_EXPORT int epub_tit_curr_valid (struct titerator *tit)
 Returns 1 if the current entry is valid and 0 otherwise.
EPUB_EXPORT int epub_tit_get_curr_depth (struct titerator *tit)
 Returns a pointer to the depth of the toc iterator's current entry.
EPUB_EXPORT char * epub_tit_get_curr_label (struct titerator *tit)
 Returns a pointer to the label of the toc iterator's current entry.
EPUB_EXPORT char * epub_tit_get_curr_link (struct titerator *tit)
 Returns a pointer to the link of the toc iterator's current entry.
EPUB_EXPORT int epub_tit_next (struct titerator *tit)
 updates the iterator to the next element.

Function Documentation

EPUB_EXPORT void epub_cleanup (  )

Cleans up after the library.

Call this when you are done with the library.

EPUB_EXPORT int epub_close ( struct epub epub )

This function closes a given epub.

It also frees the epub struct. So you can use it after calling this function.

Parameters:
epubthe struct of the epub to close.
EPUB_EXPORT void epub_dump ( struct epub epub )

Debugging function dumping various file information.

Parameters:
epubthe struct of the epub to close.
EPUB_EXPORT void epub_free_iterator ( struct eiterator it )

Frees the memory held by the given iterator.

Parameters:
itthe iterator
EPUB_EXPORT void epub_free_titerator ( struct titerator tit )

Frees the memory held by the given iterator.

Parameters:
titthe iterator
EPUB_EXPORT int epub_get_data ( struct epub epub,
const char *  name,
char **  data 
)

returns the file with the give filename.

The file is looked for in the data directory. (Useful for getting book files).

Parameters:
epubstruct of the epub file we want to read from
filenamethe name of the file we want to read
pointerto where the file data is stored
Returns:
the number of bytes read
EPUB_EXPORT struct eiterator* epub_get_iterator ( struct epub epub,
enum eiterator_type  type,
int  opt 
) [read]

Returns a book iterator of the requested type for the given epub struct.

Parameters:
epubstruct of the epub file
typethe iterator type
optother options (ignored for now)
Returns:
eiterator to the epub book
EPUB_EXPORT unsigned char** epub_get_metadata ( struct epub epub,
enum epub_metadata  type,
int *  size 
)

(Bad xml might cause some of it to be NULL).

Parameters:
epubthe struct .
EPUB_EXPORT int epub_get_ocf_file ( struct epub epub,
const char *  filename,
char **  data 
)

returns the file with the give filename

Parameters:
epubstruct of the epub file we want to read from
filenamethe name of the file we want to read
pointerto where the file data is stored
Returns:
the number of bytes read
EPUB_EXPORT struct titerator* epub_get_titerator ( struct epub epub,
enum titerator_type  type,
int  opt 
) [read]

Returns a book toc iterator of the requested type for the given epub struct.

Parameters:
epubstruct of the epub file
typethe iterator type
optother options (ignored for now)
Returns:
toc iterator to the epub book
EPUB_EXPORT char* epub_it_get_curr ( struct eiterator it )

Returns a pointer to the iterator's data.

the iterator handles the freeing of the memory.

Parameters:
itthe iterator
Returns:
pointer to the data
EPUB_EXPORT char* epub_it_get_curr_url ( struct eiterator it )

Returns a pointer to the url of the iterator's current data.

the iterator handles the freeing of the memory.

Parameters:
itthe iterator
Returns:
pointer to the current data's url
EPUB_EXPORT char* epub_it_get_next ( struct eiterator it )

updates the iterator to the next element and returns a pointer to the data.

the iterator handles the freeing of the memory.

Parameters:
itthe iterator
Returns:
pointer to the data
EPUB_EXPORT struct epub* epub_open ( const char *  filename,
int  debug 
) [read]

This function accepts an epub filename.

It then parses its information and returns it as an epub struct.

Parameters:
filenamethe name of the file to open
debugis the debug level (0=none, 1=errors, 2=warnings, 3=info)
Returns:
epub struct with the information of the file or NULL on error
EPUB_EXPORT void epub_set_debug ( struct epub epub,
int  debug 
)

This function sets the debug level to the given level.

Parameters:
filenameis the name of the file to open
debugis the debug level (0=none, 1=errors, 2=warnings, 3=info)
EPUB_EXPORT int epub_tit_curr_valid ( struct titerator tit )

Returns 1 if the current entry is valid and 0 otherwise.

Parameters:
titthe iterator
Returns:
1 if the current entry is valid and 0 otherwise
EPUB_EXPORT int epub_tit_get_curr_depth ( struct titerator tit )

Returns a pointer to the depth of the toc iterator's current entry.

the iterator handles the freeing of the memory.

Parameters:
titthe iterator
Returns:
pointer to the current entry's depth
EPUB_EXPORT char* epub_tit_get_curr_label ( struct titerator tit )

Returns a pointer to the label of the toc iterator's current entry.

the iterator handles the freeing of the memory.

Parameters:
titthe iterator
Returns:
pointer to the current entry's lable
EPUB_EXPORT char* epub_tit_get_curr_link ( struct titerator tit )

Returns a pointer to the link of the toc iterator's current entry.

the iterator handles the freeing of the memory.

Parameters:
titthe iterator
Returns:
the current entry's depth
EPUB_EXPORT int epub_tit_next ( struct titerator tit )

updates the iterator to the next element.

Parameters:
titthe iterator
Returns:
1 on success and 0 otherwise