From 0d46de871a240935996c79e2910f23de09eb9a25 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Mon, 21 Jul 2014 01:26:35 +0200 Subject: [PATCH] src: fixed clang warnings, fixed undefined symbols logs, fixed code convention violations --- src/app/qt/element/QtButton.cpp | 2 + src/app/qt/utility/QtThreadedFunctor.h | 1 + src/app/qt/view/QtGraphView.cpp | 80 +++++++++---------- src/app/qt/view/QtGraphView.h | 6 +- src/app/qt/view/QtSearchView.cpp | 3 + src/app/qt/view/QtSearchView.h | 1 + src/app/qt/view/graphElements/QtGraphEdge.cpp | 6 +- src/app/qt/view/graphElements/QtGraphEdge.h | 11 ++- src/app/qt/view/graphElements/QtGraphNode.cpp | 36 ++++----- src/app/qt/view/graphElements/QtGraphNode.h | 11 ++- src/lib/ApplicationSettings.cpp | 2 - src/lib/ApplicationSettings.h | 3 +- .../component/controller/CodeController.cpp | 4 +- src/lib/component/controller/CodeController.h | 1 - .../component/controller/GraphController.cpp | 79 +++++++++--------- .../component/controller/GraphController.h | 12 ++- .../component/controller/GraphLayouter.cpp | 18 ++--- src/lib/component/controller/GraphLayouter.h | 2 +- .../component/view/graphElements/GraphEdge.h | 11 ++- .../component/view/graphElements/GraphNode.h | 4 +- src/lib/data/ElementIndex.cpp | 8 ++ src/lib/data/ElementIndex.h | 4 +- src/lib/data/SearchIndex.cpp | 8 ++ src/lib/data/SearchIndex.h | 4 +- src/lib/data/access/GraphAccess.h | 1 - src/lib/data/graph/Edge.cpp | 4 +- src/lib/data/graph/Node.cpp | 2 - .../data/graph/edgeComponent/EdgeComponent.h | 2 - .../edgeComponent/EdgeComponentDataType.h | 2 - src/lib/utility/FileSystem.cpp | 10 +-- 30 files changed, 166 insertions(+), 172 deletions(-) diff --git a/src/app/qt/element/QtButton.cpp b/src/app/qt/element/QtButton.cpp index 084d5b00..4c16f151 100644 --- a/src/app/qt/element/QtButton.cpp +++ b/src/app/qt/element/QtButton.cpp @@ -19,5 +19,7 @@ void QtButton::setCallbackOnClick(std::function callback) void QtButton::slotOnClick() { if (m_onClick) + { m_onClick(); + } } diff --git a/src/app/qt/utility/QtThreadedFunctor.h b/src/app/qt/utility/QtThreadedFunctor.h index 7b275a97..92686f19 100644 --- a/src/app/qt/utility/QtThreadedFunctor.h +++ b/src/app/qt/utility/QtThreadedFunctor.h @@ -2,6 +2,7 @@ #define QT_THREADED_FUCTOR_H #include + #include #include diff --git a/src/app/qt/view/QtGraphView.cpp b/src/app/qt/view/QtGraphView.cpp index 878fd846..9c2ddf0a 100644 --- a/src/app/qt/view/QtGraphView.cpp +++ b/src/app/qt/view/QtGraphView.cpp @@ -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 +#include +#include +#include #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(""); @@ -81,12 +76,15 @@ void QtGraphView::doRebuildGraph(const std::vector& nodes, const std: if (view != NULL) { - std::map> weakNodes; // used when creating the edges - std::list> 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> 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> 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 newNode = findOrCreateNode(view, nodes[i]); newNode->setPosition(nodes[i].position); @@ -97,10 +95,10 @@ void QtGraphView::doRebuildGraph(const std::vector& 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 edge = createEdge(view, edges[i]); - if(edge != NULL) + if (edge != NULL) { m_edges.push_back(edge); } @@ -124,7 +122,7 @@ std::shared_ptr 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 QtGraphView::findOrCreateNode(QGraphicsView* view, co std::shared_ptr QtGraphView::findNode(const Id id) { - std::list>::iterator it = m_nodes.begin(); - - for(it; it != m_nodes.end(); it++) + for (std::list>::iterator it = m_nodes.begin(); it != m_nodes.end(); it++) { - if((*it)->getTokenId() == id) + if ((*it)->getTokenId() == id) { return *it; } else { std::shared_ptr result = findSubNode(*it, id); - if(result != NULL) + if (result != NULL) { return result; } @@ -159,17 +155,16 @@ std::shared_ptr QtGraphView::findSubNode(const std::shared_ptr> subNodes = node->getSubNodes(); - std::list>::iterator it = subNodes.begin(); - for(it; it != subNodes.end(); it++) + for (std::list>::iterator it = subNodes.begin(); it != subNodes.end(); it++) { - if((*it)->getTokenId() == id) + if ((*it)->getTokenId() == id) { return *it; } else { std::shared_ptr result = findSubNode(*it, id); - if(result != NULL) + if (result != NULL) { return result; } @@ -181,19 +176,20 @@ std::shared_ptr QtGraphView::findSubNode(const std::shared_ptr QtGraphView::createNode(QGraphicsView* view, const DummyNode& node) { - if(view != NULL) + if (view != NULL) { - std::shared_ptr newNode = std::make_shared(Vec2i(0, 0), node.name, node.tokenId); + std::shared_ptr newNode = + std::make_shared(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 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 QtGraphView::createNode(QGraphicsView* view, const Du std::shared_ptr QtGraphView::createSubNode(QGraphicsView* view, const DummyNode& node) { - if(view != NULL) + if (view != NULL) { std::shared_ptr newNode = std::make_shared(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 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 QtGraphView::createSubNode(QGraphicsView* view, con std::shared_ptr QtGraphView::createEdge(QGraphicsView* view, const DummyEdge& edge) { - if(view != NULL) + if (view != NULL) { std::shared_ptr owner = findNode(edge.ownerId); std::shared_ptr target = findNode(edge.targetId); - if(owner != NULL && target != NULL) + if (owner != NULL && target != NULL) { std::shared_ptr qtEdge = std::make_shared(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: diff --git a/src/app/qt/view/QtGraphView.h b/src/app/qt/view/QtGraphView.h index 5d420b72..b64d70ec 100644 --- a/src/app/qt/view/QtGraphView.h +++ b/src/app/qt/view/QtGraphView.h @@ -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); diff --git a/src/app/qt/view/QtSearchView.cpp b/src/app/qt/view/QtSearchView.cpp index c944beb9..31ccf61d 100644 --- a/src/app/qt/view/QtSearchView.cpp +++ b/src/app/qt/view/QtSearchView.cpp @@ -97,7 +97,10 @@ void QtSearchView::doSetAutocompletionList(const std::vector& 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); diff --git a/src/app/qt/view/QtSearchView.h b/src/app/qt/view/QtSearchView.h index 0a4a6ba2..6b116a9e 100644 --- a/src/app/qt/view/QtSearchView.h +++ b/src/app/qt/view/QtSearchView.h @@ -34,6 +34,7 @@ private: QtEditBox* m_searchBox; QtButton* m_searchButton; QtButton* m_caseSensitiveButton; + QtThreadedFunctor m_setTextFunctor; QtThreadedFunctor<> m_setFocusFunctor; QtThreadedFunctor&> m_setAutocompletionListFunctor; diff --git a/src/app/qt/view/graphElements/QtGraphEdge.cpp b/src/app/qt/view/graphElements/QtGraphEdge.cpp index 80cfba4c..98b6f13a 100644 --- a/src/app/qt/view/graphElements/QtGraphEdge.cpp +++ b/src/app/qt/view/graphElements/QtGraphEdge.cpp @@ -1,7 +1,7 @@ #include "qt/view/graphElements/QtGraphEdge.h" -#include "qgraphicsscene.h" -#include "qpen.h" +#include +#include #include "component/view/graphElements/GraphNode.h" @@ -67,7 +67,7 @@ void QtGraphEdge::removeEdgeFromScene() { std::shared_ptr node = m_owner.lock(); - if(node != NULL) + if (node != NULL) { node->removeOutEdge(this); } diff --git a/src/app/qt/view/graphElements/QtGraphEdge.h b/src/app/qt/view/graphElements/QtGraphEdge.h index a56133e2..ca34a1c2 100644 --- a/src/app/qt/view/graphElements/QtGraphEdge.h +++ b/src/app/qt/view/graphElements/QtGraphEdge.h @@ -3,17 +3,16 @@ #include -#include "qgraphicsitem.h" - -#include "utility/messaging/type/MessageActivateToken.h" +#include #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& owner, const std::weak_ptr& target, const Id id); diff --git a/src/app/qt/view/graphElements/QtGraphNode.cpp b/src/app/qt/view/graphElements/QtGraphNode.cpp index 3935b0ef..32fed627 100644 --- a/src/app/qt/view/graphElements/QtGraphNode.cpp +++ b/src/app/qt/view/graphElements/QtGraphNode.cpp @@ -2,8 +2,8 @@ #include -#include "qgraphicsscene.h" -#include "qgraphicssceneevent.h" +#include +#include #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 >::iterator it = m_inEdges.begin(); - for(it; it != m_inEdges.end(); it++) + for (std::list>::iterator it = m_inEdges.begin(); it != m_inEdges.end(); it++) { std::shared_ptr 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& edge) { - std::list >::iterator it = m_outEdges.begin(); - for(it; it != m_outEdges.end(); it++) + for (std::list>::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& edge) bool QtGraphNode::addInEdge(const std::weak_ptr& edge) { - std::list >::iterator it = m_inEdges.begin(); - for(it; it != m_inEdges.end(); it++) + for (std::list >::iterator it = m_inEdges.begin(); it != m_inEdges.end(); it++) { std::shared_ptr 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& edge) void QtGraphNode::removeOutEdge(GraphEdge* edge) { std::list >::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 >::iterator it = m_outEdges.begin(); - for(it; it != m_outEdges.end(); it++) + for (std::list >::iterator it = m_outEdges.begin(); it != m_outEdges.end(); it++) { (*it)->ownerMoved(); } std::list >::iterator it2 = m_inEdges.begin(); - while(it2 != m_inEdges.end()) + while (it2 != m_inEdges.end()) { std::shared_ptr edge = it2->lock(); - if(edge.get() != NULL) + if (edge.get() != NULL) { edge->targetMoved(); ++it2; @@ -151,8 +148,7 @@ void QtGraphNode::notifyEdgesAfterMove() } } - std::list >::iterator it3 = m_subNodes.begin(); - for(it3; it3 != m_subNodes.end(); it3++) + for (std::list >::iterator it3 = m_subNodes.begin(); it3 != m_subNodes.end(); it3++) { (*it3)->notifyParentMoved(); } diff --git a/src/app/qt/view/graphElements/QtGraphNode.h b/src/app/qt/view/graphElements/QtGraphNode.h index bbde5eed..af37f340 100644 --- a/src/app/qt/view/graphElements/QtGraphNode.h +++ b/src/app/qt/view/graphElements/QtGraphNode.h @@ -1,18 +1,17 @@ #ifndef QT_GRAPH_NODE_H #define QT_GRAPH_NODE_H -#include "qgraphicsitem.h" +#include +#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); diff --git a/src/lib/ApplicationSettings.cpp b/src/lib/ApplicationSettings.cpp index 62b92441..88771f97 100644 --- a/src/lib/ApplicationSettings.cpp +++ b/src/lib/ApplicationSettings.cpp @@ -12,8 +12,6 @@ std::shared_ptr ApplicationSettings::getInstance() return s_instance; } - - ApplicationSettings::~ApplicationSettings() { } diff --git a/src/lib/ApplicationSettings.h b/src/lib/ApplicationSettings.h index 9a28fdd2..5f878782 100644 --- a/src/lib/ApplicationSettings.h +++ b/src/lib/ApplicationSettings.h @@ -3,9 +3,8 @@ #include -#include "utility/math/Color.h" - #include "Settings.h" +#include "utility/math/Color.h" class ApplicationSettings: public Settings { diff --git a/src/lib/component/controller/CodeController.cpp b/src/lib/component/controller/CodeController.cpp index 5b389f40..f0254ac0 100644 --- a/src/lib/component/controller/CodeController.cpp +++ b/src/lib/component/controller/CodeController.cpp @@ -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) diff --git a/src/lib/component/controller/CodeController.h b/src/lib/component/controller/CodeController.h index 017271be..7cfc0a62 100644 --- a/src/lib/component/controller/CodeController.h +++ b/src/lib/component/controller/CodeController.h @@ -34,5 +34,4 @@ private: LocationAccess* m_locationAccess; }; - #endif // CODE_CONTROLLER_H diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index 99f6bb3e..062232f3 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -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 nodes; - if(m_graphAccess->checkTokenIsNode(activeId)) + if (m_graphAccess->checkTokenIsNode(activeId)) { nodes.push_back(createDummyNode(activeId)); std::vector neighbours = createNeighbourNodes(nodes[0]); @@ -72,9 +71,9 @@ Id GraphController::findTopLevelNode(const Id nodeId) { std::vector> 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> 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 GraphController::createNeighbourNodes(const Id nodeId) std::vector> parameterEdges = m_graphAccess->getParameterOfEdgesOfNode(nodeId); std::vector> 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 GraphController::createNeighbourNodes(const DummyNode& no std::set 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 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::iterator it = tmpNodes.begin(); - for(it; it != tmpNodes.end(); it++) + + for (std::set::iterator it = tmpNodes.begin(); it != tmpNodes.end(); it++) { result.push_back(*it); } @@ -191,17 +190,17 @@ std::vector GraphController::createEdges(const std::vector std::unordered_set nodeIds; // to help discard edges that point to non-existing nodes in the sub-graph std::queue 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 GraphController::createEdges(const std::vector } std::set 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 tmp = getNeighbourEdgesOfNode(nodes[i]); - std::set::iterator it = tmp.begin(); - for(it; it != tmp.end(); it++) + for (std::set::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::iterator it = tmpEdges.begin(); - for(it; it != tmpEdges.end(); it++) + for (std::set::iterator it = tmpEdges.begin(); it != tmpEdges.end(); it++) { result.push_back(*it); } @@ -244,32 +241,32 @@ std::set GraphController::getNeighbourEdgesOfNode(const DummyNode& no std::vector> parameterEdges = m_graphAccess->getParameterOfEdgesOfNode(node.tokenId); std::vector> 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 tmpNeighbours = getNeighbourEdgesOfNode(node.subNodes[i]); result.insert(tmpNeighbours.begin(), tmpNeighbours.end()); diff --git a/src/lib/component/controller/GraphController.h b/src/lib/component/controller/GraphController.h index 17e4f999..97eed694 100644 --- a/src/lib/component/controller/GraphController.h +++ b/src/lib/component/controller/GraphController.h @@ -4,20 +4,19 @@ #include #include -#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 +class GraphController + : public Controller + , public MessageListener { public: GraphController(GraphAccess* graphAccess); @@ -41,5 +40,4 @@ private: GraphAccess* m_graphAccess; }; - #endif // GRAPH_CONTROLLER_H diff --git a/src/lib/component/controller/GraphLayouter.cpp b/src/lib/component/controller/GraphLayouter.cpp index 578f0dc7..58d04a48 100644 --- a/src/lib/component/controller/GraphLayouter.cpp +++ b/src/lib/component/controller/GraphLayouter.cpp @@ -8,11 +8,11 @@ void GraphLayouter::layoutSimpleRaster(std::vector& 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& nodes) void GraphLayouter::layoutSimpleRing(std::vector& 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); } diff --git a/src/lib/component/controller/GraphLayouter.h b/src/lib/component/controller/GraphLayouter.h index f2f3050d..9fa3be30 100644 --- a/src/lib/component/controller/GraphLayouter.h +++ b/src/lib/component/controller/GraphLayouter.h @@ -14,4 +14,4 @@ public: static void layoutSimpleRing(std::vector& nodes); }; -#endif // GRAPH_LAYOUTER_H \ No newline at end of file +#endif // GRAPH_LAYOUTER_H diff --git a/src/lib/component/view/graphElements/GraphEdge.h b/src/lib/component/view/graphElements/GraphEdge.h index 2e3239b5..49c072fe 100644 --- a/src/lib/component/view/graphElements/GraphEdge.h +++ b/src/lib/component/view/graphElements/GraphEdge.h @@ -3,11 +3,10 @@ #include +#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 \ No newline at end of file +#endif // GRAPH_EDGE_H diff --git a/src/lib/component/view/graphElements/GraphNode.h b/src/lib/component/view/graphElements/GraphNode.h index 67126dd3..4c0e3a7d 100644 --- a/src/lib/component/view/graphElements/GraphNode.h +++ b/src/lib/component/view/graphElements/GraphNode.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; } diff --git a/src/lib/data/ElementIndex.cpp b/src/lib/data/ElementIndex.cpp index fc9dfab3..06492743 100644 --- a/src/lib/data/ElementIndex.cpp +++ b/src/lib/data/ElementIndex.cpp @@ -1 +1,9 @@ #include "data/ElementIndex.h" + +ElementIndex::ElementIndex() +{ +} + +ElementIndex::~ElementIndex() +{ +} diff --git a/src/lib/data/ElementIndex.h b/src/lib/data/ElementIndex.h index 0ddcbc7e..107895ac 100644 --- a/src/lib/data/ElementIndex.h +++ b/src/lib/data/ElementIndex.h @@ -3,7 +3,9 @@ class ElementIndex { +public: + ElementIndex(); + virtual ~ElementIndex(); }; - #endif // ELEMENT_INDEX_H diff --git a/src/lib/data/SearchIndex.cpp b/src/lib/data/SearchIndex.cpp index d0203fbf..5a422090 100644 --- a/src/lib/data/SearchIndex.cpp +++ b/src/lib/data/SearchIndex.cpp @@ -1 +1,9 @@ #include "data/SearchIndex.h" + +SearchIndex::SearchIndex() +{ +} + +SearchIndex::~SearchIndex() +{ +} diff --git a/src/lib/data/SearchIndex.h b/src/lib/data/SearchIndex.h index ec767796..c143a2e9 100644 --- a/src/lib/data/SearchIndex.h +++ b/src/lib/data/SearchIndex.h @@ -3,7 +3,9 @@ class SearchIndex { +public: + SearchIndex(); + virtual ~SearchIndex(); }; - #endif // SEARCH_INDEX_H diff --git a/src/lib/data/access/GraphAccess.h b/src/lib/data/access/GraphAccess.h index e05f8b5c..73bc394e 100644 --- a/src/lib/data/access/GraphAccess.h +++ b/src/lib/data/access/GraphAccess.h @@ -32,5 +32,4 @@ public: virtual bool checkTokenIsNode(const Id id) const = 0; }; - #endif // GRAPH_ACCESS_H diff --git a/src/lib/data/graph/Edge.cpp b/src/lib/data/graph/Edge.cpp index f34bc46e..3359cb6d 100644 --- a/src/lib/data/graph/Edge.cpp +++ b/src/lib/data/graph/Edge.cpp @@ -2,8 +2,8 @@ #include -#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 ""; } diff --git a/src/lib/data/graph/Node.cpp b/src/lib/data/graph/Node.cpp index 7406547e..314d991c 100644 --- a/src/lib/data/graph/Node.cpp +++ b/src/lib/data/graph/Node.cpp @@ -2,8 +2,6 @@ #include -// #include "data/graph/edgeComponent/EdgeComponentDataType.h" -// #include "data/type/DataType.h" #include "utility/logging/logging.h" Node::Node(NodeType type, const std::string& name) diff --git a/src/lib/data/graph/edgeComponent/EdgeComponent.h b/src/lib/data/graph/edgeComponent/EdgeComponent.h index 976a8afd..1e5255c3 100644 --- a/src/lib/data/graph/edgeComponent/EdgeComponent.h +++ b/src/lib/data/graph/edgeComponent/EdgeComponent.h @@ -3,7 +3,6 @@ #include "data/graph/Edge.h" - class EdgeComponent { public: @@ -21,5 +20,4 @@ private: Edge* m_edge; }; - #endif // EDGE_COMPONENT_H diff --git a/src/lib/data/graph/edgeComponent/EdgeComponentDataType.h b/src/lib/data/graph/edgeComponent/EdgeComponentDataType.h index 687dc6ec..9653a6a4 100644 --- a/src/lib/data/graph/edgeComponent/EdgeComponentDataType.h +++ b/src/lib/data/graph/edgeComponent/EdgeComponentDataType.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 diff --git a/src/lib/utility/FileSystem.cpp b/src/lib/utility/FileSystem.cpp index f10ff449..d3ed0e8e 100644 --- a/src/lib/utility/FileSystem.cpp +++ b/src/lib/utility/FileSystem.cpp @@ -1,19 +1,19 @@ #include "utility/FileSystem.h" #include "boost/filesystem.hpp" + #include "utility/logging/logging.h" std::vector FileSystem::getSourceFilesFromDirectory( const std::string& path, const std::vector& extensions -) -{ +){ std::vector 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; }