* ======================================================
*
* LyX, The Document Processor
- * Copyright (C) 1995 Matthias Ettrich
- * Copyright (C) 1995-1998 The LyX Team.
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 1995-2001 The LyX Team.
*
- * This file is Copyright (C) 1996-1998
+ * This file is Copyright 1996-2001
* Lars Gullik Bjønnes
*
* ======================================================
#include "DepTable.h"
#include "support/lyxlib.h"
#include "support/filetools.h"
+#include "support/lstrings.h"
#include <fstream>
+#include "debug.h"
+
using std::make_pair;
using std::ofstream;
using std::ifstream;
+using std::endl;
void DepTable::insert(string const & fi,
bool upd,
if (deplist.find(f) == deplist.end()) {
if (upd) {
one = two;
- two = lyx::sum(f.c_str());
+ two = lyx::sum(f);
}
deplist[f] = make_pair(one, two);
}
void DepTable::update()
{
- for(DepList::iterator itr = deplist.begin();
+ for (DepList::iterator itr = deplist.begin();
itr != deplist.end();
++itr) {
- unsigned long one = (*itr).second.second;
- unsigned long two = lyx::sum((*itr).first.c_str());
- (*itr).second = make_pair(one, two);
+ unsigned long const one = itr->second.second;
+ unsigned long const two = lyx::sum(itr->first);
+ itr->second = make_pair(one, two);
if (lyxerr.debugging(Debug::DEPEND)) {
- lyxerr << "Update dep: " << (*itr).first << " "
+ lyxerr << "Update dep: " << itr->first << " "
<< one << " " << two;
if (one != two)
lyxerr << " +";
for (DepList::const_iterator cit = deplist.begin();
cit != deplist.end();
++cit) {
- if ((*cit).second.first != (*cit).second.second) return true;
+ if ((*cit).second.first != cit->second.second) return true;
}
return false;
}
string fil = MakeAbsPath(f);
DepList::const_iterator cit = deplist.find(fil);
if (cit != deplist.end()) {
- if ((*cit).second.first != (*cit).second.second
- && (*cit).second.second != 0)
+ if (cit->second.first != cit->second.second
+ && cit->second.second != 0)
return true;
}
return false;
for (DepList::const_iterator cit = deplist.begin();
cit != deplist.end();
++cit) {
- if (suffixIs((*cit).first, ext.c_str())) {
- if ((*cit).second.first != (*cit).second.second)
+ if (suffixIs(cit->first, ext)) {
+ if (cit->second.first != cit->second.second)
return true;
}
}
void DepTable::remove_files_with_extension(string const & suf)
{
DepList tmp;
- for (DepList::const_iterator cit = deplist.begin();
+ // we want const_iterator (Lgb)
+ for (DepList::iterator cit = deplist.begin();
cit != deplist.end(); ++cit) {
- if (!suffixIs((*cit).first, suf.c_str()))
- tmp[(*cit).first] = (*cit).second;
+ if (!suffixIs(cit->first, suf))
+ tmp[cit->first] = cit->second;
}
deplist.swap(tmp);
-
}
{
ofstream ofs(f.c_str());
for (DepList::const_iterator cit = deplist.begin();
- cit != deplist.end();
- ++cit) {
+ cit != deplist.end(); ++cit) {
if (lyxerr.debugging(Debug::DEPEND)) {
lyxerr << "Write dep: "
- << (*cit).first << " "
- << (*cit).second.first << " "
- << (*cit).second.second << endl;
+ << cit->first << " "
+ << cit->second.first << " "
+ << cit->second.second << endl;
}
- ofs << (*cit).first << " "
- << (*cit).second.first << " "
- << (*cit).second.second << endl;
+ ofs << cit->first << " "
+ << cit->second.first << " "
+ << cit->second.second << endl;
}
}