]> git.tdb.fi Git - libs/core.git/blob - source/fs/stat.h
Style update: remove alignment
[libs/core.git] / source / fs / stat.h
1 #ifndef MSP_FS_STAT_H_
2 #define MSP_FS_STAT_H_
3
4 #include <sys/stat.h>
5 #include "path.h"
6
7 namespace Msp {
8 namespace FS {
9
10 /**
11 Gets information about a file.  Returns 0 on success or -1 on error.  This
12 version can be used to check for file existence and get information in one
13 call.
14 */
15 int stat(const Path &fn, struct stat &st);
16
17 /**
18 Returns information about a file.  This version throws an exception if an error
19 occurs.
20 */
21 struct stat stat(const Path &fn);
22
23 /// Gets information about a file, without following symbolic links
24 int lstat(const Path &fn, struct stat &st);
25
26 /// Returns information about a file, without following symbolic links
27 struct stat lstat(const Path &fn);
28
29 /// Tests for existence of a file
30 bool exists(const Path &path);
31
32 /// Tests whether a path refers to an existing regular file
33 bool is_reg(const Path &path);
34
35 /// Tests whether a path refers to an existing directory
36 bool is_dir(const Path &path);
37
38 /// Tests whether a path refers to a symbolic link
39 bool is_link(const Path &path);
40
41 } // namespace FS
42 } // namespace Msp
43
44 #endif