]> git.lyx.org Git - features.git/blobdiff - src/Chktex.C
clear()->erase() ; lots of using directives for cxx
[features.git] / src / Chktex.C
index dc94696ace1b5a8317eee8d9a2b7a3c89ef74575..0dab6668c32616ce5fe90c9c08b7d61a3ec34d95 100644 (file)
@@ -1,18 +1,19 @@
 /* This file is part of
- * ======================================================
+ * ====================================================== 
  * 
  *           LyX, The Document Processor        
  *          Copyright 1995 Matthias Ettrich
- *           Copyright 1995-1999 The LyX Team.
+ *           Copyright 1995-2000 The LyX Team.
  *
  *           This file is Copyright 1997-1998
  *           Asger Alstrup
  *
- *======================================================
+ * ====================================================== 
  */
 
 #include <config.h>
 
+#include <fstream>
 #include <cstdlib> // atoi
 
 #ifdef __GNUG__
@@ -30,6 +31,9 @@
 #include "support/path.h"
 #include "gettext.h"
 
+using std::ifstream;
+using std::getline;
+
 /*
  * CLASS Chktex
  */
@@ -56,37 +60,26 @@ int Chktex::run(TeXErrors &terr)
 }
 
 
-int Chktex::scanLogFile(TeXErrors &terr)
+int Chktex::scanLogFile(TeXErrors & terr)
 {
        string token;
        int retval = 0;
 
-       LyXLex lex(0, 0);
-
        string tmp = ChangeExtension(file, ".log", true);
 
-       if (!lex.setFile(tmp)) {
-               // Unable to open file. Return at once
-               return -1;
-       }
-
-       while (lex.IsOK()) {
-               if (lex.EatLine())
-                       token = lex.GetString();
-               else // blank line in the file being read
-                       continue;
-
+       ifstream ifs(tmp.c_str());
+       while (getline(ifs, token)) {
                string srcfile, line, pos, warno, warning;
-               token=split(token, srcfile, ':');
-               token=split(token, line, ':');
-               token=split(token, pos, ':');
-               token=split(token, warno, ':');
-               token=split(token, warning, ':');
+               token = split(token, srcfile, ':');
+               token = split(token, line, ':');
+               token = split(token, pos, ':');
+               token = split(token, warno, ':');
+               token = split(token, warning, ':');
 
                int lineno = atoi(line.c_str());
                warno = _("ChkTeX warning id #") + warno;
                terr.insertError(lineno, warno, warning);
-               retval++;
+               ++retval;
        }
        return retval;
 }