1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/* This file is part of
|
2002-03-21 17:27:08 +00:00
|
|
|
|
* ======================================================
|
|
|
|
|
*
|
1999-09-27 18:44:28 +00:00
|
|
|
|
* LyX, The Document Processor
|
2000-03-09 03:36:48 +00:00
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
2001-05-30 13:53:44 +00:00
|
|
|
|
* Copyright 1995-2001 The LyX Team.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2001-05-30 13:53:44 +00:00
|
|
|
|
* This file is Copyright 1996-2001
|
1999-09-27 18:44:28 +00:00
|
|
|
|
* Lars Gullik Bj<EFBFBD>nnes
|
2002-01-16 22:17:38 +00:00
|
|
|
|
* Ben Stanley
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*
|
2002-03-21 17:27:08 +00:00
|
|
|
|
* ======================================================
|
1999-09-27 18:44:28 +00:00
|
|
|
|
*/
|
|
|
|
|
|
1999-10-02 16:21:10 +00:00
|
|
|
|
#ifndef DEP_TABLE_H
|
|
|
|
|
#define DEP_TABLE_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
#include "LString.h"
|
1999-11-04 01:40:20 +00:00
|
|
|
|
#include <map>
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
|
|
|
|
class DepTable {
|
|
|
|
|
public:
|
|
|
|
|
/** This one is a little bit harder since we need the absolute
|
|
|
|
|
filename. Should we insert files with .sty .cls etc as
|
|
|
|
|
extension? */
|
1999-11-04 01:40:20 +00:00
|
|
|
|
void insert(string const & f,
|
2002-01-16 22:17:38 +00:00
|
|
|
|
bool upd = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
|
|
|
|
void update();
|
|
|
|
|
|
|
|
|
|
///
|
1999-11-26 06:57:35 +00:00
|
|
|
|
void write(string const & f) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-11-26 06:57:35 +00:00
|
|
|
|
void read(string const & f);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// returns true if any of the files has changed
|
1999-11-26 06:57:35 +00:00
|
|
|
|
bool sumchange() const;
|
1999-11-04 01:40:20 +00:00
|
|
|
|
/// return true if fil has changed.
|
1999-11-26 06:57:35 +00:00
|
|
|
|
bool haschanged(string const & fil) const;
|
1999-11-04 01:40:20 +00:00
|
|
|
|
/// return true if a file with extension ext has changed.
|
1999-11-26 06:57:35 +00:00
|
|
|
|
bool extchanged(string const & ext) const;
|
|
|
|
|
///
|
|
|
|
|
bool exist(string const & fil) const;
|
2002-01-16 22:17:38 +00:00
|
|
|
|
/// returns true if any files with ext exist
|
2002-03-12 17:15:44 +00:00
|
|
|
|
bool ext_exist(string const & ext) const;
|
1999-11-26 06:57:35 +00:00
|
|
|
|
///
|
|
|
|
|
void remove_files_with_extension(string const &);
|
2002-01-16 22:17:38 +00:00
|
|
|
|
///
|
|
|
|
|
void remove_file(string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
private:
|
|
|
|
|
///
|
2001-11-27 02:56:55 +00:00
|
|
|
|
struct dep_info {
|
2002-01-16 22:17:38 +00:00
|
|
|
|
/// Previously calculated CRC value
|
|
|
|
|
unsigned long crc_prev;
|
|
|
|
|
/// Current CRC value - only re-computed if mtime has changed.
|
|
|
|
|
unsigned long crc_cur;
|
|
|
|
|
/// mtime from last time current CRC was calculated.
|
|
|
|
|
long mtime_cur;
|
|
|
|
|
///
|
|
|
|
|
bool changed() const;
|
2001-11-27 02:56:55 +00:00
|
|
|
|
};
|
|
|
|
|
///
|
|
|
|
|
typedef std::map<string, dep_info> DepList;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-11-04 01:40:20 +00:00
|
|
|
|
DepList deplist;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|