nyctergatis.com

Contact

Projects
Sysquake Remote Live
NME
PDF
Hike
Sudoku
GifBuilder
jpeglib for Palm OS
MySQL Client
Cross-GCC for Mac OS
NE.h File Reference

Nyctergatis EPUB, a.k.a. More...

#include "zip.h"

Go to the source code of this file.

Data Structures

struct  NE
 Main NE structure (shouldn't be accessed directly) More...

Defines

#define NULL   0
 null pointer
#define FALSE   0
 false boolean value
#define TRUE   1
 true boolean value

Typedefs

typedef unsigned char NEBoolean
typedef struct NENEPtr

Enumerations

enum  NEErr {
  kNEErrOk = 0, kNEErrCannotCreateEPUBFile, kNEErrZip, kNEErrMalloc,
  kNEErrCannotOpenFile
}
enum  NEMetadataKey {
  kNEMetaTitle, kNEMetaCreator, kNEMetaIdentifier, kNEMetaLanguage,
  kNEMetaSubject, kNEMetaDescription, kNEMetaPublisher, kNEMetaDate,
  kNEMetaSource, kNEMetaRights
}
 Kind of metadata. More...

Functions

NEErr NEBegin (NEPtr ne, char const *filename)
 Begin the creation of an EPUB file.
NEErr NEAddMetadata (NEPtr ne, NEMetadataKey key, char const *data, int dataLen)
 Add metadata.
NEErr NEAddPart (NEPtr ne, char const *filename, NEBoolean auxiliary)
 Add an XHTML part to the book manifest; its contents should also be added with NEAddFile or NENewFile/NEWriteToFile/NECloseFile.
NEErr NEAddOther (NEPtr ne, char const *filename, int filenameLen, char const *mimetype)
 Add non-HTML content to the book (images, css, etc.); its contents should also be added with NEAddFile or NENewFile/NEWriteToFile/NECloseFile.
void NEEnumOther (NEPtr ne, char const **filename, int *filenameLength)
 Enumerate files added by NEAddOther.
NEErr NEAddTOCEntry (NEPtr ne, char const *title, char const *relativeUrl, int level)
 Add an entry to the table of contents.
NEErr NEAddFile (NEPtr ne, char const *filename, char const *path)
 Add the contents of a file.
NEErr NENewFile (NEPtr ne, char const *filename)
 Create a new file in the EPUB.
NEErr NEWriteToFile (NEPtr ne, char const *data, int len)
 Add data to the file created with NENewFile.
NEErr NECloseFile (NEPtr ne)
 Close the file opened by NENewFile.
NEErr NEAddEndnote (NEPtr ne, char const *endnote, int len, char const *refDoc, int refDocLen, char const **refLink)
 Add an endnote.
NEErr NEMakeCover (NEPtr ne)
NEErr NESetCoverImage (NEPtr ne, char const *filename, int filenameLen)
 Specify an image to be used for the cover.
NEErr NEEnd (NEPtr ne)
 Finish writing the EPUB file and release all resources.
NEErr NEStringCopy (char **str, char const *src, int srcLen)
 Copy a string to a sring allocated by malloc.
NEErr NEStringCat (char **str, char const *src, int srcLen)
 Concatenate a string to a string allocated by malloc.
NEErr NEStringAdd (char **str, char const *src, int srcLen)
 Concatenate a string with a linefeed separator character.
char const * NEStringNextPart (char const *str)
 Find next part after the next linefeed character.
void NEStringFree (char **str)
 Deallocated string.

Detailed Description

Nyctergatis EPUB, a.k.a.

NE (creation of EPUB documents). Relies on zlib (by Jean-Loup Gailly and Mark Adler) and minizip (by Gilles Vollant, distributed with zlib) for zip compression.

Author:
Yves Piguet.

Definition in file NE.h.


Enumeration Type Documentation

Kind of metadata.

Enumerator:
kNEMetaTitle 

title

kNEMetaCreator 

creator (author); may be multiple

kNEMetaIdentifier 

unique identifier (ISBN, reversed domain name, etc.)

kNEMetaLanguage 

language (RFC 3066; en, fr, de, ...)

kNEMetaSubject 

subject; may be multiple

kNEMetaDescription 

description

kNEMetaPublisher 

publisher

kNEMetaDate 

date (YYYY or YYYY-MM or YYYY-MM-DD)

kNEMetaSource 

source

kNEMetaRights 

copyright notice

Definition at line 110 of file NE.h.


Function Documentation

NEErr NEAddEndnote ( NEPtr  ne,
char const *  endnote,
int  len,
char const *  refDoc,
int  refDocLen,
char const **  refLink 
)

Add an endnote.

Parameters:
[in,out]nereference to EPUB main structure
[in]endnoteXHTML code for the endnote (without number)
[in]lenlength of endnote in bytes
[in]refDocname of the document containing the reference
[in]refDocLenlength of srcDoc in bytes
[out]refLinkXHTML code to use as a link to the endnote (null-terminated)
Returns:
kNEErrOk for success, error code for failure

Definition at line 449 of file NE.c.

NEErr NEAddFile ( NEPtr  ne,
char const *  filename,
char const *  path 
)

Add the contents of a file.

Parameters:
[in,out]nereference to EPUB main structure
[in]filenamefile name as seen in the EPUB
[in]pathpath of the original file
Returns:
kNEErrOk for success, error code for failure

Definition at line 323 of file NE.c.

NEErr NEAddMetadata ( NEPtr  ne,
NEMetadataKey  key,
char const *  data,
int  dataLen 
)

Add metadata.

Parameters:
[in,out]nereference to EPUB main structure
[in]keykind of metadata
[in]datametadata value
[in]dataLenlength of data in bytes
Returns:
kNEErrOk for success, error code for failure

Definition at line 205 of file NE.c.

NEErr NEAddOther ( NEPtr  ne,
char const *  filename,
int  filenameLen,
char const *  mimetype 
)

Add non-HTML content to the book (images, css, etc.); its contents should also be added with NEAddFile or NENewFile/NEWriteToFile/NECloseFile.

Parameters:
[in,out]nereference to EPUB main structure
[in]filenamefilename
[in]filenameLenlength of filename in bytes
[in]mimetypeMIME type (NULL to use filename's suffix)
Returns:
kNEErrOk for success, error code for failure

Definition at line 297 of file NE.c.

NEErr NEAddPart ( NEPtr  ne,
char const *  filename,
NEBoolean  auxiliary 
)

Add an XHTML part to the book manifest; its contents should also be added with NEAddFile or NENewFile/NEWriteToFile/NECloseFile.

Parameters:
[in,out]nereference to EPUB main structure
[in]filenamefilename
[in]auxiliaryTRUE for auxiliary content (referenced via hyperlinks), FALSE for main contents (main line of reading)
Returns:
kNEErrOk for success, error code for failure

Definition at line 253 of file NE.c.

NEErr NEAddTOCEntry ( NEPtr  ne,
char const *  title,
char const *  relativeUrl,
int  level 
)

Add an entry to the table of contents.

Parameters:
[in,out]nereference to EPUB main structure
[in]titleentry text
[in]relativeURLrelative URL to the file with an optional anchor
[in]level1 for top-level entries, 2 for subentries, etc.
Returns:
kNEErrOk for success, error code for failure

Definition at line 374 of file NE.c.

NEErr NEBegin ( NEPtr  ne,
char const *  filename 
)

Begin the creation of an EPUB file.

Parameters:
[out]nereference to EPUB main structure
[in]filenameEPUB file name, or NULL for debug (write to stderr)
Returns:
kNEErrOk for success, error code for failure

Definition at line 143 of file NE.c.

NEErr NECloseFile ( NEPtr  ne)

Close the file opened by NENewFile.

Returns:
kNEErrOk for success, error code for failure

Definition at line 442 of file NE.c.

NEErr NEEnd ( NEPtr  ne)

Finish writing the EPUB file and release all resources.

Returns:
kNEErrOk for success, error code for failure

Definition at line 858 of file NE.c.

void NEEnumOther ( NEPtr  ne,
char const **  filename,
int *  filenameLength 
)

Enumerate files added by NEAddOther.

Parameters:
[in]nereference to EPUB main structure
[in,out]filenameprevious filename on input (NULL to get the first one), next filename on output (NULL if no more)
[out]filenameLengthlength of filename in bytes

Definition at line 308 of file NE.c.

NEErr NENewFile ( NEPtr  ne,
char const *  filename 
)

Create a new file in the EPUB.

Parameters:
[in,out]nereference to EPUB main structure
[in]filenamefilename in document subdirectory, or in EPUB root if it starts with "/"
Returns:
kNEErrOk for success, error code for failure

Definition at line 399 of file NE.c.

NEErr NESetCoverImage ( NEPtr  ne,
char const *  filename,
int  filenameLen 
)

Specify an image to be used for the cover.

Parameters:
[in,out]nereference to EPUB main structure
[in]filenamefilename of the cover image (should also be added with NENewFile or NEAddFile)
[in]filenameLenlength of filename in bytes, or -1 if null-terminated
Returns:
kNEErrOk for success, error code for failure

Definition at line 244 of file NE.c.

NEErr NEStringAdd ( char **  str,
char const *  src,
int  srcLen 
)

Concatenate a string with a linefeed separator character.

Parameters:
[out]strnull-terminated string allocated by malloc, or NULL
[in]srcsource string to be concatenated
[in]srcLenlength of src in bytes, or -1 if null-terminated
Returns:
kNEErrOk for success, error code for failure

Definition at line 77 of file NE.c.

NEErr NEStringCat ( char **  str,
char const *  src,
int  srcLen 
)

Concatenate a string to a string allocated by malloc.

Parameters:
[out]strnull-terminated string allocated by malloc, or NULL
[in]srcsource string to be concatenated
[in]srcLenlength of src in bytes, or -1 if null-terminated
Returns:
kNEErrOk for success, error code for failure

Definition at line 55 of file NE.c.

NEErr NEStringCopy ( char **  str,
char const *  src,
int  srcLen 
)

Copy a string to a sring allocated by malloc.

Parameters:
[in,out]strnull-terminated string allocated by malloc, or NULL
[in]srcsource string to be copied
[in]srcLenlength of src in bytes, or -1 if null-terminated
Returns:
kNEErrOk for success, error code for failure

Definition at line 34 of file NE.c.

void NEStringFree ( char **  str)

Deallocated string.

Parameters:
[in,out]strstring to be deallocated, or NULL

Definition at line 136 of file NE.c.

char const* NEStringNextPart ( char const *  str)

Find next part after the next linefeed character.

Parameters:
[in]strinput null-terminated string, or NULL
Returns:
address of string following the next (first) line-feed, or NULL if none

Definition at line 100 of file NE.c.

NEErr NEWriteToFile ( NEPtr  ne,
char const *  data,
int  len 
)

Add data to the file created with NENewFile.

Parameters:
[in,out]nereference to EPUB main structure
[in]datadata
[in]lenlength of data in bytes
Returns:
kNEErrOk for success, error code for failure

Definition at line 428 of file NE.c.

Generated by Doxygen.
Copyright 2007-2013, Yves Piguet.
All rights reserved.