• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kviewshell

DjVuPort.h

Go to the documentation of this file.
00001 //C-  -*- C++ -*-
00002 //C- -------------------------------------------------------------------
00003 //C- DjVuLibre-3.5
00004 //C- Copyright (c) 2002  Leon Bottou and Yann Le Cun.
00005 //C- Copyright (c) 2001  AT&T
00006 //C-
00007 //C- This software is subject to, and may be distributed under, the
00008 //C- GNU General Public License, Version 2. The license should have
00009 //C- accompanied the software or you may obtain a copy of the license
00010 //C- from the Free Software Foundation at http://www.fsf.org .
00011 //C-
00012 //C- This program is distributed in the hope that it will be useful,
00013 //C- but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //C- GNU General Public License for more details.
00016 //C- 
00017 //C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library
00018 //C- distributed by Lizardtech Software.  On July 19th 2002, Lizardtech 
00019 //C- Software authorized us to replace the original DjVu(r) Reference 
00020 //C- Library notice by the following text (see doc/lizard2002.djvu):
00021 //C-
00022 //C-  ------------------------------------------------------------------
00023 //C- | DjVu (r) Reference Library (v. 3.5)
00024 //C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
00025 //C- | The DjVu Reference Library is protected by U.S. Pat. No.
00026 //C- | 6,058,214 and patents pending.
00027 //C- |
00028 //C- | This software is subject to, and may be distributed under, the
00029 //C- | GNU General Public License, Version 2. The license should have
00030 //C- | accompanied the software or you may obtain a copy of the license
00031 //C- | from the Free Software Foundation at http://www.fsf.org .
00032 //C- |
00033 //C- | The computer code originally released by LizardTech under this
00034 //C- | license and unmodified by other parties is deemed "the LIZARDTECH
00035 //C- | ORIGINAL CODE."  Subject to any third party intellectual property
00036 //C- | claims, LizardTech grants recipient a worldwide, royalty-free, 
00037 //C- | non-exclusive license to make, use, sell, or otherwise dispose of 
00038 //C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the 
00039 //C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU 
00040 //C- | General Public License.   This grant only confers the right to 
00041 //C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to 
00042 //C- | the extent such infringement is reasonably necessary to enable 
00043 //C- | recipient to make, have made, practice, sell, or otherwise dispose 
00044 //C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to 
00045 //C- | any greater extent that may be necessary to utilize further 
00046 //C- | modifications or combinations.
00047 //C- |
00048 //C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
00049 //C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
00050 //C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
00051 //C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
00052 //C- +------------------------------------------------------------------
00053 // 
00054 // $Id: DjVuPort.h,v 1.8 2003/11/07 22:08:21 leonb Exp $
00055 // $Name: release_3_5_15 $
00056 
00057 #ifndef _DJVUPORT_H
00058 #define _DJVUPORT_H
00059 #ifdef HAVE_CONFIG_H
00060 #include "config.h"
00061 #endif
00062 #if NEED_GNUG_PRAGMAS
00063 # pragma interface
00064 #endif
00065 
00066 
00067 #include "GThreads.h"
00068 #include "GURL.h"
00069 
00070 #ifdef HAVE_NAMESPACES
00071 namespace DJVU {
00072 # ifdef NOT_DEFINED // Just to fool emacs c++ mode
00073 }
00074 #endif
00075 #endif
00076 
00077 class DataPool;
00078 
00124 
00125 class DjVuPort;
00126 class DjVuPortcaster;
00127 class DjVuFile;
00128 
00141 class DjVuPort : public GPEnabled
00142 {
00143 public:
00144    DjVuPort();
00145    virtual ~DjVuPort();
00146    static void *operator new (size_t sz);
00147    static void operator delete(void *addr);
00148 
00150    static DjVuPortcaster *get_portcaster(void);
00151 
00154    DjVuPort(const DjVuPort & port);
00155 
00158    DjVuPort & operator=(const DjVuPort & port);
00159 
00168    virtual bool     inherits(const GUTF8String &class_name) const;
00169 
00176 
00182    virtual GURL     id_to_url(const DjVuPort * source, const GUTF8String &id);
00183 
00188    virtual GP<DjVuFile> id_to_file(const DjVuPort * source, const GUTF8String &id);
00189 
00198    virtual GP<DataPool> request_data(const DjVuPort * source, const GURL & url);
00199 
00203    virtual bool     notify_error(const DjVuPort * source, const GUTF8String &msg);
00204 
00208    virtual bool     notify_status(const DjVuPort * source, const GUTF8String &msg);
00209 
00214    virtual void     notify_redisplay(const class DjVuImage * source);
00215 
00219    virtual void     notify_relayout(const class DjVuImage * source);
00220 
00222    virtual void     notify_chunk_done(const DjVuPort * source, const GUTF8String &name);
00223 
00235    virtual void     notify_file_flags_changed(const class DjVuFile * source,
00236                           long set_mask, long clr_mask);
00237 
00245    virtual void     notify_doc_flags_changed(const class DjVuDocument * source,
00246                          long set_mask, long clr_mask);
00247    
00252    virtual void     notify_decode_progress(const DjVuPort * source, float done);
00253 
00259    enum ErrorRecoveryAction {ABORT=0,SKIP_PAGES=1,SKIP_CHUNKS=2,KEEP_ALL=3 }; 
00261 public:
00262    class DjVuPortCorpse;
00263 private:
00264    static GCriticalSection  * corpse_lock;
00265    static DjVuPortCorpse    * corpse_head, * corpse_tail;
00266    static int           corpse_num;
00267 };
00268 
00276 class DjVuSimplePort : public DjVuPort
00277 {
00278 public:
00280    virtual bool     inherits(const GUTF8String &class_name) const;
00281 
00284    virtual GP<DataPool> request_data(const DjVuPort * source, const GURL & url);
00285 
00287    virtual bool     notify_error(const DjVuPort * source, const GUTF8String &msg);
00288    
00290    virtual bool     notify_status(const DjVuPort * source, const GUTF8String &msg);
00291 };
00292 
00293 
00301 class DjVuMemoryPort : public DjVuPort
00302 {
00303 public:
00305    virtual bool     inherits(const GUTF8String &class_name) const;
00306 
00310    virtual GP<DataPool> request_data(const DjVuPort * source, const GURL & url);
00311 
00315    void     add_data(const GURL & url, const GP<DataPool> & pool);
00316 private:
00317    GCriticalSection lock;
00318    GPMap<GURL, DataPool>map;
00319 };
00320 
00321 
00322 
00356 class DjVuPortcaster
00357 {
00358 public:
00360    static DjVuPortcaster *get_portcaster(void)
00361     { return DjVuPort::get_portcaster(); } ;
00362 
00364    DjVuPortcaster(void);
00365 
00366    virtual ~DjVuPortcaster(void);
00367 
00371    void     del_port(const DjVuPort * port);
00372    
00377    void     add_route(const DjVuPort *src, DjVuPort *dst);
00378 
00381    void     del_route(const DjVuPort *src, DjVuPort *dst);
00382 
00386    void     copy_routes(DjVuPort *dst, const DjVuPort *src);
00387 
00390    GP<DjVuPort> is_port_alive(DjVuPort *port);
00391 
00399    void     add_alias(const DjVuPort * port, const GUTF8String &alias);
00400 
00402    static void      clear_all_aliases(void);
00403 
00405    void     clear_aliases(const DjVuPort * port);
00406 
00410    GP<DjVuPort> alias_to_port(const GUTF8String &name);
00411 
00415    GPList<DjVuPort> prefix_to_ports(const GUTF8String &prefix);
00416 
00420    virtual GURL     id_to_url(const DjVuPort * source, const GUTF8String &id);
00421 
00426    virtual GP<DjVuFile> id_to_file(const DjVuPort * source, const GUTF8String &id);
00427 
00431    virtual GP<DataPool> request_data(const DjVuPort * source, const GURL & url);
00432 
00436    virtual bool     notify_error(const DjVuPort * source, const GUTF8String &msg);
00437 
00441    virtual bool     notify_status(const DjVuPort * source, const GUTF8String &msg);
00442 
00446    virtual void     notify_redisplay(const class DjVuImage * source);
00447 
00451    virtual void     notify_relayout(const class DjVuImage * source);
00452 
00456    virtual void     notify_chunk_done(const DjVuPort * source, const GUTF8String &name);
00457 
00461    virtual void     notify_file_flags_changed(const class DjVuFile * source,
00462                           long set_mask, long clr_mask);
00463 
00467    virtual void     notify_doc_flags_changed(const class DjVuDocument * source,
00468                          long set_mask, long clr_mask);
00469    
00473    virtual void     notify_decode_progress(const DjVuPort * source, float done);
00474 
00475 private:
00476       // We use these 'void *' to minimize template instantiations.
00477    friend class DjVuPort;
00478    GCriticalSection     map_lock;
00479    GMap<const void *, void *>   route_map;  // GMap<DjVuPort *, GList<DjVuPort *> *>
00480    GMap<const void *, void *>   cont_map;   // GMap<DjVuPort *, DjVuPort *>
00481    GMap<GUTF8String, const void *>  a2p_map;    // GMap<GUTF8String, DjVuPort *>
00482    void add_to_closure(GMap<const void*, void*> & set,
00483                        const DjVuPort *dst, int distance);
00484    void compute_closure(const DjVuPort *src, GPList<DjVuPort> &list,
00485                         bool sorted=false);
00486 };
00487 
00488 
00489 inline bool
00490 DjVuPort::inherits(const GUTF8String &class_name) const
00491 {
00492    return (class_name == "DjVuPort");
00493 }
00494 
00495 inline bool
00496 DjVuSimplePort::inherits(const GUTF8String &class_name) const
00497 {
00498    return
00499       (class_name == "DjVuSimplePort") || DjVuPort::inherits(class_name);
00500 }
00501 
00502 inline bool
00503 DjVuMemoryPort::inherits(const GUTF8String &class_name) const
00504 {
00505    return
00506       (class_name == "DjVuMemoryPort") || DjVuPort::inherits(class_name);
00507 }
00508 
00510 
00511 
00512 #ifdef HAVE_NAMESPACES
00513 }
00514 # ifndef NOT_USING_DJVU_NAMESPACE
00515 using namespace DJVU;
00516 # endif
00517 #endif
00518 #endif

kviewshell

Skip menu "kviewshell"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kviewshell
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal