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

kviewshell

GURL.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: GURL.h,v 1.9 2003/11/07 22:08:21 leonb Exp $
00055 // $Name: release_3_5_15 $
00056 
00057 #ifndef _GURL_H_
00058 #define _GURL_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 "GString.h"
00068 #include "Arrays.h"
00069 #include "GThreads.h"
00070 
00071 
00072 #ifdef HAVE_NAMESPACES
00073 namespace DJVU {
00074 # ifdef NOT_DEFINED // Just to fool emacs c++ mode
00075 }
00076 #endif
00077 #endif
00078 
00096 
00117 class GURL
00118 {
00119 public:
00120   class Filename;
00121   class UTF8;
00122   class Native;
00123 protected:
00130 
00131    GURL(const char * url_string);
00133 
00134 public:
00135    GURL(void);
00136 
00137    GURL(const GUTF8String & url_string);
00138 
00139    GURL(const GNativeString & url_string);
00140 
00141    GURL(const GUTF8String &xurl, const GURL &codebase);
00142 
00143    GURL(const GNativeString &xurl, const GURL &codebase);
00144 
00146    GURL(const GURL & gurl);
00147 
00149    virtual ~GURL(void) {}
00150 
00151 private:
00152       // The 'class_lock' should be locked whenever you're accessing
00153       // url, or cgi_name_arr, or cgi_value_arr.
00154    GCriticalSection class_lock;
00155 protected:
00156    GUTF8String  url;
00157    DArray<GUTF8String>  cgi_name_arr, cgi_value_arr;
00158    bool validurl;
00159 
00160    void     init(const bool nothrow=false);
00161    void     convert_slashes(void);
00162    void     beautify_path(void);
00163    static GUTF8String   beautify_path(GUTF8String url);
00164 
00165    static GUTF8String   protocol(const GUTF8String& url);
00166    void     parse_cgi_args(void);
00167    void     store_cgi_args(void);
00168 public:
00170    bool is_valid(void) const;     // const lies to the compiler because of dependency problems
00171 
00173    GUTF8String  protocol(void) const;
00174 
00177    GUTF8String  hash_argument(void) const;
00178 
00182    void     set_hash_argument(const GUTF8String &arg);
00183 
00186    int      cgi_arguments(void) const;
00187 
00190    int      djvu_cgi_arguments(void) const;
00191 
00194    GUTF8String  cgi_name(int num) const;
00195 
00198    GUTF8String  djvu_cgi_name(int num) const;
00199 
00202    GUTF8String  cgi_value(int num) const;
00203    
00206    GUTF8String  djvu_cgi_value(int num) const;
00207    
00210    DArray<GUTF8String>cgi_names(void) const;
00211 
00214    DArray<GUTF8String>djvu_cgi_names(void) const;
00215    
00218    DArray<GUTF8String>cgi_values(void) const;
00219 
00222    DArray<GUTF8String>djvu_cgi_values(void) const;
00223 
00225    void     clear_all_arguments(void);
00226 
00228    void     clear_hash_argument(void);
00229 
00231    void     clear_djvu_cgi_arguments(void);
00232 
00234    void     clear_cgi_arguments(void);
00235 
00238    void     add_djvu_cgi_argument(const GUTF8String &name, const char * value=0);
00239    
00243    GURL     base(void) const;
00244 
00246    GUTF8String pathname(void) const;
00247 
00252    GUTF8String  name(void) const;
00253 
00258    GUTF8String  fname(void) const;
00259 
00261    GUTF8String  extension(void) const;
00262 
00264    bool     is_empty(void) const;
00265 
00267    bool     is_local_file_url(void) const;
00268 
00276 
00277 //   GURL       operator+(const GUTF8String &name) const;
00279 
00281    bool operator==(const GURL & gurl2) const;
00282 
00284    bool operator!=(const GURL & gurl2) const;
00285 
00287    GURL &   operator=(const GURL & url);
00288 
00290    operator const char*(void) const { return url; };
00291 
00298    GUTF8String get_string(const GUTF8String &useragent) const;
00299 
00300    GUTF8String get_string(const bool nothrow=false) const;
00301 
00303    static GUTF8String encode_reserved(const GUTF8String &gs);
00304 
00307    static GUTF8String decode_reserved(const GUTF8String &url);
00308 
00310   bool is_local_path(void) const;
00311 
00313   bool is_file(void) const;
00314 
00316   bool is_dir(void) const;
00317 
00319   GURL follow_symlinks(void) const;
00320 
00322   int mkdir(void) const;
00323 
00327   int deletefile(void) const;
00328 
00331   int cleardir(const int timeout=0) const;
00332 
00334   int renameto(const GURL &newurl) const;
00335 
00337   GList<GURL> listdir(void) const;
00338 
00353    GUTF8String UTF8Filename(void) const;
00355    GNativeString NativeFilename(void) const;
00356 
00359    friend unsigned int  hash(const GURL & gurl);
00360 
00368   static GUTF8String expand_name(const GUTF8String &filename, const char *fromdirname=0);
00369 };
00370 
00371 class GURL::UTF8 : public GURL
00372 {
00373 public:
00374   UTF8(const GUTF8String &xurl);
00375   UTF8(const GUTF8String &xurl, const GURL &codebase);
00376 };
00377 
00378 class GURL::Native : public GURL
00379 {
00380 public:
00381   Native(const GNativeString &xurl);
00382   Native(const GNativeString &xurl, const GURL &codebase);
00383 };
00384 
00385 class GURL::Filename : public GURL
00386 {
00387 public:
00388   Filename(const GUTF8String &filename);
00389   Filename(const GNativeString &filename);
00390   class UTF8;
00391   class Native;
00392 };
00393 
00394 class GURL::Filename::UTF8 : public GURL::Filename
00395 {
00396 public:
00397   UTF8(const GUTF8String &filename);
00398 };
00399 
00400 class GURL::Filename::Native : public GURL::Filename
00401 {
00402 public:
00403   Native(const GNativeString &filename);
00404 };
00405 
00406 
00407 inline bool
00408 GURL::operator!=(const GURL & gurl2) const
00409 {
00410   return !(*this == gurl2);
00411 }
00412 
00413 inline GUTF8String
00414 GURL::protocol(void) const
00415 {
00416    return protocol(get_string());
00417 }
00418 
00419 inline bool
00420 GURL::is_empty(void) const
00421 {
00422    return !url.length()||!get_string().length();
00423 }
00424 
00425 // Test if the URL is valid.
00426 // If invalid, reinitialize and return the result.
00427 inline bool
00428 GURL::is_valid(void) const
00429 {
00430   if(!validurl)
00431     const_cast<GURL *>(this)->init(true);
00432   return validurl;
00433 }
00434 
00435 
00436 
00438 
00439 
00440 #ifdef HAVE_NAMESPACES
00441 }
00442 # ifndef NOT_USING_DJVU_NAMESPACE
00443 using namespace DJVU;
00444 # endif
00445 #endif
00446 #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