source: trunk/libdjvu/GOS.h @ 136

Last change on this file since 136 was 17, checked in by Eugene Romanenko, 16 years ago

update makefiles, remove absolute paths, update djvulibre to version 3.5.17

File size: 6.5 KB
Line 
1//C-  -*- C++ -*-
2//C- -------------------------------------------------------------------
3//C- DjVuLibre-3.5
4//C- Copyright (c) 2002  Leon Bottou and Yann Le Cun.
5//C- Copyright (c) 2001  AT&T
6//C-
7//C- This software is subject to, and may be distributed under, the
8//C- GNU General Public License, Version 2. The license should have
9//C- accompanied the software or you may obtain a copy of the license
10//C- from the Free Software Foundation at http://www.fsf.org .
11//C-
12//C- This program is distributed in the hope that it will be useful,
13//C- but WITHOUT ANY WARRANTY; without even the implied warranty of
14//C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15//C- GNU General Public License for more details.
16//C-
17//C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library
18//C- distributed by Lizardtech Software.  On July 19th 2002, Lizardtech
19//C- Software authorized us to replace the original DjVu(r) Reference
20//C- Library notice by the following text (see doc/lizard2002.djvu):
21//C-
22//C-  ------------------------------------------------------------------
23//C- | DjVu (r) Reference Library (v. 3.5)
24//C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
25//C- | The DjVu Reference Library is protected by U.S. Pat. No.
26//C- | 6,058,214 and patents pending.
27//C- |
28//C- | This software is subject to, and may be distributed under, the
29//C- | GNU General Public License, Version 2. The license should have
30//C- | accompanied the software or you may obtain a copy of the license
31//C- | from the Free Software Foundation at http://www.fsf.org .
32//C- |
33//C- | The computer code originally released by LizardTech under this
34//C- | license and unmodified by other parties is deemed "the LIZARDTECH
35//C- | ORIGINAL CODE."  Subject to any third party intellectual property
36//C- | claims, LizardTech grants recipient a worldwide, royalty-free,
37//C- | non-exclusive license to make, use, sell, or otherwise dispose of
38//C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the
39//C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU
40//C- | General Public License.   This grant only confers the right to
41//C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to
42//C- | the extent such infringement is reasonably necessary to enable
43//C- | recipient to make, have made, practice, sell, or otherwise dispose
44//C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to
45//C- | any greater extent that may be necessary to utilize further
46//C- | modifications or combinations.
47//C- |
48//C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
49//C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
50//C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
51//C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
52//C- +------------------------------------------------------------------
53//
54// $Id: GOS.h,v 1.8 2003/11/07 22:08:21 leonb Exp $
55// $Name:  $
56
57#ifndef _GOS_H_
58#define _GOS_H_
59#ifdef HAVE_CONFIG_H
60#include "config.h"
61#endif
62#if NEED_GNUG_PRAGMAS
63# pragma interface
64#endif
65
66/** @name GOS.h
67    Files #"GOS.h"# and #"GOS.cpp"# implement operating system
68    dependent functions with a unified interface.  All these functions
69    are implemented as static member of class \Ref{GOS}.
70    Functions are provided for testing the presence of a file or a directory
71    (\Ref{GOS::is_file}, \Ref{GOS::is_dir}), for manipulating file and directory names
72    (\Ref{GOS::dirname}, \Ref{GOS::basename}, \Ref{GOS::expand_name},
73    for obtaining and changing the current directory (\Ref{GOS::cwd}),
74    for converting between file names and urls (\Ref{GOS::filename_to_url},
75    \Ref{GOS::url_to_filename}), and for counting time (\Ref{GOS::ticks},
76    \Ref{GOS::sleep}).
77   
78    @memo
79    Operating System dependent functions.
80    @author
81    L\'eon Bottou <leonb@research.att.com> -- Initial implementation
82    @version
83    #$Id: GOS.h,v 1.8 2003/11/07 22:08:21 leonb Exp $#
84*/
85//@{
86
87#include "DjVuGlobal.h"
88#include "GString.h"
89
90#ifdef HAVE_NAMESPACES
91namespace DJVU {
92# ifdef NOT_DEFINED // Just to fool emacs c++ mode
93}
94#endif
95#endif
96
97
98class GURL;
99
100/** Operating System dependent functions. */
101class GOS
102{
103 public:
104  // -----------------------------------------
105  // Functions for dealing with filenames
106  // -----------------------------------------
107
108  /** Returns the last component of file name #filename#.  If the filename
109      suffix matches argument #suffix#, the filename suffix is removed.  This
110      function works like the unix command #/bin/basename#, but also supports
111      the naming conventions of other operating systems. */
112  static GUTF8String basename(const GUTF8String &filename, const char *suffix=0);
113
114  /** Sets and returns the current working directory.
115      When argument #dirname# is specified, the current directory is changed
116      to #dirname#. This function always returns the fully qualified name
117      of the current directory. */
118  static GUTF8String cwd(const GUTF8String &dirname=GUTF8String());
119
120  // -----------------------------------------
121  // Functions for measuring time
122  // -----------------------------------------
123 
124  /** Returns a number of elapsed milliseconds.  This number counts elapsed
125      milliseconds since a operating system dependent date. This function is
126      useful for timing code. */
127  static unsigned long ticks();
128
129  /** Sleeps during the specified time expressed in milliseconds.
130      Other threads can run while the calling thread sleeps. */
131  static void sleep(int milliseconds);
132
133  /// Read the named variable from the environment, and converts it to UTF8.
134  static GUTF8String getenv(const GUTF8String &name);
135
136#if 0
137  // -------------------------------------------
138  // Functions for converting filenames and urls
139  // -------------------------------------------
140  /** Encodes all reserved characters, so that the #filename# can be
141      used inside a URL. Every reserved character is encoded using escape
142      sequence in the form of #%XX#. The legal characters are alphanumeric and
143      #$-_.+!*'(),:#.
144      Use \Ref{decode_reserved}() to convert the URL back to the filename. */
145//  static GString encode_reserved(const char * filename);
146  static GString encode_mbcs_reserved(const char * filename);/*MBCS*/
147#endif
148
149};
150
151
152//@}
153// ------------
154
155#ifdef HAVE_NAMESPACES
156}
157# ifndef NOT_USING_DJVU_NAMESPACE
158using namespace DJVU;
159# endif
160#endif
161#endif
Note: See TracBrowser for help on using the repository browser.