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

kviewshell

XMLTags.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: XMLTags.h,v 1.9 2003/11/07 22:08:22 leonb Exp $
00055 // $Name: release_3_5_15 $
00056 
00057 #ifndef _LT_XMLTAGS__
00058 #define _LT_XMLTAGS__
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 // This is purely Lizardtech stuff.
00068 
00069 #include "GContainer.h"
00070 #include "GString.h"
00071 
00072 #ifdef HAVE_NAMESPACES
00073 namespace DJVU {
00074 # ifdef NOT_DEFINED // Just to fool emacs c++ mode
00075 }
00076 #endif
00077 #endif
00078 
00079 class lt_XMLContents;
00080 class DjVuFile;
00081 class DjVuDocument;
00082 class ByteStream;
00083 class XMLByteStream;
00084 class GURL;
00085 
00086 class lt_XMLTags : public GPEnabled
00087 {
00088 protected:
00089   lt_XMLTags();
00090   lt_XMLTags(const char n[]);
00091 
00092 public:
00094   static GP<lt_XMLTags> create(void) { return new lt_XMLTags; }
00096   static GP<lt_XMLTags> create(const char n[]) { return new lt_XMLTags(n); }
00098   void init(const GURL & url);
00100   static GP<lt_XMLTags> create(const GURL &url);
00102   void init(const GP<ByteStream> &bs);
00104   static GP<lt_XMLTags> create(const GP<ByteStream> &bs);
00106   void init(XMLByteStream &xmlbs);
00108   static GP<lt_XMLTags> create(XMLByteStream &xmlbs);
00110   ~lt_XMLTags();
00111 
00112   inline int get_Line(void) const;
00113   inline const GUTF8String& get_raw(void) const;
00114   inline const GUTF8String& get_name(void) const;
00115   inline const GList<lt_XMLContents>& get_content(void) const;
00116   inline const GMap<GUTF8String,GUTF8String>& get_args(void) const;
00117   inline const GMap<GUTF8String,GPList<lt_XMLTags> >& get_allTags(void) const;
00118 
00119   GPList<lt_XMLTags> get_Tags(char const tagname[]) const;
00120   inline void set_Line(const int xstartline) { startline=xstartline; }
00121 
00122   inline void addtag(GP<lt_XMLTags> x);
00123   inline void addraw(GUTF8String raw);
00124   inline GPosition contains(GUTF8String name) const;
00125   inline const GPList<lt_XMLTags> & operator [] (const GUTF8String name) const;
00126   inline const GPList<lt_XMLTags> & operator [] (const GPosition &pos) const;
00127   static void ParseValues(char const *t, GMap<GUTF8String,GUTF8String> &args,bool downcase=true);
00128   static void get_Maps(char const tagname[],char const argn[],
00129     GPList<lt_XMLTags> list, GMap<GUTF8String, GP<lt_XMLTags> > &map);
00130   void write(ByteStream &bs,bool const top=true) const;
00131 
00132 protected:
00133   GUTF8String name;
00134   GMap<GUTF8String,GUTF8String> args;
00135   GList<lt_XMLContents> content;
00136   GUTF8String raw;
00137   GMap<GUTF8String,GPList<lt_XMLTags> > allTags;
00138   int startline;
00139 };
00140 
00141 class lt_XMLContents
00142 {
00143 public:
00144   lt_XMLContents(void);
00145   lt_XMLContents(GP<lt_XMLTags> tag);
00146   GP<lt_XMLTags> tag;
00147   GUTF8String raw;
00148   void write(ByteStream &bs) const;
00149 };
00150 
00151 inline GP<lt_XMLTags>
00152 lt_XMLTags::create(const GURL &url)
00153 {
00154   const GP<lt_XMLTags> retval(new lt_XMLTags);
00155   retval->init(url);
00156   return retval;
00157 }
00158 
00159 inline GP<lt_XMLTags>
00160 lt_XMLTags::create(const GP<ByteStream> &bs)
00161 {
00162   const GP<lt_XMLTags> retval(new lt_XMLTags);
00163   retval->init(bs);
00164   return retval;
00165 }
00166 
00167 inline GP<lt_XMLTags>
00168 lt_XMLTags::create(XMLByteStream &xmlbs)
00169 {
00170   const GP<lt_XMLTags> retval(new lt_XMLTags);
00171   retval->init(xmlbs);
00172   return retval;
00173 }
00174 
00176 inline void
00177 lt_XMLTags::addtag (GP<lt_XMLTags> x)
00178 {
00179   content.append(lt_XMLContents(x));
00180   allTags[x->name].append(x);
00181 }
00182 
00183 inline void
00184 lt_XMLTags::addraw (GUTF8String r)
00185 {
00186   GPosition pos=content;
00187   if(pos)
00188   {
00189     content[pos].raw+=r;
00190   }else
00191   {
00192     raw+=r;
00193   }
00194 }
00195 
00196 inline int
00197 lt_XMLTags::get_Line(void) const
00198 { return startline; }
00199 
00200 inline const GUTF8String &
00201 lt_XMLTags::get_name(void) const { return name; }
00202 
00203 inline const GUTF8String &
00204 lt_XMLTags::get_raw(void) const { return raw; }
00205 
00206 inline const GList<lt_XMLContents> &
00207 lt_XMLTags::get_content(void) const { return content; }
00208 
00209 inline const GMap<GUTF8String,GUTF8String> &
00210 lt_XMLTags::get_args(void) const { return args; }
00211 
00212 inline const GMap<GUTF8String,GPList<lt_XMLTags> > &
00213 lt_XMLTags::get_allTags(void) const { return allTags; }
00214 
00215 inline GPosition
00216 lt_XMLTags::contains(GUTF8String name) const
00217 {
00218   return allTags.contains(name);
00219 }
00220 
00221 inline const GPList<lt_XMLTags> &
00222 lt_XMLTags::operator [] (const GUTF8String name) const
00223 {
00224   return allTags[name];
00225 }
00226 
00227 inline const GPList<lt_XMLTags> &
00228 lt_XMLTags::operator [] (const GPosition &pos) const
00229 {
00230   return allTags[pos];
00231 }
00232 
00233 
00234 #ifdef HAVE_NAMESPACES
00235 }
00236 # ifndef NOT_USING_DJVU_NAMESPACE
00237 using namespace DJVU;
00238 # endif
00239 #endif
00240 #endif /* _LT_XMLTAGS__ */
00241 
00242 

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