C++: Remove unneeded qualifications

Mostly done using the following ruby script:
Dir.glob('**/*.cpp').each { |file|
  next if file =~ %r{src/shared/qbs|/qmljs/}
  s = File.read(file)
  s.scan(/^using namespace (.*);$/) {
    ns = $1
    t = s.gsub(/^(.*)\b#{ns}::((?!Const)[A-Z])/) { |m|
      before = $1
      char = $2
      if before =~ /"|\/\/|\\|using|SIGNAL|SLOT|Q_/
        m
      else
        before + char
      end
    }
    if t != s
      puts file
      File.open(file, 'w').write(t)
    end
  }
}

Change-Id: I6fbe13ddc1485efe95c3156097bf41d90c0febac
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-02-04 17:01:07 +02:00
committed by Orgad Shaneh
parent f5225c0928
commit 65e7db42b8
54 changed files with 303 additions and 305 deletions

View File

@@ -107,7 +107,7 @@ void CppQtStyleIndenter::indentBlock(QTextDocument *doc,
{
Q_UNUSED(doc)
CppTools::QtStyleCodeFormatter codeFormatter(tabSettings, codeStyleSettings());
QtStyleCodeFormatter codeFormatter(tabSettings, codeStyleSettings());
codeFormatter.updateStateUntil(block);
int indent;
@@ -140,7 +140,7 @@ void CppQtStyleIndenter::indent(QTextDocument *doc,
QTextBlock block = doc->findBlock(cursor.selectionStart());
const QTextBlock end = doc->findBlock(cursor.selectionEnd()).next();
CppTools::QtStyleCodeFormatter codeFormatter(tabSettings, codeStyleSettings());
QtStyleCodeFormatter codeFormatter(tabSettings, codeStyleSettings());
codeFormatter.updateStateUntil(block);
QTextCursor tc = cursor;
@@ -161,15 +161,15 @@ void CppQtStyleIndenter::indent(QTextDocument *doc,
void CppQtStyleIndenter::setCodeStylePreferences(TextEditor::ICodeStylePreferences *preferences)
{
CppTools::CppCodeStylePreferences *cppCodeStylePreferences
= qobject_cast<CppTools::CppCodeStylePreferences *>(preferences);
CppCodeStylePreferences *cppCodeStylePreferences
= qobject_cast<CppCodeStylePreferences *>(preferences);
if (cppCodeStylePreferences)
m_cppCodeStylePreferences = cppCodeStylePreferences;
}
void CppQtStyleIndenter::invalidateCache(QTextDocument *doc)
{
CppTools::QtStyleCodeFormatter formatter;
QtStyleCodeFormatter formatter;
formatter.invalidateCache(doc);
}