kviewshell
DjVuErrorList.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: DjVuErrorList.h,v 1.9 2003/11/07 22:08:20 leonb Exp $ 00055 // $Name: release_3_5_15 $ 00056 00057 #ifndef _DJVUERRORLIST_H 00058 #define _DJVUERRORLIST_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 "DjVuPort.h" 00068 00069 #ifdef HAVE_NAMESPACES 00070 namespace DJVU { 00071 # ifdef NOT_DEFINED // Just to fool emacs c++ mode 00072 } 00073 #endif 00074 #endif 00075 00076 class ByteStream; 00077 00088 00093 class DjVuErrorList : public DjVuSimplePort 00094 { 00095 protected: 00097 DjVuErrorList(void); 00098 public: 00099 static GP<DjVuErrorList> create(void) {return new DjVuErrorList();} 00100 00102 GURL set_stream(GP<ByteStream>); 00103 00105 virtual bool notify_error(const DjVuPort * source, const GUTF8String & msg); 00106 00108 virtual bool notify_status(const DjVuPort * source, const GUTF8String & msg); 00109 00111 inline void connect( const DjVuPort &port); 00112 00114 inline GList<GUTF8String> GetErrorList(void); 00115 00117 inline void ClearError(void); 00118 00120 GUTF8String GetError(void); 00121 00123 inline bool HasError(void) const; 00124 00126 inline GList<GUTF8String> GetStatusList(void); 00127 00129 inline void ClearStatus(void); 00130 00132 GUTF8String GetStatus(void); 00133 00135 inline bool HasStatus(void) const; 00136 00139 virtual GP<DataPool> request_data ( 00140 const DjVuPort * source, const GURL & url ); 00141 00142 private: 00143 GURL pool_url; 00144 GP<DataPool> pool; 00145 GList<GUTF8String> Errors; 00146 GList<GUTF8String> Status; 00147 private: //dummy stuff 00148 static GURL set_stream(ByteStream *); 00149 }; 00150 00151 inline void 00152 DjVuErrorList::connect( const DjVuPort &port ) 00153 { get_portcaster()->add_route(&port, this); } 00154 00155 inline GList<GUTF8String> 00156 DjVuErrorList::GetErrorList(void) 00157 { 00158 GList<GUTF8String> retval=(const GList<GUTF8String>)Errors; 00159 Errors.empty(); 00160 return retval; 00161 } 00162 00163 inline void 00164 DjVuErrorList::ClearError(void) 00165 { Errors.empty(); } 00166 00167 inline GList<GUTF8String> 00168 DjVuErrorList::GetStatusList(void) 00169 { 00170 GList<GUTF8String> retval=(const GList<GUTF8String>)Status; 00171 Status.empty(); 00172 return retval; 00173 } 00174 00175 inline void 00176 DjVuErrorList::ClearStatus(void) 00177 { Status.empty(); } 00178 00179 inline bool 00180 DjVuErrorList::HasError(void) const 00181 { return !Errors.isempty(); } 00182 00183 inline bool 00184 DjVuErrorList::HasStatus(void) const 00185 { return !Status.isempty(); } 00186 00187 00188 #ifdef HAVE_NAMESPACES 00189 } 00190 # ifndef NOT_USING_DJVU_NAMESPACE 00191 using namespace DJVU; 00192 # endif 00193 #endif 00194 #endif