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
Go to the documentation of this file.
00001 
00083 #ifndef __NE__
00084 #define __NE__
00085 
00086 #include "zip.h"
00087 
00088 typedef unsigned char NEBoolean;
00089 
00090 #if !defined(NULL)
00091 
00092 #   define NULL 0
00093 #endif
00094 
00095 #if !defined(FALSE)
00096 #   define FALSE 0  ///< false boolean value
00097 #   define TRUE 1   ///< true boolean value
00098 #endif
00099 
00100 typedef enum
00101 {
00102     kNEErrOk = 0,
00103     kNEErrCannotCreateEPUBFile,
00104     kNEErrZip,
00105     kNEErrMalloc,
00106     kNEErrCannotOpenFile,
00107 } NEErr;
00108 
00110 typedef enum
00111 {
00112     kNEMetaTitle,   
00113     kNEMetaCreator, 
00114     kNEMetaIdentifier,  
00115     kNEMetaLanguage,    
00116     kNEMetaSubject, 
00117     kNEMetaDescription, 
00118     kNEMetaPublisher,   
00119     kNEMetaDate,    
00120     kNEMetaSource,  
00121     kNEMetaRights   
00122 } NEMetadataKey;
00123 
00125 typedef struct
00126 {
00127     zipFile zf; 
00128     
00129     // required metadata
00130     char *title;    
00131     char *creator;  
00132     char *identifier;   
00133     char *language; // language (RFC 3066; lf-separated if multiple)
00134     
00135     // optional metadata
00136     char *subject;  
00137     char *description;  
00138     char *publisher;    
00139     char *date; 
00140     char *source;   
00141     char *rights;   
00142     
00143     // endnotes
00144     char *endnotes; 
00145     int endnoteCount;   
00146     char *lastRefLink;  
00147     char *currentDoc;   
00148     
00149     // parts (XHTML)
00150     char *parts;    
00151     char *auxParts; 
00152     char *cover;    
00153     char *coverImage;   
00154     
00155     // other documents (images, css, etc.)
00156     char *other;    
00157     
00158     // toc entries
00159     char *tocEntries;   
00160     int ncxCount;   
00161     int maxTOCDepth;    
00162 } NE, *NEPtr;
00163 
00169 NEErr NEBegin(NEPtr ne, char const *filename);
00170 
00178 NEErr NEAddMetadata(NEPtr ne,
00179     NEMetadataKey key, char const *data, int dataLen);
00180 
00189 NEErr NEAddPart(NEPtr ne, char const *filename, NEBoolean auxiliary);
00190 
00199 NEErr NEAddOther(NEPtr ne,
00200         char const *filename, int filenameLen,
00201         char const *mimetype);
00202 
00209 void NEEnumOther(NEPtr ne,
00210         char const **filename,
00211         int *filenameLength);
00212 
00220 NEErr NEAddTOCEntry(NEPtr ne, char const *title, char const *relativeUrl, int level);
00221 
00228 NEErr NEAddFile(NEPtr ne,
00229     char const *filename,
00230     char const *path);
00231 
00238 NEErr NENewFile(NEPtr ne,
00239     char const *filename);
00240 
00247 NEErr NEWriteToFile(NEPtr ne,
00248     char const *data, int len);
00249 
00253 NEErr NECloseFile(NEPtr ne);
00254 
00264 NEErr NEAddEndnote(NEPtr ne,
00265         char const *endnote, int len,
00266         char const *refDoc, int refDocLen,
00267         char const **refLink);
00268 
00269 NEErr NEMakeCover(NEPtr ne);
00270 
00278 NEErr NESetCoverImage(NEPtr ne, char const *filename, int filenameLen);
00279 
00283 NEErr NEEnd(NEPtr ne);
00284 
00285 // utility string functions
00286 
00293 NEErr NEStringCopy(char **str, char const *src, int srcLen);
00294 
00301 NEErr NEStringCat(char **str, char const *src, int srcLen);
00302 
00309 NEErr NEStringAdd(char **str, char const *src, int srcLen);
00310 
00315 char const *NEStringNextPart(char const *str);
00316 
00320 void NEStringFree(char **str);
00321 
00322 
00323 #endif
Generated by Doxygen.
Copyright 2007-2013, Yves Piguet.
All rights reserved.