]> git.lyx.org Git - features.git/blobdiff - src/Lexer.cpp
'using namespace lyx::support' instead of 'using support::xxx'
[features.git] / src / Lexer.cpp
index ce8de705470bde04ad3f5d76e8710ea8dac34b10..781aa52d15c5784e830a7bd4fde90549e0d979da 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "Lexer.h"
 
-#include "debug.h"
+#include "support/debug.h"
 
 #include "support/convert.h"
 #include "support/filetools.h"
 #include <sstream>
 #include <vector>
 
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 
-using support::compare_ascii_no_case;
-using support::FileName;
-using support::getFormatFromContents;
-using support::isStrDbl;
-using support::isStrInt;
-using support::ltrim;
-using support::makeDisplayPath;
-using support::prefixIs;
-using support::split;
-using support::subst;
-using support::trim;
-
-using std::endl;
-using std::getline;
-using std::lower_bound;
-using std::sort;
-using std::string;
-using std::ios;
-using std::istream;
-using std::ostream;
-
-
 //////////////////////////////////////////////////////////////////////
 //
 // Lexer::Pimpl
@@ -253,30 +233,30 @@ void Lexer::Pimpl::popTable()
 bool Lexer::Pimpl::setFile(FileName const & filename)
 {
        // Check the format of the file.
-       string const format = getFormatFromContents(filename);
+       string const format = filename.guessFormatFromContents();
 
        if (format == "gzip" || format == "zip" || format == "compress") {
-               LYXERR(Debug::LYXLEX) << "lyxlex: compressed" << endl;
+               LYXERR(Debug::LYXLEX, "lyxlex: compressed");
                // The check only outputs a debug message, because it triggers
                // a bug in compaq cxx 6.2, where is_open() returns 'true' for
                // a fresh new filebuf.  (JMarc)
                if (gz_.is_open() || istream::off_type(is.tellg()) > -1)
-                       lyxerr[Debug::LYXLEX] << "Error in LyXLex::setFile: "
-                               "file or stream already set." << endl;
+                       LYXERR(Debug::LYXLEX, "Error in LyXLex::setFile: "
+                               "file or stream already set.");
                gz_.open(filename.toFilesystemEncoding().c_str(), ios::in);
                is.rdbuf(&gz_);
                name = filename.absFilename();
                lineno = 0;
                return gz_.is_open() && is.good();
        } else {
-               LYXERR(Debug::LYXLEX) << "lyxlex: UNcompressed" << endl;
+               LYXERR(Debug::LYXLEX, "lyxlex: UNcompressed");
 
                // The check only outputs a debug message, because it triggers
                // a bug in compaq cxx 6.2, where is_open() returns 'true' for
                // a fresh new filebuf.  (JMarc)
                if (fb_.is_open() || istream::off_type(is.tellg()) > 0) {
-                       LYXERR(Debug::LYXLEX) << "Error in Lexer::setFile: "
-                               "file or stream already set." << endl;
+                       LYXERR(Debug::LYXLEX, "Error in Lexer::setFile: "
+                               "file or stream already set.");
                }
                fb_.open(filename.toFilesystemEncoding().c_str(), ios::in);
                is.rdbuf(&fb_);
@@ -290,8 +270,8 @@ bool Lexer::Pimpl::setFile(FileName const & filename)
 void Lexer::Pimpl::setStream(istream & i)
 {
        if (fb_.is_open() || istream::off_type(is.tellg()) > 0) {
-               LYXERR(Debug::LYXLEX)  << "Error in Lexer::setStream: "
-                       "file or stream already set." << endl;
+               LYXERR(Debug::LYXLEX, "Error in Lexer::setStream: "
+                       "file or stream already set.");
        }
        is.rdbuf(i.rdbuf());
        lineno = 0;
@@ -334,8 +314,7 @@ bool Lexer::Pimpl::next(bool esc /* = false */)
                                string dummy;
                                getline(is, dummy);
 
-                               LYXERR(Debug::LYXLEX) << "Comment read: `" << c
-                                                     << dummy << '\'' << endl;
+                               LYXERR(Debug::LYXLEX, "Comment read: `" << c << dummy << '\'');
 #else
                                // unfortunately ignore is buggy (Lgb)
                                is.ignore(100, '\n');
@@ -423,8 +402,7 @@ bool Lexer::Pimpl::next(bool esc /* = false */)
                                string dummy;
                                getline(is, dummy);
 
-                               LYXERR(Debug::LYXLEX) << "Comment read: `" << c
-                                                     << dummy << '\'' << endl;
+                               LYXERR(Debug::LYXLEX, "Comment read: `" << c << dummy << '\'');
 #else
                                // but ignore is also still buggy (Lgb)
                                // This is fast (Lgb)
@@ -536,8 +514,7 @@ bool Lexer::Pimpl::eatLine()
        while (is && c != '\n') {
                is.get(cc);
                c = cc;
-               //LYXERR(Debug::LYXLEX) << "Lexer::EatLine read char: `"
-               //                    << c << '\'' << endl;
+               //LYXERR(Debug::LYXLEX, "Lexer::EatLine read char: `" << c << '\'');
                if (c != '\r')
                        buff.push_back(c);
        }
@@ -790,8 +767,7 @@ string const Lexer::getLongString(string const & endtoken)
 
                string const token = trim(getString(), " \t");
 
-               LYXERR(Debug::PARSER) << "LongString: `"
-                                     << getString() << '\'' << endl;
+               LYXERR(Debug::PARSER, "LongString: `" << getString() << '\'');
 
                // We do a case independent comparison, like search_kw does.
                if (compare_ascii_no_case(token, endtoken) == 0)
@@ -803,8 +779,7 @@ string const Lexer::getLongString(string const & endtoken)
                        if (i != string::npos)
                                prefix = tmpstr.substr(0, i);
                        firstline = false;
-                       LYXERR(Debug::PARSER)
-                               << "Prefix = `" << prefix << "\'" << endl;
+                       LYXERR(Debug::PARSER, "Prefix = `" << prefix << "\'");
                }
 
                // further lines in long strings may have the same