1 /**
2  * Copyright: Copyright (c) 2011 Jacob Carlborg. All rights reserved.
3  * Authors: Jacob Carlborg, Joakim Brännström (joakim.brannstrom dottli gmx.com)
4  * Version: 1.1+
5  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6  * History:
7  *  1.0 initial release. 2012-01-29 $(BR)
8  *    Jacob Carlborg
9  *
10  *  1.1+ additional features missing compared to cindex.py. 2015-03-07 $(BR)
11  *    Joakim Brännström
12  */
13 
14 module clang.File;
15 
16 import core.stdc.time;
17 
18 import clang.c.Index;
19 
20 import clang.Util;
21 
22 /// The File class represents a particular source file that is part of a translation unit.
23 struct File {
24     mixin CX;
25 
26     /// Returns: the complete file and path name of the file.
27     @property string name() const @trusted {
28         // OK to throw away const because the C functions do not change the ptr.
29         return toD(clang_getFileName(cast(CType) cx));
30     }
31 
32     /// Return the last modification time of the file.
33     @property time_t time() const @trusted {
34         // OK to throw away const because the C functions do not change the ptr.
35         return clang_getFileTime(cast(CType) cx);
36     }
37 
38     string toString() @safe const {
39         return name;
40     }
41 }