Commit bdf6c3d0 authored by Roberto Raggi's avatar Roberto Raggi

Store the encoded file name in a QString.

parent b3bccbc2
......@@ -80,10 +80,10 @@ public:
void addFormal(const QByteArray &formal)
{ _formals.append(formal); }
QByteArray fileName() const
QString fileName() const
{ return _fileName; }
void setFileName(const QByteArray &fileName)
void setFileName(const QString &fileName)
{ _fileName = fileName; }
unsigned line() const
......@@ -120,7 +120,7 @@ private:
QByteArray _name;
QByteArray _definition;
QVector<QByteArray> _formals;
QByteArray _fileName;
QString _fileName;
unsigned _line;
union
......
......@@ -53,6 +53,7 @@
#include <QList>
#include <QByteArray>
#include <QString>
namespace CPlusPlus {
......@@ -88,7 +89,7 @@ private:
void rehash();
public:
QByteArray currentFile;
QString currentFile;
unsigned currentLine;
bool hideNext;
......
......@@ -564,7 +564,7 @@ void Preprocessor::popState()
_savedStates.removeLast();
}
QByteArray Preprocessor::operator()(const QByteArray &filename,
QByteArray Preprocessor::operator()(const QString &filename,
const QByteArray &source)
{
QByteArray preprocessed;
......@@ -635,7 +635,7 @@ void Preprocessor::processNewline(bool force)
out(QByteArray::number(_dot->lineno));
out(' ');
out('"');
out(env->currentFile);
out(env->currentFile.toUtf8());
out('"');
out('\n');
} else {
......@@ -714,7 +714,7 @@ bool Preprocessor::markGeneratedTokens(bool markGeneratedTokens,
return previous;
}
void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &source,
void Preprocessor::preprocess(const QString &fileName, const QByteArray &source,
QByteArray *result)
{
QByteArray *previousResult = _result;
......@@ -722,7 +722,7 @@ void Preprocessor::preprocess(const QByteArray &fileName, const QByteArray &sour
pushState(createStateFromSource(source));
const QByteArray previousFileName = env->currentFile;
const QString previousFileName = env->currentFile;
env->currentFile = fileName;
const unsigned previousCurrentLine = env->currentLine;
......
......@@ -67,10 +67,10 @@ class CPLUSPLUS_EXPORT Preprocessor
public:
Preprocessor(Client *client, Environment *env);
QByteArray operator()(const QByteArray &filename,
QByteArray operator()(const QString &filename,
const QByteArray &source);
void preprocess(const QByteArray &filename,
void preprocess(const QString &filename,
const QByteArray &source,
QByteArray *result);
......
......@@ -108,7 +108,7 @@ const char *MacroExpander::expand(const char *__first, const char *__last,
__result->append(QByteArray::number(env->currentLine));
__result->append(' ');
__result->append('"');
__result->append(env->currentFile);
__result->append(env->currentFile.toUtf8());
__result->append('"');
__result->append('\n');
++lines;
......@@ -244,16 +244,14 @@ const char *MacroExpander::expand(const char *__first, const char *__last,
{
if (fast_name == "__LINE__")
{
char buf [16];
const size_t count = qsnprintf (buf, 16, "%d", env->currentLine + lines);
__result->append(buf, count);
__result->append(QByteArray::number(env->currentLine + lines));
continue;
}
else if (fast_name == "__FILE__")
{
__result->append('"');
__result->append(env->currentFile);
__result->append(env->currentFile.toUtf8());
__result->append('"');
continue;
}
......
......@@ -761,7 +761,7 @@ CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor,
foreach (const Document::MacroUse use, doc->macroUses()) {
if (use.contains(endOfName - 1)) {
const Macro &macro = use.macro();
link.fileName = QString::fromUtf8(macro.fileName());
link.fileName = macro.fileName();
link.line = macro.line();
link.pos = use.begin();
link.length = use.end() - use.begin();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment