/usr/include/shevek/dir.hh is in libshevek-dev 1.3-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 | /* dir.hh - directory access
* Copyright 2006 Bas Wijnen <wijnen@debian.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SHEVEK_DIR_HH
#define SHEVEK_DIR_HH
#include <string>
#include <sys/types.h>
#include <set>
#include <glibmm.h>
namespace shevek
{
/// Get information about files in a directory.
class dir
{
public:
/// Information about a single file in a directory.
struct file
{
/// The name of the file.
std::string name;
/// Whether it is a directory.
bool is_dir;
/// The user-ID of the file.
uid_t uid;
/// The group-ID of the file.
gid_t gid;
/// The size of the file.
off_t size;
/// Sorting operator, needed for putting them in a std::set.
bool operator< (file const &that) const;
};
/// Storage of the files.
typedef std::set <file> store;
/// Iterator for looping over the files.
typedef store::const_iterator const_iterator;
/// Create an empty directory object.
dir ();
/// Create a directory object and load content into it.
dir (std::string const &path);
/// Load new content into an existing directory object.
void load (std::string const &path);
/// Loop over the files.
const_iterator begin () const;
/// Loop over the files.
const_iterator end () const;
/// Number of files in the directory.
unsigned size () const;
private:
store data;
};
}
#endif
|