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

kviewshell

DjVuErrorList.cpp

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.cpp,v 1.8 2003/11/07 22:08:20 leonb Exp $
00055 // $Name: release_3_5_15 $
00056 
00057 #ifdef HAVE_CONFIG_H
00058 # include "config.h"
00059 #endif
00060 #if NEED_GNUG_PRAGMAS
00061 # pragma implementation
00062 #endif
00063 
00064 #include "DjVuErrorList.h"
00065 #include "DjVmDoc.h"
00066 #include "GException.h"
00067 #include "GContainer.h"
00068 #include "GOS.h"
00069 #include "DataPool.h"
00070 #include <string.h>
00071 
00072 
00073 #ifdef HAVE_NAMESPACES
00074 namespace DJVU {
00075 # ifdef NOT_DEFINED // Just to fool emacs c++ mode
00076 }
00077 #endif
00078 #endif
00079 
00080 
00081 DjVuErrorList::DjVuErrorList() {}
00082 
00083 GURL
00084 DjVuErrorList::set_stream(GP<ByteStream> xibs)
00085 {
00086   GUTF8String name;
00087   static unsigned long serial=0;
00088   pool=DataPool::create(xibs);
00089   name.format("data://%08lx/%08lx.djvu",
00090     ++serial,(unsigned long)(size_t)((const ByteStream *)xibs));
00091   pool_url=GURL::UTF8(name);
00092   return pool_url;
00093 }
00094 
00095 bool
00096 DjVuErrorList::notify_error(const DjVuPort * source, const GUTF8String & msg)
00097 {
00098   Errors.append(msg);
00099   return 1;
00100 }
00101 
00102 bool
00103 DjVuErrorList::notify_status(const DjVuPort * source, const GUTF8String &msg)
00104 {
00105   Status.append(msg);
00106   return 1;
00107 }  
00108 
00109 GUTF8String
00110 DjVuErrorList::GetError(void)
00111 {
00112   GUTF8String PrevError;
00113   GPosition pos;
00114   if((pos=Errors))
00115   {
00116     PrevError=Errors[pos];
00117     Errors.del(pos);
00118   }
00119   return PrevError;
00120 }
00121 
00122 GUTF8String
00123 DjVuErrorList::GetStatus(void)
00124 {
00125   GUTF8String PrevStatus;
00126   GPosition pos;
00127   if((pos=Status))
00128   {
00129     PrevStatus=Status[pos];
00130     Status.del(pos);
00131   }
00132   return PrevStatus;
00133 }
00134 
00135 GP<DataPool>
00136 DjVuErrorList::request_data(const DjVuPort * source, const GURL & url)
00137 {
00138    GP<DataPool> retval;
00139    G_TRY
00140    {
00141      if (pool && url.protocol().downcase() == "data")
00142      {
00143        if(url == pool_url)
00144        {
00145          retval=pool;
00146        }else if(url.base() == pool_url)
00147        {
00148          GUTF8String name=url.fname();
00149          GP<DjVmDoc> doc=DjVmDoc::create();
00150          GP<ByteStream> bs=pool->get_stream();
00151          doc->read(*bs);
00152          retval=doc->get_data(name);
00153        }
00154      }else if (url.is_local_file_url())
00155      {
00156 //       GUTF8String fname=GOS::url_to_filename(url);
00157 //       if (GOS::basename(fname)=="-") fname="-";
00158        retval=DataPool::create(url);
00159      }
00160    }
00161    G_CATCH_ALL
00162    {
00163      retval=0;
00164    } G_ENDCATCH;
00165    return retval;
00166 }
00167  
00168 
00169 #ifdef HAVE_NAMESPACES
00170 }
00171 # ifndef NOT_USING_DJVU_NAMESPACE
00172 using namespace DJVU;
00173 # endif
00174 #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