Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXStat.h
1 /********************************************************************************
2 * *
3 * F i l e S t a t i s t i c s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2005,2022 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXSTAT_H
22 #define FXSTAT_H
23 
24 namespace FX {
25 
26 
27 class FXFile;
28 
29 
31 class FXAPI FXStat {
32 private:
33  FXuint modeFlags;
34  FXuint userNumber;
35  FXuint groupNumber;
36  FXuint linkCount;
37  FXTime createTime;
38  FXTime accessTime;
39  FXTime modifyTime;
40  FXlong fileVolume;
41  FXlong fileIndex;
42  FXlong fileSize;
43 public:
44 
46  FXStat():modeFlags(0),userNumber(0),groupNumber(0),linkCount(0),createTime(0),accessTime(0),modifyTime(0),fileVolume(0),fileIndex(0),fileSize(0){ }
47 
49  FXuint mode() const { return modeFlags; }
50 
52  FXuint user() const { return userNumber; }
53 
55  FXuint group() const { return groupNumber; }
56 
58  FXuint links() const { return linkCount; }
59 
61  FXTime created() const { return createTime; }
62 
64  FXTime accessed() const { return accessTime; }
65 
67  FXTime modified() const { return modifyTime; }
68 
70  FXlong volume() const { return fileVolume; }
71 
73  FXlong index() const { return fileIndex; }
74 
76  FXlong size() const { return fileSize; }
77 
79  FXbool isHidden() const;
80 
82  FXbool isDirectory() const;
83 
85  FXbool isFile() const;
86 
88  FXbool isLink() const;
89 
91  FXbool isSetUid() const;
92 
94  FXbool isSetGid() const;
95 
97  FXbool isSetSticky() const;
98 
100  FXbool isDevice() const;
101 
103  FXbool isCharacter() const;
104 
106  FXbool isBlock() const;
107 
109  FXbool isSocket() const;
110 
112  FXbool isFifo() const;
113 
115  FXbool isReadable() const;
116 
118  FXbool isWritable() const;
119 
121  FXbool isExecutable() const;
122 
124  FXbool isOwnerReadWriteExecute() const;
125 
127  FXbool isOwnerReadable() const;
128 
130  FXbool isOwnerWritable() const;
131 
133  FXbool isOwnerExecutable() const;
134 
136  FXbool isGroupReadWriteExecute() const;
137 
139  FXbool isGroupReadable() const;
140 
142  FXbool isGroupWritable() const;
143 
145  FXbool isGroupExecutable() const;
146 
148  FXbool isOtherReadWriteExecute() const;
149 
151  FXbool isOtherReadable() const;
152 
154  FXbool isOtherWritable() const;
155 
157  FXbool isOtherExecutable() const;
158 
159 
161  static FXbool statFile(const FXString& file,FXStat& info);
162 
164  static FXbool statLink(const FXString& file,FXStat& info);
165 
167  static FXbool stat(const FXFile& file,FXStat& info);
168 
169 
171  static FXuint mode(const FXString& file);
172 
174  static FXbool mode(const FXString& file,FXuint perm);
175 
177  static FXbool exists(const FXString& file);
178 
180  static FXlong size(const FXString& file);
181 
183  static FXlong volume(const FXString& file);
184 
186  static FXlong index(const FXString& file);
187 
189  static FXuint links(const FXString& file);
190 
196  static FXTime modified(const FXString& file);
197 
203  static FXbool modified(const FXString& file,FXTime ns);
204 
209  static FXTime accessed(const FXString& file);
210 
216  static FXbool accessed(const FXString& file,FXTime ns);
217 
224  static FXTime created(const FXString& file);
225 
231  static FXbool created(const FXString& file,FXTime ns);
232 
234  static FXbool isHidden(const FXString& file);
235 
237  static FXbool isFile(const FXString& file);
238 
240  static FXbool isLink(const FXString& file);
241 
243  static FXbool isDirectory(const FXString& file);
244 
246  static FXbool isReadable(const FXString& file);
247 
249  static FXbool isWritable(const FXString& file);
250 
252  static FXbool isExecutable(const FXString& file);
253 
255  static FXbool isOwnerReadWriteExecute(const FXString& file);
256 
258  static FXbool isOwnerReadable(const FXString& file);
259 
261  static FXbool isOwnerWritable(const FXString& file);
262 
264  static FXbool isOwnerExecutable(const FXString& file);
265 
267  static FXbool isGroupReadWriteExecute(const FXString& file);
268 
270  static FXbool isGroupReadable(const FXString& file);
271 
273  static FXbool isGroupWritable(const FXString& file);
274 
276  static FXbool isGroupExecutable(const FXString& file);
277 
279  static FXbool isOtherReadWriteExecute(const FXString& file);
280 
282  static FXbool isOtherReadable(const FXString& file);
283 
285  static FXbool isOtherWritable(const FXString& file);
286 
288  static FXbool isOtherExecutable(const FXString& file);
289 
291  static FXbool isSetUid(const FXString& file);
292 
294  static FXbool isSetGid(const FXString& file);
295 
297  static FXbool isSetSticky(const FXString& file);
298 
301  static FXbool isAccessible(const FXString& file,FXuint m=FXIO::ReadWrite);
302 
304  static FXbool getTotalDiskSpace(const FXString& path,FXulong& space);
305 
307  static FXbool getAvailableDiskSpace(const FXString& path,FXulong& space);
308  };
309 
310 }
311 
312 #endif
FXuint links() const
Return number of links to file.
Definition: FXStat.h:58
Open for writing.
Definition: FXIO.h:43
Statistics about a file or directory.
Definition: FXStat.h:31
FXTime accessed() const
Return time when last accessed, in nanoseconds.
Definition: FXStat.h:64
FXlong size() const
Return file size in bytes.
Definition: FXStat.h:76
FXlong index() const
Return file index number.
Definition: FXStat.h:73
FXuint group() const
Return group number.
Definition: FXStat.h:55
FXTime created() const
Return time when file was created, in nanoseconds.
Definition: FXStat.h:61
FXuint mode() const
Return the mode flags for this file.
Definition: FXStat.h:49
Definition: FX4Splitter.h:28
FXuint user() const
Return user number.
Definition: FXStat.h:52
FXlong volume() const
Return file volume number.
Definition: FXStat.h:70
Low level file access.
Definition: FXFile.h:34
FXStat()
File size.
Definition: FXStat.h:46
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42
FXTime modified() const
Return time when last modified, in nanoseconds.
Definition: FXStat.h:67

Copyright © 1997-2022 Jeroen van der Zijp