26 #if ! defined (octave_file_stat_h)
27 #define octave_file_stat_h 1
29 #include "octave-config.h"
35 #include <sys/types.h>
48 : m_initialized (false), m_fail (false), m_errmsg (), m_mode (),
49 m_ino (), m_dev (), m_nlink (), m_uid (), m_gid (),
50 m_size (), m_atime (), m_mtime (), m_ctime (), m_rdev (),
51 m_blksize (), m_blocks () { }
54 : m_initialized (fs.m_initialized), m_fail (fs.m_fail),
55 m_errmsg (fs.m_errmsg), m_mode (fs.m_mode), m_ino (fs.m_ino),
56 m_dev (fs.m_dev), m_nlink (fs.m_nlink), m_uid (fs.m_uid),
57 m_gid (fs.m_gid), m_size (fs.m_size), m_atime (fs.m_atime),
58 m_mtime (fs.m_mtime), m_ctime (fs.m_ctime), m_rdev (fs.m_rdev),
59 m_blksize (fs.m_blksize), m_blocks (fs.m_blocks) { }
91 static sys::time resolution (1.0);
100 bool is_blk (
void)
const;
101 bool is_chr (
void)
const;
102 bool is_dir (
void)
const;
103 bool is_fifo (
void)
const;
104 bool is_lnk (
void)
const;
105 bool is_reg (
void)
const;
106 bool is_sock (
void)
const;
108 static bool is_blk (mode_t mode);
109 static bool is_chr (mode_t mode);
110 static bool is_dir (mode_t mode);
111 static bool is_fifo (mode_t mode);
112 static bool is_lnk (mode_t mode);
113 static bool is_reg (mode_t mode);
114 static bool is_sock (mode_t mode);
116 static bool have_struct_stat_st_rdev (
void);
117 static bool have_struct_stat_st_blksize (
void);
118 static bool have_struct_stat_st_blocks (
void);
120 ino_t
ino (
void)
const {
return m_ino; }
121 dev_t
dev (
void)
const {
return m_dev; }
123 nlink_t
nlink (
void)
const {
return m_nlink; }
125 uid_t
uid (
void)
const {
return m_uid; }
126 gid_t
gid (
void)
const {
return m_gid; }
128 off_t
size (
void)
const {
return m_size; }
130 sys::time
atime (
void)
const {
return m_atime; }
131 sys::time
mtime (
void)
const {
return m_mtime; }
132 sys::time
ctime (
void)
const {
return m_ctime; }
134 dev_t
rdev (
void)
const {
return m_rdev; }
136 long blksize (
void)
const {
return m_blksize; }
137 long blocks (
void)
const {
return m_blocks; }
139 mode_t
mode (
void)
const {
return m_mode; }
141 std::string mode_as_string (
void)
const;
143 bool ok (
void)
const {
return m_initialized && ! m_fail; }
145 operator bool ()
const {
return ok (); }
147 bool exists (
void)
const {
return ok (); }
149 std::string
error (
void)
const {
return ok () ?
"" : m_errmsg; }
156 static int is_newer (
const std::string&,
const sys::time&);
219 file_stat (
const std::string&
n =
"",
bool fl =
true);
223 m_follow_links (fs.m_follow_links) { }
244 if (! m_initialized || force)
245 update_internal (force);
250 if (
n != m_file_name || ! m_initialized || force)
252 m_initialized =
false;
256 update_internal (force);
269 void update_internal (
bool force =
false);
302 if (! m_initialized || force)
303 update_internal (force);
308 if (
n != m_fid || ! m_initialized || force)
310 m_initialized =
false;
314 update_internal (force);
323 void update_internal (
bool force =
false);
base_file_stat & operator=(const base_file_stat &fs)
sys::time mtime(void) const
base_file_stat(const base_file_stat &fs)
bool is_newer(const sys::time &time) const
sys::time ctime(void) const
sys::time time_resolution(void) const
sys::time atime(void) const
std::string error(void) const
virtual ~base_file_stat(void)=default
nlink_t nlink(void) const
file_fstat(const file_fstat &fs)
void get_stats(bool force=false)
~file_fstat(void)=default
void get_stats(int n, bool force=false)
file_stat(const file_stat &fs)
void get_stats(bool force=false)
void get_stats(const std::string &n, bool force=false)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn