MCPcopy Create free account
hub / github.com/KDE/kdevelop / shouldRenameFile

Method shouldRenameFile

kdevplatform/language/codegen/basicrefactoring.cpp:132–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132bool BasicRefactoring::shouldRenameFile(Declaration* declaration)
133{
134 // only try to rename files when we renamed a class/struct
135 if (!dynamic_cast<ClassDeclaration*>(declaration)) {
136 return false;
137 }
138 const QUrl currUrl = declaration->topContext()->url().toUrl();
139 const QString fileName = currUrl.fileName();
140 const QPair<QString, QString> nameExtensionPair = splitFileAtExtension(fileName);
141 // check whether we renamed something that is called like the document it lives in
142 return nameExtensionPair.first.compare(declaration->identifier().toString(), Qt::CaseInsensitive) == 0;
143}
144
145DocumentChangeSet::ChangeResult BasicRefactoring::applyChanges(const QString& oldName, const QString& newName,
146 DocumentChangeSet& changes, DUContext* context,

Callers 1

textChangedMethod · 0.80

Calls 8

splitFileAtExtensionFunction · 0.85
toUrlMethod · 0.45
urlMethod · 0.45
topContextMethod · 0.45
fileNameMethod · 0.45
compareMethod · 0.45
toStringMethod · 0.45
identifierMethod · 0.45

Tested by

no test coverage detected