Logo Search packages:      
Sourcecode: djvulibre version File versions

DjVuErrorList Class Reference

#include <DjVuErrorList.h>

Inheritance diagram for DjVuErrorList:

DjVuSimplePort DjVuPort GPEnabled

List of all members.

Detailed Description

DjVuErrorList# provides a convenient way to redirect error messages from classes derived from DjVuPort to a list that can be accessed at any time.

Definition at line 93 of file DjVuErrorList.h.


These virtual functions may be overridden by the subclasses of DjVuPort#. They are called by the {DjVuPortcaster} when the port is alive and when there is a route between the source of the notification and this port.

virtual GP< DjVuFileid_to_file (const DjVuPort *source, const GUTF8String &id)
virtual GURL id_to_url (const DjVuPort *source, const GUTF8String &id)
virtual void notify_chunk_done (const DjVuPort *source, const GUTF8String &name)
virtual void notify_decode_progress (const DjVuPort *source, float done)
virtual void notify_doc_flags_changed (const class DjVuDocument *source, long set_mask, long clr_mask)
virtual void notify_file_flags_changed (const class DjVuFile *source, long set_mask, long clr_mask)
virtual void notify_redisplay (const class DjVuImage *source)
virtual void notify_relayout (const class DjVuImage *source)
enum  ErrorRecoveryAction { ABORT = 0, SKIP_PAGES = 1, SKIP_CHUNKS = 2, KEEP_ALL = 3 }

Public Member Functions

int get_count (void) const
GUTF8String GetError (void)
 Get one error message and clear that message from the list.
GUTF8String GetStatus (void)
 Get one status message and clear that message from the list.
virtual bool notify_error (const DjVuPort *source, const GUTF8String &msg)
 Append all error messages to the list.
virtual bool notify_status (const DjVuPort *source, const GUTF8String &msg)
 Append all status messages to the list.
virtual GP< DataPoolrequest_data (const DjVuPort *source, const GURL &url)
GURL set_stream (GP< ByteStream >)
 This constructor allows the user to specify the ByteStream.
This file implements a very simple class for redirecting port caster messages that would normally end up on stderr to a double linked list.

DjVuErrorList class.

Bill C Riemers <docbill@sourceforge.net>
DjVuErrorList.h,v 1.9 2003/11/07 22:08:20 leonb Exp

void ClearError (void)
 Just clear the list.
void ClearStatus (void)
 Just clear the list.
void connect (const DjVuPort &port)
 Add a new class to have its messages redirected here.
GList< GUTF8StringGetErrorList (void)
 Get the listing of errors, and clear the list.
GList< GUTF8StringGetStatusList (void)
 Get the listing of status messages, and clear the list.
bool HasError (void) const
 Check if there are anymore error messages.
bool HasStatus (void) const
 Check if there are any more status messages.
Files #"DjVuPort.h"# and #"DjVuPort.cpp"# implement a communication mechanism between different parties involved in decoding DjVu files. It should be pretty clear that the creator of {DjVuDocument} and {DjVuFile} would like to receive some information about the progress of decoding, errors occurred, etc. It may also want to provide source data for decoders (like it's done in the plugin where the real data is downloaded from the net and is fed into DjVu decoders).

Normally this functionality is implemented by means of callbacks which are run when a given condition comes true. Unfortunately it's not quite easy to implement this strategy in our case. The reason is that there may be more than one "client" working with the same document, and the document should send the information to each of the clients. This could be done by means of callback {lists}, of course, but we want to achieve more bulletproof results: we want to be sure that the client that we're about to contact is still alive, and is not being destroyed by another thread. Besides, we are going to call these "callbacks" from many places, from many different classes. Maintaining multi-thread safe callback lists is very difficult.

Finally, we want to provide some default implementation of these "callbacks" in the library, which should attempt to process the requests themselves if they can, and contact the client only if they're unable to do it (like in the case of {DjVuPort::request_data}() with local URL where {DjVuDocument} can get the data from the hard drive itself not disturbing the document's creator.

Two classes implement a general communication mechanism: {DjVuPort} and {DjVuPortcaster}. Any sender and recipient of requests should be a subclass of {DjVuPort}. {DjVuPortcaster} maintains a map of routes between {DjVuPort}s, which should be configured by somebody else. Whenever a port wants to send a request, it calls the corresponding function of {DjVuPortcaster}, and the portcaster relays the request to all the destinations that it sees in the internal map.

The {DjVuPortcaster} is responsible for keeping the map up to date by getting rid of destinations that have been destroyed. Map updates are performed from a single place and are serialized by a global monitor.

DjVu decoder communication mechanism.

Andrei Erofeev <eaf@geocities.com>\ L\'eon Bottou <leonb@research.att.com>
DjVuPort.h,v 1.8 2003/11/07 22:08:21 leonb Exp

virtual bool inherits (const GUTF8String &class_name) const
 Returns 1 if class_name# is #"DjVuPort"# or #"DjVuSimplePort"#.

Static Public Member Functions

static GP< DjVuErrorListcreate (void)
static DjVuPortcasterget_portcaster (void)
static void operator delete (void *addr)
static void * operator new (size_t sz)

Protected Member Functions

 DjVuErrorList (void)
 The normal port caster constructor.

Protected Attributes

volatile int count
 The reference counter.

Static Private Member Functions

static GURL set_stream (ByteStream *)

Private Attributes

GList< GUTF8StringErrors
GP< DataPoolpool
GURL pool_url
GList< GUTF8StringStatus

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

Generated by  Doxygen 1.6.0   Back to index