logic: multiple fixes and improvements

* showing project name in main window title
* keep reference count visible when maximizing code file
* show first node in db when no main function is available
* log Storage stats after parse
* fixed macro locations saved multiply
* using NameHierarchy when retrieving ids
This commit is contained in:
Eberhard Graether
2015-10-01 19:03:05 +02:00
parent 8fa9bdde5e
commit 2704d47cd8
28 changed files with 246 additions and 154 deletions
+40 -30
View File
@@ -93,20 +93,51 @@ void Storage::removeUnusedNames()
clearCaches();
}
void Storage::logGraph() const
std::vector<FileInfo> Storage::getInfoOnAllFiles() const
{
std::vector<FileInfo> fileInfos;
std::vector<StorageFile> storageFiles = m_sqliteStorage.getAllFiles();
for (size_t i = 0; i < storageFiles.size(); i++)
{
boost::posix_time::ptime modificationTime = boost::posix_time::not_a_date_time;
if (storageFiles[i].modificationTime != "not-a-date-time")
{
modificationTime = boost::posix_time::time_from_string(storageFiles[i].modificationTime);
}
fileInfos.push_back(FileInfo(
FilePath(storageFiles[i].filePath),
modificationTime
));
}
return fileInfos;
}
void Storage::logLocations() const
{
}
void Storage::logIndex() const
const SearchIndex& Storage::getSearchIndex() const
{
return m_tokenIndex;
}
void Storage::logStats() const
{
std::stringstream ss;
ss << "\nGraph:\n";
ss << "\t" << m_sqliteStorage.getNodeCount() << " Nodes\n";
ss << "\t" << m_sqliteStorage.getEdgeCount() << " Edges\n";
ss << "\nSearch:\n";
ss << "\t" << m_tokenIndex.getCharCount() << " Characters\n";
ss << "\t" << m_tokenIndex.getWordCount() << " Words\n";
ss << "\t" << m_tokenIndex.getNodeCount() << " SearchNodes\n";
ss << "\t" << m_sqliteStorage.getNameHierarchyElementCount() << " NameHierarchyElements\n";
ss << "\nCode:\n";
ss << "\t" << m_sqliteStorage.getFileCount() << " Files\n";
ss << "\t" << m_sqliteStorage.getSourceLocationCount() << " Source Locations\n";
LOG_WARNING(ss.str());
}
void Storage::startParsing()
@@ -704,25 +735,9 @@ Id Storage::getIdForEdge(
return m_sqliteStorage.getEdgeBySourceTargetType(sourceId, targetId, type).id;
}
std::vector<FileInfo> Storage::getInfoOnAllFiles() const
Id Storage::getIdForFirstNode() const
{
std::vector<FileInfo> fileInfos;
std::vector<StorageFile> storageFiles = m_sqliteStorage.getAllFiles();
for (size_t i = 0; i < storageFiles.size(); i++)
{
boost::posix_time::ptime modificationTime = boost::posix_time::not_a_date_time;
if (storageFiles[i].modificationTime != "not-a-date-time")
{
modificationTime = boost::posix_time::time_from_string(storageFiles[i].modificationTime);
}
fileInfos.push_back(FileInfo(
FilePath(storageFiles[i].filePath),
modificationTime
));
}
return fileInfos;
return m_sqliteStorage.getFirstNode().id;
}
NameHierarchy Storage::getNameHierarchyForNodeWithId(Id nodeId) const
@@ -796,7 +811,7 @@ std::shared_ptr<Graph> Storage::getGraphForActiveTokenIds(const std::vector<Id>&
addAggregationEdgesToGraph(elementId, graph);
}
else
else if (m_sqliteStorage.isEdge(elementId))
{
addEdgeAndAllChildrenToGraph(elementId, graph);
}
@@ -1129,11 +1144,6 @@ std::shared_ptr<TextAccess> Storage::getFileContent(const FilePath& filePath) co
return m_sqliteStorage.getFileContentByPath(filePath.str());
}
const SearchIndex& Storage::getSearchIndex() const
{
return m_tokenIndex;
}
Id Storage::addNodeHierarchy(Node::NodeType nodeType, NameHierarchy nameHierarchy, bool distinct)
{
addNameHierarchyElements(nameHierarchy);