]> git.lyx.org Git - lyx.git/blobdiff - src/Chktex.C
QComboBox::textChanged is a Qt3 support signal only, QComboBox::editTextChanged is...
[lyx.git] / src / Chktex.C
index 33e9d2e683e116b70a0e238d35f56e36b161c61d..09c48a7eabe1a45963a5e7d861c3439839d6df72 100644 (file)
 #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/docstream.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
-#include "support/lyxlib.h"
-#include "support/path.h"
 #include "support/systemcall.h"
 
-#include "support/BoostFormat.h"
+#include <boost/format.hpp>
 
-#include <fstream>
 
-using namespace lyx::support;
+namespace lyx {
+
+using support::changeExtension;
+using support::onlyFilename;
+using support::split;
+using support::Systemcall;
 
-using std::ifstream;
 using std::getline;
+using std::string;
+using std::ifstream;
 
 
 Chktex::Chktex(string const & chktex, string const & f, string const & p)
@@ -42,7 +45,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);
@@ -57,34 +60,36 @@ int Chktex::run(TeXErrors &terr)
 
 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::basic_format<char_type> msg(_("ChkTeX warning id # %1$d"));
 #else
-       string const msg(_("ChkTeX warning id # "));
+       docstring const msg(_("ChkTeX warning id # "));
 #endif
-       ifstream ifs(tmp.c_str());
+       docstring token;
+       // FIXME UNICODE
+       // We have no idea what the encoding of the error file is
+       idocfstream ifs(tmp.c_str());
        while (getline(ifs, token)) {
-               string srcfile;
-               string line;
-               string pos;
-               string warno;
-               string warning;
+               docstring srcfile;
+               docstring line;
+               docstring pos;
+               docstring warno;
+               docstring warning;
                token = split(token, srcfile, ':');
                token = split(token, line, ':');
                token = split(token, pos, ':');
                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);
@@ -94,3 +99,6 @@ int Chktex::scanLogFile(TeXErrors & terr)
        }
        return retval;
 }
+
+
+} // namespace lyx