This file is indexed.

/usr/include/simgear/misc/sg_dir.hxx is in libsimgear-dev 3.0.0-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
// Written by James Turner, started July 2010.
//
// Copyright (C) 2010  Curtis L. Olson - http://www.flightgear.org/~curt
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//
// $Id$


#ifndef _SG_DIR_HXX
#define _SG_DIR_HXX

#include <sys/types.h>

#include <simgear/compiler.h>
#include <string>

#include <simgear/math/sg_types.hxx>
#include <simgear/misc/sg_path.hxx>

#ifdef _MSC_VER
  typedef int mode_t;
#endif

namespace simgear
{
  typedef std::vector<SGPath> PathList;

  class Dir
  {
  public:
    Dir();
    ~Dir();
    
    /**
     * when this directory object is destroyed, remove the corresponding
     * diretory (and its contents) from the disk. Often used with temporary
     * directories to ensure they are cleaned up.
     */
    void setRemoveOnDestroy();
    
    static Dir current();
    
    /**
     * create a temporary directory, using the supplied name
     */
    static Dir tempDir(const std::string& templ);
      
    Dir(const SGPath& path);
    Dir(const Dir& rel, const SGPath& relPath);
    
    enum FileTypes
    {
      TYPE_FILE = 1,
      TYPE_DIR = 2,
      NO_DOT_OR_DOTDOT = 1 << 12,
      INCLUDE_HIDDEN = 1 << 13
    };
    
    PathList children(int types = 0, const std::string& nameGlob = "") const;
    
    /**
     * test if the directory contains no children (except '.' and '..')
     */
    bool isEmpty() const;
    
    SGPath file(const std::string& name) const;
    
    SGPath path() const
        { return _path; }
    
    /**
     * create the directory (and any parents as required) with the
     * request mode, or return failure
     */
    bool create(mode_t mode);
    
    /**
     * remove the directory. 
     * If recursive is true, contained files and directories are
     * recursively removed
     */
    bool remove(bool recursive = false);
    
    /**
     * remove our children but not us
     */
    bool removeChildren() const;
    
    
    /**
     * Check that the directory at the path exists (and is a directory!)
     */
    bool exists() const;
    
    /**
     * parent directory, if one exists
     */
    Dir parent() const;
  private:
    mutable SGPath _path;
    bool _removeOnDestroy;
  };
} // of namespace simgear

#endif // _SG_DIR_HXX