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