]> git.tdb.fi Git - libs/core.git/blob - source/stat.h
Refactor the API
[libs/core.git] / source / 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
13 namespace Msp {
14 namespace FS {
15
16 class Path;
17
18 /**
19 Gets information about a file.  Returns 0 on success or -1 on error.  This
20 version can be used to check for file existence and get information in one
21 call.
22 */
23 int stat(const Path &fn, struct stat &st);
24
25 /**
26 Returns information about a file.  This version throws an exception if an error
27 occurs.
28 */
29 struct stat stat(const Path &fn);
30
31 /// Tests for existence of a file
32 bool exists(const Path &path);
33
34 /// Tests whether a path refers to an existing regular file
35 bool is_reg(const Path &path);
36
37 /// Tests whether a path refers to an existing directory
38 bool is_dir(const Path &path);
39
40 } // namespace FS
41 } // namespace Msp
42
43 #endif