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

Method apply

kdevplatform/util/kdevformatfile.cpp:88–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88bool KDevFormatFile::apply()
89{
90 for (const KDevFormatLine& formatLine : std::as_const(m_formatLines)) {
91 if (formatLine.wildcards.isEmpty()) {
92 qStdOut() << "matched \"" << m_origFilePath << "\" without wildcard";
93 return executeCommand(formatLine.command);
94 }
95
96 const QChar dirSeparator = QDir::separator();
97 for (const QString& wildcard : formatLine.wildcards) {
98 const QString pattern = QDir::current().canonicalPath() + dirSeparator + wildcard.trimmed();
99 if (WildcardHelpers::matchSinglePattern(pattern, m_origFilePath)) {
100 qStdOut() << "matched \"" << m_origFilePath << "\" with wildcard \"" << wildcard << '\"';
101 return executeCommand(formatLine.command);
102 }
103 }
104 }
105
106 qStdOut() << formatFileName << ": error: no commands applicable to \"" << m_origFilePath << "\"\n";
107 return false;
108}
109
110bool KDevFormatFile::executeCommand(QString command)
111{

Callers 3

mainFunction · 0.45
applyFormattingFunction · 0.45
runTestMethod · 0.45

Calls 3

matchSinglePatternFunction · 0.85
canonicalPathMethod · 0.80
isEmptyMethod · 0.45

Tested by 2

applyFormattingFunction · 0.36
runTestMethod · 0.36