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

@@ -261,7 +261,7 @@ Namespace *isNamespaceFunction(const LookupContext &context, Function *function)
// Given include is e.g. "afile.h" or <afile.h> (quotes/angle brackets included!).
void insertNewIncludeDirective(const QString &include, CppRefactoringFilePtr file,
const CPlusPlus::Document::Ptr &cppDocument)
const Document::Ptr &cppDocument)
{
// Find optimal position
using namespace IncludeUtils;
@@ -2636,7 +2636,7 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
return;
// Check if there is already a definition
CppTools::SymbolFinder symbolFinder;
SymbolFinder symbolFinder;
if (symbolFinder.findMatchingDefinition(decl, interface.snapshot(),
true)) {
return;
@@ -2729,7 +2729,7 @@ public:
, m_classDecl(0)
, m_offerQuickFix(true)
{
setDescription(TextEditor::QuickFixFactory::tr("Create Getter and Setter Member Functions"));
setDescription(QuickFixFactory::tr("Create Getter and Setter Member Functions"));
const QList<AST *> &path = interface.path();
// We expect something like
@@ -3881,8 +3881,8 @@ public:
{
setDescription(
mode == FromPointer
? TextEditor::QuickFixFactory::tr("Convert to Stack Variable")
: TextEditor::QuickFixFactory::tr("Convert to Pointer"));
? QuickFixFactory::tr("Convert to Stack Variable")
: QuickFixFactory::tr("Convert to Pointer"));
}
void perform() Q_DECL_OVERRIDE
@@ -4220,7 +4220,7 @@ public:
, m_signalName(signalName)
, m_storageName(storageName)
{
setDescription(TextEditor::QuickFixFactory::tr("Generate Missing Q_PROPERTY Members..."));
setDescription(QuickFixFactory::tr("Generate Missing Q_PROPERTY Members..."));
}
void perform()