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