]> git.lyx.org Git - lyx.git/blobdiff - src/DepTable.C
Fix working of the spellchecker dialog with ispell when there are no
[lyx.git] / src / DepTable.C
index 60b6e65e9734d0378d22fc07ba682066bf00ddfb..132419b920b4c92007c9b6e1c636c8414bcec27d 100644 (file)
@@ -3,9 +3,9 @@
  * 
  *           LyX, The Document Processor
  *          Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
+ *           Copyright 1995-2001 The LyX Team.
  *
- *           This file is Copyright 1996-2000
+ *           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,
@@ -35,7 +39,7 @@ void DepTable::insert(string const & fi,
        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);
        }
@@ -44,14 +48,14 @@ void DepTable::insert(string const & fi,
 
 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 << " +";
@@ -66,7 +70,7 @@ bool DepTable::sumchange() const
        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;
 }
@@ -78,8 +82,8 @@ bool DepTable::haschanged(string const & f) const
        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;
@@ -91,8 +95,8 @@ bool DepTable::extchanged(string const & ext) const
        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;
                }
        }
@@ -111,13 +115,13 @@ bool DepTable::exist(string const & fil) const
 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);
-       
 }
 
 
@@ -125,17 +129,16 @@ void DepTable::write(string const & f) const
 {
        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;
        }
 }