]> git.lyx.org Git - lyx.git/blob - src/support/filename.C
split LyXText::rowlist_ into individual Paragraph::rows_ chunks
[lyx.git] / src / support / filename.C
1 /**
2  * \file filename.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * This file is part of LyX, the document processor.
9  * Licence details can be found in the file COPYING.
10  */
11
12 #include <config.h>
13
14 #include "filename.h"
15 #include "support/filetools.h"
16
17
18 namespace lyx {
19 namespace support {
20
21
22 FileName::FileName()
23         : save_abs_path_(true)
24 {}
25
26
27 void FileName::set(string const & name, string const & buffer_path)
28 {
29         save_abs_path_ = AbsolutePath(name);
30         name_ = save_abs_path_ ? name : MakeAbsPath(name, buffer_path);
31 }
32
33
34 void FileName::erase()
35 {
36         name_.erase();
37 }
38
39
40 string const FileName::relFilename(string const & path) const
41 {
42         return MakeRelPath(name_, path);
43 }
44
45
46 string const FileName::outputFilename(string const & path) const
47 {
48         return save_abs_path_ ? name_ : MakeRelPath(name_, path);
49 }
50
51
52 bool operator==(FileName const & lhs, FileName const & rhs)
53 {
54         return lhs.absFilename() == rhs.absFilename() &&
55                 lhs.saveAbsPath() == rhs.saveAbsPath();
56 }
57
58
59 bool operator!=(FileName const & lhs, FileName const & rhs)
60 {
61         return !(lhs == rhs);
62 }
63
64 } //namespace support
65 } // namespace lyx