class DjVuPortclass DjVuPortcasterclass DjVuPort: public GPEnabled

Base class for notification targets.

Inheritance:


Public Methods

[more]static DjVuPortcaster* get_portcaster(void)
Use this function to get a copy of the global DjVuPortcaster.
[more] DjVuPort(const DjVuPort & port)
Copy constructor.
[more]DjVuPort& operator=(const DjVuPort & port)
Copy operator.
[more]virtual bool inherits(const char * class_name) const
Should return 1 if the called class inherits class class_name.

Public

[more] Notifications.

[more]virtual GURL id_to_url(const DjVuPort * source, const char * id)
This request is issued to request translation of the ID, used in an DjVu INCL chunk to a URL, which may be used to request data associated with included file.
[more]virtual GPBase id_to_file(const DjVuPort * source, const char * id)
This request is used to get a file corresponding to the given ID.
[more]virtual GP<DataPool> request_data(const DjVuPort * source, const GURL & url)
This request is issued when decoder needs additional data for decoding.
[more]virtual bool notify_error(const DjVuPort * source, const char * msg)
This notification is sent when an error occurs and the error message should be shown to the user.
[more]virtual bool notify_status(const DjVuPort * source, const char * msg)
This notification is sent to update the decoding status.
[more]virtual void notify_redisplay(const class DjVuImage * source)
This notification is sent by DjVuImage when it should be redrawn.
[more]virtual void notify_relayout(const class DjVuImage * source)
This notification is sent by \ref{DjVuImage} when its geometry has been changed as a result of decoding.
[more]virtual void notify_chunk_done(const DjVuPort * source, const char * name)
This notification is sent when a new chunk has been decoded.
[more]virtual void notify_file_flags_changed(const class DjVuFile * source, long set_mask, long clr_mask)
This notification is sent after the DjVuFile flags have been changed.
[more]virtual void notify_doc_flags_changed(const class DjVuDocument * source, long set_mask, long clr_mask)
This notification is sent after the DjVuDocument flags have been changed.
[more]virtual void notify_decode_progress(const DjVuPort * source, float done)
This notification is sent from time to time while decoding is in progress.
[more]enum ErrorRecoveryAction
This is the standard types for defining what to do in case of errors.


Inherited from GPEnabled:

Public Methods

oint get_count(void) const

Protected Fields

ovolatile int count


Documentation

Base class for notification targets. DjVuPort provides base functionality for classes willing to take part in sending and receiving messages generated during decoding process. You need to derive your class from DjVuPort if you want it to be able to send or receive requests. In addition, for receiving requests you should override one or more virtual function.

Important remark --- All ports should be allocated on the heap using operator new and immediately secured using a GP smart pointer. Ports which are not secured by a smart-pointer are not considered ``alive'' and never receive notifications!

ostatic DjVuPortcaster* get_portcaster(void)
Use this function to get a copy of the global DjVuPortcaster.

o DjVuPort(const DjVuPort & port)
Copy constructor. When DjVuPorts are copied, the portcaster copies all incoming and outgoing routes of the original.

oDjVuPort& operator=(const DjVuPort & port)
Copy operator. Similarly to the copy constructor, the portcaster copies all incoming and outgoing coming routes of the original.

ovirtual bool inherits(const char * class_name) const
Should return 1 if the called class inherits class class_name. When a destination receives a request, it can retrieve the pointer to the source DjVuPort. This virtual function should be able to help to identify the source of the request. For example, DjVuFile is also derived from DjVuPort. In order for the receiver to recognize the sender, the DjVuFile should override this function to return TRUE when the class_name is either DjVuPort or DjVuFile

o Notifications.
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.

ovirtual GURL id_to_url(const DjVuPort * source, const char * id)
This request is issued to request translation of the ID, used in an DjVu INCL chunk to a URL, which may be used to request data associated with included file. DjVuDocument usually intercepts all such requests, and the user doesn't have to worry about the translation

ovirtual GPBase id_to_file(const DjVuPort * source, const char * id)
This request is used to get a file corresponding to the given ID. DjVuDocument is supposed to intercept it and either create a new instance of DjVuFile or reuse an existing one from the cache.

ovirtual GP<DataPool> request_data(const DjVuPort * source, const GURL & url)
This request is issued when decoder needs additional data for decoding. Both DjVuFile and DjVuDocument are initialized with a URL, not the document data. As soon as they need the data, they call this function, whose responsibility is to locate the source of the data basing on the URL passed and return it back in the form of the DataPool. If this particular receiver is unable to fullfil the request, it should return 0.

ovirtual bool notify_error(const DjVuPort * source, const char * msg)
This notification is sent when an error occurs and the error message should be shown to the user. The receiver should return 0 if it is unable to process the request. Otherwise the receiver should return 1.

ovirtual bool notify_status(const DjVuPort * source, const char * msg)
This notification is sent to update the decoding status. The receiver should return 0 if it is unable to process the request. Otherwise the receiver should return 1.

ovirtual void notify_redisplay(const class DjVuImage * source)
This notification is sent by DjVuImage when it should be redrawn. It may be used to implement progressive redisplay.

Parameters:
source - The sender of the request

ovirtual void notify_relayout(const class DjVuImage * source)
This notification is sent by \ref{DjVuImage} when its geometry has been changed as a result of decoding. It may be used to implement progressive redisplay.

ovirtual void notify_chunk_done(const DjVuPort * source, const char * name)
This notification is sent when a new chunk has been decoded.

ovirtual void notify_file_flags_changed(const class DjVuFile * source, long set_mask, long clr_mask)
This notification is sent after the DjVuFile flags have been changed. This happens, for example, when:
  • Decoding succeeded, failed or just stopped
  • All data has been received
  • All included files have been created

Parameters:
source - DjVuFile, which flags have been changed
set_mask - bits, which have been set
clr_mask - bits, which have been cleared

ovirtual void notify_doc_flags_changed(const class DjVuDocument * source, long set_mask, long clr_mask)
This notification is sent after the DjVuDocument flags have been changed. This happens, for example, after it receives enough data and can determine its structure (BUNDLED, OLD_INDEXED, etc.).

Parameters:
source - DjVuDocument, which flags have been changed
set_mask - bits, which have been set
clr_mask - bits, which have been cleared

ovirtual void notify_decode_progress(const DjVuPort * source, float done)
This notification is sent from time to time while decoding is in progress. The purpose is obvious: to provide a way to know how much is done and how long the decoding will continue. Argument done is a number from 0 to 1 reflecting the progress.

oenum ErrorRecoveryAction
This is the standard types for defining what to do in case of errors. This is only used by some of the subclasses, but it needs to be defined here to guarantee all subclasses use the same enum types. In general, many errors are non recoverable. Using a setting other than ABORT may just result in even more errors.


Direct child classes:
DjVuSimplePort
DjVuMemoryPort
DjVuImage
DjVuFile
DjVuDocument

Alphabetic index HTML hierarchy of classes or Java


DjVu is a trademark of LizardTech, Inc.
All other products mentioned are registered trademarks or trademarks of their respective companies.