#include <djv_chunks.h>

Public Types | |
| typedef SimpleArray< AutoPtr < Chunk > > | Array |
| typedef void(* | OnChunkCallback )(void *inContext, Chunk *inChunkLoaded) |
Public Member Functions | |
| virtual String | getId () const =0 |
| virtual AutoPtr< const Data > | getData () const =0 |
| virtual AutoPtr< Data > | getData ()=0 |
| virtual void | setData (const Data *inData)=0 |
| virtual const Array & | getChildren () const =0 |
| virtual Array & | getChildren ()=0 |
| virtual size_t | find (const String &inIdentifier, size_t inPrevPos=(size_t) 0-1, bool inOnlyAvailable=false) const =0 |
| virtual size_t | find (const String &inId1, const String &inId2, size_t inPrevPos=(size_t) 0-1, bool inOnlyAvailable=false) const =0 |
| virtual bool | isIncluded () const =0 |
| virtual bool | isAvailable () const =0 |
| virtual bool | isCollection () const =0 |
| virtual void | assureImmediateResponse (OnChunkCallback inOnChunkCallback=NULL, void *inContext=NULL)=0 |
| virtual void | prepareForMerger (Chunk *inChunkMergeTo, std::map< String, String > *outNameRemappings=NULL, bool inDoingAutoNavmAnnoRemapping=true)=0 |
| virtual void | compact ()=0 |
| virtual void | setSecurityProvider (const SecurityProvider *inSecProv)=0 |
| virtual const SecurityProvider * | getSecurityProvider () const =0 |
| virtual void | lock () const =0 |
| virtual void | unlock () const =0 |
| virtual Chunk * | getDirectPointer ()=0 |
| virtual String | getNameInDIRM () const =0 |
Static Public Member Functions | |
| static AutoPtr< Chunk > | create (const String &inIdentifier) |
| static AutoPtr< Chunk > | create (const String &inIdentifier, const void *inData, size_t inDataSize) |
| static AutoPtr< Chunk > | create (const String &inIdentifier, Stream *inDataStream) |
| static AutoPtr< Chunk > | createCollection (const String &inIdentifier) |
Locker lock(*chunk); chunk->getChildren().push_back(...);
Definition at line 39 of file djv_chunks.h.
| typedef SimpleArray<AutoPtr<Chunk> > Celartem::DjVu::Chunk::Array |
Definition of Array which is usually used for accessing each child Chunk element.
Definition at line 129 of file djv_chunks.h.
| typedef void(* Celartem::DjVu::Chunk::OnChunkCallback)(void *inContext, Chunk *inChunkLoaded) |
Callback definition used by assureImmediateResponse method.
During assureImmediateResponse call, this callback is called when each chunk is loaded.
| inContext | The context passed to the second parameter of assureImmediateResponse method. | |
| inChunkLoaded | The chunk which is just loaded. |
Create a Chunk instance.
| inIdentifier | 4 character identifier used with the newly created chunk. |
Referenced by Celartem::DjVu::PageInfo::encodeINFOChunk().
| static AutoPtr<Chunk> Celartem::DjVu::Chunk::create | ( | const String & | inIdentifier, | |
| const void * | inData, | |||
| size_t | inDataSize | |||
| ) | [static] |
Create a Chunk instance.
| inIdentifier | 4 character identifier used with the newly created chunk. | |
| inData | The data to be associated. Please note that this data is duplicated to the newly created Chunk instance. | |
| inDataSize | The size of the data. |
| virtual String Celartem::DjVu::Chunk::getId | ( | ) | const [pure virtual] |
Get the identifier of this chunk.
Get the associated Data instance. (const version)
NULL if no data is assigned. Referenced by Celartem::DjVu::PageInfo::decode().
| virtual void Celartem::DjVu::Chunk::setData | ( | const Data * | inData | ) | [pure virtual] |
| virtual const Array& Celartem::DjVu::Chunk::getChildren | ( | ) | const [pure virtual] |
Get the child elements. (const version)
FORM) chunk, this method throws an exception.Lock lock(*chunk); Array& array = getChildren(); ... lock.unlock(); // or just get out of the scope
| virtual Array& Celartem::DjVu::Chunk::getChildren | ( | ) | [pure virtual] |
Get the child elements.
FORM) chunk, this method throws an exception.Lock lock(*chunk); Array& array = getChildren(); ... lock.unlock(); // or just get out of the scope
| virtual size_t Celartem::DjVu::Chunk::find | ( | const String & | inIdentifier, | |
| size_t | inPrevPos = (size_t) 0-1, |
|||
| bool | inOnlyAvailable = false | |||
| ) | const [pure virtual] |
Search for the specified chunk.
| inIdentifier | The chunk identifier such as DJVU, INFO. | |
| inPrevPos | The index returned by the previous call to this method. To start search from the first element, set (size_t)-1 for this.This is useful when finding multiple occurrences of the chunks such as BG44. | |
| inOnlyAvailable | If this is true, this method searchs only available chunks (For more about available chunks, see isAvailable method. |
| virtual size_t Celartem::DjVu::Chunk::find | ( | const String & | inId1, | |
| const String & | inId2, | |||
| size_t | inPrevPos = (size_t) 0-1, |
|||
| bool | inOnlyAvailable = false | |||
| ) | const [pure virtual] |
Search for the specified chunk.
This is a special version which takes two identifiers and returns the occurrence of either inId1 or inId2.
Some of the DjVu chunks such as TXTz and ANTz have uncompressed versions; TXTa and ANTa. This method is designed for searching such kind of chunks.
| inId1 | The chunk identifier. | |
| inId2 | The chunk identifier. | |
| inPrevPos | The index returned by the previous call to this method. To start search from the first element, set (size_t)-1 for this.This is useful when finding multiple occurrences of the chunks such as BG44. | |
| inOnlyAvailable | If this is true, this method searchs only available chunks (For more about available chunks, see isAvailable method. |
| virtual bool Celartem::DjVu::Chunk::isIncluded | ( | ) | const [pure virtual] |
Determine whether the chunk is included by INCL indirection chunk or not.
true if the chunk is included by INCL; otherwise false. | virtual bool Celartem::DjVu::Chunk::isAvailable | ( | ) | const [pure virtual] |
Determine whether the chunk data is already available or not.
This method determines whether all the data of the chunk is loaded onto the memory or not. To make sure all of them are on memory, use assureImmediateResponse.
true if the data is already available; otherwise false. | virtual bool Celartem::DjVu::Chunk::isCollection | ( | ) | const [pure virtual] |
Determine whether the instance is a collection or not.
true if this is a collection instance; otherwise false. | virtual void Celartem::DjVu::Chunk::assureImmediateResponse | ( | OnChunkCallback | inOnChunkCallback = NULL, |
|
| void * | inContext = NULL | |||
| ) | [pure virtual] |
Load all the data to the memory and disconnect from any external resources.
When overwriting the original file from which the chunks are loaded, some of the chunk may not be loaded onto the memory and take the references to the original file. In such situation, assureImmediateResponse make sure that all the chunks are loaded onto the memory and completely disconnected from the original file.
| 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. |
| virtual void Celartem::DjVu::Chunk::prepareForMerger | ( | Chunk * | inChunkMergeTo, | |
| std::map< String, String > * | outNameRemappings = NULL, |
|||
| bool | inDoingAutoNavmAnnoRemapping = true | |||
| ) | [pure virtual] |
Prepare for the merger with the specified DJVM chunk. Each DJVU chunks are usually managed by a name and if multiple DjVu files are merged into a DjVu file, it may cause some confliction in names. This method renames such chunks before the actual merge process.
| inChunkMergeTo | Pointer to a DJVM Chunk instance to merge with. | |
| outNameRemappings | A map instance which receives name remapping list (old to new) for further process. It can be NULL if you don't need such information. | |
| inDoingAutoNavmAnnoRemapping | true to instruct this method to do updating NAVM and ANTz, ANTa chunks. |
| virtual void Celartem::DjVu::Chunk::compact | ( | ) | [pure virtual] |
Minimize the memory usage by removing reserved area.
This is useful when reducing memory fragmentation due to complicated process.
This method also make sure that all the data is on memory as if assureImmediateResponse were called.
| virtual void Celartem::DjVu::Chunk::setSecurityProvider | ( | const SecurityProvider * | inSecProv | ) | [pure virtual] |
Set a SecurityProvider instance to this chunk.
Only collection chunk can have SecurityProvider.
| inSecProv | Pointer to a SecurityProvider instance. |
| virtual const SecurityProvider* Celartem::DjVu::Chunk::getSecurityProvider | ( | ) | const [pure virtual] |
Get the SecurityProvider instance associated to this chunk.
NULL. | virtual void Celartem::DjVu::Chunk::lock | ( | ) | const [pure virtual] |
Lock the instance.
This method provides a synchronization mechanism for processing the instance between threads.
If you plan to use the instance in multi-threaded program, it's recommended to lock the instance before accessing the data.
Implements Celartem::Lockable.
| virtual void Celartem::DjVu::Chunk::unlock | ( | ) | const [pure virtual] |
| virtual Chunk* Celartem::DjVu::Chunk::getDirectPointer | ( | ) | [pure virtual] |
| virtual String Celartem::DjVu::Chunk::getNameInDIRM | ( | ) | const [pure virtual] |
Get the name for this chunk, which is listed in DIRM if available.
DIRM if available; otherwise NullString.