Mercurial > octave
annotate liboctave/system/file-stat.h @ 21244:1473547f50f5
include octave-config.h in public header files
* mk-opts.pl, mkbuiltins, mk-ops.awk, sparse-mk-ops.awk:
Emit "#include octave-config.h" statement for generated header files.
* build-env.h, builtins.h, Cell.h, base-text-renderer.h,
c-file-ptr-stream.h, cdisplay.h, comment-list.h, data.h, debug.h,
defaults.in.h, defun-dld.h, defun-int.h, defun.h, dirfns.h, display.h,
dynamic-ld.h, error.h, errwarn.h, event-queue.h, file-io.h,
ft-text-renderer.h, gl-render.h, gl2ps-print.h, graphics.in.h,
gripes.h, help.h, hook-fcn.h, input.h, jit-ir.h, jit-typeinfo.h,
jit-util.h, load-path.h, load-save.h, ls-ascii-helper.h, ls-hdf5.h,
ls-mat-ascii.h, ls-mat4.h, ls-mat5.h, ls-oct-binary.h, ls-oct-text.h,
ls-utils.h, mex.h, mexproto.h, mxarray.in.h, oct-errno.h, oct-fstrm.h,
oct-handle.h, oct-hdf5-types.h, oct-hdf5.h, oct-hist.h, oct-iostrm.h,
oct-lvalue.h, oct-map.h, oct-obj.h, oct-opengl.h, oct-prcstrm.h,
oct-procbuf.h, oct-stdstrm.h, oct-stream.h, oct-strstrm.h, oct.h,
octave-default-image.h, octave-link.h, octave-preserve-stream-state.h,
pager.h, pr-output.h, procstream.h, profiler.h, pt-jit.h,
sighandlers.h, siglist.h, sparse-xdiv.h, sparse-xpow.h, symtab.h,
sysdep.h, text-renderer.h, toplev.h, txt-eng.h, utils.h, variables.h,
workspace-element.h, xdiv.h, xnorm.h, xpow.h, zfstream.h, oct-qhull.h,
ov-base-diag.h, ov-base-int.h, ov-base-mat.h, ov-base-scalar.h,
ov-base-sparse.h, ov-base.h, ov-bool-mat.h, ov-bool-sparse.h,
ov-bool.h, ov-builtin.h, ov-cell.h, ov-ch-mat.h, ov-class.h,
ov-classdef.h, ov-colon.h, ov-complex.h, ov-cs-list.h, ov-cx-diag.h,
ov-cx-mat.h, ov-cx-sparse.h, ov-dld-fcn.h, ov-fcn-handle.h,
ov-fcn-inline.h, ov-fcn.h, ov-float.h, ov-flt-complex.h,
ov-flt-cx-diag.h, ov-flt-cx-mat.h, ov-flt-re-diag.h, ov-flt-re-mat.h,
ov-int-traits.h, ov-int16.h, ov-int32.h, ov-int64.h, ov-int8.h,
ov-intx.h, ov-java.h, ov-lazy-idx.h, ov-mex-fcn.h, ov-null-mat.h,
ov-oncleanup.h, ov-perm.h, ov-range.h, ov-re-diag.h, ov-re-mat.h,
ov-re-sparse.h, ov-scalar.h, ov-str-mat.h, ov-struct.h,
ov-type-conv.h, ov-typeinfo.h, ov-uint16.h, ov-uint32.h, ov-uint64.h,
ov-uint8.h, ov-usr-fcn.h, ov.h, ovl.h, octave.h, op-int.h, ops.h,
options-usage.h, lex.h, parse.h, pt-all.h, pt-arg-list.h,
pt-array-list.h, pt-assign.h, pt-binop.h, pt-bp.h, pt-cbinop.h,
pt-cell.h, pt-check.h, pt-classdef.h, pt-cmd.h, pt-colon.h,
pt-const.h, pt-decl.h, pt-eval.h, pt-except.h, pt-exp.h,
pt-fcn-handle.h, pt-funcall.h, pt-id.h, pt-idx.h, pt-jump.h,
pt-loop.h, pt-mat.h, pt-misc.h, pt-pr-code.h, pt-select.h, pt-stmt.h,
pt-unop.h, pt-walk.h, pt.h, token.h, version.in.h, Array-util.h,
Array.h, CColVector.h, CDiagMatrix.h, CMatrix.h, CNDArray.h,
CRowVector.h, CSparse.h, DiagArray2.h, MArray.h, MDiagArray2.h,
MSparse.h, Matrix.h, MatrixType.h, PermMatrix.h, Range.h, Sparse.h,
boolMatrix.h, boolNDArray.h, boolSparse.h, chMatrix.h, chNDArray.h,
dColVector.h, dDiagMatrix.h, dMatrix.h, dNDArray.h, dRowVector.h,
dSparse.h, dim-vector.h, fCColVector.h, fCDiagMatrix.h, fCMatrix.h,
fCNDArray.h, fCRowVector.h, fColVector.h, fDiagMatrix.h, fMatrix.h,
fNDArray.h, fRowVector.h, idx-vector.h, int16NDArray.h,
int32NDArray.h, int64NDArray.h, int8NDArray.h, intNDArray.h,
uint16NDArray.h, uint32NDArray.h, uint64NDArray.h, uint8NDArray.h,
f77-fcn.h, lo-error.h, quit.h, CmplxAEPBAL.h, CmplxCHOL.h,
CmplxGEPBAL.h, CmplxHESS.h, CmplxLU.h, CmplxQR.h, CmplxQRP.h,
CmplxSCHUR.h, CmplxSVD.h, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h,
DAERTFunc.h, DASPK.h, DASRT.h, DASSL.h, DET.h, EIG.h, LSODE.h, ODE.h,
ODEFunc.h, ODES.h, ODESFunc.h, Quad.h, base-aepbal.h, base-dae.h,
base-de.h, base-lu.h, base-min.h, base-qr.h, bsxfun-decl.h, bsxfun.h,
dbleAEPBAL.h, dbleCHOL.h, dbleGEPBAL.h, dbleHESS.h, dbleLU.h,
dbleQR.h, dbleQRP.h, dbleSCHUR.h, dbleSVD.h, eigs-base.h,
fCmplxAEPBAL.h, fCmplxCHOL.h, fCmplxGEPBAL.h, fCmplxHESS.h,
fCmplxLU.h, fCmplxQR.h, fCmplxQRP.h, fCmplxSCHUR.h, fCmplxSVD.h,
fEIG.h, floatAEPBAL.h, floatCHOL.h, floatGEPBAL.h, floatHESS.h,
floatLU.h, floatQR.h, floatQRP.h, floatSCHUR.h, floatSVD.h,
lo-mappers.h, lo-specfun.h, oct-convn.h, oct-fftw.h, oct-norm.h,
oct-rand.h, oct-spparms.h, randgamma.h, randmtzig.h, randpoisson.h,
sparse-chol.h, sparse-dmsolve.h, sparse-lu.h, sparse-qr.h,
Sparse-diag-op-defs.h, Sparse-op-decls.h, Sparse-op-defs.h,
Sparse-perm-op-defs.h, mx-base.h, mx-defs.h, mx-ext.h, mx-op-decl.h,
mx-op-defs.h, dir-ops.h, file-ops.h, file-stat.h, lo-sysdep.h,
mach-info.h, oct-env.h, oct-group.h, oct-openmp.h, oct-passwd.h,
oct-syscalls.h, oct-time.h, oct-uname.h, pathlen.h, sysdir.h,
syswait.h, action-container.h, base-list.h, byte-swap.h,
caseless-str.h, cmd-edit.h, cmd-hist.h, data-conv.h, functor.h,
glob-match.h, lo-array-errwarn.h, lo-array-gripes.h, lo-cutils.h,
lo-ieee.h, lo-macros.h, lo-math.h, lo-regexp.h, lo-traits.h,
lo-utils.h, oct-alloc.h, oct-base64.h, oct-binmap.h, oct-cmplx.h,
oct-glob.h, oct-inttypes.h, oct-locbuf.h, oct-mutex.h, oct-refcount.h,
oct-rl-edit.h, oct-rl-hist.h, oct-shlib.h, oct-sort.h, oct-sparse.h,
pathsearch.h, singleton-cleanup.h, sparse-sort.h, sparse-util.h,
statdefs.h, str-vec.h, sun-utils.h, unwind-prot.h, url-transfer.h:
Include octave-config.h.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Feb 2016 14:25:53 -0500 |
parents | 93748bcaec17 |
children | 30c53770f47e |
rev | line source |
---|---|
2926 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17769
diff
changeset
|
3 Copyright (C) 1996-2015 John W. Eaton |
2926 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2926 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2926 | 20 |
21 */ | |
22 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
23 #if ! defined (octave_file_stat_h) |
2926 | 24 #define octave_file_stat_h 1 |
25 | |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
27 |
2926 | 28 #include <string> |
29 | |
3260 | 30 #include "oct-time.h" |
31 | |
2926 | 32 #include <sys/types.h> |
33 | |
34 class | |
6108 | 35 OCTAVE_API |
8549 | 36 base_file_stat |
2926 | 37 { |
38 public: | |
39 | |
8549 | 40 base_file_stat (void) |
41 : initialized (false), fail (false), errmsg (), fs_mode (), | |
42 fs_ino (), fs_dev (), fs_nlink (), fs_uid (), fs_gid (), | |
43 fs_size (), fs_atime (), fs_mtime (), fs_ctime (), fs_rdev (), | |
44 fs_blksize (), fs_blocks () { } | |
45 | |
46 base_file_stat (const base_file_stat& fs) | |
47 : initialized (fs.initialized), fail (fs.fail), errmsg (fs.errmsg), | |
48 fs_mode (fs.fs_mode), fs_ino (fs.fs_ino), fs_dev (fs.fs_dev), | |
49 fs_nlink (fs.fs_nlink), fs_uid (fs.fs_uid), fs_gid (fs.fs_gid), | |
50 fs_size (fs.fs_size), fs_atime (fs.fs_atime), fs_mtime (fs.fs_mtime), | |
51 fs_ctime (fs.fs_ctime), fs_rdev (fs.fs_rdev), | |
52 fs_blksize (fs.fs_blksize), fs_blocks (fs.fs_blocks) { } | |
53 | |
54 base_file_stat& operator = (const base_file_stat& fs) | |
55 { | |
56 if (this != &fs) | |
2926 | 57 { |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
58 initialized = fs.initialized; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
59 fail = fs.fail; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
60 errmsg = fs.errmsg; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
61 fs_mode = fs.fs_mode; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
62 fs_ino = fs.fs_ino; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
63 fs_dev = fs.fs_dev; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
64 fs_nlink = fs.fs_nlink; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
65 fs_uid = fs.fs_uid; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
66 fs_gid = fs.fs_gid; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
67 fs_size = fs.fs_size; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
68 fs_atime = fs.fs_atime; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
69 fs_mtime = fs.fs_mtime; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
70 fs_ctime = fs.fs_ctime; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
71 fs_rdev = fs.fs_rdev; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
72 fs_blksize = fs.fs_blksize; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
73 fs_blocks = fs.fs_blocks; |
2926 | 74 } |
75 | |
8549 | 76 return *this; |
77 } | |
2926 | 78 |
9748
d6b2b708b6b0
load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
79 // The minimum difference in file time stamp values. |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
80 // FIXME: This value should come from the filesystem itself. |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
81 // How can we get that info? |
9748
d6b2b708b6b0
load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
82 octave_time time_resolution (void) const |
d6b2b708b6b0
load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
83 { |
d6b2b708b6b0
load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
84 static octave_time resolution (1.0); |
d6b2b708b6b0
load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
85 return resolution; |
d6b2b708b6b0
load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
86 } |
d6b2b708b6b0
load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
87 |
8689
ddbe87599331
base_file_stat::is_XXX: return false if object is not initialized
John W. Eaton <jwe@octave.org>
parents:
8549
diff
changeset
|
88 // File status and info. The is_XXX functions will return false for |
ddbe87599331
base_file_stat::is_XXX: return false if object is not initialized
John W. Eaton <jwe@octave.org>
parents:
8549
diff
changeset
|
89 // file_stat objects that are not properly initialized. The others |
ddbe87599331
base_file_stat::is_XXX: return false if object is not initialized
John W. Eaton <jwe@octave.org>
parents:
8549
diff
changeset
|
90 // should all return 0 (or the equivalent, for the given object) |
ddbe87599331
base_file_stat::is_XXX: return false if object is not initialized
John W. Eaton <jwe@octave.org>
parents:
8549
diff
changeset
|
91 // which is likely not meaningful. |
2926 | 92 |
93 bool is_blk (void) const; | |
94 bool is_chr (void) const; | |
95 bool is_dir (void) const; | |
96 bool is_fifo (void) const; | |
97 bool is_lnk (void) const; | |
98 bool is_reg (void) const; | |
99 bool is_sock (void) const; | |
100 | |
5476 | 101 static bool is_blk (mode_t mode); |
102 static bool is_chr (mode_t mode); | |
103 static bool is_dir (mode_t mode); | |
104 static bool is_fifo (mode_t mode); | |
105 static bool is_lnk (mode_t mode); | |
106 static bool is_reg (mode_t mode); | |
107 static bool is_sock (mode_t mode); | |
108 | |
2926 | 109 ino_t ino (void) const { return fs_ino; } |
110 dev_t dev (void) const { return fs_dev; } | |
111 | |
112 nlink_t nlink (void) const { return fs_nlink; } | |
113 | |
114 uid_t uid (void) const { return fs_uid; } | |
115 gid_t gid (void) const { return fs_gid; } | |
116 | |
117 off_t size (void) const { return fs_size; } | |
118 | |
3260 | 119 octave_time atime (void) const { return fs_atime; } |
120 octave_time mtime (void) const { return fs_mtime; } | |
121 octave_time ctime (void) const { return fs_ctime; } | |
2926 | 122 |
123 dev_t rdev (void) const { return fs_rdev; } | |
124 | |
125 long blksize (void) const { return fs_blksize; } | |
126 long blocks (void) const { return fs_blocks; } | |
127 | |
5476 | 128 mode_t mode (void) const { return fs_mode; } |
129 | |
3504 | 130 std::string mode_as_string (void) const; |
2926 | 131 |
132 bool ok (void) const { return initialized && ! fail; } | |
133 | |
3145 | 134 operator bool () const { return ok (); } |
2926 | 135 |
136 bool exists (void) const { return ok (); } | |
137 | |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20792
diff
changeset
|
138 std::string error (void) const { return ok () ? "" : errmsg; } |
2926 | 139 |
140 // Has the file referenced by this object been modified since TIME? | |
3260 | 141 bool is_newer (const octave_time& time) const { return fs_mtime > time; } |
2926 | 142 |
143 // It's nice to be able to hide the file_stat object if we don't | |
144 // really care about it. | |
3504 | 145 static int is_newer (const std::string&, const octave_time&); |
2926 | 146 |
8549 | 147 protected: |
2926 | 148 |
11506
964b7fd379f1
more constructor/destructor fixes
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
149 virtual ~base_file_stat (void) { } |
964b7fd379f1
more constructor/destructor fixes
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
150 |
2926 | 151 // TRUE means we have already called stat. |
152 bool initialized; | |
153 | |
154 // TRUE means the stat for this file failed. | |
155 bool fail; | |
156 | |
157 // If a failure occurs, this contains the system error text. | |
3504 | 158 std::string errmsg; |
2926 | 159 |
160 // file type and permissions | |
161 mode_t fs_mode; | |
162 | |
163 // serial number | |
164 ino_t fs_ino; | |
165 | |
166 // device number | |
167 dev_t fs_dev; | |
168 | |
169 // number of links | |
170 nlink_t fs_nlink; | |
171 | |
172 // user ID of owner | |
173 uid_t fs_uid; | |
174 | |
175 // group ID of owner | |
176 gid_t fs_gid; | |
177 | |
178 // size in bytes, for regular files | |
179 off_t fs_size; | |
180 | |
181 // time of last access | |
3260 | 182 octave_time fs_atime; |
2926 | 183 |
184 // time of last modification | |
3260 | 185 octave_time fs_mtime; |
2926 | 186 |
187 // time of last file status change | |
3260 | 188 octave_time fs_ctime; |
2926 | 189 |
190 // device number for special files | |
191 dev_t fs_rdev; | |
192 | |
193 // best I/O block size | |
194 long fs_blksize; | |
195 | |
196 // number of 512-byte blocks allocated | |
197 long fs_blocks; | |
8549 | 198 }; |
199 | |
200 class | |
201 OCTAVE_API | |
202 file_stat : public base_file_stat | |
203 { | |
204 public: | |
205 | |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20792
diff
changeset
|
206 file_stat (const std::string& n = "", bool fl = true) |
8549 | 207 : base_file_stat (), file_name (n), follow_links (fl) |
208 { | |
209 if (! file_name.empty ()) | |
210 update_internal (); | |
211 } | |
212 | |
213 file_stat (const file_stat& fs) | |
214 : base_file_stat (fs), file_name (fs.file_name), | |
215 follow_links (fs.follow_links) { } | |
216 | |
217 file_stat& operator = (const file_stat& fs) | |
218 { | |
219 if (this != &fs) | |
220 { | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
221 base_file_stat::operator = (fs); |
8549 | 222 |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
223 file_name = fs.file_name; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
224 follow_links = fs.follow_links; |
8549 | 225 } |
226 | |
227 return *this; | |
228 } | |
229 | |
230 ~file_stat (void) { } | |
231 | |
232 void get_stats (bool force = false) | |
233 { | |
234 if (! initialized || force) | |
235 update_internal (force); | |
236 } | |
237 | |
238 void get_stats (const std::string& n, bool force = false) | |
239 { | |
20792
d0991cbd6141
maint: Remove extra spaces in if () conditionals.
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
240 if (n != file_name || ! initialized || force) |
8549 | 241 { |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
242 initialized = false; |
8549 | 243 |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
244 file_name = n; |
8549 | 245 |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
246 update_internal (force); |
8549 | 247 } |
248 } | |
249 | |
250 private: | |
251 | |
252 // Name of the file. | |
253 std::string file_name; | |
254 | |
255 // TRUE means follow symbolic links to the ultimate file (stat). | |
256 // FALSE means get information about the link itself (lstat). | |
257 bool follow_links; | |
2926 | 258 |
259 void update_internal (bool force = false); | |
8549 | 260 }; |
2926 | 261 |
8549 | 262 class |
263 OCTAVE_API | |
264 file_fstat : public base_file_stat | |
265 { | |
266 public: | |
267 | |
268 file_fstat (int n) : base_file_stat (), fid (n) | |
269 { | |
270 update_internal (); | |
271 } | |
272 | |
273 file_fstat (const file_fstat& fs) | |
274 : base_file_stat (fs), fid (fs.fid) { } | |
275 | |
276 file_fstat& operator = (const file_fstat& fs) | |
277 { | |
278 if (this != &fs) | |
279 { | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
280 base_file_stat::operator = (fs); |
8549 | 281 |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
282 fid = fs.fid; |
8549 | 283 } |
284 | |
285 return *this; | |
286 } | |
287 | |
288 ~file_fstat (void) { } | |
289 | |
290 void get_stats (bool force = false) | |
291 { | |
292 if (! initialized || force) | |
293 update_internal (force); | |
294 } | |
295 | |
296 void get_stats (int n, bool force = false) | |
297 { | |
20792
d0991cbd6141
maint: Remove extra spaces in if () conditionals.
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
298 if (n != fid || ! initialized || force) |
8549 | 299 { |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
300 initialized = false; |
8549 | 301 |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
302 fid = n; |
8549 | 303 |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
304 update_internal (force); |
8549 | 305 } |
306 } | |
307 | |
308 private: | |
309 | |
310 // Open file descriptor. | |
311 int fid; | |
312 | |
313 void update_internal (bool force = false); | |
2926 | 314 }; |
315 | |
316 #endif |