Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

kdevplatform: less auto-casting from/to ascii & from bytearray

Reviewed By: kfunk

Subscribers: kfunk, kdevelop-devel

Differential Revision: https://phabricator.kde.org/D8512
parent 4460a8b3
......@@ -40,7 +40,7 @@ static const char* const BREAKPOINT_KINDS[Breakpoint::LastBreakpointKind] = {
static Breakpoint::BreakpointKind stringToKind(const QString& kindString)
{
for (int i = 0; i < Breakpoint::LastBreakpointKind; ++i) {
if (BREAKPOINT_KINDS[i] == kindString) {
if (kindString == QLatin1String(BREAKPOINT_KINDS[i])) {
return (Breakpoint::BreakpointKind)i;
}
}
......@@ -100,7 +100,7 @@ bool Breakpoint::setData(int index, const QVariant& value)
{
QString s = value.toString();
if (index == LocationColumn) {
QRegExp rx("^(.+):([0-9]+)$");
QRegExp rx(QStringLiteral("^(.+):([0-9]+)$"));
int idx = rx.indexIn(s);
if (m_kind == CodeBreakpoint && idx != -1) {
m_url = QUrl::fromLocalFile(rx.cap(1));
......@@ -171,7 +171,7 @@ QVariant Breakpoint::data(int column, int role) const
if (column == TypeColumn && role == Qt::DisplayRole)
{
return BREAKPOINT_KINDS[m_kind];
return QLatin1String(BREAKPOINT_KINDS[m_kind]);
}
if (column == ConditionColumn && (role == Qt::DisplayRole || role == Qt::EditRole)) {
......@@ -187,7 +187,7 @@ QVariant Breakpoint::data(int column, int role) const
} else {
ret = m_url.toDisplayString(QUrl::PreferLocalFile | QUrl::StripTrailingSlash);
}
ret += ':' + QString::number(m_line+1);
ret += QLatin1Char(':') + QString::number(m_line+1);
} else {
ret = m_expression;
}
......
......@@ -213,7 +213,7 @@ BreakpointModel::headerData(int section, Qt::Orientation orientation,
}
if (role == Qt::DisplayRole) {
if (section == 0 || section == 1) return "";
if (section == 0 || section == 1) return QString();
if (section == 2) return i18n("Type");
if (section == 3) return i18n("Location");
if (section == 4) return i18n("Condition");
......
......@@ -205,7 +205,7 @@ QVariant FrameStackModel::data(const QModelIndex& index, int role) const
QString ret = ICore::self()->projectController()
->prettyFileName(frame.file, IProjectController::FormatPlain);
if (frame.line != -1) {
ret += ':' + QString::number(frame.line + 1);
ret += QLatin1Char(':') + QString::number(frame.line + 1);
}
return ret;
} else if (role == Qt::DecorationRole) {
......
......@@ -188,9 +188,9 @@ public:
: TreeItem(model, parent)
{
QVector<QVariant> data;
data.push_back("...");
data.push_back(QVariant(QStringLiteral("...")));
for (int i = 1; i < model->columnCount(QModelIndex()); ++i)
data.push_back("");
data.push_back(QString());
setData(data);
}
......
......@@ -154,7 +154,7 @@ public:
{
QString ext;
if( extension.isEmpty() ) {
ext = qobject_interface_iid<Extension*>();
ext = QString::fromUtf8(qobject_interface_iid<Extension*>());
} else {
ext = extension;
}
......
......@@ -103,7 +103,7 @@ void SourceFormatterStyle::setMimeTypes(const SourceFormatterStyle::MimeList& ty
void SourceFormatterStyle::setMimeTypes(const QStringList& types)
{
foreach ( auto& t, types ) {
auto items = t.split('|');
auto items = t.split(QLatin1Char('|'));
if ( items.size() != 2 ) {
continue;
}
......@@ -167,10 +167,7 @@ QString ISourceFormatter::optionMapToString(const QMap<QString, QVariant> &map)
QString options;
QMap<QString, QVariant>::const_iterator it = map.constBegin();
for (; it != map.constEnd(); ++it) {
options += it.key();
options += '=';
options += it.value().toString();
options += ',';
options += it.key() + QLatin1Char('=') + it.value().toString() + QLatin1Char(',');
}
return options;
}
......@@ -178,10 +175,10 @@ QString ISourceFormatter::optionMapToString(const QMap<QString, QVariant> &map)
QMap<QString, QVariant> ISourceFormatter::stringToOptionMap(const QString &options)
{
QMap<QString, QVariant> map;
QStringList pairs = options.split(',', QString::SkipEmptyParts);
QStringList pairs = options.split(QLatin1Char(','), QString::SkipEmptyParts);
QStringList::const_iterator it;
for (it = pairs.constBegin(); it != pairs.constEnd(); ++it) {
QStringList bits = (*it).split('=');
const QStringList bits = (*it).split(QLatin1Char('='));
map[bits[0]] = bits[1];
}
return map;
......@@ -191,7 +188,7 @@ QString ISourceFormatter::missingExecutableMessage(const QString &name)
{
return i18n("The executable %1 cannot be found. Please make sure"
" it is installed and can be executed. <br />"
"The plugin will not work until you fix this problem.", "<b>" + name + "</b>");
"The plugin will not work until you fix this problem.", QLatin1String("<b>") + name + QLatin1String("</b>"));
}
}
......
......@@ -139,7 +139,7 @@ void RenameAssistant::textChanged(KTextEditor::Document* doc, const KTextEditor:
return;
//If the inserted text isn't valid for a variable name, consider the editing ended
QRegExp validDeclName("^[0-9a-zA-Z_]*$");
QRegExp validDeclName(QStringLiteral("^[0-9a-zA-Z_]*$"));
if (removedText.isEmpty() && !validDeclName.exactMatch(doc->text(invocationRange))) {
d->reset();
return;
......
......@@ -163,8 +163,8 @@ void DocumentChangeTracker::updateChangedRange(int delay)
static Cursor cursorAdd(Cursor c, const QString& text)
{
c.setLine(c.line() + text.count('\n'));
c.setColumn(c.column() + (text.length() - qMin(0, text.lastIndexOf('\n'))));
c.setLine(c.line() + text.count(QLatin1Char('\n')));
c.setColumn(c.column() + (text.length() - qMin(0, text.lastIndexOf(QLatin1Char('\n')))));
return c;
}
......
......@@ -132,7 +132,7 @@ QVariant ClassModel::data(const QModelIndex& index, int role) const
QVariant ClassModel::headerData(int, Qt::Orientation, int role) const
{
if ( role == Qt::DisplayRole )
return "Class";
return QStringLiteral("Class");
return QVariant();
}
......
......@@ -299,9 +299,9 @@ FunctionNode::FunctionNode(Declaration* a_decl, NodesModelInterface* a_model)
ClassFunctionDeclaration* classmember = dynamic_cast<ClassFunctionDeclaration*>(a_decl);
if ( classmember ) {
if ( classmember->isConstructor() || classmember->isDestructor() )
m_sortableString = '0' + m_displayName;
m_sortableString = QLatin1Char('0') + m_displayName;
else
m_sortableString = '1' + m_displayName;
m_sortableString = QLatin1Char('1') + m_displayName;
}
else {
m_sortableString = m_displayName;
......
......@@ -29,7 +29,7 @@ typedef PushValue<int> IntPusher;
///Extracts the last line from the given string
QString CodeCompletionContext::extractLastLine(const QString& str) {
int prevLineEnd = str.lastIndexOf('\n');
int prevLineEnd = str.lastIndexOf(QLatin1Char('\n'));
if(prevLineEnd != -1)
return str.mid(prevLineEnd+1);
else
......
......@@ -51,26 +51,26 @@ void insertFunctionParenText(KTextEditor::View* view, const KTextEditor::Cursor&
//Need to have a paren behind
QString suffix = view->document()->text( KTextEditor::Range( pos, pos + KTextEditor::Cursor(1, 0) ) );
if( suffix.trimmed().startsWith('(') ) {
if (suffix.trimmed().startsWith(QLatin1Char('('))) {
//Move the cursor behind the opening paren
if( view )
view->setCursorPosition( pos + KTextEditor::Cursor( 0, suffix.indexOf('(')+1 ) );
view->setCursorPosition(pos + KTextEditor::Cursor(0, suffix.indexOf(QLatin1Char('(')) + 1));
}else{
//We need to insert an opening paren
QString openingParen;
if( spaceBeforeParen )
openingParen = QStringLiteral(" (");
else
openingParen = '(';
openingParen = QLatin1Char('(');
if( spaceBetweenParens && (haveArguments || spaceBetweenEmptyParens) )
openingParen += ' ';
openingParen += QLatin1Char(' ');
QString closingParen;
if( spaceBetweenParens && (haveArguments) ) {
closingParen = QStringLiteral(" )");
} else
closingParen = ')';
closingParen = QLatin1Char(')');
KTextEditor::Cursor jumpPos = pos + KTextEditor::Cursor( 0, openingParen.length() );
......@@ -79,8 +79,8 @@ void insertFunctionParenText(KTextEditor::View* view, const KTextEditor::Cursor&
if (IntegralType::Ptr type = funcType->returnType().cast<IntegralType>()) {
if (type->dataType() == IntegralType::TypeVoid) {
const QChar nextChar = view->document()->characterAt(pos);
if (nextChar != ';' && nextChar != ')' && nextChar != ',') {
closingParen += ';';
if (nextChar != QLatin1Char(';') && nextChar != QLatin1Char(')') && nextChar != QLatin1Char(',')) {
closingParen += QLatin1Char(';');
}
}
}
......
......@@ -111,7 +111,7 @@ void CodeCompletionWorker::computeCompletions(const KDevelop::DUContextPointer&
}
if( position.column() == 0 ) //Seems like when the cursor is a the beginning of a line, kate does not give the \n
text += '\n';
text += QLatin1Char('\n');
if (aborting()) {
failed();
......
......@@ -156,7 +156,7 @@ QVariant NormalDeclarationCompletionItem::data(const QModelIndex& index, int rol
if(!m_declaration->context()->owner()->identifier().isEmpty())
return shortenedTypeString(DeclarationPointer(m_declaration->context()->owner()), desiredTypeLength);
else
return "enum";
return QStringLiteral("enum");
}
}
if (FunctionType::Ptr functionType = m_declaration->type<FunctionType>()) {
......@@ -171,17 +171,17 @@ QVariant NormalDeclarationCompletionItem::data(const QModelIndex& index, int rol
}else if(argumentHintDepth()) {
return QString();//Don't show useless prefixes in the argument-hints
}else if(funDecl && funDecl->isConstructor() )
return "<constructor>";
return QStringLiteral("<constructor>");
else if(funDecl && funDecl->isDestructor() )
return "<destructor>";
return QStringLiteral("<destructor>");
else
return "<incomplete type>";
return QStringLiteral("<incomplete type>");
} else {
return shortenedTypeString(m_declaration, desiredTypeLength);
}
} else {
return "<incomplete type>";
return QStringLiteral("<incomplete type>");
}
} else if (index.column() == CodeCompletionModel::Arguments) {
if (m_declaration->isFunctionDeclaration()) {
......
......@@ -173,7 +173,7 @@ void ApplyChangesWidgetPrivate::createEditPart(const IndexedString & file)
CodeRepresentation::Ptr repr = createCodeRepresentation(file);
if(!repr->fileExists())
{
const QString templateName = QDir::tempPath() + QLatin1Char('/') + url.fileName().split('.').last();
const QString templateName = QDir::tempPath() + QLatin1Char('/') + url.fileName().split(QLatin1Char('.')).last();
QTemporaryFile * temp(new QTemporaryFile(templateName));
temp->open();
temp->write(repr->text().toUtf8());
......
......@@ -101,5 +101,5 @@ QString ArchiveTemplateLocation::templateContents(const QString& name) const
{
const KArchiveFile* file = dynamic_cast<const KArchiveFile*>(m_directory->entry(name));
Q_ASSERT(file);
return file->data();
return QString::fromUtf8(file->data());
}
......@@ -52,7 +52,7 @@ namespace {
QPair<QString, QString> splitFileAtExtension(const QString& fileName)
{
int idx = fileName.indexOf('.');
int idx = fileName.indexOf(QLatin1Char('.'));
if (idx == -1) {
return qMakePair(fileName, QString());
}
......
......@@ -44,7 +44,7 @@ QString CodeRepresentation::rangeText(const KTextEditor::Range& range) const
QString rangedText = line(range.start().line()).mid(range.start().column());
for(int i = range.start().line() + 1; i <= range.end().line(); ++i)
rangedText += '\n' + ((i == range.end().line()) ? line(i).left(range.end().column()) : line(i));
rangedText += QLatin1Char('\n') + ((i == range.end().line()) ? line(i).left(range.end().column()) : line(i));
return rangedText;
}
......@@ -64,8 +64,8 @@ static void grepLine(const QString& identifier, const QString& lineText, int lin
pos += identifier.length();
int end = pos;
if(!surroundedByBoundary || ( (end == lineText.length() || !lineText[end].isLetterOrNumber() || lineText[end] != '_')
&& (start-1 < 0 || !lineText[start-1].isLetterOrNumber() || lineText[start-1] != '_')) )
if (!surroundedByBoundary || ( (end == lineText.length() || !lineText[end].isLetterOrNumber() || lineText[end] != QLatin1Char('_'))
&& (start-1 < 0 || !lineText[start-1].isLetterOrNumber() || lineText[start-1] != QLatin1Char('_'))) )
{
ret << KTextEditor::Range(lineNumber, start, lineNumber, end);
}
......@@ -158,7 +158,7 @@ class FileCodeRepresentation : public CodeRepresentation {
QFile file( localFile );
if ( file.open(QIODevice::ReadOnly) ) {
data = QString::fromLocal8Bit(file.readAll());
lineData = data.split('\n');
lineData = data.split(QLatin1Char('\n'));
}
m_exists = file.exists();
}
......@@ -228,7 +228,7 @@ class ArtificialStringData : public QSharedData {
}
void setData(const QString& data) {
m_data = data;
m_lineData = m_data.split('\n');
m_lineData = m_data.split(QLatin1Char('\n'));
}
QString data() const {
return m_data;
......
......@@ -379,7 +379,7 @@ DocumentChangeSet::ChangeResult DocumentChangeSetPrivate::generateNewText(const
}
//Create the actual new modified file
QStringList textLines = repr->text().split('\n');
QStringList textLines = repr->text().split(QLatin1Char('\n'));
QUrl url = file.toUrl();
......@@ -406,8 +406,8 @@ DocumentChangeSet::ChangeResult DocumentChangeSetPrivate::generateNewText(const
if(formatPolicy == DocumentChangeSet::AutoFormatChangesKeepIndentation) {
// Reproduce the previous indentation
QStringList oldLines = oldNewText.split('\n');
QStringList newLines = change.m_newText.split('\n');
QStringList oldLines = oldNewText.split(QLatin1Char('\n'));
QStringList newLines = change.m_newText.split(QLatin1Char('\n'));
if(oldLines.size() == newLines.size()) {
for(int line = 0; line < newLines.size(); ++line) {
......
......@@ -39,7 +39,7 @@ using namespace KDevelop;
/// @param base String such as 'public QObject' or 'QObject'
InheritanceDescription descriptionFromString(const QString& base)
{
QStringList splitBase = base.split(' ');
QStringList splitBase = base.split(QLatin1Char(' '));
QString identifier = splitBase.takeLast();
QString inheritanceMode = splitBase.join(QStringLiteral(" "));
......@@ -159,8 +159,8 @@ QUrl TemplateClassGenerator::fileUrl(const QString& outputFile) const
void TemplateClassGenerator::setFileUrl(const QString& outputFile, const QUrl& url)
{
d->fileUrls.insert(outputFile, url);
d->renderer.addVariable("output_file_" + outputFile.toLower(), QDir(d->baseUrl.path()).relativeFilePath(url.path()));
d->renderer.addVariable("output_file_" + outputFile.toLower() + "_absolute", url.toLocalFile());
d->renderer.addVariable(QLatin1String("output_file_") + outputFile.toLower(), QDir(d->baseUrl.path()).relativeFilePath(url.path()));
d->renderer.addVariable(QLatin1String("output_file_") + outputFile.toLower() + QLatin1String("_absolute"), url.toLocalFile());
}
KTextEditor::Cursor TemplateClassGenerator::filePosition(const QString& outputFile) const
......
......@@ -132,9 +132,8 @@ QString TemplateRenderer::render(const QString& content, const QString& name) co
d->errorString.clear();
}
if (d->emptyLinesPolicy == TrimEmptyLines && output.contains('\n'))
{
QStringList lines = output.split('\n', QString::KeepEmptyParts);
if (d->emptyLinesPolicy == TrimEmptyLines && output.contains(QLatin1Char('\n'))) {
QStringList lines = output.split(QLatin1Char('\n'), QString::KeepEmptyParts);
QMutableStringListIterator it(lines);
// Remove empty lines from the start of the document
......@@ -201,7 +200,7 @@ QString TemplateRenderer::render(const QString& content, const QString& name) co
}
else if (d->emptyLinesPolicy == RemoveEmptyLines)
{
QStringList lines = output.split('\n', QString::SkipEmptyParts);
QStringList lines = output.split(QLatin1Char('\n'), QString::SkipEmptyParts);
QMutableStringListIterator it(lines);
while (it.hasNext())
{
......@@ -226,7 +225,7 @@ QString TemplateRenderer::renderFile(const QUrl& url, const QString& name) const
QFile file(url.toLocalFile());
file.open(QIODevice::ReadOnly);
QString content(file.readAll());
const QString content = QString::fromUtf8(file.readAll());
qCDebug(LANGUAGE) << content;
return render(content, name);
......@@ -260,14 +259,14 @@ DocumentChangeSet TemplateRenderer::renderFileTemplate(const SourceFileTemplate&
DocumentChangeSet changes;
const QDir baseDir(baseUrl.path());
QRegExp nonAlphaNumeric("\\W");
QRegExp nonAlphaNumeric(QStringLiteral("\\W"));
for (QHash<QString,QUrl>::const_iterator it = fileUrls.constBegin(); it != fileUrls.constEnd(); ++it)
{
QString cleanName = it.key().toLower();
cleanName.replace(nonAlphaNumeric, QStringLiteral("_"));
const QString path = it.value().toLocalFile();
addVariable("output_file_" + cleanName, baseDir.relativeFilePath(path));
addVariable("output_file_" + cleanName + "_absolute", path);
addVariable(QLatin1String("output_file_") + cleanName, baseDir.relativeFilePath(path));
addVariable(QLatin1String("output_file_") + cleanName + QLatin1String("_absolute"), path);
}
const KArchiveDirectory* directory = fileTemplate.directory();
......@@ -292,7 +291,7 @@ DocumentChangeSet TemplateRenderer::renderFileTemplate(const SourceFileTemplate&
IndexedString document(url);
KTextEditor::Range range(KTextEditor::Cursor(0, 0), 0);
DocumentChange change(document, range, QString(), render(file->data(), outputFile.identifier));
DocumentChange change(document, range, QString(), render(QString::fromUtf8(file->data()), outputFile.identifier));
changes.addChange(change);
qCDebug(LANGUAGE) << "Added change for file" << document.str();
}
......
......@@ -93,8 +93,8 @@ public:
TemplatesModelPrivate::TemplatesModelPrivate(const QString& _typePrefix)
: typePrefix(_typePrefix)
{
if (!typePrefix.endsWith('/')) {
typePrefix.append('/');
if (!typePrefix.endsWith(QLatin1Char('/'))) {
typePrefix.append(QLatin1Char('/'));
}
}
......@@ -126,7 +126,7 @@ void TemplatesModel::refresh()
}
QStringList templateDescriptions;
const QStringList templatePaths = {QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +'/'+ d->resourceFilter(TemplatesModelPrivate::Description)};
const QStringList templatePaths = {QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + d->resourceFilter(TemplatesModelPrivate::Description)};
foreach(const QString& templateDescription, templatePaths) {
const QStringList files = QDir(templateDescription).entryList(QDir::Files);
foreach(const QString& file, files) {
......@@ -167,7 +167,7 @@ void TemplatesModel::refresh()
QStandardItem *TemplatesModelPrivate::createItem(const QString& name, const QString& category, QStandardItem* parent)
{
QStringList path = category.split('/');
QStringList path = category.split(QLatin1Char('/'));
QStringList currentPath;
foreach (const QString& entry, path)
......@@ -205,7 +205,7 @@ void TemplatesModelPrivate::extractTemplateDescriptions()
}
}
QString localDescriptionsDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +'/'+ resourceFilter(Description);
QString localDescriptionsDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + resourceFilter(Description);
QDir dir(localDescriptionsDir);
if(!dir.exists())
......@@ -308,10 +308,10 @@ void TemplatesModelPrivate::extractTemplateDescriptions()
QModelIndexList TemplatesModel::templateIndexes(const QString& fileName) const
{
QFileInfo info(fileName);
QString description = QStandardPaths::locate(QStandardPaths::GenericDataLocation, d->resourceFilter(TemplatesModelPrivate::Description, info.baseName() + ".kdevtemplate"));
QString description = QStandardPaths::locate(QStandardPaths::GenericDataLocation, d->resourceFilter(TemplatesModelPrivate::Description, info.baseName() + QLatin1String(".kdevtemplate")));
if (description.isEmpty())
{
description = QStandardPaths::locate(QStandardPaths::GenericDataLocation, d->resourceFilter(TemplatesModelPrivate::Description, info.baseName() + ".desktop"));
description = QStandardPaths::locate(QStandardPaths::GenericDataLocation, d->resourceFilter(TemplatesModelPrivate::Description, info.baseName() + QLatin1String(".desktop")));
}
QModelIndexList indexes;
......@@ -320,19 +320,19 @@ QModelIndexList TemplatesModel::templateIndexes(const QString& fileName) const
{
KConfig templateConfig(description);
KConfigGroup general(&templateConfig, "General");
QStringList categories = general.readEntry("Category").split('/');
QStringList categories = general.readEntry("Category").split(QLatin1Char('/'));
QStringList levels;
foreach (const QString& category, categories)
{
levels << category;
indexes << d->templateItems[levels.join(QString('/'))]->index();
indexes << d->templateItems[levels.join(QStringLiteral("/"))]->index();
}
if (!indexes.isEmpty())
{
QString name = general.readEntry("Name");
QStandardItem* categoryItem = d->templateItems[levels.join(QString('/'))];
QStandardItem* categoryItem = d->templateItems[levels.join(QStringLiteral("/"))];
for (int i = 0; i < categoryItem->rowCount(); ++i)
{
QStandardItem* templateItem = categoryItem->child(i);
......@@ -361,7 +361,7 @@ void TemplatesModel::addDataPath(const QString& path)
QString TemplatesModel::loadTemplateFile(const QString& fileName)
{
QString saveLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +'/'+ d->resourceFilter(TemplatesModelPrivate::Template);
QString saveLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + d->resourceFilter(TemplatesModelPrivate::Template);
QDir dir(saveLocation);
if(!dir.exists())
......
......@@ -186,7 +186,7 @@ bool ClassFunctionDeclaration::isDestructor() const
{
DUContext* ctx = context();
QString id = identifier().toString();
return ctx && ctx->type() == DUContext::Class && id.startsWith('~') && id.mid(1) == ctx->localScopeIdentifier().top().toString();
return ctx && ctx->type() == DUContext::Class && id.startsWith(QLatin1Char('~')) && id.mid(1) == ctx->localScopeIdentifier().top().toString();
}
uint ClassFunctionDeclaration::additionalIdentity() const
......
......@@ -181,7 +181,7 @@ void Declaration::setComment(const QByteArray& str) {
if(str.isEmpty())
d->m_comment = 0;
else
d->m_comment = commentRepository().index(Repositories::StringRepositoryItemRequest(str, IndexedString::hashString(str, str.length()), str.length()));
d->m_comment = commentRepository().index(Repositories::StringRepositoryItemRequest(str.constData(), IndexedString::hashString(str.constData(), str.length()), str.length()));
}
void Declaration::setComment(const QString& str) {
......
......@@ -310,7 +310,7 @@ public:
///Loading of some static data:
{
///@todo Solve this more duchain-like
QFile f(globalItemRepositoryRegistry().path() + "/parsing_environment_data");
QFile f(globalItemRepositoryRegistry().path() + QLatin1String("/parsing_environment_data"));
bool opened = f.open(QIODevice::ReadOnly);
///FIXME: ugh, so ugly
ParsingEnvironmentFile::m_staticData = reinterpret_cast<StaticParsingEnvironmentData*>( new char[sizeof(StaticParsingEnvironmentData)]);
......@@ -327,7 +327,7 @@ public:
///Read in the list of available top-context indices
{
QFile f(globalItemRepositoryRegistry().path() + "/available_top_context_indices");
QFile f(globalItemRepositoryRegistry().path() + QLatin1String("/available_top_context_indices"));
bool opened = f.open(QIODevice::ReadOnly);
if(opened)
{
......@@ -861,7 +861,7 @@ public:
//Store the static parsing-environment file data
///@todo Solve this more elegantly, using a general mechanism to store static duchain-like data
Q_ASSERT(ParsingEnvironmentFile::m_staticData);
QFile f(globalItemRepositoryRegistry().path() + "/parsing_environment_data");
QFile f(globalItemRepositoryRegistry().path() + QLatin1String("/parsing_environment_data"));
bool opened = f.open(QIODevice::WriteOnly);
Q_ASSERT(opened);
Q_UNUSED(opened);
......@@ -872,7 +872,7 @@ public:
{
QMutexLocker lock(&m_chainsMutex);
QFile f(globalItemRepositoryRegistry().path() + "/available_top_context_indices");
QFile f(globalItemRepositoryRegistry().path() + QLatin1String("/available_top_context_indices"));
bool opened = f.open(QIODevice::WriteOnly);
Q_ASSERT(opened);
Q_UNUSED(opened);
......
......@@ -139,10 +139,10 @@ QString DumpDotGraphPrivate::dotGraphInternal(KDevelop::DUContext* context, bool
label = QStringLiteral("unknown file");
}
if(topCtx->parsingEnvironmentFile() && topCtx->parsingEnvironmentFile()->isProxyContext())
label = "Proxy-context " + label;
label = QLatin1String("Proxy-context ") + label;
}else{
label = /*"context " + */context->localScopeIdentifier().toString();
label += ' ' + rangeToString(context->range().castToSimpleRange());
label += QLatin1Char(' ') + rangeToString(context->range().castToSimpleRange());
}
//label = QStringLiteral("%1 ").arg((size_t)context) + label;
......@@ -158,11 +158,11 @@ QString DumpDotGraphPrivate::dotGraphInternal(KDevelop::DUContext* context, bool
stream << dotGraphInternal(parent.context(m_topContext), false, true);
QString label = QStringLiteral("imports");
if( (!dynamic_cast<TopDUContext*>(parent.context(m_topContext)) || !dynamic_cast<TopDUContext*>(context)) && !(parent.context(m_topContext)->url() == context->url()) ) {
label += " from " + parent.context(m_topContext)->url().toUrl().fileName()
+ " to " + context->url().toUrl().fileName();
label += QLatin1String(" from ") + parent.context(m_topContext)->url().toUrl().fileName()
+ QLatin1String(" to ") + context->url().toUrl().fileName();
}
stream << shortLabel(context) << " -> " << shortLabel(parent.context(m_topContext)) << "[style=dotted,label=\"" << label << "\"];\n";
stream << shortLabel(context) << QLatin1String(" -> ") << shortLabel(parent.context(m_topContext)) << QLatin1String("[style=dotted,label=\"") << label << QLatin1String("\"];\n");
}
}
......@@ -172,7 +172,7 @@ QString DumpDotGraphPrivate::dotGraphInternal(KDevelop::DUContext* context, bool
if( !shortened ) {