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

@@ -46,12 +46,16 @@
//#define TIME_COMPLETION
class ClangCodeModel::ClangCompleter::PrivateData
using namespace ClangCodeModel::Internal;
namespace ClangCodeModel {
class ClangCompleter::PrivateData
{
public:
PrivateData()
: m_mutex(QMutex::Recursive)
, m_unit(Internal::Unit::create())
, m_unit(Unit::create())
, m_isSignalSlotCompletion(false)
{
}
@@ -60,7 +64,7 @@ public:
{
}
bool parseFromFile(const Internal::UnsavedFiles &unsavedFiles)
bool parseFromFile(const UnsavedFiles &unsavedFiles)
{
Q_ASSERT(!m_unit->isLoaded());
if (m_unit->fileName().isEmpty())
@@ -80,13 +84,10 @@ public:
public:
QMutex m_mutex;
Internal::Unit::Ptr m_unit;
Unit::Ptr m_unit;
bool m_isSignalSlotCompletion;
};
using namespace ClangCodeModel;
using namespace ClangCodeModel::Internal;
/**
* @brief Constructs with highest possible priority
*/
@@ -127,7 +128,7 @@ QString ClangCompleter::fileName() const
void ClangCompleter::setFileName(const QString &fileName)
{
if (d->m_unit->fileName() != fileName) {
d->m_unit = Internal::Unit::create(fileName);
d->m_unit = Unit::create(fileName);
}
}
@@ -208,3 +209,5 @@ QMutex *ClangCompleter::mutex() const
{
return &d->m_mutex;
}
} // namespace ClangCodeModel