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

kviewshell

GIFFManager.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: GIFFManager.h,v 1.8 2003/11/07 22:08:21 leonb Exp $
00055 // $Name: release_3_5_15 $
00056 
00057 #ifndef _GIFFMANAGER_H
00058 #define _GIFFMANAGER_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 "IFFByteStream.h"
00068 #include "GContainer.h"
00069 #include "Arrays.h"
00070 #include "GSmartPointer.h"
00071 #include "GString.h"
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 
00103 class GIFFChunk : public GPEnabled
00104 {
00105 protected:
00106    GIFFChunk(void);
00107    GIFFChunk(const GUTF8String &name);
00108    GIFFChunk(const GUTF8String &name, const TArray<char> & data);
00109 public:
00111    static GP<GIFFChunk> create(void) {return new GIFFChunk();}
00112 
00115    static GP<GIFFChunk> create(const GUTF8String &name)
00116    {return new GIFFChunk(name);}
00117 
00119    static GP<GIFFChunk> create(const GUTF8String &name, const TArray<char> & data)
00120    { return new GIFFChunk(name,data); }
00121 
00123    virtual ~GIFFChunk(void);
00124 
00126    GUTF8String  get_name(void) const;
00128    GUTF8String  get_full_name(void) const;
00130    GUTF8String  get_type(void) const;
00132    bool     is_container(void) const;
00135    void     set_name(GUTF8String name);
00138    bool     check_name(GUTF8String name);
00139 
00144    void     add_chunk(const GP<GIFFChunk> & chunk, int order=-1);
00148    void     del_chunk(const GUTF8String &name);
00153    GP<GIFFChunk>get_chunk(const GUTF8String &name, int * position=0);
00157    int      get_chunks_number(const GUTF8String &name);
00158    int      get_chunks_number(void);
00160    TArray<char> get_data(void) const;
00161    
00164    void     save(IFFByteStream & istr, bool use_trick=0);
00165 private:
00166    char         name[5];
00167    GUTF8String      type;
00168    GPList<GIFFChunk>    chunks;
00169    TArray<char>     data;
00170    static GUTF8String decode_name(const GUTF8String &name, int &number);
00171 };
00172 
00173 inline GUTF8String
00174 GIFFChunk::get_name(void) const { return GUTF8String(name, 4); }
00175 
00176 inline GUTF8String
00177 GIFFChunk::get_type(void) const { return type; }
00178 
00179 inline GUTF8String
00180 GIFFChunk::get_full_name(void) const { return get_type()+":"+get_name(); }
00181 
00182 inline bool
00183 GIFFChunk::is_container(void) const { return type.length()!=0; }
00184 
00185 inline TArray<char>
00186 GIFFChunk::get_data(void) const { return data; }
00187 
00188 inline
00189 GIFFChunk::GIFFChunk(void) { name[0]=0; }
00190 
00191 inline
00192 GIFFChunk::GIFFChunk(const GUTF8String &name) { set_name(name); }
00193 
00194 inline
00195 GIFFChunk::GIFFChunk(const GUTF8String &name, const TArray<char> & data_in) :
00196       data(data_in)
00197 {
00198    set_name(name);
00199 }
00200 
00201 //************************************************************************
00202 
00248 class GIFFManager : public GPEnabled
00249 {
00250 protected:
00251    GIFFManager(void);
00252    void init(void);
00253    void init(const GUTF8String &name);
00254 public:
00256    static GP<GIFFManager> create(void);
00257 
00261    static GP<GIFFManager> create(const GUTF8String &name);
00262 
00264    virtual ~GIFFManager(void);
00265 
00267    void     set_name(const GUTF8String &name);
00285    void     add_chunk(GUTF8String parent_name, const GP<GIFFChunk> & chunk, int pos=-1);
00301    void     add_chunk(GUTF8String name, const TArray<char> & data);
00315    void     del_chunk(GUTF8String name);
00316    void     del_chunk(void);
00330    int      get_chunks_number(const GUTF8String &name);
00331    int      get_chunks_number(void);
00332 
00344    GP<GIFFChunk>get_chunk(GUTF8String name, int * position=0);
00345 
00347    void     load_chunk(IFFByteStream & istr, GP<GIFFChunk> chunk);
00349    void     load_file(GP<ByteStream> str);
00351    void     load_file(const TArray<char> & data);
00353    void     save_file(GP<ByteStream> str);
00355    void     save_file(TArray<char> & data);
00356 
00357 private:
00358    GP<GIFFChunk>    top_level;
00359 
00360    static const char *  check_leading_dot(const GUTF8String &name);
00361 private: //dummy methods
00362    static void save_file(ByteStream *);
00363    static void load_file(ByteStream *);
00364 };
00365 
00366 inline void
00367 GIFFManager::set_name(const GUTF8String &name)
00368 {
00369    top_level->set_name(name);
00370 }
00371 
00372 inline
00373 GIFFManager::GIFFManager(void) {}
00374 
00375 inline  void
00376 GIFFManager::init(void)
00377 {
00378   top_level=GIFFChunk::create();
00379 }
00380 
00381 inline  void
00382 GIFFManager::init(const GUTF8String &name)
00383 {
00384   top_level=GIFFChunk::create(name);
00385 }
00386 
00387 
00388 #ifdef HAVE_NAMESPACES
00389 }
00390 # ifndef NOT_USING_DJVU_NAMESPACE
00391 using namespace DJVU;
00392 # endif
00393 #endif
00394 #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