kviewshell
DjVuMessageLite.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: DjVuMessageLite.h,v 1.9 2003/11/07 22:08:21 leonb Exp $ 00055 // $Name: release_3_5_15 $ 00056 00057 #ifndef __DJVU_MESSAGE_LITE_H__ 00058 #define __DJVU_MESSAGE_LITE_H__ 00059 #ifdef HAVE_CONFIG_H 00060 #include "config.h" 00061 #endif 00062 #if NEED_GNUG_PRAGMAS 00063 # pragma interface 00064 #endif 00065 00066 // From: Leon Bottou, 1/31/2002 00067 // All these I18N XML messages are Lizardtech innovations. 00068 // For DjvuLibre, I changed the path extraction logic 00069 // and added support for non I18N messages. 00070 00071 00072 #include "GString.h" 00073 00074 #ifdef HAVE_NAMESPACES 00075 namespace DJVU { 00076 # ifdef NOT_DEFINED // Just to fool emacs c++ mode 00077 } 00078 #endif 00079 #endif 00080 00081 class lt_XMLTags; 00082 class ByteStream; 00083 00150 class DjVuMessageLite : public GPEnabled 00151 { 00152 protected: 00153 // Constructor: 00154 DjVuMessageLite( void ); 00155 GMap<GUTF8String,GP<lt_XMLTags> > Map; 00156 GUTF8String errors; 00158 static const DjVuMessageLite &real_create(void); 00159 00160 public: 00162 static const DjVuMessageLite& (*create)(void); 00163 00165 static const DjVuMessageLite &create_lite(void); 00166 00169 static void AddByteStreamLater(const GP<ByteStream> &bs); 00170 00173 ~DjVuMessageLite(); 00174 00176 GUTF8String LookUp( const GUTF8String & MessageList ) const; 00177 00179 static GUTF8String LookUpUTF8( const GUTF8String & MessageList ) 00180 { return create().LookUp(MessageList); } 00181 00184 static GNativeString LookUpNative( const GUTF8String & MessageList ) 00185 { return create().LookUp(MessageList).getUTF82Native(); } 00186 00188 static void perror( const GUTF8String & MessageList ); 00189 00190 protected: 00191 00192 /* Looks up the msgID in the file of messages. The strings message_text 00193 and message_number are returned if found. If not found, these strings 00194 are empty. */ 00195 void LookUpID( const GUTF8String & msgID, 00196 GUTF8String &message_text, GUTF8String &message_number ) const; 00197 00198 /* Expands a single message and inserts the arguments. Single_Message 00199 contains no separators (newlines), but includes all the parameters 00200 separated by tabs. */ 00201 GUTF8String LookUpSingle( const GUTF8String & Single_Message ) const; 00202 00203 /* Insert a string into the message text. Will insert into any field 00204 description. Except for an ArgId of zero (message number), if the 00205 #ArgId# is not found, the routine adds a line with the parameter 00206 so information will not be lost. */ 00207 void InsertArg( 00208 GUTF8String &message, const int ArgId, const GUTF8String &arg ) const; 00209 00210 void AddByteStream(const GP<ByteStream> &bs); 00211 00212 protected: 00213 /* Static storage of the DjVuMessage class. */ 00214 static GP<DjVuMessageLite> &getDjVuMessageLite(void); 00215 /* Static storage of the ByteStream list. */ 00216 static GPList<ByteStream> &getByteStream(void); 00217 }; 00218 00219 00220 #ifdef HAVE_NAMESPACES 00221 } 00222 # ifndef NOT_USING_DJVU_NAMESPACE 00223 using namespace DJVU; 00224 # endif 00225 #endif 00226 #endif /* __DJVU_MESSAGE_LITE_H__ */ 00227