* Show namespace or filepath in second line of search autocompletions * Add filepaths relative to .coatidb location * Rescore matches to acknowledge line split * Fixed SearchMatch type to be drawn always visible at right edge
68 lines
1.6 KiB
C++
68 lines
1.6 KiB
C++
#ifndef HIERARCHY_CACHE_H
|
|
#define HIERARCHY_CACHE_H
|
|
|
|
#include <map>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "utility/types.h"
|
|
|
|
class HierarchyCache
|
|
{
|
|
public:
|
|
void clear();
|
|
|
|
void createConnection(Id edgeId, Id fromId, Id toId, bool fromVisible);
|
|
|
|
Id getLastVisibleParentNodeId(Id nodeId) const;
|
|
size_t getIndexOfLastVisibleParentNode(Id nodeId) const;
|
|
|
|
void addAllChildIdsForNodeId(Id nodeId, std::vector<Id>* nodeIds, std::vector<Id>* edgeIds) const;
|
|
void addFirstChildIdsForNodeId(Id nodeId, std::vector<Id>* nodeIds) const;
|
|
void addFirstVisibleChildIdsForNodeId(Id nodeId, std::vector<Id>* nodeIds) const;
|
|
|
|
bool isChildOfVisibleNodeOrInvisible(Id nodeId) const;
|
|
bool nodeHasChildren(Id nodeId) const;
|
|
|
|
private:
|
|
class HierarchyNode
|
|
{
|
|
public:
|
|
HierarchyNode(Id nodeId);
|
|
|
|
Id getNodeId() const;
|
|
|
|
Id getEdgeId() const;
|
|
void setEdgeId(Id edgeId);
|
|
|
|
HierarchyNode* getParent() const;
|
|
void setParent(HierarchyNode* parent);
|
|
|
|
void addChild(HierarchyNode* child);
|
|
const std::vector<HierarchyNode*>& getChildren() const;
|
|
|
|
void addChildIds(std::vector<Id>* nodeIds) const;
|
|
void addChildIdsRecursive(std::vector<Id>* nodeIds, std::vector<Id>* edgeIds) const;
|
|
void addVisibleNodeIdsRecursive(std::vector<Id>* nodeIds) const;
|
|
|
|
bool isVisible() const;
|
|
void setIsVisible(bool isVisible);
|
|
|
|
private:
|
|
const Id m_nodeId;
|
|
Id m_edgeId;
|
|
|
|
HierarchyNode* m_parent;
|
|
std::vector<HierarchyNode*> m_children;
|
|
|
|
bool m_isVisible;
|
|
};
|
|
|
|
HierarchyNode* getNode(Id nodeId) const;
|
|
HierarchyNode* createNode(Id nodeId);
|
|
|
|
std::map<Id, std::shared_ptr<HierarchyNode>> m_nodes;
|
|
};
|
|
|
|
#endif // HIERARCHY_CACHE_H
|