src: fixed clang warnings, fixed undefined symbols logs, fixed code convention violations
This commit is contained in:
@@ -19,5 +19,7 @@ void QtButton::setCallbackOnClick(std::function<void(void)> callback)
|
||||
void QtButton::slotOnClick()
|
||||
{
|
||||
if (m_onClick)
|
||||
{
|
||||
m_onClick();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define QT_THREADED_FUCTOR_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <QObject>
|
||||
#include <QSemaphore>
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
#include "QtGraphView.h"
|
||||
|
||||
#include "qboxlayout.h"
|
||||
#include "qgraphicsitem.h"
|
||||
#include "qgraphicsproxywidget.h"
|
||||
#include "qgraphicsscene.h"
|
||||
#include "qgraphicsview.h"
|
||||
#include "qpushbutton.h"
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include <QBoxLayout>
|
||||
#include <QFrame>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
|
||||
#include "qt/QtWidgetWrapper.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/view/graphElements/QtGraphEdge.h"
|
||||
#include "qt/view/graphElements/QtGraphNode.h"
|
||||
#include "qt/view/graphElements/QtGraphNodeMouseMovable.h"
|
||||
@@ -68,8 +65,6 @@ QGraphicsView* QtGraphView::getView()
|
||||
{
|
||||
QWidget* widget = QtWidgetWrapper::getWidgetOfView(this);
|
||||
|
||||
QLayout* layout = widget->layout();
|
||||
|
||||
QObjectList children = widget->children();
|
||||
|
||||
return widget->findChild<QGraphicsView*>("");
|
||||
@@ -81,12 +76,15 @@ void QtGraphView::doRebuildGraph(const std::vector<DummyNode>& nodes, const std:
|
||||
|
||||
if (view != NULL)
|
||||
{
|
||||
std::map<Id, std::weak_ptr<GraphNode>> weakNodes; // used when creating the edges
|
||||
std::list<std::shared_ptr<GraphNode>> newNodes; // temporary stores all nodes (existing and newly created) needed in the new graph
|
||||
// this is a relatively easy and cheap way to save existing nodes that are still needed
|
||||
// Used when creating the edges.
|
||||
std::map<Id, std::weak_ptr<GraphNode>> weakNodes;
|
||||
|
||||
// Temporary stores all nodes (existing and newly created) needed in the new graph
|
||||
// this is a relatively easy and cheap way to save existing nodes that are still needed
|
||||
std::list<std::shared_ptr<GraphNode>> newNodes;
|
||||
|
||||
// create nodes (or find existing nodes for re-use)
|
||||
for(unsigned int i = 0; i < nodes.size(); i++)
|
||||
for (unsigned int i = 0; i < nodes.size(); i++)
|
||||
{
|
||||
std::shared_ptr<GraphNode> newNode = findOrCreateNode(view, nodes[i]);
|
||||
newNode->setPosition(nodes[i].position);
|
||||
@@ -97,10 +95,10 @@ void QtGraphView::doRebuildGraph(const std::vector<DummyNode>& nodes, const std:
|
||||
doClear();
|
||||
m_nodes = newNodes;
|
||||
|
||||
for(unsigned int i = 0; i < edges.size(); i++)
|
||||
for (unsigned int i = 0; i < edges.size(); i++)
|
||||
{
|
||||
std::shared_ptr<GraphEdge> edge = createEdge(view, edges[i]);
|
||||
if(edge != NULL)
|
||||
if (edge != NULL)
|
||||
{
|
||||
m_edges.push_back(edge);
|
||||
}
|
||||
@@ -124,7 +122,7 @@ std::shared_ptr<GraphNode> QtGraphView::findOrCreateNode(QGraphicsView* view, co
|
||||
|
||||
result = findNode(node.tokenId);
|
||||
|
||||
if(result == NULL)
|
||||
if (result == NULL)
|
||||
{
|
||||
result = createNode(view, node);
|
||||
}
|
||||
@@ -134,18 +132,16 @@ std::shared_ptr<GraphNode> QtGraphView::findOrCreateNode(QGraphicsView* view, co
|
||||
|
||||
std::shared_ptr<GraphNode> QtGraphView::findNode(const Id id)
|
||||
{
|
||||
std::list<std::shared_ptr<GraphNode>>::iterator it = m_nodes.begin();
|
||||
|
||||
for(it; it != m_nodes.end(); it++)
|
||||
for (std::list<std::shared_ptr<GraphNode>>::iterator it = m_nodes.begin(); it != m_nodes.end(); it++)
|
||||
{
|
||||
if((*it)->getTokenId() == id)
|
||||
if ((*it)->getTokenId() == id)
|
||||
{
|
||||
return *it;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::shared_ptr<GraphNode> result = findSubNode(*it, id);
|
||||
if(result != NULL)
|
||||
if (result != NULL)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
@@ -159,17 +155,16 @@ std::shared_ptr<GraphNode> QtGraphView::findSubNode(const std::shared_ptr<GraphN
|
||||
{
|
||||
std::list<std::shared_ptr<GraphNode>> subNodes = node->getSubNodes();
|
||||
|
||||
std::list<std::shared_ptr<GraphNode>>::iterator it = subNodes.begin();
|
||||
for(it; it != subNodes.end(); it++)
|
||||
for (std::list<std::shared_ptr<GraphNode>>::iterator it = subNodes.begin(); it != subNodes.end(); it++)
|
||||
{
|
||||
if((*it)->getTokenId() == id)
|
||||
if ((*it)->getTokenId() == id)
|
||||
{
|
||||
return *it;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::shared_ptr<GraphNode> result = findSubNode(*it, id);
|
||||
if(result != NULL)
|
||||
if (result != NULL)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
@@ -181,19 +176,20 @@ std::shared_ptr<GraphNode> QtGraphView::findSubNode(const std::shared_ptr<GraphN
|
||||
|
||||
std::shared_ptr<GraphNode> QtGraphView::createNode(QGraphicsView* view, const DummyNode& node)
|
||||
{
|
||||
if(view != NULL)
|
||||
if (view != NULL)
|
||||
{
|
||||
std::shared_ptr<QtGraphNodeMouseMovable> newNode = std::make_shared<QtGraphNodeMouseMovable>(Vec2i(0, 0), node.name, node.tokenId);
|
||||
std::shared_ptr<QtGraphNodeMouseMovable> newNode =
|
||||
std::make_shared<QtGraphNodeMouseMovable>(Vec2i(0, 0), node.name, node.tokenId);
|
||||
view->scene()->addItem(newNode.get());
|
||||
m_nodes.push_back(newNode);
|
||||
|
||||
for(unsigned int i = 0; i < node.subNodes.size(); i++)
|
||||
for (unsigned int i = 0; i < node.subNodes.size(); i++)
|
||||
{
|
||||
std::shared_ptr<QtGraphNode> subNode = createSubNode(view, node.subNodes[i]);
|
||||
subNode->setParentItem(newNode.get());
|
||||
newNode->addSubNode(subNode);
|
||||
subNode->setRect(0, 0, 80, 20);
|
||||
subNode->moveBy(10, (i+1)*30);
|
||||
subNode->moveBy(10, (i + 1) * 30);
|
||||
}
|
||||
|
||||
newNode->setRect(0, 0, 100, 40 + (node.subNodes.size() * 30));
|
||||
@@ -209,18 +205,18 @@ std::shared_ptr<GraphNode> QtGraphView::createNode(QGraphicsView* view, const Du
|
||||
|
||||
std::shared_ptr<QtGraphNode> QtGraphView::createSubNode(QGraphicsView* view, const DummyNode& node)
|
||||
{
|
||||
if(view != NULL)
|
||||
if (view != NULL)
|
||||
{
|
||||
std::shared_ptr<QtGraphNode> newNode = std::make_shared<QtGraphNode>(Vec2i(0, 0), node.name, node.tokenId);
|
||||
view->scene()->addItem(newNode.get());
|
||||
|
||||
for(unsigned int i = 0; i < node.subNodes.size(); i++)
|
||||
for (unsigned int i = 0; i < node.subNodes.size(); i++)
|
||||
{
|
||||
std::shared_ptr<QtGraphNode> subNode = createSubNode(view, node.subNodes[i]);
|
||||
subNode->setParentItem(newNode.get());
|
||||
newNode->addSubNode(subNode);
|
||||
subNode->setRect(0, 0, 80, 20);
|
||||
subNode->moveBy(10, (i+1)*30);
|
||||
subNode->moveBy(10, (i + 1) * 30);
|
||||
}
|
||||
|
||||
return newNode;
|
||||
@@ -234,33 +230,33 @@ std::shared_ptr<QtGraphNode> QtGraphView::createSubNode(QGraphicsView* view, con
|
||||
|
||||
std::shared_ptr<QtGraphEdge> QtGraphView::createEdge(QGraphicsView* view, const DummyEdge& edge)
|
||||
{
|
||||
if(view != NULL)
|
||||
if (view != NULL)
|
||||
{
|
||||
std::shared_ptr<GraphNode> owner = findNode(edge.ownerId);
|
||||
std::shared_ptr<GraphNode> target = findNode(edge.targetId);
|
||||
|
||||
if(owner != NULL && target != NULL)
|
||||
if (owner != NULL && target != NULL)
|
||||
{
|
||||
std::shared_ptr<QtGraphEdge> qtEdge = std::make_shared<QtGraphEdge>(owner, target, edge.tokenId);
|
||||
|
||||
switch(edge.edgeType)
|
||||
switch (edge.edgeType)
|
||||
{
|
||||
case Edge::EdgeType::EDGE_CALL:
|
||||
case Edge::EDGE_CALL:
|
||||
qtEdge->setColor(m_edgeColors[0]);
|
||||
break;
|
||||
case Edge::EdgeType::EDGE_USAGE:
|
||||
case Edge::EDGE_USAGE:
|
||||
qtEdge->setColor(m_edgeColors[1]);
|
||||
break;
|
||||
case Edge::EdgeType::EDGE_TYPE_OF:
|
||||
case Edge::EDGE_TYPE_OF:
|
||||
qtEdge->setColor(m_edgeColors[2]);
|
||||
break;
|
||||
case Edge::EdgeType::EDGE_RETURN_TYPE_OF:
|
||||
case Edge::EDGE_RETURN_TYPE_OF:
|
||||
qtEdge->setColor(m_edgeColors[3]);
|
||||
break;
|
||||
case Edge::EdgeType::EDGE_PARAMETER_TYPE_OF:
|
||||
case Edge::EDGE_PARAMETER_TYPE_OF:
|
||||
qtEdge->setColor(m_edgeColors[4]);
|
||||
break;
|
||||
case Edge::EdgeType::EDGE_INHERITANCE:
|
||||
case Edge::EDGE_INHERITANCE:
|
||||
qtEdge->setColor(m_edgeColors[5]);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
#ifndef QT_GRAPH_VIEW_H
|
||||
#define QT_GRAPH_VIEW_H
|
||||
|
||||
#include "component/view/GraphView.h"
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
|
||||
#include "utility/math/Vector4.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
#include "component/view/GraphView.h"
|
||||
|
||||
struct DummyEdge;
|
||||
struct DummyNode;
|
||||
class QGraphicsView;
|
||||
class QtGraphEdge;
|
||||
class QtGraphNode;
|
||||
|
||||
class QtGraphView : public GraphView
|
||||
class QtGraphView: public GraphView
|
||||
{
|
||||
public:
|
||||
QtGraphView(ViewLayout* viewLayout);
|
||||
|
||||
@@ -97,7 +97,10 @@ void QtSearchView::doSetAutocompletionList(const std::vector<std::string>& autoc
|
||||
{
|
||||
QStringList wordList;
|
||||
for (const std::string& s: autocompletionList)
|
||||
{
|
||||
wordList << s.c_str();
|
||||
}
|
||||
|
||||
QCompleter *completer = new QCompleter(wordList, m_searchBox);
|
||||
completer->popup()->setObjectName("search_box_popup");
|
||||
completer->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
|
||||
@@ -34,6 +34,7 @@ private:
|
||||
QtEditBox* m_searchBox;
|
||||
QtButton* m_searchButton;
|
||||
QtButton* m_caseSensitiveButton;
|
||||
|
||||
QtThreadedFunctor<const std::string&> m_setTextFunctor;
|
||||
QtThreadedFunctor<> m_setFocusFunctor;
|
||||
QtThreadedFunctor<const std::vector<std::string>&> m_setAutocompletionListFunctor;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "qt/view/graphElements/QtGraphEdge.h"
|
||||
|
||||
#include "qgraphicsscene.h"
|
||||
#include "qpen.h"
|
||||
#include <QGraphicsScene>
|
||||
#include <QPen>
|
||||
|
||||
#include "component/view/graphElements/GraphNode.h"
|
||||
|
||||
@@ -67,7 +67,7 @@ void QtGraphEdge::removeEdgeFromScene()
|
||||
{
|
||||
std::shared_ptr<GraphNode> node = m_owner.lock();
|
||||
|
||||
if(node != NULL)
|
||||
if (node != NULL)
|
||||
{
|
||||
node->removeOutEdge(this);
|
||||
}
|
||||
|
||||
@@ -3,17 +3,16 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "qgraphicsitem.h"
|
||||
|
||||
#include "utility/messaging/type/MessageActivateToken.h"
|
||||
#include <QGraphicsItem>
|
||||
|
||||
#include "component/view/graphElements/GraphEdge.h"
|
||||
#include "utility/messaging/type/MessageActivateToken.h"
|
||||
|
||||
class GraphNode;
|
||||
|
||||
class QtGraphEdge:
|
||||
public GraphEdge,
|
||||
public QGraphicsLineItem
|
||||
class QtGraphEdge
|
||||
: public GraphEdge
|
||||
, public QGraphicsLineItem
|
||||
{
|
||||
public:
|
||||
QtGraphEdge(const std::weak_ptr<GraphNode>& owner, const std::weak_ptr<GraphNode>& target, const Id id);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "qgraphicsscene.h"
|
||||
#include "qgraphicssceneevent.h"
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsSceneEvent>
|
||||
|
||||
#include "qt/view/graphElements/QtGraphEdge.h"
|
||||
|
||||
@@ -24,11 +24,10 @@ QtGraphNode::QtGraphNode(const Vec2i& position, const std::string& name, const I
|
||||
|
||||
QtGraphNode::~QtGraphNode()
|
||||
{
|
||||
std::list<std::weak_ptr<GraphEdge> >::iterator it = m_inEdges.begin();
|
||||
for(it; it != m_inEdges.end(); it++)
|
||||
for (std::list<std::weak_ptr<GraphEdge>>::iterator it = m_inEdges.begin(); it != m_inEdges.end(); it++)
|
||||
{
|
||||
std::shared_ptr<GraphEdge> edge = it->lock();
|
||||
if(edge != NULL)
|
||||
if (edge != NULL)
|
||||
{
|
||||
edge->removeEdgeFromScene();
|
||||
}
|
||||
@@ -50,7 +49,7 @@ void QtGraphNode::setPosition(const Vec2i& position)
|
||||
Vec2i currentPosition = getPosition();
|
||||
Vec2i offset = position - currentPosition;
|
||||
|
||||
if(offset.getLength() > 0.0f)
|
||||
if (offset.getLength() > 0.0f)
|
||||
{
|
||||
this->moveBy(offset.x, offset.y);
|
||||
notifyEdgesAfterMove();
|
||||
@@ -59,10 +58,10 @@ void QtGraphNode::setPosition(const Vec2i& position)
|
||||
|
||||
bool QtGraphNode::addOutEdge(const std::shared_ptr<GraphEdge>& edge)
|
||||
{
|
||||
std::list<std::shared_ptr<GraphEdge> >::iterator it = m_outEdges.begin();
|
||||
for(it; it != m_outEdges.end(); it++)
|
||||
for (std::list<std::shared_ptr<GraphEdge>>::iterator it = m_outEdges.begin(); it != m_outEdges.end(); it++)
|
||||
{
|
||||
if ((*it)->getOwner().lock() == edge->getOwner().lock() && (*it)->getTarget().lock() == edge->getTarget().lock())
|
||||
if ((*it)->getOwner().lock() == edge->getOwner().lock() &&
|
||||
(*it)->getTarget().lock() == edge->getTarget().lock())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -74,11 +73,10 @@ bool QtGraphNode::addOutEdge(const std::shared_ptr<GraphEdge>& edge)
|
||||
|
||||
bool QtGraphNode::addInEdge(const std::weak_ptr<GraphEdge>& edge)
|
||||
{
|
||||
std::list<std::weak_ptr<GraphEdge> >::iterator it = m_inEdges.begin();
|
||||
for(it; it != m_inEdges.end(); it++)
|
||||
for (std::list<std::weak_ptr<GraphEdge> >::iterator it = m_inEdges.begin(); it != m_inEdges.end(); it++)
|
||||
{
|
||||
std::shared_ptr<GraphEdge> existingEdge = it->lock();
|
||||
if(existingEdge != NULL)
|
||||
if (existingEdge != NULL)
|
||||
{
|
||||
if (existingEdge->getOwner().lock() == edge.lock()->getOwner().lock() &&
|
||||
existingEdge->getTarget().lock() == edge.lock()->getTarget().lock())
|
||||
@@ -95,9 +93,9 @@ bool QtGraphNode::addInEdge(const std::weak_ptr<GraphEdge>& edge)
|
||||
void QtGraphNode::removeOutEdge(GraphEdge* edge)
|
||||
{
|
||||
std::list<std::shared_ptr<GraphEdge> >::iterator it = m_outEdges.begin();
|
||||
while(it != m_outEdges.end())
|
||||
while (it != m_outEdges.end())
|
||||
{
|
||||
if((*it).get() == edge)
|
||||
if ((*it).get() == edge)
|
||||
{
|
||||
m_outEdges.erase(it);
|
||||
break;
|
||||
@@ -130,17 +128,16 @@ void QtGraphNode::notifyParentMoved()
|
||||
|
||||
void QtGraphNode::notifyEdgesAfterMove()
|
||||
{
|
||||
std::list<std::shared_ptr<GraphEdge> >::iterator it = m_outEdges.begin();
|
||||
for(it; it != m_outEdges.end(); it++)
|
||||
for (std::list<std::shared_ptr<GraphEdge> >::iterator it = m_outEdges.begin(); it != m_outEdges.end(); it++)
|
||||
{
|
||||
(*it)->ownerMoved();
|
||||
}
|
||||
|
||||
std::list<std::weak_ptr<GraphEdge> >::iterator it2 = m_inEdges.begin();
|
||||
while(it2 != m_inEdges.end())
|
||||
while (it2 != m_inEdges.end())
|
||||
{
|
||||
std::shared_ptr<GraphEdge> edge = it2->lock();
|
||||
if(edge.get() != NULL)
|
||||
if (edge.get() != NULL)
|
||||
{
|
||||
edge->targetMoved();
|
||||
++it2;
|
||||
@@ -151,8 +148,7 @@ void QtGraphNode::notifyEdgesAfterMove()
|
||||
}
|
||||
}
|
||||
|
||||
std::list<std::shared_ptr<GraphNode> >::iterator it3 = m_subNodes.begin();
|
||||
for(it3; it3 != m_subNodes.end(); it3++)
|
||||
for (std::list<std::shared_ptr<GraphNode> >::iterator it3 = m_subNodes.begin(); it3 != m_subNodes.end(); it3++)
|
||||
{
|
||||
(*it3)->notifyParentMoved();
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
#ifndef QT_GRAPH_NODE_H
|
||||
#define QT_GRAPH_NODE_H
|
||||
|
||||
#include "qgraphicsitem.h"
|
||||
#include <QGraphicsItem>
|
||||
|
||||
#include "component/view/graphElements/GraphNode.h"
|
||||
#include "utility/messaging/type/MessageActivateToken.h"
|
||||
#include "utility/math/Vector2.h"
|
||||
|
||||
#include "component/view/graphElements/GraphNode.h"
|
||||
|
||||
class QtGraphEdge;
|
||||
|
||||
class QtGraphNode:
|
||||
public GraphNode,
|
||||
public QGraphicsRectItem
|
||||
class QtGraphNode
|
||||
: public GraphNode
|
||||
, public QGraphicsRectItem
|
||||
{
|
||||
public:
|
||||
QtGraphNode(const Vec2i& position, const std::string& name, const Id tokenId);
|
||||
|
||||
@@ -12,8 +12,6 @@ std::shared_ptr<ApplicationSettings> ApplicationSettings::getInstance()
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ApplicationSettings::~ApplicationSettings()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "utility/math/Color.h"
|
||||
|
||||
#include "Settings.h"
|
||||
#include "utility/math/Color.h"
|
||||
|
||||
class ApplicationSettings: public Settings
|
||||
{
|
||||
|
||||
@@ -5,10 +5,8 @@
|
||||
#include "data/location/TokenLocation.h"
|
||||
#include "data/location/TokenLocationCollection.h"
|
||||
#include "data/location/TokenLocationFile.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
#include "utility/text/TextAccess.h"
|
||||
|
||||
CodeController::CodeController(LocationAccess* locationAccess)
|
||||
: m_locationAccess(locationAccess)
|
||||
|
||||
@@ -34,5 +34,4 @@ private:
|
||||
LocationAccess* m_locationAccess;
|
||||
};
|
||||
|
||||
|
||||
#endif // CODE_CONTROLLER_H
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "component/view/graphElements/GraphNode.h"
|
||||
#include "component/view/GraphView.h"
|
||||
#include "data/access/GraphAccess.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
GraphController::GraphController(GraphAccess* graphAccess)
|
||||
@@ -35,7 +34,7 @@ void GraphController::createDummyGraph(const Id activeId, const LayoutFunction l
|
||||
{
|
||||
std::vector<DummyNode> nodes;
|
||||
|
||||
if(m_graphAccess->checkTokenIsNode(activeId))
|
||||
if (m_graphAccess->checkTokenIsNode(activeId))
|
||||
{
|
||||
nodes.push_back(createDummyNode(activeId));
|
||||
std::vector<DummyNode> neighbours = createNeighbourNodes(nodes[0]);
|
||||
@@ -72,9 +71,9 @@ Id GraphController::findTopLevelNode(const Id nodeId)
|
||||
{
|
||||
std::vector<std::tuple<Id, Id, Id>> memberEdges = m_graphAccess->getMemberEdgesOfNode(nodeId);
|
||||
|
||||
for(unsigned int i = 0; i < memberEdges.size(); i++)
|
||||
for (unsigned int i = 0; i < memberEdges.size(); i++)
|
||||
{
|
||||
if(std::get<0>(memberEdges[i]) != nodeId)
|
||||
if (std::get<0>(memberEdges[i]) != nodeId)
|
||||
{
|
||||
return findTopLevelNode(std::get<0>(memberEdges[i]));
|
||||
}
|
||||
@@ -91,9 +90,9 @@ DummyNode GraphController::buildNodeTopDown(const Id nodeId)
|
||||
result.tokenId = nodeId;
|
||||
|
||||
std::vector<std::tuple<Id, Id, Id>> memberEdges = m_graphAccess->getMemberEdgesOfNode(nodeId);
|
||||
for(unsigned int i = 0; i < memberEdges.size(); i++)
|
||||
for (unsigned int i = 0; i < memberEdges.size(); i++)
|
||||
{
|
||||
if(std::get<1>(memberEdges[i]) != nodeId)
|
||||
if (std::get<1>(memberEdges[i]) != nodeId)
|
||||
{
|
||||
result.subNodes.push_back(buildNodeTopDown(std::get<1>(memberEdges[i])));
|
||||
}
|
||||
@@ -114,34 +113,34 @@ std::vector<DummyNode> GraphController::createNeighbourNodes(const Id nodeId)
|
||||
std::vector<std::tuple<Id, Id, Id>> parameterEdges = m_graphAccess->getParameterOfEdgesOfNode(nodeId);
|
||||
std::vector<std::tuple<Id, Id, Id>> inheritanceEdges = m_graphAccess->getInheritanceEdgesOfNode(nodeId);
|
||||
|
||||
if(callEdges.size() > 0)
|
||||
if (callEdges.size() > 0)
|
||||
{
|
||||
edges.insert(edges.end(), callEdges.begin(), callEdges.end());
|
||||
}
|
||||
if(usageEdges.size() > 0)
|
||||
if (usageEdges.size() > 0)
|
||||
{
|
||||
edges.insert(edges.end(), usageEdges.begin(), usageEdges.end());
|
||||
}
|
||||
if(typeOfEdges.size() > 0)
|
||||
if (typeOfEdges.size() > 0)
|
||||
{
|
||||
edges.insert(edges.end(), typeOfEdges.begin(), typeOfEdges.end());
|
||||
}
|
||||
if(returnTypeEdges.size() > 0)
|
||||
if (returnTypeEdges.size() > 0)
|
||||
{
|
||||
edges.insert(edges.end(), returnTypeEdges.begin(), returnTypeEdges.end());
|
||||
}
|
||||
if(parameterEdges.size() > 0)
|
||||
if (parameterEdges.size() > 0)
|
||||
{
|
||||
edges.insert(edges.end(), parameterEdges.begin(), parameterEdges.end());
|
||||
}
|
||||
if(inheritanceEdges.size() > 0)
|
||||
if (inheritanceEdges.size() > 0)
|
||||
{
|
||||
edges.insert(edges.end(), inheritanceEdges.begin(), inheritanceEdges.end());
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < edges.size(); i++)
|
||||
for (unsigned int i = 0; i < edges.size(); i++)
|
||||
{
|
||||
if(std::get<0>(edges[i]) == nodeId)
|
||||
if (std::get<0>(edges[i]) == nodeId)
|
||||
{
|
||||
result.push_back(createDummyNode(std::get<1>(edges[i])));
|
||||
}
|
||||
@@ -161,23 +160,23 @@ std::vector<DummyNode> GraphController::createNeighbourNodes(const DummyNode& no
|
||||
std::set<DummyNode> tmpNodes; // to make it easier to keep the nodes unique
|
||||
|
||||
result = createNeighbourNodes(node.tokenId);
|
||||
for(unsigned int i = 0; i < result.size(); i++)
|
||||
for (unsigned int i = 0; i < result.size(); i++)
|
||||
{
|
||||
tmpNodes.insert(result[i]);
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < node.subNodes.size(); i++)
|
||||
for (unsigned int i = 0; i < node.subNodes.size(); i++)
|
||||
{
|
||||
std::vector<DummyNode> tmpNeighbours = createNeighbourNodes(node.subNodes[i].tokenId);
|
||||
for(unsigned int j = 0; j < tmpNeighbours.size(); j++)
|
||||
for (unsigned int j = 0; j < tmpNeighbours.size(); j++)
|
||||
{
|
||||
tmpNodes.insert(tmpNeighbours[j]);
|
||||
}
|
||||
}
|
||||
|
||||
result.clear();
|
||||
std::set<DummyNode>::iterator it = tmpNodes.begin();
|
||||
for(it; it != tmpNodes.end(); it++)
|
||||
|
||||
for (std::set<DummyNode>::iterator it = tmpNodes.begin(); it != tmpNodes.end(); it++)
|
||||
{
|
||||
result.push_back(*it);
|
||||
}
|
||||
@@ -191,17 +190,17 @@ std::vector<DummyEdge> GraphController::createEdges(const std::vector<DummyNode>
|
||||
|
||||
std::unordered_set<Id> nodeIds; // to help discard edges that point to non-existing nodes in the sub-graph
|
||||
std::queue<DummyNode> nodeQueue;
|
||||
for(unsigned int i = 0; i < nodes.size(); i++)
|
||||
for (unsigned int i = 0; i < nodes.size(); i++)
|
||||
{
|
||||
nodeQueue.push(nodes[i]);
|
||||
}
|
||||
|
||||
while(nodeQueue.size() > 0)
|
||||
while (nodeQueue.size() > 0)
|
||||
{
|
||||
DummyNode n = nodeQueue.front();
|
||||
nodeQueue.pop();
|
||||
|
||||
for(unsigned int i = 0; i < n.subNodes.size(); i++)
|
||||
for (unsigned int i = 0; i < n.subNodes.size(); i++)
|
||||
{
|
||||
nodeQueue.push(n.subNodes[i]);
|
||||
}
|
||||
@@ -210,22 +209,20 @@ std::vector<DummyEdge> GraphController::createEdges(const std::vector<DummyNode>
|
||||
}
|
||||
|
||||
std::set<DummyEdge> tmpEdges; // to make it easier to keep the edges unique
|
||||
for(unsigned int i = 0; i < nodes.size(); i++)
|
||||
for (unsigned int i = 0; i < nodes.size(); i++)
|
||||
{
|
||||
std::set<DummyEdge> tmp = getNeighbourEdgesOfNode(nodes[i]);
|
||||
|
||||
std::set<DummyEdge>::iterator it = tmp.begin();
|
||||
for(it; it != tmp.end(); it++)
|
||||
for (std::set<DummyEdge>::iterator it = tmp.begin(); it != tmp.end(); it++)
|
||||
{
|
||||
if(nodeIds.find(it->ownerId) != nodeIds.end() && nodeIds.find(it->targetId) != nodeIds.end())
|
||||
if (nodeIds.find(it->ownerId) != nodeIds.end() && nodeIds.find(it->targetId) != nodeIds.end())
|
||||
{
|
||||
tmpEdges.insert(tmp.begin(), tmp.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::set<DummyEdge>::iterator it = tmpEdges.begin();
|
||||
for(it; it != tmpEdges.end(); it++)
|
||||
for (std::set<DummyEdge>::iterator it = tmpEdges.begin(); it != tmpEdges.end(); it++)
|
||||
{
|
||||
result.push_back(*it);
|
||||
}
|
||||
@@ -244,32 +241,32 @@ std::set<DummyEdge> GraphController::getNeighbourEdgesOfNode(const DummyNode& no
|
||||
std::vector<std::tuple<Id, Id, Id>> parameterEdges = m_graphAccess->getParameterOfEdgesOfNode(node.tokenId);
|
||||
std::vector<std::tuple<Id, Id, Id>> inheritanceEdges = m_graphAccess->getInheritanceEdgesOfNode(node.tokenId);
|
||||
|
||||
for(unsigned int i = 0; i < callEdges.size(); i++)
|
||||
for (unsigned int i = 0; i < callEdges.size(); i++)
|
||||
{
|
||||
result.insert(DummyEdge(std::get<0>(callEdges[i]), std::get<1>(callEdges[i]), std::get<2>(callEdges[i]), Edge::EdgeType::EDGE_CALL));
|
||||
result.insert(DummyEdge(std::get<0>(callEdges[i]), std::get<1>(callEdges[i]), std::get<2>(callEdges[i]), Edge::EDGE_CALL));
|
||||
}
|
||||
for(unsigned int i = 0; i < usageEdges.size(); i++)
|
||||
for (unsigned int i = 0; i < usageEdges.size(); i++)
|
||||
{
|
||||
result.insert(DummyEdge(std::get<0>(usageEdges[i]), std::get<1>(usageEdges[i]), std::get<2>(usageEdges[i]), Edge::EdgeType::EDGE_USAGE));
|
||||
result.insert(DummyEdge(std::get<0>(usageEdges[i]), std::get<1>(usageEdges[i]), std::get<2>(usageEdges[i]), Edge::EDGE_USAGE));
|
||||
}
|
||||
for(unsigned int i = 0; i < typeOfEdges.size(); i++)
|
||||
for (unsigned int i = 0; i < typeOfEdges.size(); i++)
|
||||
{
|
||||
result.insert(DummyEdge(std::get<0>(typeOfEdges[i]), std::get<1>(typeOfEdges[i]), std::get<2>(typeOfEdges[i]), Edge::EdgeType::EDGE_TYPE_OF));
|
||||
result.insert(DummyEdge(std::get<0>(typeOfEdges[i]), std::get<1>(typeOfEdges[i]), std::get<2>(typeOfEdges[i]), Edge::EDGE_TYPE_OF));
|
||||
}
|
||||
for(unsigned int i = 0; i < returnTypeEdges.size(); i++)
|
||||
for (unsigned int i = 0; i < returnTypeEdges.size(); i++)
|
||||
{
|
||||
result.insert(DummyEdge(std::get<0>(returnTypeEdges[i]), std::get<1>(returnTypeEdges[i]), std::get<2>(returnTypeEdges[i]), Edge::EdgeType::EDGE_RETURN_TYPE_OF));
|
||||
result.insert(DummyEdge(std::get<0>(returnTypeEdges[i]), std::get<1>(returnTypeEdges[i]), std::get<2>(returnTypeEdges[i]), Edge::EDGE_RETURN_TYPE_OF));
|
||||
}
|
||||
for(unsigned int i = 0; i < parameterEdges.size(); i++)
|
||||
for (unsigned int i = 0; i < parameterEdges.size(); i++)
|
||||
{
|
||||
result.insert(DummyEdge(std::get<0>(parameterEdges[i]), std::get<1>(parameterEdges[i]), std::get<2>(parameterEdges[i]), Edge::EdgeType::EDGE_PARAMETER_TYPE_OF));
|
||||
result.insert(DummyEdge(std::get<0>(parameterEdges[i]), std::get<1>(parameterEdges[i]), std::get<2>(parameterEdges[i]), Edge::EDGE_PARAMETER_TYPE_OF));
|
||||
}
|
||||
for(unsigned int i = 0; i < inheritanceEdges.size(); i++)
|
||||
for (unsigned int i = 0; i < inheritanceEdges.size(); i++)
|
||||
{
|
||||
result.insert(DummyEdge(std::get<0>(inheritanceEdges[i]), std::get<1>(inheritanceEdges[i]), std::get<2>(inheritanceEdges[i]), Edge::EdgeType::EDGE_INHERITANCE));
|
||||
result.insert(DummyEdge(std::get<0>(inheritanceEdges[i]), std::get<1>(inheritanceEdges[i]), std::get<2>(inheritanceEdges[i]), Edge::EDGE_INHERITANCE));
|
||||
}
|
||||
|
||||
for(unsigned int i = 0; i < node.subNodes.size(); i++)
|
||||
for (unsigned int i = 0; i < node.subNodes.size(); i++)
|
||||
{
|
||||
std::set<DummyEdge> tmpNeighbours = getNeighbourEdgesOfNode(node.subNodes[i]);
|
||||
result.insert(tmpNeighbours.begin(), tmpNeighbours.end());
|
||||
|
||||
@@ -4,20 +4,19 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageActivateToken.h"
|
||||
|
||||
#include "component/controller/Controller.h"
|
||||
#include "component/controller/GraphLayouter.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageActivateToken.h"
|
||||
|
||||
struct DummyNode;
|
||||
struct DummyEdge;
|
||||
class GraphView;
|
||||
class GraphAccess;
|
||||
|
||||
class GraphController:
|
||||
public Controller,
|
||||
public MessageListener<MessageActivateToken>
|
||||
class GraphController
|
||||
: public Controller
|
||||
, public MessageListener<MessageActivateToken>
|
||||
{
|
||||
public:
|
||||
GraphController(GraphAccess* graphAccess);
|
||||
@@ -41,5 +40,4 @@ private:
|
||||
GraphAccess* m_graphAccess;
|
||||
};
|
||||
|
||||
|
||||
#endif // GRAPH_CONTROLLER_H
|
||||
|
||||
@@ -8,11 +8,11 @@ void GraphLayouter::layoutSimpleRaster(std::vector<DummyNode>& nodes)
|
||||
int y = 0;
|
||||
int offset = 150;
|
||||
|
||||
for(unsigned int i = 0; i < nodes.size(); i++)
|
||||
for (unsigned int i = 0; i < nodes.size(); i++)
|
||||
{
|
||||
nodes[i].position = Vec2i(x, y);
|
||||
|
||||
if(x > 0)
|
||||
if (x > 0)
|
||||
{
|
||||
y += offset;
|
||||
x = 0;
|
||||
@@ -26,20 +26,20 @@ void GraphLayouter::layoutSimpleRaster(std::vector<DummyNode>& nodes)
|
||||
|
||||
void GraphLayouter::layoutSimpleRing(std::vector<DummyNode>& nodes)
|
||||
{
|
||||
if(nodes.size() >= 1)
|
||||
if (nodes.size() >= 1)
|
||||
{
|
||||
nodes[0].position = Vec2i(0, 0);
|
||||
|
||||
if(nodes.size() > 1)
|
||||
if (nodes.size() > 1)
|
||||
{
|
||||
int offset = 150;
|
||||
float offset = 150.0f;
|
||||
|
||||
for(unsigned int i = 1; i < nodes.size(); i++)
|
||||
for (unsigned int i = 1; i < nodes.size(); i++)
|
||||
{
|
||||
float rad = ((2.0f*3.14159265359f) / float(nodes.size()-1)) * i-1;
|
||||
float rad = 2.0f * 3.14159265359f / float(nodes.size() - 1) * i - 1;
|
||||
|
||||
int x = (int)((float)offset * std::cos(rad));
|
||||
int y = (int)((float)offset * std::sin(rad));
|
||||
int x = offset * std::cos(rad);
|
||||
int y = offset * std::sin(rad);
|
||||
|
||||
nodes[i].position = Vec2i(x, y);
|
||||
}
|
||||
|
||||
@@ -14,4 +14,4 @@ public:
|
||||
static void layoutSimpleRing(std::vector<DummyNode>& nodes);
|
||||
};
|
||||
|
||||
#endif // GRAPH_LAYOUTER_H
|
||||
#endif // GRAPH_LAYOUTER_H
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "data/graph/Edge.h"
|
||||
#include "utility/math/Vector4.h"
|
||||
#include "utility/types.h"
|
||||
|
||||
#include "data/graph/Edge.h"
|
||||
|
||||
class GraphNode;
|
||||
|
||||
class GraphEdge
|
||||
@@ -47,7 +46,7 @@ public:
|
||||
|
||||
bool operator==(const DummyEdge& other) const
|
||||
{
|
||||
if(ownerId == other.ownerId && targetId == other.targetId)
|
||||
if (ownerId == other.ownerId && targetId == other.targetId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -61,11 +60,11 @@ public:
|
||||
|
||||
bool operator<(const DummyEdge& other) const
|
||||
{
|
||||
if(ownerId < other.ownerId )
|
||||
if (ownerId < other.ownerId )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(ownerId == other.ownerId)
|
||||
else if (ownerId == other.ownerId)
|
||||
{
|
||||
return (targetId < other.targetId);
|
||||
}
|
||||
@@ -84,4 +83,4 @@ public:
|
||||
Edge::EdgeType edgeType;
|
||||
};
|
||||
|
||||
#endif // GRAPH_EDGE_H
|
||||
#endif // GRAPH_EDGE_H
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
|
||||
bool operator==(const DummyNode& other) const
|
||||
{
|
||||
if(tokenId == other.tokenId
|
||||
if (tokenId == other.tokenId
|
||||
&& name == other.name
|
||||
&& position == position)
|
||||
{
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
bool operator<(const DummyNode& other) const
|
||||
{
|
||||
if(tokenId < other.tokenId)
|
||||
if (tokenId < other.tokenId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1 +1,9 @@
|
||||
#include "data/ElementIndex.h"
|
||||
|
||||
ElementIndex::ElementIndex()
|
||||
{
|
||||
}
|
||||
|
||||
ElementIndex::~ElementIndex()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
|
||||
class ElementIndex
|
||||
{
|
||||
public:
|
||||
ElementIndex();
|
||||
virtual ~ElementIndex();
|
||||
};
|
||||
|
||||
|
||||
#endif // ELEMENT_INDEX_H
|
||||
|
||||
@@ -1 +1,9 @@
|
||||
#include "data/SearchIndex.h"
|
||||
|
||||
SearchIndex::SearchIndex()
|
||||
{
|
||||
}
|
||||
|
||||
SearchIndex::~SearchIndex()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
|
||||
class SearchIndex
|
||||
{
|
||||
public:
|
||||
SearchIndex();
|
||||
virtual ~SearchIndex();
|
||||
};
|
||||
|
||||
|
||||
#endif // SEARCH_INDEX_H
|
||||
|
||||
@@ -32,5 +32,4 @@ public:
|
||||
virtual bool checkTokenIsNode(const Id id) const = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // GRAPH_ACCESS_H
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "data/graph/edgeComponent/EdgeComponent.h"
|
||||
#include "data/graph/Node.h"
|
||||
#include "data/graph/edgeComponent/EdgeComponent.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
Edge::Edge(EdgeType type, Node* from, Node* to)
|
||||
@@ -107,8 +107,6 @@ std::string Edge::getTypeString() const
|
||||
return "uses";
|
||||
case EDGE_TYPEDEF_OF:
|
||||
return "is typedef of";
|
||||
default:
|
||||
LOG_ERROR("TypeString not implemented for edge type.");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
// #include "data/graph/edgeComponent/EdgeComponentDataType.h"
|
||||
// #include "data/type/DataType.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
Node::Node(NodeType type, const std::string& name)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "data/graph/Edge.h"
|
||||
|
||||
|
||||
class EdgeComponent
|
||||
{
|
||||
public:
|
||||
@@ -21,5 +20,4 @@ private:
|
||||
Edge* m_edge;
|
||||
};
|
||||
|
||||
|
||||
#endif // EDGE_COMPONENT_H
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define EDGE_COMPONENT_DATA_TYPE_H
|
||||
|
||||
#include "data/graph/edgeComponent/EdgeComponent.h"
|
||||
|
||||
#include "data/type/DataTypeModifierStack.h"
|
||||
#include "data/type/DataTypeQualifierList.h"
|
||||
|
||||
@@ -23,5 +22,4 @@ private:
|
||||
const DataTypeModifierStack m_modifierStack;
|
||||
};
|
||||
|
||||
|
||||
#endif // EDGE_COMPONENT_DATA_TYPE_H
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
#include "utility/FileSystem.h"
|
||||
|
||||
#include "boost/filesystem.hpp"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
std::vector<std::string> FileSystem::getSourceFilesFromDirectory(
|
||||
const std::string& path, const std::vector<std::string>& extensions
|
||||
)
|
||||
{
|
||||
){
|
||||
std::vector<std::string> files;
|
||||
|
||||
if (boost::filesystem::is_directory(path))
|
||||
{
|
||||
boost::filesystem::recursive_directory_iterator it(path);
|
||||
boost::filesystem::recursive_directory_iterator endit;
|
||||
while(it != endit)
|
||||
while (it != endit)
|
||||
{
|
||||
if (boost::filesystem::is_regular_file(*it) && isValidExtension(it->path().string(), extensions))
|
||||
{
|
||||
@@ -36,9 +36,9 @@ bool FileSystem::isValidExtension(const std::string& filepath, const std::vector
|
||||
{
|
||||
boost::filesystem::path path(filepath);
|
||||
|
||||
for(std::string extension : extensions)
|
||||
for (std::string extension : extensions)
|
||||
{
|
||||
if(path.extension() == extension)
|
||||
if (path.extension() == extension)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user