* qt_helpers.cpp:
[lyx.git] / src / DepTable.h
blob7f687ccec233083ff62d2f79d06db74e7733ed53
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.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
10 * Full author contact details are available in file CREDITS.
13 #ifndef DEP_TABLE_H
14 #define DEP_TABLE_H
16 #include "support/FileName.h"
18 #include <map>
19 #include <string>
22 namespace lyx {
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();
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;
65 ///
66 typedef std::map<support::FileName, dep_info> DepList;
67 ///
68 DepList deplist;
72 } // namespace lyx
74 #endif