47#include "HDFStructure.h"
52 explicit Stat(
const char *filename) {
53 _badstat = (stat(filename, &_sbuf) != 0);
57 explicit Stat(
const string & filename):_filename(filename) {
58 _badstat = (stat(filename.c_str(), &_sbuf) != 0);
79 nlink_t nlink()
const {
80 return _sbuf.st_nlink;
96 time_t atime()
const {
97 return _sbuf.st_atime;
100 time_t mtime()
const {
101 return _sbuf.st_mtime;
104 time_t ctime()
const {
105 return _sbuf.st_ctime;
108 long blksize()
const {
109 return _sbuf.st_blksize;
112 long blocks()
const {
113 return _sbuf.st_blocks;
120 const char *filename()
const {
121 return _filename.c_str();
124 bool operator!()
const {
134inline string basename(
const string & path)
140 if (path.find(
"#") != string::npos)
141 return path.substr(path.find_last_of(
"#") + 1);
143 return path.substr(path.find_last_of(
"/") + 1);
146inline string first_part_of_full_path(
const string &path) {
148 string ret_value =
"";
149 size_t first_fs_pos = 0;
150 if(path.front()==
'/')
151 first_fs_pos = path.find(
'/',1);
153 first_fs_pos = path.find(
'/',0);
155 if (first_fs_pos == string::npos && path !=
"/")
158 ret_value = path.substr(0,first_fs_pos);