src: replaced references to NODE_FILE with call to isFile
This commit is contained in:
@@ -79,6 +79,24 @@ NodeTypeSet NodeTypeSet::getWithRemoved(const NodeTypeSet& typeSet) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
void NodeTypeSet::removeIf(const std::function<bool(const NodeType&)> condition)
|
||||
{
|
||||
for (const NodeType& type : s_allNodeTypes)
|
||||
{
|
||||
if (m_nodeTypeMask & nodeTypeToMask(type) && condition(type))
|
||||
{
|
||||
remove(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NodeTypeSet NodeTypeSet::getWithRemovedIf(const std::function<bool(const NodeType&)> condition) const
|
||||
{
|
||||
NodeTypeSet ret(*this);
|
||||
ret.removeIf(condition);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool NodeTypeSet::isEmpty() const
|
||||
{
|
||||
return m_nodeTypeMask == 0;
|
||||
|
||||
@@ -28,6 +28,9 @@ public:
|
||||
void remove(const NodeTypeSet& typeSet);
|
||||
NodeTypeSet getWithRemoved(const NodeTypeSet& typeSet) const;
|
||||
|
||||
void removeIf(const std::function<bool(const NodeType&)> condition);
|
||||
NodeTypeSet getWithRemovedIf(const std::function<bool(const NodeType&)> condition) const;
|
||||
|
||||
bool isEmpty() const;
|
||||
bool contains(const NodeType& type) const;
|
||||
bool intersectsWith(const NodeTypeSet& typeSet) const;
|
||||
|
||||
@@ -219,7 +219,7 @@ void SearchMatch::print(std::ostream& ostream) const
|
||||
|
||||
std::string SearchMatch::getFullName() const
|
||||
{
|
||||
if (searchType == SEARCH_TOKEN && nodeType.getType() == NodeType::NODE_FILE)
|
||||
if (searchType == SEARCH_TOKEN && nodeType.isFile())
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -576,12 +576,12 @@ std::vector<SearchMatch> PersistentStorage::getAutocompletionMatches(const std::
|
||||
// create SearchMatches
|
||||
std::vector<SearchMatch> matches;
|
||||
|
||||
if (!acceptedNodeTypes.getWithRemoved(NodeType(NodeType::NODE_FILE)).isEmpty())
|
||||
if (!acceptedNodeTypes.getWithRemovedIf([](const NodeType& type) { return type.isFile(); }).isEmpty())
|
||||
{
|
||||
utility::append(matches, getAutocompletionSymbolMatches(query, acceptedNodeTypes, maxResultsCount, maxBestScoredResultsLength));
|
||||
}
|
||||
|
||||
if (acceptedNodeTypes.contains(NodeType(NodeType::NODE_FILE)))
|
||||
if (!acceptedNodeTypes.getWithRemovedIf([](const NodeType& type) { return !type.isFile(); }).isEmpty())
|
||||
{
|
||||
utility::append(matches, getAutocompletionFileMatches(query, maxResultsCount));
|
||||
}
|
||||
@@ -802,7 +802,7 @@ std::vector<SearchMatch> PersistentStorage::getSearchMatchesForTokenIds(const st
|
||||
|
||||
match.delimiter = nameHierarchy.getDelimiter();
|
||||
|
||||
if (match.nodeType.getType() == NodeType::NODE_FILE)
|
||||
if (match.nodeType.isFile())
|
||||
{
|
||||
match.text = FilePath(match.text).fileName();
|
||||
}
|
||||
@@ -1727,7 +1727,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForTokenIds(const std::vector<Id>&
|
||||
}
|
||||
}
|
||||
|
||||
if (type.getType() == NodeType::NODE_FILE && m_fileNodePaths.find(node.id) != m_fileNodePaths.end())
|
||||
if (type.isFile() && m_fileNodePaths.find(node.id) != m_fileNodePaths.end())
|
||||
{
|
||||
if (!getFileNodeComplete(node.id))
|
||||
{
|
||||
@@ -2174,7 +2174,7 @@ void PersistentStorage::addNodesToGraph(const std::vector<Id>& newNodeIds, Graph
|
||||
for (const StorageNode& storageNode : m_sqliteIndexStorage.getAllByIds<StorageNode>(nodeIds))
|
||||
{
|
||||
const NodeType type(utility::intToType(storageNode.type));
|
||||
if (type.getType() == NodeType::NODE_FILE)
|
||||
if (type.isFile())
|
||||
{
|
||||
const FilePath filePath(NameHierarchy::deserialize(storageNode.serializedName).getRawName());
|
||||
|
||||
@@ -2540,7 +2540,7 @@ void PersistentStorage::buildSearchIndex()
|
||||
for (StorageNode& node : m_sqliteIndexStorage.getAll<StorageNode>())
|
||||
{
|
||||
NodeType type = utility::intToType(node.type);
|
||||
if (type == NodeType::NODE_FILE)
|
||||
if (type.isFile())
|
||||
{
|
||||
auto it = m_fileNodePaths.find(node.id);
|
||||
if (it != m_fileNodePaths.end())
|
||||
|
||||
Reference in New Issue
Block a user