]> git.lyx.org Git - lyx.git/blobdiff - src/Chktex.C
* Painter.h:
[lyx.git] / src / Chktex.C
index d3950f7595c04d6d4c36eb27f6710aca2d76132f..fc492f48cdf688f8b6ef8dfe88d2047c72bb10a9 100644 (file)
@@ -1,38 +1,40 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file Chktex.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
- *          Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
+ * \author Asger Alstrup
  *
- *           This file is Copyright 1997-1998
- *           Asger Alstrup
- *
- * ======================================================
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
 #include "Chktex.h"
-#include "LaTeX.h" // TeXErrors
-#include "lyxlex.h"
-#include "debug.h"
 #include "gettext.h"
 
-#include "support/FileInfo.h"
+#include "LaTeX.h" // TeXErrors
+
+#include "support/convert.h"
 #include "support/filetools.h"
-#include "support/systemcall.h"
-#include "support/path.h"
 #include "support/lstrings.h"
+#include "support/systemcall.h"
 
-#include "support/BoostFormat.h"
+#include <boost/format.hpp>
 
 #include <fstream>
 
-using namespace lyx::support;
 
-using std::ifstream;
+namespace lyx {
+
+using support::changeExtension;
+using support::onlyFilename;
+using support::split;
+using support::Systemcall;
+
 using std::getline;
+using std::string;
+using std::ifstream;
 
 
 Chktex::Chktex(string const & chktex, string const & f, string const & p)
@@ -44,7 +46,7 @@ Chktex::Chktex(string const & chktex, string const & f, string const & p)
 int Chktex::run(TeXErrors &terr)
 {
        // run bibtex
-       string log = OnlyFilename(ChangeExtension(file, ".log"));
+       string log = onlyFilename(changeExtension(file, ".log"));
        string tmp = cmd + " -q -v0 -b0 -x " + file + " -o " + log;
        Systemcall one;
        int result = one.startscript(Systemcall::Wait, tmp);
@@ -62,12 +64,12 @@ int Chktex::scanLogFile(TeXErrors & terr)
        string token;
        int retval = 0;
 
-       string const tmp = OnlyFilename(ChangeExtension(file, ".log"));
+       string const tmp = onlyFilename(changeExtension(file, ".log"));
 
 #if USE_BOOST_FORMAT
-       boost::format msg(STRCONV(_("ChkTeX warning id # %1$d")));
+       boost::format msg(to_utf8(_("ChkTeX warning id # %1$d")));
 #else
-       string const msg(_("ChkTeX warning id # "));
+       string const msg(to_utf8(_("ChkTeX warning id # ")));
 #endif
        ifstream ifs(tmp.c_str());
        while (getline(ifs, token)) {
@@ -82,11 +84,11 @@ int Chktex::scanLogFile(TeXErrors & terr)
                token = split(token, warno, ':');
                token = split(token, warning, ':');
 
-               int const lineno = atoi(line);
+               int const lineno = convert<int>(line);
 
 #if USE_BOOST_FORMAT
                msg % warno;
-               terr.insertError(lineno, STRCONV(msg.str()), warning);
+               terr.insertError(lineno, msg.str(), warning);
                msg.clear();
 #else
                terr.insertError(lineno, msg + warno, warning);
@@ -96,3 +98,6 @@ int Chktex::scanLogFile(TeXErrors & terr)
        }
        return retval;
 }
+
+
+} // namespace lyx