]> git.lyx.org Git - lyx.git/blob - src/DepTable.h
Extend the navigate menu to child docs
[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 <map>
17 #include <string>
18
19
20 namespace lyx {
21
22 ///
23 class DepTable {
24 public:
25         /** This one is a little bit harder since we need the absolute
26           filename. Should we insert files with .sty .cls etc as
27           extension? */
28         void insert(std::string const & f, bool upd = false);
29         ///
30         void update();
31
32         ///
33         void write(std::string const & f) const;
34         /// returns true if dep file was read successfully
35         bool read(std::string const & f);
36         /// returns true if any of the files has changed
37         bool sumchange() const;
38         /// return true if fil has changed.
39         bool haschanged(std::string const & fil) const;
40         /// return true if a file with extension ext has changed.
41         bool extchanged(std::string const & ext) const;
42         ///
43         bool exist(std::string const & fil) const;
44         /// returns true if any files with ext exist
45         bool ext_exist(std::string const & ext) const;
46         ///
47         void remove_files_with_extension(std::string const &);
48         ///
49         void remove_file(std::string const &);
50 private:
51         ///
52         class dep_info {
53         public:
54                 /// Previously calculated CRC value
55                 unsigned long crc_prev;
56                 /// Current CRC value - only re-computed if mtime has changed.
57                 unsigned long crc_cur;
58                 /// mtime from last time current CRC was calculated.
59                 long mtime_cur;
60                 ///
61                 bool changed() const;
62         };
63         ///
64         typedef std::map<std::string, dep_info> DepList;
65         ///
66         DepList deplist;
67 };
68
69
70 } // namespace lyx
71
72 #endif