23 #if !defined (octave_file_stat_h)
24 #define octave_file_stat_h 1
30 #include <sys/types.h>
39 : initialized (false), fail (false), errmsg (), fs_mode (),
40 fs_ino (), fs_dev (), fs_nlink (), fs_uid (), fs_gid (),
41 fs_size (), fs_atime (), fs_mtime (), fs_ctime (), fs_rdev (),
42 fs_blksize (), fs_blocks () { }
45 : initialized (fs.initialized), fail (fs.fail), errmsg (fs.errmsg),
46 fs_mode (fs.fs_mode), fs_ino (fs.fs_ino), fs_dev (fs.fs_dev),
47 fs_nlink (fs.fs_nlink), fs_uid (fs.fs_uid), fs_gid (fs.fs_gid),
48 fs_size (fs.fs_size), fs_atime (fs.fs_atime), fs_mtime (fs.fs_mtime),
49 fs_ctime (fs.fs_ctime), fs_rdev (fs.fs_rdev),
50 fs_blksize (fs.fs_blksize), fs_blocks (fs.fs_blocks) { }
91 bool is_blk (
void)
const;
92 bool is_chr (
void)
const;
93 bool is_dir (
void)
const;
94 bool is_fifo (
void)
const;
95 bool is_lnk (
void)
const;
96 bool is_reg (
void)
const;
97 bool is_sock (
void)
const;
99 static bool is_blk (
mode_t mode);
100 static bool is_chr (
mode_t mode);
101 static bool is_dir (
mode_t mode);
102 static bool is_fifo (
mode_t mode);
103 static bool is_lnk (
mode_t mode);
104 static bool is_reg (
mode_t mode);
105 static bool is_sock (
mode_t mode);
107 ino_t
ino (
void)
const {
return fs_ino; }
108 dev_t
dev (
void)
const {
return fs_dev; }
110 nlink_t
nlink (
void)
const {
return fs_nlink; }
112 uid_t
uid (
void)
const {
return fs_uid; }
113 gid_t
gid (
void)
const {
return fs_gid; }
115 off_t
size (
void)
const {
return fs_size; }
121 dev_t
rdev (
void)
const {
return fs_rdev; }
123 long blksize (
void)
const {
return fs_blksize; }
124 long blocks (
void)
const {
return fs_blocks; }
128 std::string mode_as_string (
void)
const;
130 bool ok (
void)
const {
return initialized && ! fail; }
132 operator bool ()
const {
return ok (); }
134 bool exists (
void)
const {
return ok (); }
136 std::string
error (
void)
const {
return ok () ? std::string () : errmsg; }
143 static int is_newer (
const std::string&,
const octave_time&);
204 file_stat (
const std::string& n = std::string (),
bool fl =
true)
207 if (! file_name.empty ())
213 follow_links (fs.follow_links) { }
232 if (! initialized || force)
233 update_internal (force);
236 void get_stats (
const std::string& n,
bool force =
false)
238 if (n != file_name || ! initialized || force)
244 update_internal (force);
257 void update_internal (
bool force =
false);
290 if (! initialized || force)
291 update_internal (force);
296 if (n != fid || ! initialized || force)
302 update_internal (force);
311 void update_internal (
bool force =
false);
octave_time ctime(void) const
std::string error(void) const
void get_stats(int n, bool force=false)
octave_time atime(void) const
base_file_stat(const base_file_stat &fs)
file_fstat(const file_fstat &fs)
bool is_newer(const octave_time &time) const
base_file_stat & operator=(const base_file_stat &fs)
void get_stats(const std::string &n, bool force=false)
file_stat(const file_stat &fs)
virtual ~base_file_stat(void)
file_stat(const std::string &n=std::string(), bool fl=true)
nlink_t nlink(void) const
octave_time mtime(void) const
void get_stats(bool force=false)
octave_time time_resolution(void) const
void get_stats(bool force=false)