src: clazy compiler warnings
get rid of most clazy warnings (https://github.com/KDE/clazy) * range loop use refs * qcolor ctor with ints * missing Q_OBJECT macro * use .constfirst instead of .first enabled ccache for unix systems for fasterr recompiling * if ccache is in path we use it now
This commit is contained in:
@@ -23,6 +23,13 @@ ENDIF(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
|
||||
set(PROJECT_NAME Sourcetrail)
|
||||
set(PROJECT_NAME_LOWER_CASE sourcetrail)
|
||||
|
||||
# speed up recompiling on unix with ccache
|
||||
find_program(CCACHE_PROGRAM ccache)
|
||||
if(CCACHE_PROGRAM)
|
||||
# Support Unix Makefiles and Ninja
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
|
||||
endif()
|
||||
|
||||
set(APP_PROJECT_NAME "${PROJECT_NAME}")
|
||||
set(LIB_LICENSE_PROJECT_NAME "${PROJECT_NAME}_lib_license")
|
||||
set(LIB_GUI_PROJECT_NAME "${PROJECT_NAME}_lib_gui")
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
const std::string PRIVATE_KEY = "@KEY@";
|
||||
const char PRIVATE_KEY[] = "@KEY@";
|
||||
|
||||
#endif // PRIVATE_KEY_H
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
const std::string PUBLIC_KEY = "@KEY@";
|
||||
const char PUBLIC_KEY[] = "@KEY@";
|
||||
|
||||
#endif // PUBLIC_KEY_H
|
||||
|
||||
@@ -42,7 +42,6 @@ fi
|
||||
|
||||
# Remove folders and contents
|
||||
rm -rf java_indexer/bin
|
||||
rm -rf java_indexer/lib
|
||||
rm -rf build
|
||||
|
||||
# Remove log files
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "includes.h" // defines 'void setup(int argc, char *argv[])'
|
||||
|
||||
#include <csignal>
|
||||
|
||||
#include "Application.h"
|
||||
#include "data/indexer/IndexerFactory.h"
|
||||
#include "data/indexer/IndexerFactoryModuleJava.h"
|
||||
@@ -36,12 +34,6 @@
|
||||
#include "utility/Version.h"
|
||||
#include "version.h"
|
||||
|
||||
void signalHandler(int signum)
|
||||
{
|
||||
std::cout << "interrupt running tasks" << std::endl;
|
||||
MessageInterruptTasks().dispatch();
|
||||
}
|
||||
|
||||
void setupLogging()
|
||||
{
|
||||
LogManager* logManager = LogManager::getInstance().get();
|
||||
@@ -269,24 +261,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
MessageEnteredLicense(checker->getCurrentLicenseType()).dispatch();
|
||||
}
|
||||
#ifdef _WIN32
|
||||
signal(SIGINT, signalHandler);
|
||||
signal(SIGTERM, signalHandler);
|
||||
signal(SIGABRT, signalHandler);
|
||||
#else
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = signalHandler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = SA_RESTART;
|
||||
if (sigaction(SIGINT, &sa, NULL))
|
||||
{
|
||||
std::cout << "Cant install SIGINT handler" << std::endl;
|
||||
}
|
||||
if (sigaction(SIGHUP, &sa, NULL))
|
||||
{
|
||||
std::cout << "Cant install SIGHUP handler" << std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (commandLineParser.hasError() )
|
||||
|
||||
+1
-12
@@ -277,25 +277,14 @@ void Application::handleMessage(MessageLoadProject* message)
|
||||
|
||||
if (m_project && projectSettingsFilePath == m_project->getProjectSettingsFilePath())
|
||||
{
|
||||
if (message->forceRefresh && m_hasGUI)
|
||||
if (message->forceRefresh)
|
||||
{
|
||||
m_project->setStateSettingsUpdated();
|
||||
refreshProject(false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
createAndLoadProject(projectSettingsFilePath);
|
||||
|
||||
if (message->forceRefresh)
|
||||
{
|
||||
refreshProject(true);
|
||||
}
|
||||
else if (!m_hasGUI)
|
||||
{
|
||||
refreshProject(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::handleMessage(MessageRefresh* message)
|
||||
|
||||
@@ -71,7 +71,7 @@ void ComponentManager::setup(ViewLayout* viewLayout)
|
||||
|
||||
void ComponentManager::clearComponents()
|
||||
{
|
||||
for (std::shared_ptr<Component> component : m_components)
|
||||
for (const std::shared_ptr<Component>& component : m_components)
|
||||
{
|
||||
Controller* controller = component->getController<Controller>();
|
||||
|
||||
@@ -84,7 +84,7 @@ void ComponentManager::clearComponents()
|
||||
|
||||
void ComponentManager::refreshViews()
|
||||
{
|
||||
for (std::shared_ptr<Component> component : m_components)
|
||||
for (const std::shared_ptr<Component>& component : m_components)
|
||||
{
|
||||
View* view = component->getView<View>();
|
||||
|
||||
@@ -94,12 +94,12 @@ void ComponentManager::refreshViews()
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<CompositeView> view : m_compositeViews)
|
||||
for (const std::shared_ptr<CompositeView>& view : m_compositeViews)
|
||||
{
|
||||
view->refreshView();
|
||||
}
|
||||
|
||||
for (std::shared_ptr<TabbedView> view : m_tabbedViews)
|
||||
for (const std::shared_ptr<TabbedView>& view : m_tabbedViews)
|
||||
{
|
||||
view->refreshView();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ std::shared_ptr<Bookmark> BookmarkController::getBookmarkForActiveToken() const
|
||||
{
|
||||
if (!m_activeEdgeIds.empty())
|
||||
{
|
||||
for (std::shared_ptr<EdgeBookmark> edgeBookmark: getAllEdgeBookmarks())
|
||||
for (const std::shared_ptr<EdgeBookmark>& edgeBookmark: getAllEdgeBookmarks())
|
||||
{
|
||||
if (!m_activeNodeIds.empty() && edgeBookmark->getActiveNodeId() == m_activeNodeIds.front() &&
|
||||
utility::isPermutation(edgeBookmark->getEdgeIds(), m_activeEdgeIds))
|
||||
@@ -87,7 +87,7 @@ std::shared_ptr<Bookmark> BookmarkController::getBookmarkForActiveToken() const
|
||||
}
|
||||
else
|
||||
{
|
||||
for (std::shared_ptr<NodeBookmark> nodeBookmark: getAllNodeBookmarks())
|
||||
for (const std::shared_ptr<NodeBookmark>& nodeBookmark: getAllNodeBookmarks())
|
||||
{
|
||||
if (utility::isPermutation(nodeBookmark->getNodeIds(), m_activeNodeIds))
|
||||
{
|
||||
@@ -101,7 +101,7 @@ std::shared_ptr<Bookmark> BookmarkController::getBookmarkForActiveToken() const
|
||||
|
||||
std::shared_ptr<Bookmark> BookmarkController::getBookmarkForNodeId(Id nodeId) const
|
||||
{
|
||||
for (std::shared_ptr<NodeBookmark> nodeBookmark: getAllNodeBookmarks())
|
||||
for (const std::shared_ptr<NodeBookmark>& nodeBookmark: getAllNodeBookmarks())
|
||||
{
|
||||
if (nodeBookmark->getNodeIds().size() == 1 && nodeBookmark->getNodeIds()[0] == nodeId)
|
||||
{
|
||||
@@ -376,11 +376,11 @@ std::vector<std::shared_ptr<Bookmark>> BookmarkController::getAllBookmarks() con
|
||||
|
||||
std::vector<std::shared_ptr<Bookmark>> bookmarks;
|
||||
|
||||
for (std::shared_ptr<NodeBookmark> nodeBookmark: getAllNodeBookmarks())
|
||||
for (const std::shared_ptr<NodeBookmark>& nodeBookmark: getAllNodeBookmarks())
|
||||
{
|
||||
bookmarks.push_back(nodeBookmark);
|
||||
}
|
||||
for (std::shared_ptr<EdgeBookmark> edgeBookmark: getAllEdgeBookmarks())
|
||||
for (const std::shared_ptr<EdgeBookmark>& edgeBookmark: getAllEdgeBookmarks())
|
||||
{
|
||||
bookmarks.push_back(edgeBookmark);
|
||||
}
|
||||
@@ -455,7 +455,7 @@ std::vector<std::shared_ptr<Bookmark>> BookmarkController::getFilteredBookmarks(
|
||||
}
|
||||
else if (filter == MessageDisplayBookmarks::BookmarkFilter::NODES)
|
||||
{
|
||||
for (std::shared_ptr<Bookmark> bookmark: bookmarks)
|
||||
for (const std::shared_ptr<Bookmark>& bookmark: bookmarks)
|
||||
{
|
||||
if (std::dynamic_pointer_cast<NodeBookmark>(bookmark))
|
||||
{
|
||||
@@ -465,7 +465,7 @@ std::vector<std::shared_ptr<Bookmark>> BookmarkController::getFilteredBookmarks(
|
||||
}
|
||||
else if (filter == MessageDisplayBookmarks::BookmarkFilter::EDGES)
|
||||
{
|
||||
for (std::shared_ptr<Bookmark> bookmark: bookmarks)
|
||||
for (const std::shared_ptr<Bookmark>& bookmark: bookmarks)
|
||||
{
|
||||
if (std::dynamic_pointer_cast<EdgeBookmark>(bookmark))
|
||||
{
|
||||
|
||||
@@ -431,7 +431,7 @@ void CodeController::expandVisibleSnippets(std::vector<CodeSnippetParams>* snipp
|
||||
continue;
|
||||
}
|
||||
|
||||
for (CodeSnippetParams newSnippet : newSnippets)
|
||||
for (CodeSnippetParams& newSnippet : newSnippets)
|
||||
{
|
||||
newSnippet.isDeclaration = oldSnippet.isDeclaration;
|
||||
newSnippet.isDefinition = oldSnippet.isDefinition;
|
||||
|
||||
@@ -106,7 +106,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
|
||||
else if (message->isAggregation)
|
||||
{
|
||||
bool isInheritanceChain = true;
|
||||
for (auto edge : m_dummyEdges)
|
||||
for (const auto& edge : m_dummyEdges)
|
||||
{
|
||||
if (!edge->data->isType(Edge::EDGE_INHERITANCE))
|
||||
{
|
||||
@@ -117,7 +117,7 @@ void GraphController::handleMessage(MessageActivateTokens* message)
|
||||
|
||||
if (isInheritanceChain)
|
||||
{
|
||||
for (auto node : m_dummyNodes)
|
||||
for (auto& node : m_dummyNodes)
|
||||
{
|
||||
node->bundleInfo.layoutVertical = true;
|
||||
}
|
||||
@@ -472,7 +472,7 @@ void GraphController::createDummyGraphForTokenIds(const std::vector<Id>& tokenId
|
||||
}
|
||||
);
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : dummyNodes)
|
||||
{
|
||||
node->hasParent = false;
|
||||
|
||||
@@ -558,7 +558,7 @@ std::vector<std::shared_ptr<DummyNode>> GraphController::createDummyNodeTopDown(
|
||||
accessKind = access->getAccess();
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> dummy : result->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& dummy : result->subNodes)
|
||||
{
|
||||
if (dummy->accessKind == accessKind)
|
||||
{
|
||||
@@ -586,7 +586,7 @@ std::vector<std::shared_ptr<DummyNode>> GraphController::createDummyNodeTopDown(
|
||||
std::vector<Id> GraphController::getExpandedNodeIds() const
|
||||
{
|
||||
std::vector<Id> nodeIds;
|
||||
for (std::pair<Id, std::shared_ptr<DummyNode>> p : m_dummyGraphNodes)
|
||||
for (const std::pair<Id, std::shared_ptr<DummyNode>>& p : m_dummyGraphNodes)
|
||||
{
|
||||
DummyNode* oldNode = p.second.get();
|
||||
if (oldNode->expanded && !oldNode->autoExpanded && oldNode->isGraphNode() &&
|
||||
@@ -634,13 +634,13 @@ bool GraphController::setActive(const std::vector<Id>& activeTokenIds, bool show
|
||||
if (activeTokenIds.size() > 0)
|
||||
{
|
||||
noActive = true;
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
setNodeActiveRecursive(node.get(), activeTokenIds, &noActive);
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyEdge> edge : m_dummyEdges)
|
||||
for (const std::shared_ptr<DummyEdge>& edge : m_dummyEdges)
|
||||
{
|
||||
if (!edge->data)
|
||||
{
|
||||
@@ -673,7 +673,7 @@ void GraphController::setVisibility(bool noActive)
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
setNodeVisibilityRecursiveBottomUp(node.get(), noActive);
|
||||
}
|
||||
@@ -700,7 +700,7 @@ void GraphController::setNodeActiveRecursive(DummyNode* node, const std::vector<
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
setNodeActiveRecursive(subNode.get(), activeTokenIds, noActive);
|
||||
}
|
||||
@@ -727,7 +727,7 @@ bool GraphController::setNodeVisibilityRecursiveBottomUp(DummyNode* node, bool n
|
||||
return false;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (setNodeVisibilityRecursiveBottomUp(subNode.get(), noActive))
|
||||
{
|
||||
@@ -759,7 +759,7 @@ void GraphController::setNodeVisibilityRecursiveTopDown(DummyNode* node, bool pa
|
||||
if ((node->isGraphNode() && node->isExpanded()) ||
|
||||
(node->isAccessNode() && (node->accessKind == ACCESS_NONE || parentExpanded)))
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (!subNode->isQualifierNode())
|
||||
{
|
||||
@@ -775,7 +775,7 @@ void GraphController::bundleNodes()
|
||||
TRACE();
|
||||
|
||||
// evaluate top level nodes
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
if (!node->isGraphNode() || !node->visible)
|
||||
{
|
||||
@@ -876,7 +876,7 @@ void GraphController::bundleNodes()
|
||||
|
||||
// bundle
|
||||
bool fileOrMacroActive = false;
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
if (node->bundleInfo.isActive && (
|
||||
node->data->isType(Node::NODE_FILE | Node::NODE_MACRO) ||
|
||||
@@ -1045,7 +1045,7 @@ void GraphController::bundleNodesAndEdgesMatching(
|
||||
std::vector<const DummyNode*> bundledNodes = bundleNode->getAllBundledNodes();
|
||||
for (const DummyNode* node : bundledNodes)
|
||||
{
|
||||
for (std::shared_ptr<DummyEdge> edge : m_dummyEdges)
|
||||
for (const std::shared_ptr<DummyEdge>& edge : m_dummyEdges)
|
||||
{
|
||||
bool owner = (edge->ownerId == node->data->getId());
|
||||
bool target = (edge->targetId == node->data->getId());
|
||||
@@ -1056,7 +1056,7 @@ void GraphController::bundleNodesAndEdgesMatching(
|
||||
}
|
||||
|
||||
DummyEdge* bundleEdgePtr = nullptr;
|
||||
for (std::shared_ptr<DummyEdge> bundleEdge : bundleEdges)
|
||||
for (const std::shared_ptr<DummyEdge>& bundleEdge : bundleEdges)
|
||||
{
|
||||
if ((owner && bundleEdge->ownerId == edge->targetId) ||
|
||||
(target && bundleEdge->ownerId == edge->ownerId))
|
||||
@@ -1185,7 +1185,7 @@ void GraphController::bundleNodesByType()
|
||||
LOG_ERROR("Nodes left after bundling for overview");
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> bundleNode : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& bundleNode : m_dummyNodes)
|
||||
{
|
||||
if (!bundleNode->isBundleNode())
|
||||
{
|
||||
@@ -1195,7 +1195,7 @@ void GraphController::bundleNodesByType()
|
||||
if (bundleNode->name == "Namespaces")
|
||||
{
|
||||
std::list<std::shared_ptr<DummyNode>> nodes;
|
||||
for (std::shared_ptr<DummyNode> node : bundleNode->bundledNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : bundleNode->bundledNodes)
|
||||
{
|
||||
nodes.push_back(node);
|
||||
}
|
||||
@@ -1210,7 +1210,7 @@ void GraphController::bundleNodesByType()
|
||||
"Anonymous Namespaces"
|
||||
);
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : nodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : nodes)
|
||||
{
|
||||
bundleNode->bundledNodes.insert(node);
|
||||
}
|
||||
@@ -1229,7 +1229,7 @@ void GraphController::addCharacterIndex()
|
||||
{
|
||||
// Remove index characters from last time
|
||||
DummyNode::BundledNodesSet newNodes;
|
||||
for (const std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
if (!node->isTextNode())
|
||||
{
|
||||
@@ -1266,12 +1266,12 @@ void GraphController::layoutNesting()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
layoutNestingRecursive(node.get());
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
layoutToGrid(node.get());
|
||||
}
|
||||
@@ -1351,7 +1351,7 @@ void GraphController::layoutNestingRecursive(DummyNode* node) const
|
||||
// Horizontal layouting is currently not used, but left in place for experimentation.
|
||||
bool layoutHorizontal = false;
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (!subNode->visible)
|
||||
{
|
||||
@@ -1366,7 +1366,7 @@ void GraphController::layoutNestingRecursive(DummyNode* node) const
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (!subNode->visible || subNode->isExpandToggleNode())
|
||||
{
|
||||
@@ -1417,7 +1417,7 @@ void GraphController::layoutNestingRecursive(DummyNode* node) const
|
||||
node->size.x = margins.left + width + margins.right;
|
||||
node->size.y = margins.top + margins.charHeight + margins.spacingA + y + height + margins.bottom;
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (!subNode->visible)
|
||||
{
|
||||
@@ -1459,7 +1459,7 @@ void GraphController::addExpandToggleNode(DummyNode* node) const
|
||||
continue;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> subSubNode : subNode->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subSubNode : subNode->subNodes)
|
||||
{
|
||||
if (subSubNode->visible && (!subSubNode->isGraphNode() || !subSubNode->data->isImplicit()))
|
||||
{
|
||||
@@ -1493,7 +1493,7 @@ void GraphController::layoutToGrid(DummyNode* node) const
|
||||
DummyNode* lastAccessNode = nullptr;
|
||||
DummyNode* expandToggleNode = nullptr;
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : node->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : node->subNodes)
|
||||
{
|
||||
if (!subNode->visible)
|
||||
{
|
||||
@@ -1565,7 +1565,7 @@ DummyNode* GraphController::getDummyGraphNodeById(Id tokenId) const
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
if (node->tokenId == tokenId)
|
||||
{
|
||||
@@ -1594,7 +1594,7 @@ void GraphController::buildGraph(
|
||||
|
||||
void GraphController::forEachDummyNodeRecursive(std::function<void(DummyNode*)> func)
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> node : m_dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_dummyNodes)
|
||||
{
|
||||
node->forEachDummyNodeRecursive(func);
|
||||
}
|
||||
@@ -1602,7 +1602,7 @@ void GraphController::forEachDummyNodeRecursive(std::function<void(DummyNode*)>
|
||||
|
||||
void GraphController::forEachDummyEdge(std::function<void(DummyEdge*)> func)
|
||||
{
|
||||
for (std::shared_ptr<DummyEdge> edge : m_dummyEdges)
|
||||
for (const std::shared_ptr<DummyEdge>& edge : m_dummyEdges)
|
||||
{
|
||||
func(edge.get());
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ void LogController::syncLogs()
|
||||
}
|
||||
|
||||
std::vector<Log> logs;
|
||||
for (Log log : m_logs)
|
||||
for (const Log& log : m_logs)
|
||||
{
|
||||
if (log.type & m_logLevel)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ int Bucket::getHeight() const
|
||||
|
||||
bool Bucket::hasNode(std::shared_ptr<DummyNode> node) const
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> n : m_nodes)
|
||||
for (const std::shared_ptr<DummyNode>& n : m_nodes)
|
||||
{
|
||||
if (node == n)
|
||||
{
|
||||
@@ -66,7 +66,7 @@ void Bucket::preLayout(Vec2i viewSize)
|
||||
|
||||
m_height = 0;
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_nodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_nodes)
|
||||
{
|
||||
node->position.x = x;
|
||||
node->position.y = y;
|
||||
@@ -93,7 +93,7 @@ void Bucket::layout(int x, int y, int width, int height)
|
||||
int cx = GraphViewStyle::toGridOffset(x + (width - m_width) / 2);
|
||||
int cy = GraphViewStyle::toGridOffset(y + (height - m_height) / 2);
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : m_nodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : m_nodes)
|
||||
{
|
||||
node->position.x = node->position.x + cx;
|
||||
node->position.y = node->position.y + cy;
|
||||
@@ -120,7 +120,7 @@ void BucketLayouter::createBuckets(
|
||||
}
|
||||
|
||||
bool activeNodeAdded = false;
|
||||
for (std::shared_ptr<DummyNode> node : nodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : nodes)
|
||||
{
|
||||
if (node->hasActiveSubNode() || !edges.size())
|
||||
{
|
||||
@@ -140,7 +140,7 @@ void BucketLayouter::createBuckets(
|
||||
}
|
||||
|
||||
std::vector<const DummyEdge*> remainingEdges;
|
||||
for (std::shared_ptr<DummyEdge> edge : edges)
|
||||
for (const std::shared_ptr<DummyEdge>& edge : edges)
|
||||
{
|
||||
remainingEdges.push_back(edge.get());
|
||||
}
|
||||
@@ -264,7 +264,7 @@ std::vector<std::shared_ptr<DummyNode>> BucketLayouter::getSortedNodes()
|
||||
std::shared_ptr<DummyNode> BucketLayouter::findTopMostDummyNodeRecursive(
|
||||
std::vector<std::shared_ptr<DummyNode>>& nodes, Id tokenId, std::shared_ptr<DummyNode> top
|
||||
){
|
||||
for (std::shared_ptr<DummyNode> node : nodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : nodes)
|
||||
{
|
||||
std::shared_ptr<DummyNode> t = (top ? top : node);
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
|
||||
bool hasVisibleSubNode() const
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
if (node->visible)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
if (node->hasActiveSubNode())
|
||||
{
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
count += 1;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
count += node->getActiveSubNodeCount();
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
if (node->hasConnectedSubNode())
|
||||
{
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
nodes.push_back(this);
|
||||
}
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
utility::append(nodes, node->getConnectedSubNodes());
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
std::vector<const DummyNode*> getAllBundledNodes() const
|
||||
{
|
||||
std::vector<const DummyNode*> nodes;
|
||||
for (std::shared_ptr<DummyNode> node : bundledNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : bundledNodes)
|
||||
{
|
||||
utility::append(nodes, node->getConnectedSubNodes());
|
||||
}
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
{
|
||||
func(this);
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : subNodes)
|
||||
{
|
||||
node->forEachDummyNodeRecursive(func);
|
||||
}
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
|
||||
this->bundleId = bundleId;
|
||||
|
||||
for (std::shared_ptr<DummyNode> node : bundledNodes)
|
||||
for (const std::shared_ptr<DummyNode>& node : bundledNodes)
|
||||
{
|
||||
bundleId = node->setBundleIdRecursive(bundleId);
|
||||
}
|
||||
@@ -247,11 +247,11 @@ public:
|
||||
}
|
||||
|
||||
size_t subNodeCount = 0;
|
||||
for (std::shared_ptr<DummyNode> subNode : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : subNodes)
|
||||
{
|
||||
if (subNode->isAccessNode())
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> subSubNode : subNode->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subSubNode : subNode->subNodes)
|
||||
{
|
||||
if (subSubNode->isGraphNode() && !subSubNode->data->isImplicit())
|
||||
{
|
||||
@@ -268,11 +268,11 @@ public:
|
||||
{
|
||||
std::map<Id, std::shared_ptr<DummyNode>> subGraphNodes;
|
||||
|
||||
for (std::shared_ptr<DummyNode> subNode : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : subNodes)
|
||||
{
|
||||
if (subNode->isAccessNode())
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> subSubNode : subNode->subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subSubNode : subNode->subNodes)
|
||||
{
|
||||
if (subSubNode->isGraphNode())
|
||||
{
|
||||
@@ -287,7 +287,7 @@ public:
|
||||
|
||||
void replaceSubGraphNodes(std::map<Id, std::shared_ptr<DummyNode>> subGraphNodes) const
|
||||
{
|
||||
for (std::shared_ptr<DummyNode> subNode : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : subNodes)
|
||||
{
|
||||
if (subNode->isAccessNode())
|
||||
{
|
||||
@@ -313,7 +313,7 @@ public:
|
||||
std::vector<std::shared_ptr<DummyNode>> getAccessNodes() const
|
||||
{
|
||||
std::vector<std::shared_ptr<DummyNode>> accessNodes;
|
||||
for (std::shared_ptr<DummyNode> subNode : subNodes)
|
||||
for (const std::shared_ptr<DummyNode>& subNode : subNodes)
|
||||
{
|
||||
if (subNode->isAccessNode())
|
||||
{
|
||||
|
||||
@@ -42,12 +42,12 @@ void TrailLayouter::buildGraph(
|
||||
const std::vector<std::shared_ptr<DummyEdge>>& dummyEdges,
|
||||
const std::map<Id, Id>& topLevelAncestorIds)
|
||||
{
|
||||
for (const std::shared_ptr<DummyNode> dummyNode : dummyNodes)
|
||||
for (const std::shared_ptr<DummyNode>& dummyNode : dummyNodes)
|
||||
{
|
||||
addNode(dummyNode);
|
||||
}
|
||||
|
||||
for (const std::shared_ptr<DummyEdge> dummyEdge : dummyEdges)
|
||||
for (const std::shared_ptr<DummyEdge>& dummyEdge : dummyEdges)
|
||||
{
|
||||
dummyEdge->path.clear();
|
||||
|
||||
@@ -267,7 +267,7 @@ void TrailLayouter::addVirtualNodes()
|
||||
{
|
||||
std::vector<std::shared_ptr<TrailEdge>> newEdges;
|
||||
|
||||
for (std::shared_ptr<TrailEdge> edge : m_allEdges)
|
||||
for (const std::shared_ptr<TrailEdge>& edge : m_allEdges)
|
||||
{
|
||||
for (int i = edge->origin->level + 1; i < edge->target->level; i++)
|
||||
{
|
||||
@@ -304,7 +304,7 @@ void TrailLayouter::addVirtualNodes()
|
||||
|
||||
void TrailLayouter::buildColumns()
|
||||
{
|
||||
for (std::shared_ptr<TrailNode> node : m_allNodes)
|
||||
for (const std::shared_ptr<TrailNode>& node : m_allNodes)
|
||||
{
|
||||
int level = node->level + 1;
|
||||
for (int i = m_nodesPerCol.size(); i <= level; i++)
|
||||
@@ -501,7 +501,7 @@ void TrailLayouter::moveNodesToAveragePosition(std::vector<TrailNode*> nodes, bo
|
||||
}
|
||||
|
||||
int averagePosition = 0;
|
||||
for (std::pair<int, std::vector<TrailNode*>> p : averagePositions)
|
||||
for (const std::pair<int, std::vector<TrailNode*>>& p : averagePositions)
|
||||
{
|
||||
averagePosition += p.first;
|
||||
}
|
||||
@@ -584,7 +584,7 @@ void TrailLayouter::moveNodesToAveragePosition(std::vector<TrailNode*> nodes, bo
|
||||
|
||||
void TrailLayouter::retrievePositions(const std::map<Id, Id>& topLevelAncestorIds)
|
||||
{
|
||||
for (std::shared_ptr<TrailNode> node : m_allNodes)
|
||||
for (std::shared_ptr<TrailNode>& node : m_allNodes)
|
||||
{
|
||||
if (node->dummyNode)
|
||||
{
|
||||
@@ -592,7 +592,7 @@ void TrailLayouter::retrievePositions(const std::map<Id, Id>& topLevelAncestorId
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<TrailEdge> edge : m_allEdges)
|
||||
for (std::shared_ptr<TrailEdge>& edge : m_allEdges)
|
||||
{
|
||||
if (edge->virtualNodes.size())
|
||||
{
|
||||
@@ -613,7 +613,7 @@ void TrailLayouter::retrievePositions(const std::map<Id, Id>& topLevelAncestorId
|
||||
void TrailLayouter::print()
|
||||
{
|
||||
std::cout << "graph: " << std::endl;
|
||||
for (std::shared_ptr<TrailNode> node : m_allNodes)
|
||||
for (std::shared_ptr<TrailNode>& node : m_allNodes)
|
||||
{
|
||||
if (node->id)
|
||||
{
|
||||
@@ -624,7 +624,7 @@ void TrailLayouter::print()
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
for (std::shared_ptr<TrailEdge> edge : m_allEdges)
|
||||
for (std::shared_ptr<TrailEdge>& edge : m_allEdges)
|
||||
{
|
||||
if (edge->origin->id || edge->target->id)
|
||||
{
|
||||
@@ -686,7 +686,7 @@ void TrailLayouter::addEdge(const std::shared_ptr<DummyEdge> dummyEdge, const st
|
||||
edge->origin = origin->second;
|
||||
edge->target = target->second;
|
||||
|
||||
for (std::shared_ptr<TrailEdge> e : m_allEdges)
|
||||
for (std::shared_ptr<TrailEdge>& e : m_allEdges)
|
||||
{
|
||||
if ((e->origin == edge->origin && e->target == edge->target) ||
|
||||
(e->origin == edge->target && e->target == edge->origin))
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "data/storage/PersistentStorage.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/messaging/type/MessageQuitApplication.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/scheduling/Blackboard.h"
|
||||
#include "utility/utility.h"
|
||||
#include "Application.h"
|
||||
@@ -66,6 +68,19 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
|
||||
bool interruptedIndexing = false;
|
||||
blackboard->get("interrupted_indexing", interruptedIndexing);
|
||||
|
||||
ErrorCountInfo errorInfo = m_storageAccess->getErrorCount();
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "Finished indexing: ";
|
||||
ss << indexedSourceFileCount << "/" << sourceFileCount << " source files indexed; ";
|
||||
ss << utility::timeToString(time);
|
||||
ss << "; " << errorInfo.total << " error" << (errorInfo.total != 1 ? "s" : "");
|
||||
if (errorInfo.fatal > 0)
|
||||
{
|
||||
ss << " (" << errorInfo.fatal << " fatal)";
|
||||
}
|
||||
MessageStatus(ss.str(), false, false).dispatch();
|
||||
|
||||
StorageStats stats = m_storageAccess->getStorageStats();
|
||||
dialogView->finishedIndexingDialog(
|
||||
indexedSourceFileCount,
|
||||
@@ -73,7 +88,7 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
|
||||
stats.completedFileCount,
|
||||
stats.fileCount,
|
||||
time,
|
||||
m_storageAccess->getErrorCount(),
|
||||
errorInfo,
|
||||
interruptedIndexing
|
||||
);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ std::vector<FullTextSearchResult> FullTextSearchIndex::searchForTerm(const std::
|
||||
|
||||
std::vector<FullTextSearchResult> ret;
|
||||
FullTextSearchResult hit;
|
||||
for (auto f : m_files)
|
||||
for (auto& f : m_files)
|
||||
{
|
||||
hit.fileId = f.fileId;
|
||||
hit.positions = f.array.searchForTerm(term);
|
||||
|
||||
@@ -43,7 +43,7 @@ void Token::removeLocationId(Id locationId)
|
||||
Token::Token(const Token& other)
|
||||
: m_id(other.m_id)
|
||||
{
|
||||
for (std::shared_ptr<TokenComponent> component: other.m_components)
|
||||
for (const std::shared_ptr<TokenComponent>& component: other.m_components)
|
||||
{
|
||||
addComponent(component->copy());
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ std::shared_ptr<IntermediateStorage> IndexerComposite::index(
|
||||
|
||||
void IndexerComposite::interrupt()
|
||||
{
|
||||
for (auto it: m_indexers)
|
||||
for (auto& it: m_indexers)
|
||||
{
|
||||
it.second->interrupt();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void InterprocessIndexerCommandManager::setIndexerCommands(
|
||||
const unsigned int overestimationMultiplier = 2;
|
||||
|
||||
size_t estimatedSize = 1048576; /* 1 MB */
|
||||
for (auto command : indexerCommands)
|
||||
for (auto& command : indexerCommands)
|
||||
{
|
||||
estimatedSize += command->getByteSize() + sizeof(SharedIndexerCommand);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ void InterprocessIndexerCommandManager::setIndexerCommands(
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto command : indexerCommands)
|
||||
for (auto& command : indexerCommands)
|
||||
{
|
||||
queue->push_back(SharedIndexerCommand(access.getAllocator()));
|
||||
SharedIndexerCommand& sharedCommand = queue->back();
|
||||
|
||||
@@ -176,7 +176,7 @@ std::set<FilePath> InterprocessIndexingStatusManager::getIndexedFiles()
|
||||
return result;
|
||||
}
|
||||
|
||||
for (auto file : *files)
|
||||
for (auto& file : *files)
|
||||
{
|
||||
result.insert(FilePath(file.c_str()));
|
||||
}
|
||||
@@ -198,7 +198,7 @@ void InterprocessIndexingStatusManager::addIndexedFiles(std::set<FilePath> fileP
|
||||
}
|
||||
|
||||
std::set<std::string> oldFiles;
|
||||
for (auto indexedFile : *indexedFiles)
|
||||
for (auto& indexedFile : *indexedFiles)
|
||||
{
|
||||
oldFiles.insert(indexedFile.c_str());
|
||||
}
|
||||
@@ -213,7 +213,7 @@ void InterprocessIndexingStatusManager::addIndexedFiles(std::set<FilePath> fileP
|
||||
}
|
||||
|
||||
size_t estimatedSize = 262144;
|
||||
for (auto newFile : newFiles)
|
||||
for (auto& newFile : newFiles)
|
||||
{
|
||||
estimatedSize += sizeof(std::string) + newFile.size();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ const std::map<FilePath, std::shared_ptr<SourceLocationFile>>& SourceLocationCol
|
||||
size_t SourceLocationCollection::getSourceLocationCount() const
|
||||
{
|
||||
size_t count = 0;
|
||||
for (auto p : m_files)
|
||||
for (auto& p : m_files)
|
||||
{
|
||||
count += p.second->getSourceLocationCount();
|
||||
}
|
||||
@@ -44,7 +44,7 @@ std::shared_ptr<SourceLocationFile> SourceLocationCollection::getSourceLocationF
|
||||
|
||||
SourceLocation* SourceLocationCollection::getSourceLocationById(Id locationId) const
|
||||
{
|
||||
for (auto p : m_files)
|
||||
for (auto& p : m_files)
|
||||
{
|
||||
SourceLocation* location = p.second->getSourceLocationById(locationId);
|
||||
if (location)
|
||||
@@ -91,7 +91,7 @@ void SourceLocationCollection::addSourceLocationFile(std::shared_ptr<SourceLocat
|
||||
void SourceLocationCollection::forEachSourceLocationFile(
|
||||
std::function<void(std::shared_ptr<SourceLocationFile>)> func) const
|
||||
{
|
||||
for (auto p : m_files)
|
||||
for (auto& p : m_files)
|
||||
{
|
||||
func(p.second);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ void SourceLocationCollection::forEachSourceLocationFile(
|
||||
|
||||
void SourceLocationCollection::forEachSourceLocation(std::function<void(SourceLocation*)> func) const
|
||||
{
|
||||
for (auto p : m_files)
|
||||
for (auto& p : m_files)
|
||||
{
|
||||
p.second->forEachSourceLocation(func);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ size_t SourceLocationFile::getSourceLocationCount() const
|
||||
size_t SourceLocationFile::getUnscopedStartLocationCount() const
|
||||
{
|
||||
size_t count = 0;
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
if (location->isStartLocation() && !location->isScopeLocation())
|
||||
{
|
||||
@@ -129,7 +129,7 @@ SourceLocation* SourceLocationFile::getSourceLocationById(Id locationId) const
|
||||
|
||||
void SourceLocationFile::forEachSourceLocation(std::function<void(SourceLocation*)> func) const
|
||||
{
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
func(location.get());
|
||||
}
|
||||
@@ -137,7 +137,7 @@ void SourceLocationFile::forEachSourceLocation(std::function<void(SourceLocation
|
||||
|
||||
void SourceLocationFile::forEachStartSourceLocation(std::function<void(SourceLocation*)> func) const
|
||||
{
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
if (location->isStartLocation())
|
||||
{
|
||||
@@ -148,7 +148,7 @@ void SourceLocationFile::forEachStartSourceLocation(std::function<void(SourceLoc
|
||||
|
||||
void SourceLocationFile::forEachEndSourceLocation(std::function<void(SourceLocation*)> func) const
|
||||
{
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
if (location->isEndLocation())
|
||||
{
|
||||
@@ -161,7 +161,7 @@ std::shared_ptr<SourceLocationFile> SourceLocationFile::getFilteredByLines(size_
|
||||
{
|
||||
std::shared_ptr<SourceLocationFile> ret = std::make_shared<SourceLocationFile>(getFilePath(), false, isComplete());
|
||||
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
if (location->getLineNumber() >= firstLineNumber && location->getLineNumber() <= lastLineNumber)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ std::shared_ptr<SourceLocationFile> SourceLocationFile::getFilteredByType(Locati
|
||||
{
|
||||
std::shared_ptr<SourceLocationFile> ret = std::make_shared<SourceLocationFile>(getFilePath(), false, isComplete());
|
||||
|
||||
for (std::shared_ptr<SourceLocation> location : m_locations)
|
||||
for (const std::shared_ptr<SourceLocation>& location : m_locations)
|
||||
{
|
||||
if (location->getType() == type)
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ void IntermediateStorage::setAllFilesIncomplete()
|
||||
void IntermediateStorage::setFilesWithErrorsIncomplete()
|
||||
{
|
||||
std::set<std::string> errorFileNames;
|
||||
for (StorageError& error : m_errors)
|
||||
for (const StorageError& error : m_errors)
|
||||
{
|
||||
errorFileNames.insert(error.filePath.str());
|
||||
}
|
||||
@@ -373,7 +373,7 @@ std::vector<StorageLocalSymbol> IntermediateStorage::getStorageLocalSymbols() co
|
||||
{
|
||||
std::vector<StorageLocalSymbol> localSymbol;
|
||||
localSymbol.reserve(m_localSymbols.size());
|
||||
for (auto it: m_localSymbols)
|
||||
for (const auto& it: m_localSymbols)
|
||||
{
|
||||
localSymbol.push_back(it.second);
|
||||
}
|
||||
@@ -384,7 +384,7 @@ std::vector<StorageSourceLocation> IntermediateStorage::getStorageSourceLocation
|
||||
{
|
||||
std::vector<StorageSourceLocation> sourceLocations;
|
||||
sourceLocations.reserve(m_sourceLocations.size());
|
||||
for (auto it: m_sourceLocations)
|
||||
for (const auto& it: m_sourceLocations)
|
||||
{
|
||||
sourceLocations.push_back(it.second);
|
||||
}
|
||||
|
||||
@@ -608,12 +608,12 @@ std::vector<SearchMatch> PersistentStorage::getAutocompletionSymbolMatches(
|
||||
elementIds.insert(elementIds.end(), result.elementIds.begin(), result.elementIds.end());
|
||||
}
|
||||
|
||||
for (StorageNode& node : m_sqliteIndexStorage.getAllByIds<StorageNode>(elementIds))
|
||||
for (const StorageNode& node : m_sqliteIndexStorage.getAllByIds<StorageNode>(elementIds))
|
||||
{
|
||||
storageNodeMap[node.id] = node;
|
||||
}
|
||||
|
||||
for (StorageSymbol& symbol : m_sqliteIndexStorage.getAllByIds<StorageSymbol>(elementIds))
|
||||
for (const StorageSymbol& symbol : m_sqliteIndexStorage.getAllByIds<StorageSymbol>(elementIds))
|
||||
{
|
||||
storageSymbolMap[symbol.id] = symbol;
|
||||
}
|
||||
@@ -786,7 +786,7 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForAll() const
|
||||
std::shared_ptr<Graph> graph = std::make_shared<Graph>();
|
||||
|
||||
std::vector<Id> tokenIds;
|
||||
for (StorageNode node: m_sqliteIndexStorage.getAll<StorageNode>())
|
||||
for (StorageNode& node: m_sqliteIndexStorage.getAll<StorageNode>())
|
||||
{
|
||||
auto it = m_symbolDefinitionKinds.find(node.id);
|
||||
if (it != m_symbolDefinitionKinds.end() && it->second == DEFINITION_EXPLICIT &&
|
||||
@@ -799,7 +799,7 @@ std::shared_ptr<Graph> PersistentStorage::getGraphForAll() const
|
||||
}
|
||||
}
|
||||
|
||||
for (auto p : m_fileNodePaths)
|
||||
for (const auto& p : m_fileNodePaths)
|
||||
{
|
||||
tokenIds.push_back(p.first);
|
||||
}
|
||||
@@ -1538,7 +1538,7 @@ std::vector<EdgeBookmark> PersistentStorage::getAllEdgeBookmarks() const
|
||||
std::vector<BookmarkCategory> PersistentStorage::getAllBookmarkCategories() const
|
||||
{
|
||||
std::vector<BookmarkCategory> categories;
|
||||
for (const StorageBookmarkCategory storageBookmarkCategoriy: m_sqliteBookmarkStorage.getAllBookmarkCategories())
|
||||
for (const StorageBookmarkCategory& storageBookmarkCategoriy : m_sqliteBookmarkStorage.getAllBookmarkCategories())
|
||||
{
|
||||
categories.push_back(BookmarkCategory(storageBookmarkCategoriy.id, storageBookmarkCategoriy.name));
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForTokenIds(const std::vector<Id>&
|
||||
|
||||
info.count = 0;
|
||||
info.countText = "reference";
|
||||
for (auto edge : m_sqliteIndexStorage.getEdgesByTargetId(node.id))
|
||||
for (const auto& edge : m_sqliteIndexStorage.getEdgesByTargetId(node.id))
|
||||
{
|
||||
if (Edge::intToType(edge.type) != Edge::EDGE_MEMBER)
|
||||
{
|
||||
@@ -1659,7 +1659,7 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
|
||||
);
|
||||
|
||||
std::vector<Id> typeNodeIds;
|
||||
for (auto edge : m_sqliteIndexStorage.getEdgesBySourceId(node.id))
|
||||
for (const auto& edge : m_sqliteIndexStorage.getEdgesBySourceId(node.id))
|
||||
{
|
||||
if (Edge::intToType(edge.type) == Edge::EDGE_TYPE_USAGE)
|
||||
{
|
||||
@@ -1680,7 +1680,7 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
|
||||
);
|
||||
|
||||
typeNames.insert(std::make_pair(nameHierarchy.getQualifiedName(), node.id));
|
||||
for (auto typeNode : m_sqliteIndexStorage.getAllByIds<StorageNode>(typeNodeIds))
|
||||
for (const auto& typeNode : m_sqliteIndexStorage.getAllByIds<StorageNode>(typeNodeIds))
|
||||
{
|
||||
typeNames.insert(std::make_pair(
|
||||
NameHierarchy::deserialize(typeNode.serializedName).getQualifiedName(),
|
||||
@@ -1689,7 +1689,7 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
|
||||
}
|
||||
|
||||
std::vector<std::pair<size_t, size_t>> locationRanges;
|
||||
for (auto p : typeNames)
|
||||
for (const auto& p : typeNames)
|
||||
{
|
||||
size_t pos = 0;
|
||||
while (pos != std::string::npos)
|
||||
@@ -1701,7 +1701,7 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
|
||||
}
|
||||
|
||||
bool inRange = false;
|
||||
for (auto p : locationRanges)
|
||||
for (const auto& p : locationRanges)
|
||||
{
|
||||
if (pos + 1 >= p.first && pos + 1 <= p.second)
|
||||
{
|
||||
@@ -1747,7 +1747,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForSourceLocationIdsAndLocalSymbolI
|
||||
{
|
||||
std::vector<Id> tokenIds = getNodeIdsForLocationIds(locationIds);
|
||||
|
||||
for (StorageNode node : m_sqliteIndexStorage.getAllByIds<StorageNode>(tokenIds))
|
||||
for (const StorageNode& node : m_sqliteIndexStorage.getAllByIds<StorageNode>(tokenIds))
|
||||
{
|
||||
TooltipSnippet snippet;
|
||||
|
||||
@@ -1916,7 +1916,7 @@ std::set<Id> PersistentStorage::getReferenced(
|
||||
const std::set<Id>& ids, std::unordered_map<Id, std::set<Id>> idToReferencingIdMap) const
|
||||
{
|
||||
std::unordered_map<Id, std::set<Id>> idToReferencedIdMap;
|
||||
for (auto it: idToReferencingIdMap)
|
||||
for (const auto& it: idToReferencingIdMap)
|
||||
{
|
||||
for (Id referencingId: it.second)
|
||||
{
|
||||
@@ -2223,7 +2223,7 @@ void PersistentStorage::addAggregationEdgesToGraph(
|
||||
|
||||
// add hierarchies of these parents
|
||||
std::vector<Id> nodeIdsToAdd;
|
||||
for (const std::pair<Id, std::vector<EdgeInfo>> p : connectedParentNodeIds)
|
||||
for (const std::pair<Id, std::vector<EdgeInfo>>& p : connectedParentNodeIds)
|
||||
{
|
||||
const Id aggregationTargetNodeId = p.first;
|
||||
if (!graph->getNodeById(aggregationTargetNodeId))
|
||||
@@ -2235,7 +2235,7 @@ void PersistentStorage::addAggregationEdgesToGraph(
|
||||
|
||||
// create aggregation edges between parents and active node
|
||||
Node* sourceNode = graph->getNodeById(nodeId);
|
||||
for (const std::pair<Id, std::vector<EdgeInfo>> p : connectedParentNodeIds)
|
||||
for (const std::pair<Id, std::vector<EdgeInfo>>& p : connectedParentNodeIds)
|
||||
{
|
||||
const Id aggregationTargetNodeId = p.first;
|
||||
|
||||
@@ -2364,14 +2364,14 @@ void PersistentStorage::buildFilePathMaps()
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (StorageFile file: m_sqliteIndexStorage.getAll<StorageFile>())
|
||||
for (StorageFile& file: m_sqliteIndexStorage.getAll<StorageFile>())
|
||||
{
|
||||
m_fileNodeIds.emplace(FilePath(file.filePath), file.id);
|
||||
m_fileNodePaths.emplace(file.id, FilePath(file.filePath));
|
||||
m_fileNodeComplete.emplace(file.id, file.complete);
|
||||
}
|
||||
|
||||
for (StorageSymbol symbol : m_sqliteIndexStorage.getAll<StorageSymbol>())
|
||||
for (StorageSymbol& symbol : m_sqliteIndexStorage.getAll<StorageSymbol>())
|
||||
{
|
||||
m_symbolDefinitionKinds.emplace(symbol.id, intToDefinitionKind(symbol.definitionKind));
|
||||
}
|
||||
@@ -2383,7 +2383,7 @@ void PersistentStorage::buildSearchIndex()
|
||||
|
||||
FilePath dbPath = getDbFilePath();
|
||||
|
||||
for (StorageNode node : m_sqliteIndexStorage.getAll<StorageNode>())
|
||||
for (StorageNode& node : m_sqliteIndexStorage.getAll<StorageNode>())
|
||||
{
|
||||
if (Node::intToType(node.type) == Node::NODE_FILE)
|
||||
{
|
||||
@@ -2419,7 +2419,7 @@ void PersistentStorage::buildFullTextSearchIndex() const
|
||||
{
|
||||
TRACE();
|
||||
|
||||
for (StorageFile file : m_sqliteIndexStorage.getAll<StorageFile>())
|
||||
for (StorageFile& file : m_sqliteIndexStorage.getAll<StorageFile>())
|
||||
{
|
||||
m_fullTextSearchIndex.addFile(file.id, m_sqliteIndexStorage.getFileContentById(file.id)->getText());
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ void StorageProvider::logCurrentState() const
|
||||
std::string logString = "Storages waiting for injection:";
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_storagesMutex);
|
||||
for (std::shared_ptr<IntermediateStorage> storage: m_storages)
|
||||
for (const std::shared_ptr<IntermediateStorage>& storage: m_storages)
|
||||
{
|
||||
logString += " " + std::to_string(storage->getSourceLocationCount()) + ";";
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ Project::~Project()
|
||||
bool Project::refresh(bool forceRefresh)
|
||||
{
|
||||
if (m_state == PROJECT_STATE_NOT_LOADED)
|
||||
{
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ bool Project::refresh(bool forceRefresh)
|
||||
m_settings->reload();
|
||||
|
||||
m_sourceGroups = SourceGroupFactory::getInstance()->createSourceGroups(m_settings->getAllSourceGroupSettings());
|
||||
for (std::shared_ptr<SourceGroup> sourceGroup: m_sourceGroups)
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
|
||||
{
|
||||
if (!sourceGroup->prepareRefresh())
|
||||
{
|
||||
@@ -275,7 +275,7 @@ void Project::load()
|
||||
bool Project::requestIndex(bool forceRefresh, bool needsFullRefresh)
|
||||
{
|
||||
std::set<FilePath> allSourceFilePaths;
|
||||
for (std::shared_ptr<SourceGroup> sourceGroup: m_sourceGroups)
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
|
||||
{
|
||||
if (!sourceGroup->prepareIndexing())
|
||||
{
|
||||
@@ -357,7 +357,7 @@ bool Project::requestIndex(bool forceRefresh, bool needsFullRefresh)
|
||||
}
|
||||
|
||||
std::set<FilePath> filesToIndex;
|
||||
for (std::shared_ptr<SourceGroup> sourceGroup: m_sourceGroups)
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
|
||||
{
|
||||
sourceGroup->fetchSourceFilePathsToIndex(staticSourceFilePaths);
|
||||
utility::append(filesToIndex, sourceGroup->getSourceFilePathsToIndex());
|
||||
@@ -432,9 +432,9 @@ void Project::buildIndex(
|
||||
|
||||
std::set<FilePath> filesToIndexTemp = filesToIndex;
|
||||
std::shared_ptr<IndexerCommandList> indexerCommandList = std::make_shared<IndexerCommandList>();
|
||||
for (std::shared_ptr<SourceGroup> sourceGroup: m_sourceGroups)
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup : m_sourceGroups)
|
||||
{
|
||||
for (std::shared_ptr<IndexerCommand> command: sourceGroup->getIndexerCommands(&filesToIndexTemp, fullRefresh))
|
||||
for (const std::shared_ptr<IndexerCommand>& command : sourceGroup->getIndexerCommands(&filesToIndexTemp, fullRefresh))
|
||||
{
|
||||
indexerCommandList->addCommand(command);
|
||||
}
|
||||
@@ -533,7 +533,7 @@ void Project::buildIndex(
|
||||
|
||||
bool Project::hasCxxSourceGroup() const
|
||||
{
|
||||
for (std::shared_ptr<SourceGroup> sourceGroup: m_sourceGroups)
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
|
||||
{
|
||||
if (sourceGroup->getLanguage() == LANGUAGE_C || sourceGroup->getLanguage() == LANGUAGE_CPP)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ void SourceGroupFactory::addModule(std::shared_ptr<SourceGroupFactoryModule> mod
|
||||
std::vector<std::shared_ptr<SourceGroup>> SourceGroupFactory::createSourceGroups(std::vector<std::shared_ptr<SourceGroupSettings>> allSourceGroupSettings)
|
||||
{
|
||||
std::vector<std::shared_ptr<SourceGroup>> sourceGroups;
|
||||
for (std::shared_ptr<SourceGroupSettings> sourceGroupSettings: allSourceGroupSettings)
|
||||
for (const std::shared_ptr<SourceGroupSettings>& sourceGroupSettings: allSourceGroupSettings)
|
||||
{
|
||||
std::shared_ptr<SourceGroup> sourceGroup = createSourceGroup(sourceGroupSettings);
|
||||
if (sourceGroup)
|
||||
@@ -36,7 +36,7 @@ std::shared_ptr<SourceGroup> SourceGroupFactory::createSourceGroup(std::shared_p
|
||||
{
|
||||
std::shared_ptr<SourceGroup> sourceGroup;
|
||||
|
||||
for (std::shared_ptr<SourceGroupFactoryModule> module: m_modules)
|
||||
for (const std::shared_ptr<SourceGroupFactoryModule>& module: m_modules)
|
||||
{
|
||||
if (module->supports(settings->getType()))
|
||||
{
|
||||
|
||||
@@ -377,7 +377,7 @@ std::vector<FilePath> ApplicationSettings::getRecentProjects() const
|
||||
std::vector<FilePath> recentProjects;
|
||||
std::vector<FilePath> loadedRecentProjects = getPathValues("user/recent_projects/recent_project");
|
||||
|
||||
for (FilePath project: loadedRecentProjects)
|
||||
for (const FilePath& project: loadedRecentProjects)
|
||||
{
|
||||
if (project.isAbsolute())
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "utility/utilityUuid.h"
|
||||
|
||||
const size_t ProjectSettings::VERSION = 4;
|
||||
const std::string PROJECT_FILE_EXTENSION = ".srctrlprj";
|
||||
const char PROJECT_FILE_EXTENSION[] = ".srctrlprj";
|
||||
|
||||
LanguageType ProjectSettings::getLanguageOfProject(const FilePath& filePath)
|
||||
{
|
||||
@@ -17,7 +17,7 @@ LanguageType ProjectSettings::getLanguageOfProject(const FilePath& filePath)
|
||||
|
||||
ProjectSettings projectSettings;
|
||||
projectSettings.load(filePath);
|
||||
for (std::shared_ptr<SourceGroupSettings> sourceGroupSettings: projectSettings.getAllSourceGroupSettings())
|
||||
for (const std::shared_ptr<SourceGroupSettings>& sourceGroupSettings: projectSettings.getAllSourceGroupSettings())
|
||||
{
|
||||
const LanguageType currentLanguageType = getLanguageTypeForSourceGroupType(sourceGroupSettings->getType());
|
||||
if (languageType == LANGUAGE_UNKNOWN)
|
||||
@@ -63,10 +63,10 @@ bool ProjectSettings::equalsExceptNameAndLocation(const ProjectSettings& other)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (std::shared_ptr<SourceGroupSettings> mySourceGroup: allMySettings)
|
||||
for (const std::shared_ptr<SourceGroupSettings>& mySourceGroup : allMySettings)
|
||||
{
|
||||
bool matched = false;
|
||||
for (std::shared_ptr<SourceGroupSettings> otherSourceGroup: allOtherSettings)
|
||||
for (const std::shared_ptr<SourceGroupSettings>& otherSourceGroup : allOtherSettings)
|
||||
{
|
||||
if (mySourceGroup->equals(otherSourceGroup))
|
||||
{
|
||||
@@ -211,7 +211,7 @@ void ProjectSettings::setAllSourceGroupSettings(const std::vector<std::shared_pt
|
||||
m_config->removeValues(key);
|
||||
}
|
||||
|
||||
for (std::shared_ptr<SourceGroupSettings> settings: allSettings)
|
||||
for (const std::shared_ptr<SourceGroupSettings>& settings: allSettings)
|
||||
{
|
||||
const std::string key = "source_groups/source_group_" + settings->getId();
|
||||
const SourceGroupType type = settings->getType();
|
||||
|
||||
@@ -113,7 +113,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<int>& values)
|
||||
std::vector<std::string> valuesStringVector;
|
||||
if (getValues(key, valuesStringVector))
|
||||
{
|
||||
for (std::string valueString : valuesStringVector)
|
||||
for (const std::string& valueString : valuesStringVector)
|
||||
{
|
||||
values.push_back(atoi(valueString.c_str()));
|
||||
}
|
||||
@@ -127,7 +127,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<float>& values
|
||||
std::vector<std::string> valuesStringVector;
|
||||
if (getValues(key, valuesStringVector))
|
||||
{
|
||||
for (std::string valueString : valuesStringVector)
|
||||
for (const std::string& valueString : valuesStringVector)
|
||||
{
|
||||
values.push_back(static_cast<float>(atof(valueString.c_str())));
|
||||
}
|
||||
@@ -141,7 +141,7 @@ bool ConfigManager::getValues(const std::string& key, std::vector<bool>& values)
|
||||
std::vector<std::string> valuesStringVector;
|
||||
if (getValues(key, valuesStringVector))
|
||||
{
|
||||
for (std::string valueString : valuesStringVector)
|
||||
for (const std::string& valueString : valuesStringVector)
|
||||
{
|
||||
values.push_back(atoi(valueString.c_str()) != 0);
|
||||
}
|
||||
|
||||
@@ -46,15 +46,15 @@ void conflicting_options(const boost::program_options::variables_map& vm,
|
||||
std::vector<FilePath> extractPaths(const std::vector<std::string>& vector)
|
||||
{
|
||||
std::vector<FilePath> v;
|
||||
for (std::string s : vector)
|
||||
for (const std::string& s : vector)
|
||||
{
|
||||
std::vector<std::string> temp= utility::splitToVector(s, ',');
|
||||
for (std::string path : temp)
|
||||
for (const std::string& path : temp)
|
||||
{
|
||||
v.push_back(FilePath(path));
|
||||
}
|
||||
}
|
||||
return std::move(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
} // namespace cmd
|
||||
|
||||
@@ -24,7 +24,7 @@ void FileManager::update(
|
||||
|
||||
m_allSourceFilePaths.clear();
|
||||
|
||||
for (FileInfo fileInfo: FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions))
|
||||
for (const FileInfo& fileInfo : FileSystem::getFileInfosFromPaths(m_sourcePaths, m_sourceExtensions))
|
||||
{
|
||||
const FilePath& filePath = fileInfo.path;
|
||||
if (isExcluded(filePath))
|
||||
@@ -76,7 +76,7 @@ std::set<FilePath> FileManager::getAllSourceFilePathsRelative(const FilePath& ba
|
||||
std::vector<FilePath> FileManager::makeCanonical(const std::vector<FilePath>& filePaths)
|
||||
{
|
||||
std::vector<FilePath> ret;
|
||||
for (const FilePath filePath: filePaths)
|
||||
for (const FilePath& filePath: filePaths)
|
||||
{
|
||||
ret.push_back(filePath.canonical());
|
||||
}
|
||||
@@ -85,7 +85,7 @@ std::vector<FilePath> FileManager::makeCanonical(const std::vector<FilePath>& fi
|
||||
|
||||
bool FileManager::isExcluded(const FilePath& filePath) const
|
||||
{
|
||||
for (FilePath path : m_excludePaths)
|
||||
for (const FilePath& path : m_excludePaths)
|
||||
{
|
||||
if (path == filePath || path.contains(filePath))
|
||||
{
|
||||
|
||||
@@ -322,7 +322,7 @@ FilePath FilePath::replaceExtension(const std::string& extension) const
|
||||
bool FilePath::hasExtension(const std::vector<std::string>& extensions) const
|
||||
{
|
||||
std::string e = extension();
|
||||
for (std::string ext : extensions)
|
||||
for (const std::string& ext : extensions)
|
||||
{
|
||||
if (e == ext)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ bool FileRegisterStateData::fileIsIndexed(const FilePath& filePath) const
|
||||
|
||||
void FileRegisterStateData::setIndexedFiles(const std::set<FilePath>& filePaths)
|
||||
{
|
||||
for (auto path : filePaths)
|
||||
for (auto& path : filePaths)
|
||||
{
|
||||
m_filePaths[path] = STATE_INDEXED;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void Tracer::printTraces()
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
size_t unfinishEvents = 0;
|
||||
for (auto p : m_startedEvents)
|
||||
for (auto& p : m_startedEvents)
|
||||
{
|
||||
unfinishEvents += p.second.size();
|
||||
}
|
||||
@@ -67,11 +67,11 @@ void Tracer::printTraces()
|
||||
std::cout << "-----------------------------------------------------------------";
|
||||
std::cout << "------------------------------------------------------------\n";
|
||||
|
||||
for (auto p : m_events)
|
||||
for (auto& p : m_events)
|
||||
{
|
||||
std::cout << "thread: " << p.first << std::endl;
|
||||
|
||||
for (const std::shared_ptr<TraceEvent> event : p.second)
|
||||
for (const std::shared_ptr<TraceEvent>& event : p.second)
|
||||
{
|
||||
std::cout.width(8 + 2 * event->depth);
|
||||
std::cout << std::right << std::setprecision(3) << std::fixed << event->time;
|
||||
@@ -104,9 +104,9 @@ void Tracer::printTraces()
|
||||
|
||||
std::map<std::string, AccumulatedTraceEvent> accumulatedEvents;
|
||||
|
||||
for (auto p : m_events)
|
||||
for (auto& p : m_events)
|
||||
{
|
||||
for (const std::shared_ptr<TraceEvent> event : p.second)
|
||||
for (const std::shared_ptr<TraceEvent>& event : p.second)
|
||||
{
|
||||
std::string name = event->eventName + event->functionName + event->locationName;
|
||||
|
||||
@@ -136,7 +136,7 @@ void Tracer::printTraces()
|
||||
}
|
||||
);
|
||||
|
||||
for (const std::pair<std::string, AccumulatedTraceEvent> p : accumulatedEvents)
|
||||
for (const std::pair<std::string, AccumulatedTraceEvent>& p : accumulatedEvents)
|
||||
{
|
||||
sortedEvents.insert(p.second);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace utility
|
||||
{
|
||||
std::deque<std::string> c;
|
||||
|
||||
for (std::string str : list)
|
||||
for (const std::string& str : list)
|
||||
{
|
||||
if (str.size())
|
||||
{
|
||||
@@ -322,7 +322,7 @@ namespace utility
|
||||
}
|
||||
|
||||
paramPart = "";
|
||||
for (std::string str : paramLines)
|
||||
for (const std::string& str : paramLines)
|
||||
{
|
||||
paramPart += "\n\t" + str;
|
||||
size_t length = tabWidth + str.size();
|
||||
|
||||
@@ -25,17 +25,17 @@ size_t IndexerCommandCxx::getByteSize() const
|
||||
{
|
||||
size_t size = IndexerCommand::getByteSize();
|
||||
|
||||
for (auto i : m_systemHeaderSearchPaths)
|
||||
for (auto& i : m_systemHeaderSearchPaths)
|
||||
{
|
||||
size += sizeof(std::string) + i.str().size();
|
||||
}
|
||||
|
||||
for (auto i : m_frameworkSearchPaths)
|
||||
for (auto& i : m_frameworkSearchPaths)
|
||||
{
|
||||
size += sizeof(std::string) + i.str().size();
|
||||
}
|
||||
|
||||
for (auto i : m_compilerFlags)
|
||||
for (auto& i : m_compilerFlags)
|
||||
{
|
||||
size += sizeof(std::string) + i.size();
|
||||
}
|
||||
|
||||
@@ -26,8 +26,5 @@ clang::FrontendAction* ASTActionFactory::create()
|
||||
{
|
||||
return new ASTAction<clang::PreprocessOnlyAction>(m_client, m_fileRegister, m_canonicalFilePathCache);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ASTAction<clang::ASTFrontendAction>(m_client, m_fileRegister, m_canonicalFilePathCache);
|
||||
}
|
||||
return new ASTAction<clang::ASTFrontendAction>(m_client, m_fileRegister, m_canonicalFilePathCache);
|
||||
}
|
||||
|
||||
@@ -58,10 +58,7 @@ NameHierarchy CxxAstVisitorComponentContext::getContextName(const NameHierarchy&
|
||||
{
|
||||
return (*it)->getName();
|
||||
}
|
||||
else
|
||||
{
|
||||
skipped++;
|
||||
}
|
||||
skipped++;
|
||||
}
|
||||
}
|
||||
return fallback;
|
||||
|
||||
@@ -39,7 +39,7 @@ CxxFunctionDeclName::~CxxFunctionDeclName()
|
||||
|
||||
NameHierarchy CxxFunctionDeclName::toNameHierarchy() const
|
||||
{
|
||||
std::string signaturePrefix = "";
|
||||
std::string signaturePrefix;
|
||||
if (m_isStatic)
|
||||
{
|
||||
signaturePrefix += "static ";
|
||||
|
||||
@@ -70,7 +70,7 @@ std::string CxxTypeName::toString() const
|
||||
}
|
||||
ret += toNameHierarchy().getQualifiedName();
|
||||
|
||||
for (Modifier modifier: m_modifiers)
|
||||
for (const Modifier& modifier: m_modifiers)
|
||||
{
|
||||
ret += " " + modifier.symbol;
|
||||
if (!modifier.qualifierFlags.empty())
|
||||
|
||||
@@ -31,14 +31,14 @@ CxxVariableDeclName::~CxxVariableDeclName()
|
||||
|
||||
NameHierarchy CxxVariableDeclName::toNameHierarchy() const
|
||||
{
|
||||
std::string signaturePrefix = "";
|
||||
std::string signaturePrefix;
|
||||
if (m_isStatic)
|
||||
{
|
||||
signaturePrefix += "static ";
|
||||
}
|
||||
signaturePrefix += CxxTypeName::makeUnsolvedIfNull(m_typeName)->toString();
|
||||
|
||||
const std::string signaturePostfix = "";
|
||||
const std::string signaturePostfix;
|
||||
|
||||
NameHierarchy ret = CxxDeclName::toNameHierarchy();
|
||||
std::shared_ptr<NameElement> nameElement = std::make_shared<NameElement>(
|
||||
|
||||
@@ -123,7 +123,7 @@ std::shared_ptr<CxxDeclName> CxxDeclNameResolver::getDeclName(const clang::Named
|
||||
// we skip this node because its child (the lambda call operator) has already been recorded.
|
||||
return std::shared_ptr<CxxDeclName>();
|
||||
}
|
||||
else if (declNameString.size() == 0)
|
||||
else if (declNameString.empty())
|
||||
{
|
||||
const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager();
|
||||
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(declaration->getLocStart());
|
||||
@@ -285,7 +285,7 @@ std::shared_ptr<CxxDeclName> CxxDeclNameResolver::getDeclName(const clang::Named
|
||||
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(declaration->getLocStart());
|
||||
return std::make_shared<CxxDeclName>(getNameForAnonymousSymbol("namespace", presumedBegin), std::vector<std::string>());
|
||||
}
|
||||
else if (clang::isa<clang::EnumDecl>(declaration) && declNameString.size() == 0)
|
||||
else if (clang::isa<clang::EnumDecl>(declaration) && declNameString.empty())
|
||||
{
|
||||
const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager();
|
||||
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(declaration->getLocStart());
|
||||
@@ -296,13 +296,13 @@ std::shared_ptr<CxxDeclName> CxxDeclNameResolver::getDeclName(const clang::Named
|
||||
clang::isa<clang::TemplateTypeParmDecl>(declaration) ||
|
||||
clang::isa<clang::NonTypeTemplateParmDecl>(declaration) ||
|
||||
clang::isa<clang::TemplateTemplateParmDecl>(declaration)
|
||||
) && declNameString.size() == 0)
|
||||
) && declNameString.empty())
|
||||
{
|
||||
const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager();
|
||||
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(declaration->getLocStart());
|
||||
return std::make_shared<CxxDeclName>(getNameForAnonymousSymbol("template parameter", presumedBegin), std::vector<std::string>());
|
||||
}
|
||||
else if (clang::isa<clang::ParmVarDecl>(declaration) && declNameString.size() == 0)
|
||||
else if (clang::isa<clang::ParmVarDecl>(declaration) && declNameString.empty())
|
||||
{
|
||||
const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager();
|
||||
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(declaration->getLocStart());
|
||||
@@ -331,7 +331,7 @@ std::shared_ptr<CxxDeclName> CxxDeclNameResolver::getDeclName(const clang::Named
|
||||
}
|
||||
}
|
||||
|
||||
if (declNameString.size() > 0)
|
||||
if (!declNameString.empty())
|
||||
{
|
||||
return std::make_shared<CxxDeclName>(declNameString, std::vector<std::string>(), std::shared_ptr<CxxName>());
|
||||
}
|
||||
@@ -355,7 +355,7 @@ std::string CxxDeclNameResolver::getNameForAnonymousSymbol(const std::string& sy
|
||||
|
||||
std::string CxxDeclNameResolver::getTemplateParameterString(const clang::NamedDecl* parameter)
|
||||
{
|
||||
std::string templateParameterTypeString = "";
|
||||
std::string templateParameterTypeString;
|
||||
|
||||
if (parameter)
|
||||
{
|
||||
@@ -398,7 +398,7 @@ std::string CxxDeclNameResolver::getTemplateParameterTypeString(const clang::Non
|
||||
typeNameResolver.ignoreContextDecl(m_currentDecl);
|
||||
}
|
||||
|
||||
std::string typeString = "";
|
||||
std::string typeString;
|
||||
|
||||
std::shared_ptr<CxxTypeName> typeName = CxxTypeName::makeUnsolvedIfNull(typeNameResolver.getName(parameter->getType()));
|
||||
typeString = typeName->toString();
|
||||
|
||||
@@ -118,7 +118,7 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxx::getIndexerCommands(
|
||||
utility::append(compilerFlags, m_settings->getCompilerFlags());
|
||||
|
||||
std::set<FilePath> indexedPaths;
|
||||
for (FilePath p: m_settings->getSourcePathsExpandedAndAbsolute())
|
||||
for (const FilePath& p : m_settings->getSourcePathsExpandedAndAbsolute())
|
||||
{
|
||||
if (p.exists())
|
||||
{
|
||||
@@ -127,7 +127,7 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxx::getIndexerCommands(
|
||||
}
|
||||
|
||||
std::set<FilePath> excludedPaths;
|
||||
for (FilePath p: m_settings->getExcludePathsExpandedAndAbsolute())
|
||||
for (const FilePath& p: m_settings->getExcludePathsExpandedAndAbsolute())
|
||||
{
|
||||
if (p.exists())
|
||||
{
|
||||
@@ -152,7 +152,7 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxx::getIndexerCommands(
|
||||
MessageStatus(message, true).dispatch();
|
||||
}
|
||||
|
||||
for (clang::tooling::CompileCommand command: cdb->getAllCompileCommands())
|
||||
for (const clang::tooling::CompileCommand& command: cdb->getAllCompileCommands())
|
||||
{
|
||||
FilePath sourcePath = FilePath(command.Filename).canonical();
|
||||
if (!sourcePath.isAbsolute())
|
||||
|
||||
@@ -47,7 +47,7 @@ void utility::CompilationDatabase::getHeaders()
|
||||
std::set<FilePath> systemHeaders;
|
||||
std::set<FilePath> headers;
|
||||
|
||||
for (clang::tooling::CompileCommand command : commands)
|
||||
for (clang::tooling::CompileCommand& command : commands)
|
||||
{
|
||||
for( size_t i = 0; i < command.CommandLine.size(); i++)
|
||||
{
|
||||
|
||||
@@ -122,7 +122,6 @@ QString QtAutocompletionModel::longestType() const
|
||||
QtAutocompletionDelegate::QtAutocompletionDelegate(QtAutocompletionModel* model, QObject* parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
, m_model(model)
|
||||
, m_arrow()
|
||||
{
|
||||
resetCharSizes();
|
||||
}
|
||||
@@ -145,8 +144,10 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
|
||||
|
||||
// define highlight colors
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
QColor fillColor("#FFFFFF");
|
||||
QColor textColor("#000000");
|
||||
// QColor fillColor("#FFFFFF");
|
||||
QColor fillColor(0xFF, 0xFF, 0xFF);
|
||||
// QColor textColor("#000000");
|
||||
QColor textColor(0, 0, 0);
|
||||
|
||||
if (type.size() && type != "command")
|
||||
{
|
||||
@@ -169,7 +170,7 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
|
||||
|
||||
// draw highlights at indices
|
||||
QString highlightText(text.size(), ' ');
|
||||
if (indices.size())
|
||||
if (!indices.empty())
|
||||
{
|
||||
for (int i = 0; i < indices.size(); i++)
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ private:
|
||||
class QtAutocompletionDelegate
|
||||
: public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QtAutocompletionDelegate(QtAutocompletionModel* model, QObject* parent = 0);
|
||||
virtual ~QtAutocompletionDelegate();
|
||||
|
||||
@@ -48,23 +48,23 @@ bool MouseWheelOverScrollbarFilter::eventFilter(QObject* obj, QEvent* event)
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
QtCodeArea::LineNumberArea::LineNumberArea(QtCodeArea *codeArea)
|
||||
QtLineNumberArea::QtLineNumberArea(QtCodeArea *codeArea)
|
||||
: QWidget(codeArea)
|
||||
, m_codeArea(codeArea)
|
||||
{
|
||||
setObjectName("line_number_area");
|
||||
}
|
||||
|
||||
QtCodeArea::LineNumberArea::~LineNumberArea()
|
||||
QtLineNumberArea::~QtLineNumberArea()
|
||||
{
|
||||
}
|
||||
|
||||
QSize QtCodeArea::LineNumberArea::sizeHint() const
|
||||
QSize QtLineNumberArea::sizeHint() const
|
||||
{
|
||||
return QSize(m_codeArea->lineNumberAreaWidth(), 0);
|
||||
}
|
||||
|
||||
void QtCodeArea::LineNumberArea::paintEvent(QPaintEvent *event)
|
||||
void QtLineNumberArea::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
m_codeArea->lineNumberAreaPaintEvent(event);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ QtCodeArea::QtCodeArea(
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
||||
|
||||
m_lineNumberArea = new LineNumberArea(this);
|
||||
m_lineNumberArea = new QtLineNumberArea(this);
|
||||
|
||||
m_digits = lineNumberDigits();
|
||||
updateLineNumberAreaWidth();
|
||||
|
||||
@@ -13,6 +13,7 @@ class QResizeEvent;
|
||||
class QSize;
|
||||
class QtCodeNavigator;
|
||||
class QWidget;
|
||||
class QtCodeArea;
|
||||
|
||||
class MouseWheelOverScrollbarFilter
|
||||
: public QObject
|
||||
@@ -26,6 +27,23 @@ protected:
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
};
|
||||
|
||||
class QtLineNumberArea
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtLineNumberArea(QtCodeArea* codeArea);
|
||||
virtual ~QtLineNumberArea();
|
||||
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QtCodeArea* m_codeArea;
|
||||
};
|
||||
|
||||
|
||||
class QtCodeArea
|
||||
: public QtCodeField
|
||||
@@ -33,21 +51,6 @@ class QtCodeArea
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
class LineNumberArea
|
||||
: public QWidget
|
||||
{
|
||||
public:
|
||||
LineNumberArea(QtCodeArea* codeArea);
|
||||
virtual ~LineNumberArea();
|
||||
|
||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QtCodeArea* m_codeArea;
|
||||
};
|
||||
|
||||
QtCodeArea(
|
||||
uint startLineNumber,
|
||||
|
||||
@@ -62,7 +62,8 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator)
|
||||
|
||||
m_minimizeButton = new QtIconStateButton(this);
|
||||
m_minimizeButton->addState(QtIconStateButton::STATE_DEFAULT, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_active.png").c_str());
|
||||
m_minimizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_inactive.png").c_str(), "#5E5D5D");
|
||||
// m_minimizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_inactive.png").c_str(), "#5E5D5D");
|
||||
m_minimizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_inactive.png").c_str(), QColor(0x5E, 0x5D, 0x5D));
|
||||
m_minimizeButton->addState(QtIconStateButton::STATE_DISABLED, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_inactive.png").c_str());
|
||||
m_minimizeButton->setObjectName("file_button");
|
||||
m_minimizeButton->setToolTip("minimize");
|
||||
@@ -70,7 +71,8 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator)
|
||||
|
||||
m_snippetButton = new QtIconStateButton(this);
|
||||
m_snippetButton->addState(QtIconStateButton::STATE_DEFAULT, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_active.png").c_str());
|
||||
m_snippetButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_inactive.png").c_str(), "#5E5D5D");
|
||||
// m_snippetButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_inactive.png").c_str(), "#5E5D5D");
|
||||
m_snippetButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_inactive.png").c_str(), QColor(0x5E, 0x5D, 0x5D));
|
||||
m_snippetButton->addState(QtIconStateButton::STATE_DISABLED, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_inactive.png").c_str());
|
||||
m_snippetButton->setObjectName("file_button");
|
||||
m_snippetButton->setToolTip("show snippets");
|
||||
@@ -78,7 +80,8 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator)
|
||||
|
||||
m_maximizeButton = new QtIconStateButton(this);
|
||||
m_maximizeButton->addState(QtIconStateButton::STATE_DEFAULT, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_active.png").c_str());
|
||||
m_maximizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_inactive.png").c_str(), "#5E5D5D");
|
||||
// m_maximizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_inactive.png").c_str(), "#5E5D5D");
|
||||
m_maximizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_inactive.png").c_str(), QColor(0x5E, 0x5D, 0x5D));
|
||||
m_maximizeButton->addState(QtIconStateButton::STATE_DISABLED, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_inactive.png").c_str());
|
||||
m_maximizeButton->setObjectName("file_button");
|
||||
m_maximizeButton->setToolTip("maximize");
|
||||
@@ -131,7 +134,7 @@ std::string QtCodeFile::getFileName() const
|
||||
|
||||
QtCodeSnippet* QtCodeFile::addCodeSnippet(const CodeSnippetParams& params)
|
||||
{
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
|
||||
{
|
||||
if (snippet->getStartLineNumber() == params.startLineNumber &&
|
||||
snippet->getEndLineNumber() == params.endLineNumber)
|
||||
@@ -226,7 +229,7 @@ QtCodeSnippet* QtCodeFile::insertCodeSnippet(const CodeSnippetParams& params)
|
||||
|
||||
QtCodeSnippet* QtCodeFile::getSnippetForLocationId(Id locationId) const
|
||||
{
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
|
||||
{
|
||||
if (snippet->getLineNumberForLocationId(locationId))
|
||||
{
|
||||
@@ -244,7 +247,7 @@ QtCodeSnippet* QtCodeFile::getSnippetForLine(unsigned int line) const
|
||||
return m_fileSnippet.get();
|
||||
}
|
||||
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
|
||||
{
|
||||
if (snippet->getStartLineNumber() <= line && line <= snippet->getEndLineNumber())
|
||||
{
|
||||
@@ -264,7 +267,7 @@ std::pair<QtCodeSnippet*, Id> QtCodeFile::getFirstSnippetWithActiveLocationId(Id
|
||||
{
|
||||
std::pair<QtCodeSnippet*, Id> result(nullptr, 0);
|
||||
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
|
||||
{
|
||||
Id locationId = snippet->getFirstActiveLocationId(tokenId);
|
||||
if (locationId != 0)
|
||||
@@ -303,7 +306,7 @@ void QtCodeFile::updateContent()
|
||||
{
|
||||
updateSnippets();
|
||||
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
|
||||
{
|
||||
snippet->updateContent();
|
||||
}
|
||||
@@ -329,7 +332,7 @@ void QtCodeFile::setIsComplete(bool isComplete)
|
||||
|
||||
void QtCodeFile::setMinimized()
|
||||
{
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
|
||||
{
|
||||
snippet->hide();
|
||||
}
|
||||
@@ -352,7 +355,7 @@ void QtCodeFile::setMinimized()
|
||||
|
||||
void QtCodeFile::setSnippets()
|
||||
{
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
|
||||
{
|
||||
snippet->show();
|
||||
}
|
||||
@@ -375,7 +378,7 @@ void QtCodeFile::setSnippets()
|
||||
|
||||
void QtCodeFile::setMaximized()
|
||||
{
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
|
||||
{
|
||||
snippet->hide();
|
||||
}
|
||||
@@ -409,7 +412,7 @@ void QtCodeFile::updateSnippets()
|
||||
}
|
||||
|
||||
int maxDigits = 1;
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
|
||||
{
|
||||
if (snippet != m_snippets.front() && snippet->styleSheet().size())
|
||||
{
|
||||
@@ -419,7 +422,7 @@ void QtCodeFile::updateSnippets()
|
||||
maxDigits = qMax(maxDigits, snippet->lineNumberDigits());
|
||||
}
|
||||
|
||||
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
|
||||
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
|
||||
{
|
||||
snippet->updateLineNumberAreaWidthForDigits(maxDigits);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ QtCodeFile* QtCodeFileList::getFile(const FilePath filePath)
|
||||
{
|
||||
QtCodeFile* file = nullptr;
|
||||
|
||||
for (std::shared_ptr<QtCodeFile> filePtr : m_files)
|
||||
for (const std::shared_ptr<QtCodeFile>& filePtr : m_files)
|
||||
{
|
||||
if (filePtr->getFilePath() == filePath)
|
||||
{
|
||||
@@ -177,7 +177,7 @@ bool QtCodeFileList::requestScroll(const FilePath& filePath, uint lineNumber, Id
|
||||
|
||||
void QtCodeFileList::updateFiles()
|
||||
{
|
||||
for (std::shared_ptr<QtCodeFile> file : m_files)
|
||||
for (const std::shared_ptr<QtCodeFile>& file : m_files)
|
||||
{
|
||||
file->updateContent();
|
||||
}
|
||||
@@ -185,7 +185,7 @@ void QtCodeFileList::updateFiles()
|
||||
|
||||
void QtCodeFileList::showContents()
|
||||
{
|
||||
for (std::shared_ptr<QtCodeFile> filePtr : m_files)
|
||||
for (const std::shared_ptr<QtCodeFile>& filePtr : m_files)
|
||||
{
|
||||
filePtr->show();
|
||||
}
|
||||
@@ -193,7 +193,7 @@ void QtCodeFileList::showContents()
|
||||
|
||||
void QtCodeFileList::onWindowFocus()
|
||||
{
|
||||
for (std::shared_ptr<QtCodeFile> filePtr : m_files)
|
||||
for (const std::shared_ptr<QtCodeFile>& filePtr : m_files)
|
||||
{
|
||||
filePtr->updateTitleBar();
|
||||
}
|
||||
@@ -218,7 +218,7 @@ std::pair<QtCodeSnippet*, Id> QtCodeFileList::getFirstSnippetWithActiveLocationI
|
||||
{
|
||||
std::pair<QtCodeSnippet*, Id> result(nullptr, 0);
|
||||
|
||||
for (std::shared_ptr<QtCodeFile> filePtr : m_files)
|
||||
for (const std::shared_ptr<QtCodeFile>& filePtr : m_files)
|
||||
{
|
||||
if (filePtr->isCollapsed())
|
||||
{
|
||||
|
||||
@@ -228,7 +228,6 @@ bool QtDirectoryListBox::event(QEvent* event)
|
||||
|
||||
void QtDirectoryListBox::dropEvent(QDropEvent *event)
|
||||
{
|
||||
QFileInfo fileInfo;
|
||||
foreach(QUrl url, event->mimeData()->urls())
|
||||
{
|
||||
QtListItemWidget* widget = addListBoxItem();
|
||||
|
||||
@@ -24,6 +24,7 @@ protected:
|
||||
class QtIconButton
|
||||
: public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtIconButton(QString iconPath, QString hoveredIconPath, QWidget* parent = nullptr);
|
||||
|
||||
|
||||
@@ -862,7 +862,7 @@ void QtSmartSearchBox::layoutElements()
|
||||
|
||||
bool QtSmartSearchBox::hasSelectedElements() const
|
||||
{
|
||||
for (const std::shared_ptr<QtSearchElement> element : m_elements)
|
||||
for (const std::shared_ptr<QtSearchElement>& element : m_elements)
|
||||
{
|
||||
if (element->isChecked())
|
||||
{
|
||||
@@ -887,7 +887,7 @@ std::string QtSmartSearchBox::getSelectedString() const
|
||||
|
||||
void QtSmartSearchBox::selectAllElementsWith(bool selected)
|
||||
{
|
||||
for (const std::shared_ptr<QtSearchElement> element : m_elements)
|
||||
for (const std::shared_ptr<QtSearchElement>& element : m_elements)
|
||||
{
|
||||
element->setChecked(selected);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,8 @@ QtStatusBar::QtStatusBar()
|
||||
m_errorButton.setStyleSheet("QPushButton { color: #D00000; margin-right: 0; spacing: none; }");
|
||||
m_errorButton.setIcon(utility::colorizePixmap(
|
||||
QPixmap((ResourcePaths::getGuiPath().str() + "statusbar_view/dot.png").c_str()),
|
||||
"#D00000"
|
||||
// "#D00000"
|
||||
QColor(0xD0, 0, 0)
|
||||
).scaledToHeight(12));
|
||||
addPermanentWidget(&m_errorButton);
|
||||
|
||||
|
||||
@@ -131,3 +131,4 @@ void QtTable::resizeEvent(QResizeEvent* event)
|
||||
|
||||
updateRows();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ void QtTooltip::setTooltipInfo(TooltipInfo info)
|
||||
addTitle(info.title.c_str(), info.count, info.countText.c_str());
|
||||
}
|
||||
|
||||
for (TooltipSnippet snippet : info.snippets)
|
||||
for (TooltipSnippet& snippet : info.snippets)
|
||||
{
|
||||
QtCodeField* field = new QtCodeField(1, snippet.code, snippet.locationFile);
|
||||
|
||||
|
||||
@@ -434,7 +434,7 @@ QString ShowSaveFileDialog(QWidget *parent,
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
QString file_name = dialog.selectedFiles().first();
|
||||
QString file_name = dialog.selectedFiles().constFirst();
|
||||
QFileInfo info(file_name);
|
||||
|
||||
if (info.suffix().isEmpty() && !dialog.selectedNameFilter().isEmpty())
|
||||
|
||||
@@ -26,6 +26,9 @@ void QtRequest::finished(QNetworkReply *reply)
|
||||
QVariant statusCodeV = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
|
||||
QVariant redirectionTargetUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
||||
|
||||
Q_UNUSED(statusCodeV);
|
||||
Q_UNUSED(redirectionTargetUrl);
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError)
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "An error occured during http request. ERRORCODE: " << reply->error());
|
||||
|
||||
@@ -16,8 +16,6 @@ QtTcpWrapper::QtTcpWrapper(QObject* parent, const std::string& ip, const quint16
|
||||
|
||||
void QtTcpWrapper::startListening()
|
||||
{
|
||||
QHostAddress address(m_ip.c_str());
|
||||
|
||||
if (!m_tcpServer->listen(QHostAddress::LocalHost, m_serverPort))
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "TCP server failed to start with error: \"" + m_tcpServer->errorString().toStdString() + "\". Unable to listen for IDE plugin messages.");
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
{
|
||||
m_freeCallbacks.acquire();
|
||||
m_callback = callback;
|
||||
signalExecution();
|
||||
emit signalExecution();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace utility
|
||||
|
||||
for (int loadedFontId: loadedFontIds)
|
||||
{
|
||||
for (QString family: QFontDatabase::applicationFontFamilies(loadedFontId))
|
||||
for (QString& family: QFontDatabase::applicationFontFamilies(loadedFontId))
|
||||
{
|
||||
LOG_INFO("Loaded FontFamily: " + family.toStdString());
|
||||
}
|
||||
|
||||
@@ -179,16 +179,6 @@ void QtDialogView::finishedIndexingDialog(
|
||||
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
|
||||
float time, ErrorCountInfo errorInfo, bool interrupted)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Finished indexing: ";
|
||||
ss << indexedFileCount << "/" << totalIndexedFileCount << " source files indexed; ";
|
||||
ss << utility::timeToString(time);
|
||||
ss << "; " << errorInfo.total << " error" << (errorInfo.total != 1 ? "s" : "");
|
||||
if (errorInfo.fatal > 0)
|
||||
{
|
||||
ss << " (" << errorInfo.fatal << " fatal)";
|
||||
}
|
||||
MessageStatus(ss.str(), false, false).dispatch();
|
||||
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
|
||||
@@ -352,3 +352,4 @@ bool QtErrorView::isShownError(const ErrorInfo& error)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -206,13 +206,13 @@ void QtGraphView::activateEdge(Id edgeId, bool centerOrigin)
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
for (std::shared_ptr<QtGraphEdge> edge : m_oldEdges)
|
||||
for (std::shared_ptr<QtGraphEdge>& edge : m_oldEdges)
|
||||
{
|
||||
edge->setIsActive(false);
|
||||
edge->setIsFocused(false);
|
||||
}
|
||||
|
||||
for (std::shared_ptr<QtGraphEdge> edge : m_oldEdges)
|
||||
for (std::shared_ptr<QtGraphEdge>& edge : m_oldEdges)
|
||||
{
|
||||
if (edge->getData() && edge->getData()->getId() == edgeId)
|
||||
{
|
||||
@@ -264,7 +264,7 @@ void QtGraphView::finishedTransition()
|
||||
void QtGraphView::clickedInEmptySpace()
|
||||
{
|
||||
std::vector<std::shared_ptr<QtGraphEdge>> activeEdges;
|
||||
for (std::shared_ptr<QtGraphEdge> edge : m_oldEdges)
|
||||
for (std::shared_ptr<QtGraphEdge>& edge : m_oldEdges)
|
||||
{
|
||||
if (edge->getIsActive())
|
||||
{
|
||||
@@ -276,7 +276,7 @@ void QtGraphView::clickedInEmptySpace()
|
||||
|
||||
if (m_graph && m_graph->getTrailMode() != Graph::TRAIL_NONE)
|
||||
{
|
||||
for (std::shared_ptr<QtGraphEdge> edge : activeEdges)
|
||||
for (std::shared_ptr<QtGraphEdge>& edge : activeEdges)
|
||||
{
|
||||
edge->setIsActive(false);
|
||||
}
|
||||
@@ -639,14 +639,14 @@ void QtGraphView::doRebuildGraph(
|
||||
// create edges
|
||||
Graph::TrailMode trailMode = m_graph ? m_graph->getTrailMode() : Graph::TRAIL_NONE;
|
||||
std::set<Id> visibleEdgeIds;
|
||||
for (const std::shared_ptr<DummyEdge> edge : edges)
|
||||
for (const std::shared_ptr<DummyEdge>& edge : edges)
|
||||
{
|
||||
if (!edge->data || !edge->data->isType(Edge::EDGE_AGGREGATION))
|
||||
{
|
||||
createEdge(view, edge.get(), &visibleEdgeIds, trailMode, offset, params.bezierEdges);
|
||||
}
|
||||
}
|
||||
for (const std::shared_ptr<DummyEdge> edge : edges)
|
||||
for (const std::shared_ptr<DummyEdge>& edge : edges)
|
||||
{
|
||||
if (edge->data && edge->data->isType(Edge::EDGE_AGGREGATION))
|
||||
{
|
||||
@@ -1025,7 +1025,7 @@ void QtGraphView::createTransition()
|
||||
vanish->addAnimation(anim);
|
||||
}
|
||||
|
||||
for (std::shared_ptr<QtGraphEdge> edge : m_oldEdges)
|
||||
for (const std::shared_ptr<QtGraphEdge>& edge : m_oldEdges)
|
||||
{
|
||||
QPropertyAnimation* anim = new QPropertyAnimation(edge.get(), "opacity");
|
||||
anim->setDuration(150);
|
||||
@@ -1105,7 +1105,7 @@ void QtGraphView::createTransition()
|
||||
node->blendOut();
|
||||
}
|
||||
|
||||
for (std::shared_ptr<QtGraphEdge> edge : m_edges)
|
||||
for (const std::shared_ptr<QtGraphEdge>& edge : m_edges)
|
||||
{
|
||||
QPropertyAnimation* anim = new QPropertyAnimation(edge.get(), "opacity");
|
||||
anim->setDuration(150);
|
||||
|
||||
@@ -249,7 +249,7 @@ void QtLogView::updateTable()
|
||||
m_model->removeRows(0, m_model->rowCount());
|
||||
}
|
||||
|
||||
for ( Log log : m_logs )
|
||||
for ( Log& log : m_logs )
|
||||
{
|
||||
if (log.type & m_logLevel)
|
||||
{
|
||||
@@ -298,7 +298,7 @@ void QtLogView::doAddLog(Logger::LogLevel type, const LogMessage& message)
|
||||
void QtLogView::doAddLogs(const std::vector<Log>& logs)
|
||||
{
|
||||
doClear();
|
||||
for(Log log : logs)
|
||||
for(const Log& log : logs)
|
||||
{
|
||||
if( log.type & m_logLevel )
|
||||
{
|
||||
|
||||
@@ -14,9 +14,10 @@ class QStandardItemModel;
|
||||
class QtTable;
|
||||
|
||||
class QtLogView
|
||||
: public LogView
|
||||
, public QWidget
|
||||
: public QWidget
|
||||
, public LogView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtLogView(ViewLayout* viewLayout);
|
||||
virtual ~QtLogView();
|
||||
|
||||
@@ -139,7 +139,7 @@ void QtStatusView::doRefreshView()
|
||||
|
||||
void QtStatusView::doAddStatus(const std::vector<Status>& status)
|
||||
{
|
||||
for (Status s : status)
|
||||
for (const Status& s : status)
|
||||
{
|
||||
const int rowNumber = m_table->getFilledRowCount();
|
||||
if (rowNumber < m_model->rowCount())
|
||||
|
||||
@@ -12,9 +12,10 @@ class QStandardItemModel;
|
||||
class QtTable;
|
||||
|
||||
class QtStatusView
|
||||
: public StatusView
|
||||
, public QWidget
|
||||
: public QWidget
|
||||
, public StatusView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtStatusView(ViewLayout* viewLayout);
|
||||
virtual ~QtStatusView();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
class QtGraphNodeAccess
|
||||
: public QtGraphNode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtGraphNodeAccess(AccessKind accessKind);
|
||||
virtual ~QtGraphNodeAccess();
|
||||
|
||||
@@ -9,6 +9,7 @@ class QtCountCircleItem;
|
||||
class QtGraphNodeBundle
|
||||
: public QtGraphNode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtGraphNodeBundle(Id tokenId, size_t nodeCount, Node::NodeType type, std::string name);
|
||||
virtual ~QtGraphNodeBundle();
|
||||
|
||||
@@ -8,6 +8,7 @@ class FilePath;
|
||||
class QtGraphNodeData
|
||||
: public QtGraphNode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtGraphNodeData(const Node* data, const std::string& name, bool hasParent, bool childVisible, bool hasQualifier);
|
||||
virtual ~QtGraphNodeData();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
class QtGraphNodeExpandToggle
|
||||
: public QtGraphNode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtGraphNodeExpandToggle(bool expanded, int invisibleSubNodeCount);
|
||||
virtual ~QtGraphNodeExpandToggle();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class QtGraphNodeQualifier
|
||||
: public QtGraphNode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtGraphNodeQualifier(const NameHierarchy& name);
|
||||
virtual ~QtGraphNodeQualifier();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
class QtGraphNodeText
|
||||
: public QtGraphNode
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtGraphNodeText(const std::string& name);
|
||||
virtual ~QtGraphNodeText();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
class QtAboutLicense
|
||||
: public QtWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtAboutLicense(QWidget* parent = 0);
|
||||
QSize sizeHint() const override;
|
||||
|
||||
@@ -132,17 +132,17 @@ void QtBookmarkBrowser::setBookmarks(const std::vector<std::shared_ptr<Bookmark>
|
||||
m_bookmarkTree->clear();
|
||||
|
||||
std::map<std::string, BookmarkCategory> categoryNamesOrdered;
|
||||
for (std::shared_ptr<Bookmark> bookmark: bookmarks)
|
||||
for (const std::shared_ptr<Bookmark>& bookmark : bookmarks)
|
||||
{
|
||||
categoryNamesOrdered.emplace(bookmark->getCategory().getName(), bookmark->getCategory());
|
||||
}
|
||||
|
||||
for (auto p : categoryNamesOrdered)
|
||||
for (const auto& p : categoryNamesOrdered)
|
||||
{
|
||||
findOrCreateTreeCategory(p.second);
|
||||
}
|
||||
|
||||
for (std::shared_ptr<Bookmark> bookmark: bookmarks)
|
||||
for (const std::shared_ptr<Bookmark>& bookmark : bookmarks)
|
||||
{
|
||||
QtBookmark* qtBookmark = new QtBookmark();
|
||||
qtBookmark->setBookmark(bookmark);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
class QtEulaWindow
|
||||
: public QtWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static const int EULA_VERSION = 2;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
class QtShortcutTable
|
||||
: public QTableWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtShortcutTable(QWidget* parent = nullptr);
|
||||
void updateSize();
|
||||
|
||||
@@ -32,7 +32,7 @@ void QtSelectPathsDialog::setPathsList(const std::vector<FilePath>& paths, const
|
||||
{
|
||||
std::set<FilePath> checked(checkedPaths.begin(), checkedPaths.end());
|
||||
|
||||
for (FilePath s : paths)
|
||||
for (const FilePath& s : paths)
|
||||
{
|
||||
QListWidgetItem* item = new QListWidgetItem(s.str().c_str(), m_list);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
|
||||
@@ -61,7 +61,7 @@ void QtSelectPathsDialog::setPathsList(const std::vector<FilePath>& paths, const
|
||||
|
||||
void QtSelectPathsDialog::checkSelected(bool checked)
|
||||
{
|
||||
for(QListWidgetItem* item : m_list->selectedItems())
|
||||
for (QListWidgetItem* item : m_list->selectedItems())
|
||||
{
|
||||
item->setCheckState( (checked ? Qt::Checked : Qt::Unchecked) );
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ class QListWidget;
|
||||
class QtSelectPathsDialog
|
||||
: public QtTextEditDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtSelectPathsDialog(const QString& title, const QString& description, QWidget* parent = 0);
|
||||
|
||||
|
||||
@@ -95,3 +95,4 @@ void QtSplashScreen::drawContents(QPainter *painter)
|
||||
|
||||
painter->drawText(r, Qt::AlignLeft, m_string);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
class QtWindowStackElement
|
||||
: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtWindowStackElement(QWidget* parent = nullptr);
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ bool QtProjectWizzard::applicationSettingsContainVisualStudioHeaderSearchPaths()
|
||||
{
|
||||
std::vector<FilePath> expandedPaths;
|
||||
const std::shared_ptr<CombinedPathDetector> headerPathDetector = utility::getCxxVsHeaderPathDetector();
|
||||
for (const std::string& detectorName: headerPathDetector->getWorkingDetectorNames())
|
||||
for (const std::string& detectorName : headerPathDetector->getWorkingDetectorNames())
|
||||
{
|
||||
for (const FilePath& path: headerPathDetector->getPaths(detectorName))
|
||||
{
|
||||
@@ -319,7 +319,7 @@ void QtProjectWizzard::updateSourceGroupList()
|
||||
{
|
||||
m_sourceGroupList->clear();
|
||||
|
||||
for (const std::shared_ptr<SourceGroupSettings> group : m_allSourceGroupSettings)
|
||||
for (const std::shared_ptr<SourceGroupSettings>& group : m_allSourceGroupSettings)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(QString::fromStdString(group->getName()));
|
||||
m_sourceGroupList->addItem(item);
|
||||
|
||||
@@ -44,10 +44,10 @@ void QtProjectWizzardContentCDBSource::load()
|
||||
std::vector<FilePath> filePaths =
|
||||
IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath);
|
||||
|
||||
for (FilePath path : filePaths)
|
||||
for (FilePath& path : filePaths)
|
||||
{
|
||||
bool excluded = false;
|
||||
for (FilePath p : excludePaths)
|
||||
for (const FilePath& p : excludePaths)
|
||||
{
|
||||
if (p == path || p.contains(path))
|
||||
{
|
||||
|
||||
@@ -66,6 +66,7 @@ private slots:
|
||||
class QtProjectWizzardContentPathSourceMaven
|
||||
: public QtProjectWizzardContentPath
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtProjectWizzardContentPathSourceMaven(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
@@ -85,6 +86,7 @@ private:
|
||||
class QtProjectWizzardContentPathDependenciesMaven
|
||||
: public QtProjectWizzardContentPath
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtProjectWizzardContentPathDependenciesMaven(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ private:
|
||||
class QtProjectWizzardContentPathsSource
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtProjectWizzardContentPathsSource(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
@@ -89,6 +90,7 @@ private slots:
|
||||
class QtProjectWizzardContentPathsExclude
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtProjectWizzardContentPathsExclude(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
@@ -101,7 +103,6 @@ class QtProjectWizzardContentPathsHeaderSearch
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentPathsHeaderSearch(
|
||||
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
|
||||
@@ -123,6 +124,7 @@ private:
|
||||
class QtProjectWizzardContentPathsHeaderSearchGlobal
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtProjectWizzardContentPathsHeaderSearchGlobal(QtProjectWizzardWindow* window);
|
||||
|
||||
@@ -135,6 +137,7 @@ public:
|
||||
class QtProjectWizzardContentPathsFrameworkSearch
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtProjectWizzardContentPathsFrameworkSearch(
|
||||
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
|
||||
@@ -149,6 +152,7 @@ public:
|
||||
class QtProjectWizzardContentPathsFrameworkSearchGlobal
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtProjectWizzardContentPathsFrameworkSearchGlobal(QtProjectWizzardWindow* window);
|
||||
|
||||
@@ -160,6 +164,7 @@ public:
|
||||
class QtProjectWizzardContentPathsClassJava
|
||||
: public QtProjectWizzardContentPaths
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtProjectWizzardContentPathsClassJava(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
vlayout->setSpacing(10);
|
||||
|
||||
m_languages = new QButtonGroup();
|
||||
for (auto it: sourceGroupInfos)
|
||||
for (auto& it: sourceGroupInfos)
|
||||
{
|
||||
QPushButton* b = new QPushButton(languageTypeToString(it.first).c_str(), this);
|
||||
b->setObjectName("menuButton");
|
||||
@@ -85,10 +85,10 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
selectedLanguage = LanguageType(languageTypeInt);
|
||||
}
|
||||
|
||||
for (auto it: m_buttons)
|
||||
for (auto& it: m_buttons)
|
||||
{
|
||||
it.second->setExclusive(false);
|
||||
for (QAbstractButton* button: it.second->buttons())
|
||||
for (QAbstractButton* button : it.second->buttons())
|
||||
{
|
||||
button->setChecked(false);
|
||||
button->setVisible(it.first == selectedLanguage);
|
||||
@@ -104,11 +104,11 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
|
||||
QHBoxLayout* hlayout = new QHBoxLayout();
|
||||
|
||||
for (auto languageIt: sourceGroupInfos)
|
||||
for (auto& languageIt: sourceGroupInfos)
|
||||
{
|
||||
QButtonGroup* sourceGroupButtons = new QButtonGroup(this);
|
||||
|
||||
for (auto sourceGroupIt: languageIt.second)
|
||||
for (auto& sourceGroupIt: languageIt.second)
|
||||
{
|
||||
QToolButton* b = createSourceGroupButton(
|
||||
utility::insertLineBreaksAtBlankSpaces(sourceGroupTypeToProjectSetupString(sourceGroupIt.type), 15).c_str(),
|
||||
@@ -122,7 +122,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
m_buttons[languageIt.first] = sourceGroupButtons;
|
||||
}
|
||||
|
||||
for (auto it: m_buttons)
|
||||
for (auto& it: m_buttons)
|
||||
{
|
||||
connect(it.second, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
|
||||
[this](QAbstractButton* button)
|
||||
@@ -166,14 +166,14 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
|
||||
layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 1);
|
||||
layout->setHorizontalSpacing(0);
|
||||
|
||||
m_languages->buttons().first()->click();
|
||||
m_languages->buttons().constFirst()->click();
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentSelect::save()
|
||||
{
|
||||
SourceGroupType selectedType;
|
||||
|
||||
for (auto it: m_buttons)
|
||||
for (auto& it: m_buttons)
|
||||
{
|
||||
if (QAbstractButton* b = it.second->checkedButton())
|
||||
{
|
||||
@@ -193,7 +193,7 @@ bool QtProjectWizzardContentSelect::check()
|
||||
{
|
||||
bool sourceGroupChosen = false;
|
||||
|
||||
for (auto it: m_buttons)
|
||||
for (auto& it: m_buttons)
|
||||
{
|
||||
if (it.second->checkedId() != -1)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ void CombinedPathDetector::addDetector(std::shared_ptr<PathDetector> detector)
|
||||
std::vector<std::string> CombinedPathDetector::getWorkingDetectorNames()
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
for (std::shared_ptr<PathDetector> detector: m_detectors)
|
||||
for (const std::shared_ptr<PathDetector>& detector: m_detectors)
|
||||
{
|
||||
if (detector->isWorking())
|
||||
{
|
||||
@@ -31,7 +31,7 @@ std::vector<std::string> CombinedPathDetector::getWorkingDetectorNames()
|
||||
|
||||
std::vector<FilePath> CombinedPathDetector::getPaths() const
|
||||
{
|
||||
for (std::shared_ptr<PathDetector> detector: m_detectors)
|
||||
for (const std::shared_ptr<PathDetector>& detector: m_detectors)
|
||||
{
|
||||
std::vector<FilePath> detectedPaths = detector->getPaths();
|
||||
if (!detectedPaths.empty())
|
||||
@@ -44,7 +44,7 @@ std::vector<FilePath> CombinedPathDetector::getPaths() const
|
||||
|
||||
std::vector<FilePath> CombinedPathDetector::getPaths(std::string detectorName) const
|
||||
{
|
||||
for (std::shared_ptr<PathDetector> detector: m_detectors)
|
||||
for (const std::shared_ptr<PathDetector>& detector: m_detectors)
|
||||
{
|
||||
if (detector->getName() == detectorName)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace utility
|
||||
|
||||
if (!standardHeaders.empty())
|
||||
{
|
||||
for (std::string s : utility::splitToVector(standardHeaders, '\n'))
|
||||
for (const std::string& s : utility::splitToVector(standardHeaders, '\n'))
|
||||
{
|
||||
paths.push_back(utility::trim(s));
|
||||
}
|
||||
|
||||
@@ -5,12 +5,11 @@
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
#ifdef __x86_64__
|
||||
const std::string arch = "amd64";
|
||||
const char jvmLibPathRelativeToJavaExecutable[] = "/../lib/amd64/server/libjvm.so";
|
||||
#else
|
||||
const std::string arch = "i386";
|
||||
const char jvmLibPathRelativeToJavaExecutable[] = "/../lib/i386/server/libjvm.so";
|
||||
#endif
|
||||
|
||||
const std::string jvmLibPathRelativeToJavaExecutable = "/../lib/" + arch + "/server/libjvm.so";
|
||||
|
||||
JavaPathDetectorLinux::JavaPathDetectorLinux(const std::string javaVersion)
|
||||
: JavaPathDetector("Java " + javaVersion + " for Linux", javaVersion)
|
||||
@@ -109,7 +108,7 @@ std::vector<FilePath> JavaPathDetectorLinux::getPaths() const
|
||||
paths.push_back(FilePath("/usr/lib/jvm/default/bin/java"));
|
||||
paths.push_back(FilePath("/usr/lib/jvm/java-openjdk/bin/java"));
|
||||
|
||||
for ( FilePath path : paths )
|
||||
for (const FilePath& path : paths )
|
||||
{
|
||||
if (checkVersion(path))
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ size_t IndexerCommandJava::getByteSize() const
|
||||
{
|
||||
size_t size = IndexerCommand::getByteSize();
|
||||
|
||||
for (auto i : m_classPath)
|
||||
for (auto& i : m_classPath)
|
||||
{
|
||||
size += sizeof(std::string) + i.str().size();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands
|
||||
std::vector<FilePath> classPath = getClassPath();
|
||||
|
||||
std::set<FilePath> indexedPaths;
|
||||
for (FilePath p: m_settings->getSourcePathsExpandedAndAbsolute())
|
||||
for (const FilePath& p: m_settings->getSourcePathsExpandedAndAbsolute())
|
||||
{
|
||||
if (p.exists())
|
||||
{
|
||||
@@ -85,7 +85,7 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands
|
||||
}
|
||||
|
||||
std::set<FilePath> excludedPaths;
|
||||
for (FilePath p: m_settings->getExcludePathsExpandedAndAbsolute())
|
||||
for (const FilePath& p: m_settings->getExcludePathsExpandedAndAbsolute())
|
||||
{
|
||||
if (p.exists())
|
||||
{
|
||||
@@ -242,7 +242,7 @@ std::set<FilePath> SourceGroupJava::fetchRootDirectories()
|
||||
std::set<FilePath> rootDirectories;
|
||||
|
||||
std::shared_ptr<JavaEnvironment> javaEnvironment = JavaEnvironmentFactory::getInstance()->createEnvironment();
|
||||
for (FilePath filePath: m_allSourceFilePaths)
|
||||
for (const FilePath& filePath: m_allSourceFilePaths)
|
||||
{
|
||||
std::shared_ptr<TextAccess> textAccess = TextAccess::createFromFile(filePath);
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ bool License::isTestLicense() const
|
||||
|
||||
bool License::isNonCommercialLicenseType() const
|
||||
{
|
||||
for ( const std::string nonCommercialLicenseType : NON_COMMERCIAL_LICENSE_TYPES)
|
||||
for ( const std::string& nonCommercialLicenseType : NON_COMMERCIAL_LICENSE_TYPES)
|
||||
{
|
||||
if (m_type == nonCommercialLicenseType)
|
||||
{
|
||||
@@ -440,12 +440,6 @@ bool License::loadPublicKeyFromFile(const std::string& filename)
|
||||
|
||||
bool License::loadPublicKey()
|
||||
{
|
||||
if (PUBLIC_KEY.empty())
|
||||
{
|
||||
std::cout << "Public key is empty" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
Botan::DataSource_Memory in(PUBLIC_KEY);
|
||||
Botan::RSA_PublicKey *rsaPublicKey = dynamic_cast<Botan::RSA_PublicKey *>(Botan::X509::load_key(in));
|
||||
|
||||
@@ -483,10 +477,12 @@ bool License::loadPublicKeyFromString(const std::string& publicKey)
|
||||
std::string License::getLicenseString() const
|
||||
{
|
||||
std::string license = "";
|
||||
license += LicenseConstants::BEGIN_LICENSE_STRING + "\n";
|
||||
license += LicenseConstants::BEGIN_LICENSE_STRING;
|
||||
license += "\n";
|
||||
license += getMessage(true) + "\n";
|
||||
license += getSignature() + "\n";
|
||||
license += LicenseConstants::END_LICENSE_STRING + "\n";
|
||||
license += LicenseConstants::END_LICENSE_STRING;
|
||||
license += "\n";
|
||||
|
||||
return license;
|
||||
}
|
||||
|
||||
@@ -14,15 +14,15 @@ namespace Botan
|
||||
}
|
||||
|
||||
namespace LicenseConstants {
|
||||
const std::string BEGIN_LICENSE_STRING = "-----BEGIN LICENSE-----";
|
||||
const std::string END_LICENSE_STRING = "-----END LICENSE-----";
|
||||
const std::string TEST_LICENSE_STRING = "Test License";
|
||||
const std::string PRODUCT_STRING = "Product: Sourcetrail";
|
||||
const std::string LICENSED_TO_STRING = "Licensed to: ";
|
||||
const std::string LICENSE_TYPE_STRING = "License type: ";
|
||||
const std::string VALID_UNTIL_STRING = "Valid until: ";
|
||||
const std::string VALID_UP_TO_STRING = "Valid up to version: ";
|
||||
const std::string SEPARATOR_STRING = "-";
|
||||
const char BEGIN_LICENSE_STRING[] = "-----BEGIN LICENSE-----";
|
||||
const char END_LICENSE_STRING[] = "-----END LICENSE-----";
|
||||
const char TEST_LICENSE_STRING[] = "Test License";
|
||||
const char PRODUCT_STRING[] = "Product: Sourcetrail";
|
||||
const char LICENSED_TO_STRING[] = "Licensed to: ";
|
||||
const char LICENSE_TYPE_STRING[] = "License type: ";
|
||||
const char VALID_UNTIL_STRING[] = "Valid until: ";
|
||||
const char VALID_UP_TO_STRING[] = "Valid up to version: ";
|
||||
const char SEPARATOR_STRING[] = "-";
|
||||
const int MINOR_VERSIONS_PER_YEAR = 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
#include "PrivateKey.h"
|
||||
#include "PublicKey.h"
|
||||
|
||||
const std::string KEY_FILEENDING = ".pem";
|
||||
const std::string PRIVATE_KEY_PASSWORD = "BA#jk5vbklAiKL9K3k$";
|
||||
const char PRIVATE_KEY_PASSWORD[] = "BA#jk5vbklAiKL9K3k$";
|
||||
const char PRIVATE_KEY_FILE[] = "private-sourcetrail.pem";
|
||||
const char PUBLIC_KEY_FILE[] = "public-sourcetrail.pem";
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
));
|
||||
}
|
||||
|
||||
for (auto thread : threads)
|
||||
for (auto& thread : threads)
|
||||
{
|
||||
thread->join();
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
SharedMemory::Vector<SharedMemory::String>* strings =
|
||||
access.accessValueWithAllocator<SharedMemory::Vector<SharedMemory::String>>("strings");
|
||||
TS_ASSERT_EQUALS(strings->size(), 4);
|
||||
for (SharedMemory::String str : *strings)
|
||||
for (SharedMemory::String& str : *strings)
|
||||
{
|
||||
TS_ASSERT_EQUALS(str, "ho");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user