C++: use a global string table for SearchSymbols.

This string table uniques strings, so that multiple identical strings
share their contents. It is used by the locator and the symbol searcher,
and will later be used by the class view.

Change-Id: Ib8b50f69bbf994d0d7a39b66dc8caf1a3d9bfb42
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2014-02-25 16:16:11 +01:00
parent a940c73d81
commit a870c29a71
13 changed files with 232 additions and 19 deletions

View File

@@ -42,8 +42,9 @@ SearchSymbols::SymbolTypes SearchSymbols::AllTypes =
| SymbolSearcher::Enums
| SymbolSearcher::Declarations;
SearchSymbols::SearchSymbols() :
symbolsToSearchFor(SymbolSearcher::Classes | SymbolSearcher::Functions | SymbolSearcher::Enums)
SearchSymbols::SearchSymbols(Internal::StringTable &stringTable)
: strings(stringTable)
, symbolsToSearchFor(SymbolSearcher::Classes | SymbolSearcher::Functions | SymbolSearcher::Enums)
{
}
@@ -62,7 +63,7 @@ QList<ModelItemInfo> SearchSymbols::operator()(Document::Ptr doc, int sizeHint,
}
(void) switchScope(previousScope);
QList<ModelItemInfo> result = items;
strings.clear();
strings.scheduleGC();
items.clear();
m_paths.clear();
return result;
@@ -291,7 +292,7 @@ void SearchSymbols::appendItem(const QString &symbolName, const QString &symbolT
findOrInsert(symbolType),
findOrInsert(symbolScope),
itemType,
path,
findOrInsert(path),
symbol->line(),
symbol->column() - 1, // 1-based vs 0-based column
icon));