This file is indexed.

/usr/include/zipios++/filepath.h is in libzipios++-dev 0.1.5.9+cvs.2007.04.28-5.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#ifndef FILEPATH_H
#define FILEPATH_H

#include "zipios++/zipios-config.h"

#include <stdexcept>
#include <string>

namespace zipios {

using namespace std    ;

/** FilePath represents a path to a file or directory name. FilePath has
    member functions to check if the file path is a valid file system entity,
    and to check what kind of file system entity it is, e.g. is it a file, a 
    directory, a pipe etc.
*/
class FilePath {
public:
  /** Constructor.
      @param path A string representation of the path.
      @param check_exists If true is specified the constructor will
      check the existence and type of the path immidiately, instead of
      deferring that task until it is needed. */
  FilePath( const string &path = "", bool check_exists = false ) ;

  inline FilePath &operator= ( const string &rhs ) ;

  inline operator string() const ;

  /** Concatenates FilePath objects. A file separator is inserted
      if appropriate. */
  inline FilePath operator+ ( const FilePath &name ) const ;

  /** Returns filename of the FilePath object by pruning the path
      off. */
  inline FilePath filename() const ;


  /** @return true If the path is a valid file system entity. */
  inline bool exists()         const ;

  /** @return true if the path is a regular file. */
  inline bool isRegular()      const ;

  /** @return true if the path is a directory. */
  inline bool isDirectory()    const ;

  /** @return true if the path is character special (a character
      device file).  */
  inline bool isCharSpecial()  const ;

  /** @return true if the path is block special (a block device
      file). */
  inline bool isBlockSpecial() const ;

  /** @return true if the path is a socket. */
  inline bool isSocket()       const ;

  /** @return true if the path is a Fifo (a pipe). */
  inline bool isFifo()         const ;

protected:

  /** Prunes the trailing separator of a specified path. */
  inline void pruneTrailingSeparator() ;

  /** This function sets _checked to true, stats the path, to see if
  it exists and to determine what type of file it is. All the query
  functions check if _checked is true, and if it isn't they call
  check(). This means stat'ing is deferred until it becomes
  necessary. */
  void check() const ;

  static const char _separator;

  // FIXME: Should be bitfield
  mutable bool   _checked   ;
  mutable bool   _exists    ;
  mutable bool   _is_reg    ;
  mutable bool   _is_dir    ;
  mutable bool   _is_char   ;
  mutable bool   _is_block  ;
  mutable bool   _is_socket ;
  mutable bool   _is_fifo   ;
  string _path              ;
};


//
// Inline member functions
//

FilePath &FilePath::operator= ( const string &rhs ) {
  _path = rhs ;
  pruneTrailingSeparator() ;
  return *this ;
}

void FilePath::pruneTrailingSeparator() {
  if ( _path.size() > 0 )
    if ( _path[ _path.size() -1 ] == _separator )
      _path.erase( _path.size() - 1 ) ; 
}

FilePath::operator string() const { 
  return _path ;
} 


FilePath FilePath::operator+ ( const FilePath &name ) const { 
  if ( _path.size() > 0 )
    return _path + _separator + name._path ; 
  else
    return name._path ;
}


FilePath FilePath::filename() const {
  string::size_type pos ;
  pos = _path.find_last_of( _separator ) ;
  if ( pos != string::npos )
    return _path.substr( pos + 1);
  else 
    return _path ;
}


bool FilePath::exists() const {
  if ( ! _checked )
    check() ;
  return _exists ;
}


bool FilePath::isRegular() const {
  if ( ! _checked )
    check() ;
  return _is_reg ;
}


bool FilePath::isDirectory() const {
  if ( ! _checked )
    check() ;
  return _is_dir ;
}


bool FilePath::isCharSpecial() const {
  if ( ! _checked )
    check() ;
  return _is_char ;
}


bool FilePath::isBlockSpecial() const {
  if ( ! _checked )
    check() ;
  return _is_block ;
}


bool FilePath::isSocket() const {
  if ( ! _checked )
    check() ;
  return _is_socket ;
}


bool FilePath::isFifo() const {
  if ( ! _checked )
    check() ;
  return _is_fifo ;
}


} // namespace
#endif

/** \file
    Header file that defines FilePath.
*/

/*
  Zipios++ - a small C++ library that provides easy access to .zip files.
  Copyright (C) 2000  Thomas Søndergaard
  
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.
  
  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  
  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
*/