Public Types | Public Member Functions | List of all members
Celartem::DjVu::IFFErrorRecoveryHandler Class Referenceabstract

#include <djv_chunkdiag.h>

Inheritance diagram for Celartem::DjVu::IFFErrorRecoveryHandler:
Inheritance graph
[legend]

Public Types

enum  Action { ThrowException = 0, IgnoreThisChunk = 1, IgnoreThisAndTrailingChunks = 2 }
 

Public Member Functions

virtual Action handleError (Chunk *inParentChunk, const String &inNewChunkId, Storage *inStorage, uint64_t inChunkOffset, size_t inChunkLength, const Exception &inException)=0
 
- Public Member Functions inherited from Celartem::Referable
 Referable ()
 
void addRef () const
 
void releaseRef () const
 
size_t getReferenceCount () const
 

Additional Inherited Members

- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

Detailed Description

        This class is used to control error handling during
        \ref IFF::deserialize method.\n
        By default, \ref IFF::deserialize throws an exception when it
        encounters the error on loading a chunk. This class is to recover
        from such kind of errors.\n
        All you have to do is inherit this class and implement
        \ref handleError method. Please note that this class should
        initialized with \c new. The following is a sample use of this
        class:
class MyErrorRecovery : public IFFErrorRecoveryHandler
{
public:
Chunk* inParentChunk,
const String& inNewChunkId,
Storage* inStorage,
uint64_t inChunkOffset,
size_t inChunkLength,
const Exception& inException)
{
// This method ignores chunks with loading errors.
}
};
...
AutoPtr<MyErrorRecovery> recvHandler = new MyErrorRecovery();
AutoPtr<Chunk> chunk = IFF::deserialize(
storage, NULL, NULL, NULL, NULL, recvHandler);

Member Enumeration Documentation

This enumeration is used to determine how to treat the error.

Enumerator
ThrowException 

Throw the exception.

IgnoreThisChunk 

Ignore only this broken chunk.

IgnoreThisAndTrailingChunks 

Ignore this and the trailing chunks.

Member Function Documentation

virtual Action Celartem::DjVu::IFFErrorRecoveryHandler::handleError ( Chunk inParentChunk,
const String inNewChunkId,
Storage inStorage,
uint64_t  inChunkOffset,
size_t  inChunkLength,
const Exception inException 
)
pure virtual

This method determines how to treat the error occured during deserialization.
You can also access to the Storage which contains the actual data which causes the loading problem.

Parameters
inParentChunkPointer to the chunk which has been planed to contain the error chunk.
inNewChunkIdThe Id of the error chunk. If the error was occured on decoding the chunk Id, this may be NullString.
inStorageThe Storage instance which contains the data of the error chunk. You can call readBytes, setPos, and several information methods on this and the caller is responsible for restoring the original state after your code.
inChunkOffsetThe offset of the chunk on inStorage Storage instance.
inChunkLengthThe size of the chunk on inStorage Storage instance. This may be NULL depending on the error cause.
inExceptionThe exception being thrown.
Returns
One of Action enumeration values which determines the recovery process.

The documentation for this class was generated from the following file:

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:07.
Cuminas Logo