#include <djv_serialize.h>
Classes | |
struct | DIRMEntry |
struct | Layout |
Public Types | |
enum | ChunkType { Unknown = 0, Page = 1, Thumbnail = 2, Annotation = 3, SecurityInfo = 4 } |
enum | DjVuMultipageType { NotConfigured = -1, Single = 0, Bundled = 1, Indirect = 2 } |
enum | SerializationMode { smAuto = 0, smSingle = 1, smBundled = 2, smIndirect = 3, smAsIs = 4, smAsIsWithIncl = 5 } |
typedef void(* | SerializationCallback )(void *inContext, size_t inCurrent, size_t inMax) |
Static Public Member Functions | |
static AutoPtr< Chunk > | deserialize (Storage *inStorage, ResourceBroker *inBroker=NULL, Layout *outIffLayout=NULL, CredentialProvider *inCredProv=NULL, SecurityProviderBroker *inSecProvBroker=NULL, IFFErrorRecoveryHandler *inErrorRecoveryHandler=NULL, Chunk::OnChunkCallback inOnChunkCallback=NULL, Chunk::OnChunkCallback inOnFormChunkConstructionCallback=NULL, void *inContext=NULL) |
static IFF::DjVuMultipageType | serialize (Storage *inStorage, const Chunk *inChunkToSerialize, SerializationCallback inCallback=NULL, void *inContext=NULL, SerializationMode inMode=smAuto, StorageLocator *inStorageLocator=NULL, const SecurityProvider *inSecProv=NULL) |
This struct provides the functions to access IFF structured DjVu files.
This structure is for advanced purpose so if you are a beginner programmer, you had better start with Document class anyway.
typedef void(* Celartem::DjVu::IFF::SerializationCallback)(void *inContext, size_t inCurrent, size_t inMax) |
Definition for the callback function which is used by serialize method.
inContext | The user define parameter which is passed to serialize method's 4th parameter. |
inCurrent | An value which indicates the current progress status. The persentage is calculated by (inCurrent * 100 / inMax). |
inMax | The value which indicates the maximum value of inCurrent. |
This enumeration is used to decide the serialization mode.
Enumerator | |
---|---|
smAuto |
The serialization mode is automatically decided. If there are multiple pages in the document, they will be serialized into a bundled DjVu file; otherwise, the page is serialized into a single page DjVu file. |
smSingle |
Create a single page DjVu file. If there are multiple pages in the document, only the first page is serialized. |
smBundled |
Create bundled DjVu format. Even if there's only one page in the document, this option instructs the serialize method to output |
smIndirect |
Create indirect DjVu format. Create indirect DjVu file; the output is in multiple files; the satellite files are located by StorageLocator. |
smAsIs |
For special IFF structure construction. |
smAsIsWithIncl |
Serialize as is but with INCL. |
|
static |
Deserialize a Chunk which contains DjVu document from a IFF structured DjVu file.
Please note that this function actually does not load all the content of the file if the file has DIRM
chunk on the top of file. In this case, the returned Chunk
instance may keep the storage open until all the chunks are loaded onto memory. To make sure all the chunks are loaded onto the memory, use Chunk::preload.
Note that Document class is easy wrapper for this method so you had better use Document::create method to load DjVu files for normal purpose.
inStorage | A Storage instance which contains DjVu document. |
inBroker | An optional parameter which specifies a ResourceBroker instance to locate any satellite files. |
outIffLayout | A Layout instance which receives the information about IFF chunk layout in the DjVu file. Please note that Layout::broker variable may lock the files until it is NULL cleared or destructed. |
inCredProv | A CredentialProvider instance which is used if the DjVu file being deserialized is protected by some security mechanism. |
inSecProvBroker | A SecurityProviderBroker instance which loads SecurityProvider instance from 4 character security system Id. If this is NULL , this function uses the default SecurityProviderBroker instance.This parameter is useful if you want to create your own SecurityProvider class and let deserialize function to use that class. |
inErrorRecoveryHandler | A IFFErrorRecoveryHandler instance which handles exceptions during deserializing the input DjVu file. This can be NULL and then all the exceptions are directly thrown to the user code.For more information, see IFFErrorRecoveryHandler. |
inOnChunkCallback | Pointer to a callback function which will be called when each chunk is loaded. |
inContext | A user defined data which is passed to the callback function. |
DJVM
but if is a single page, this chunk is DJVU
. If you don't want to check such conditions, you had better use Document class rather than this method.
|
static |
Serialize a Chunk which contains DjVu document to a IFF structured DjVu file.
When serializing the IFF data onto the file from which deserialize function has loaded the chunks, the original file may be locked by some half-serialized chunks and the overwrite process may fail. To recover from such failures, use Chunk::preload.
Note that Document class is easy wrapper for this method so you had better use Document::save method to save DjVu files for normal purpose.
inStorage | A Storage instance to serialize to. |
inChunkToSerialize | A Chunk instance to be serialized. |
inCallback | Pointer to a function which is called during the serialization process. |
inContext | Pointer to a parameter which is passed to inCallback function. |
inMode | One of SerializationMode enumeration values and it decides how to generate DjVu file. |
inStorageLocator | Pointer to a StorageLocator instance which is used when create Storage instance for indirect DjVu files. It can be NULL if you want to use StorageLocator instance initialized with the index name which is returned by inStorage->getStorageId(). |
inSecProv | This parameter is required if you want to create Secure DjVu files. Otherwise, for normal DjVu files, this should be NULL . |