]> git.lyx.org Git - lyx.git/blob - src/DepTable.h
more latin1..utf8 schanges. all of src/* should be utf8 now
[lyx.git] / src / DepTable.h
1 // -*- C++ -*-
2 /**
3  * \file DepTable.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Jean-Marc Lasgouttes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef DEP_TABLE_H
14 #define DEP_TABLE_H
15
16 #include "support/FileName.h"
17
18 #include <map>
19 #include <string>
20
21
22 namespace lyx {
23
24 ///
25 class DepTable {
26 public:
27         /** This one is a little bit harder since we need the absolute
28           filename. Should we insert files with .sty .cls etc as
29           extension? */
30         void insert(support::FileName const & f, bool upd = false);
31         ///
32         void update();
33
34         ///
35         void write(support::FileName const & f) const;
36         /// returns true if dep file was read successfully
37         bool read(support::FileName const & f);
38         /// returns true if any of the files has changed
39         bool sumchange() const;
40         /// return true if fil has changed.
41         bool haschanged(support::FileName const & fil) const;
42         /// return true if a file with extension ext has changed.
43         bool extchanged(std::string const & ext) const;
44         ///
45         bool exist(support::FileName const & fil) const;
46         /// returns true if any files with ext exist
47         bool ext_exist(std::string const & ext) const;
48         ///
49         void remove_files_with_extension(std::string const &);
50         ///
51         void remove_file(support::FileName const &);
52 private:
53         ///
54         class dep_info {
55         public:
56                 /// Previously calculated CRC value
57                 unsigned long crc_prev;
58                 /// Current CRC value - only re-computed if mtime has changed.
59                 unsigned long crc_cur;
60                 /// mtime from last time current CRC was calculated.
61                 long mtime_cur;
62                 ///
63                 bool changed() const;
64         };
65         ///
66         typedef std::map<support::FileName, dep_info> DepList;
67         ///
68         DepList deplist;
69 };
70
71
72 } // namespace lyx
73
74 #endif