]> git.lyx.org Git - lyx.git/blob - src/DepTable.h
"Inter-word Space"
[lyx.git] / src / DepTable.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *           Copyright 1995 Matthias Ettrich
7  *           Copyright 1995-2001 The LyX Team.
8  *
9  *           This file is Copyright 1996-2001
10  *           Lars Gullik Bjønnes
11  *           Ben Stanley
12  *
13  * ======================================================
14  */
15
16 #ifndef DEP_TABLE_H
17 #define DEP_TABLE_H
18
19 #include "LString.h"
20 #include <map>
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(string const & f, bool upd = false);
29         ///
30         void update();
31
32         ///
33         void write(string const & f) const;
34         /// returns true if dep file was read successfully
35         bool read(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(string const & fil) const;
40         /// return true if a file with extension ext has changed.
41         bool extchanged(string const & ext) const;
42         ///
43         bool exist(string const & fil) const;
44         /// returns true if any files with ext exist
45         bool ext_exist(string const & ext) const;
46         ///
47         void remove_files_with_extension(string const &);
48         ///
49         void remove_file(string const &);
50 private:
51         ///
52         struct dep_info {
53                 /// Previously calculated CRC value
54                 unsigned long crc_prev;
55                 /// Current CRC value - only re-computed if mtime has changed.
56                 unsigned long crc_cur;
57                 /// mtime from last time current CRC was calculated.
58                 long mtime_cur;
59                 ///
60                 bool changed() const;
61         };
62         ///
63         typedef std::map<string, dep_info> DepList;
64         ///
65         DepList deplist;
66 };
67
68 #endif