logic: use wstring in symbol and bookmark names

* use wstring in symbol and bookmark names
* fixed setting apppath in windows includes
* regard utf8 encoding in shared indexer commands
* regard utf8 encoding in shared indexer status
This commit is contained in:
mlangkabel
2018-02-05 17:17:33 +01:00
parent c99e79364f
commit 9e041c1f0a
155 changed files with 1955 additions and 1864 deletions
@@ -52,7 +52,7 @@ void ActivationController::handleMessage(MessageActivateFile* message)
{
MessageActivateTokens messageActivateTokens(message);
messageActivateTokens.tokenIds.push_back(fileId);
messageActivateTokens.tokenNames.push_back(NameHierarchy(message->filePath.str(), NAME_DELIMITER_FILE));
messageActivateTokens.tokenNames.push_back(NameHierarchy(message->filePath.wstr(), NAME_DELIMITER_FILE));
messageActivateTokens.searchMatches = m_storageAccess->getSearchMatchesForTokenIds({ fileId });
messageActivateTokens.dispatchImmediately();
}
@@ -14,8 +14,8 @@
#include "utility/utilityString.h"
#include "utility/utility.h"
const std::string BookmarkController::s_edgeSeperatorToken = " => ";
const std::string BookmarkController::s_defaultCategoryName = "default";
const std::wstring BookmarkController::s_edgeSeperatorToken = L" => ";
const std::wstring BookmarkController::s_defaultCategoryName = L"default";
BookmarkController::BookmarkController(StorageAccess* storageAccess)
: m_storageAccess(storageAccess)
@@ -58,15 +58,15 @@ void BookmarkController::displayBookmarksFor(Bookmark::BookmarkFilter filter, Bo
}
void BookmarkController::createBookmark(
const std::string& name, const std::string& comment, const std::string& category, Id nodeId
const std::wstring& name, const std::wstring& comment, const std::wstring& category, Id nodeId
){
LOG_INFO_STREAM(<< "Attempting to create new bookmark");
LOG_INFO("Attempting to create new bookmark");
BookmarkCategory bookmarkCategory(0, category.empty() ? s_defaultCategoryName : category);
if (!m_activeEdgeIds.empty())
{
LOG_INFO_STREAM(<< "Creating Edge Bookmark");
LOG_INFO("Creating Edge Bookmark");
EdgeBookmark bookmark(0, name, comment, TimeStamp::now(), bookmarkCategory);
bookmark.setEdgeIds(m_activeEdgeIds);
@@ -84,7 +84,7 @@ void BookmarkController::createBookmark(
}
else
{
LOG_INFO_STREAM(<< "Creating Node Bookmark");
LOG_INFO("Creating Node Bookmark");
NodeBookmark bookmark(0, name, comment, TimeStamp::now(), bookmarkCategory);
if (nodeId)
@@ -109,7 +109,7 @@ void BookmarkController::createBookmark(
}
void BookmarkController::editBookmark(
Id bookmarkId, const std::string& name, const std::string& comment, const std::string& category
Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& category
){
LOG_INFO_STREAM(<< "Attempting to update Bookmark " << bookmarkId);
@@ -154,7 +154,7 @@ void BookmarkController::deleteBookmarkForActiveTokens()
{
if (std::shared_ptr<Bookmark> bookmark = getBookmarkForActiveToken())
{
LOG_INFO_STREAM(<< "Deleting bookmark " << bookmark->getName());
LOG_INFO(L"Deleting bookmark " + bookmark->getName());
m_storageAccess->removeBookmark(bookmark->getId());
@@ -165,13 +165,13 @@ void BookmarkController::deleteBookmarkForActiveTokens()
}
else
{
LOG_WARNING_STREAM(<< "No Bookmark to delete for active tokens.");
LOG_WARNING("No Bookmark to delete for active tokens.");
}
}
void BookmarkController::activateBookmark(const std::shared_ptr<Bookmark> bookmark)
{
LOG_INFO_STREAM(<< "Attempting to activate Bookmark");
LOG_INFO("Attempting to activate Bookmark");
if (std::shared_ptr<EdgeBookmark> edgeBookmark = std::dynamic_pointer_cast<EdgeBookmark>(bookmark))
{
@@ -207,7 +207,7 @@ void BookmarkController::activateBookmark(const std::shared_ptr<Bookmark> bookma
}
else
{
LOG_ERROR_STREAM(<< "Failed to activate bookmark, did not find edges to activate");
LOG_ERROR("Failed to activate bookmark, did not find edges to activate");
}
}
else if (std::shared_ptr<NodeBookmark> nodeBookmark = std::dynamic_pointer_cast<NodeBookmark>(bookmark))
@@ -359,7 +359,7 @@ void BookmarkController::handleMessage(MessageShowErrors* message)
clear();
}
std::vector<std::string> BookmarkController::getActiveTokenDisplayNames() const
std::vector<std::wstring> BookmarkController::getActiveTokenDisplayNames() const
{
if (m_activeEdgeIds.size() > 0)
{
@@ -371,9 +371,9 @@ std::vector<std::string> BookmarkController::getActiveTokenDisplayNames() const
}
}
std::vector<std::string> BookmarkController::getDisplayNamesForNodeId(Id nodeId) const
std::vector<std::wstring> BookmarkController::getDisplayNamesForNodeId(Id nodeId) const
{
return std::vector<std::string>({ getNodeDisplayName(nodeId) });
return std::vector<std::wstring>({ getNodeDisplayName(nodeId) });
}
std::vector<BookmarkCategory> BookmarkController::getAllBookmarkCategories() const
@@ -428,7 +428,7 @@ bool BookmarkController::canCreateBookmark() const
std::vector<std::shared_ptr<Bookmark>> BookmarkController::getAllBookmarks() const
{
LOG_INFO_STREAM(<< "Retrieving all bookmarks");
LOG_INFO("Retrieving all bookmarks");
std::vector<std::shared_ptr<Bookmark>> bookmarks;
@@ -475,9 +475,9 @@ std::vector<std::shared_ptr<Bookmark>> BookmarkController::getBookmarks(
return bookmarks;
}
std::vector<std::string> BookmarkController::getActiveNodeDisplayNames() const
std::vector<std::wstring> BookmarkController::getActiveNodeDisplayNames() const
{
std::vector<std::string> names;
std::vector<std::wstring> names;
for (Id nodeId : m_activeNodeIds)
{
names.push_back(getNodeDisplayName(nodeId));
@@ -485,27 +485,27 @@ std::vector<std::string> BookmarkController::getActiveNodeDisplayNames() const
return names;
}
std::vector<std::string> BookmarkController::getActiveEdgeDisplayNames() const
std::vector<std::wstring> BookmarkController::getActiveEdgeDisplayNames() const
{
std::vector<std::string> activeEdgeDisplayNames;
std::vector<std::wstring> activeEdgeDisplayNames;
for (Id activeEdgeId: m_activeEdgeIds)
{
const StorageEdge activeEdge = m_storageAccess->getEdgeById(activeEdgeId);
const std::string sourceDisplayName = getNodeDisplayName(activeEdge.sourceNodeId);
const std::string targetDisplayName = getNodeDisplayName(activeEdge.targetNodeId);
const std::wstring sourceDisplayName = getNodeDisplayName(activeEdge.sourceNodeId);
const std::wstring targetDisplayName = getNodeDisplayName(activeEdge.targetNodeId);
activeEdgeDisplayNames.push_back(sourceDisplayName + s_edgeSeperatorToken + targetDisplayName);
}
return activeEdgeDisplayNames;
}
std::string BookmarkController::getNodeDisplayName(const Id nodeId) const
std::wstring BookmarkController::getNodeDisplayName(const Id nodeId) const
{
NodeType type = m_storageAccess->getNodeTypeForNodeWithId(nodeId);
NameHierarchy nameHierarchy = m_storageAccess->getNameHierarchyForNodeId(nodeId);
if (type.isFile())
{
return FilePath(nameHierarchy.getQualifiedName()).fileName();
return FilePath(nameHierarchy.getQualifiedName()).wFileName();
}
return nameHierarchy.getQualifiedName();
@@ -632,8 +632,8 @@ bool BookmarkController::bookmarkDateCompare(const std::shared_ptr<Bookmark> a,
bool BookmarkController::bookmarkNameCompare(const std::shared_ptr<Bookmark> a, const std::shared_ptr<Bookmark> b)
{
std::string aName = a->getName();
std::string bName = b->getName();
std::wstring aName = a->getName();
std::wstring bName = b->getName();
aName = utility::toLowerCase(aName);
bName = utility::toLowerCase(bName);
@@ -37,8 +37,8 @@ public:
void displayBookmarks();
void displayBookmarksFor(Bookmark::BookmarkFilter filter, Bookmark::BookmarkOrder order);
void createBookmark(const std::string& name, const std::string& comment, const std::string& category, Id nodeId);
void editBookmark(Id bookmarkId, const std::string& name, const std::string& comment, const std::string& category);
void createBookmark(const std::wstring& name, const std::wstring& comment, const std::wstring& category, Id nodeId);
void editBookmark(Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& category);
void deleteBookmark(Id bookmarkId);
void deleteBookmarkCategory(Id categoryId);
@@ -76,8 +76,8 @@ private:
virtual void handleMessage(MessageFinishedParsing* message);
virtual void handleMessage(MessageShowErrors* message);
std::vector<std::string> getActiveTokenDisplayNames() const;
std::vector<std::string> getDisplayNamesForNodeId(Id nodeId) const;
std::vector<std::wstring> getActiveTokenDisplayNames() const;
std::vector<std::wstring> getDisplayNamesForNodeId(Id nodeId) const;
std::vector<BookmarkCategory> getAllBookmarkCategories() const;
@@ -92,9 +92,9 @@ private:
std::vector<std::shared_ptr<Bookmark>> getBookmarks(
Bookmark::BookmarkFilter filter, Bookmark::BookmarkOrder order) const;
std::vector<std::string> getActiveNodeDisplayNames() const;
std::vector<std::string> getActiveEdgeDisplayNames() const;
std::string getNodeDisplayName(const Id id) const;
std::vector<std::wstring> getActiveNodeDisplayNames() const;
std::vector<std::wstring> getActiveEdgeDisplayNames() const;
std::wstring getNodeDisplayName(const Id id) const;
std::vector<std::shared_ptr<Bookmark>> getFilteredBookmarks(
const std::vector<std::shared_ptr<Bookmark>>& bookmarks, Bookmark::BookmarkFilter filter) const;
@@ -112,8 +112,8 @@ private:
void update();
static const std::string s_edgeSeperatorToken;
static const std::string s_defaultCategoryName;
static const std::wstring s_edgeSeperatorToken;
static const std::wstring s_defaultCategoryName;
StorageAccess* m_storageAccess;
mutable BookmarkCache m_bookmarkCache;
@@ -160,7 +160,7 @@ void CodeController::handleMessage(MessageActivateTokens* message)
if (message->tokenNames.size())
{
status += L"Activate \"" + utility::decodeFromUtf8(message->tokenNames[0].getQualifiedName()) + L"\": ";
status += L"Activate \"" + message->tokenNames[0].getQualifiedName() + L"\": ";
}
status += std::to_wstring(message->tokenIds.size()) + L" ";
@@ -660,7 +660,7 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
{
if (location->getTokenIds().size())
{
params.title = m_storageAccess->getNameHierarchyForNodeId(location->getTokenIds()[0]).getQualifiedName();
params.title = utility::encodeToUtf8(m_storageAccess->getNameHierarchyForNodeId(location->getTokenIds()[0]).getQualifiedName());
params.titleId = location->getLocationId();
}
}
@@ -682,7 +682,7 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
{
if (location->getTokenIds().size())
{
params.footer = m_storageAccess->getNameHierarchyForNodeId(location->getTokenIds()[0]).getQualifiedName();
params.footer = utility::encodeToUtf8(m_storageAccess->getNameHierarchyForNodeId(location->getTokenIds()[0]).getQualifiedName());
params.footerId = location->getLocationId();
}
}
@@ -829,12 +829,12 @@ std::vector<std::string> CodeController::getProjectDescription(SourceLocationFil
break;
}
std::string serializedName = line.substr(posA + 1, posB - posA - 1);
std::wstring serializedName = utility::decodeFromUtf8(line.substr(posA + 1, posB - posA - 1));
NameHierarchy nameHierarchy = NameHierarchy::deserialize(serializedName);
Id tokenId = m_storageAccess->getNodeIdForNameHierarchy(nameHierarchy);
std::string nameString = nameHierarchy.getQualifiedName();
std::string nameString = utility::encodeToUtf8(nameHierarchy.getQualifiedName());
if (tokenId > 0)
{
line.replace(posA, posB - posA + 1, nameString);
@@ -1010,7 +1010,7 @@ void GraphController::bundleNodes()
},
1,
false,
"Importing Files"
L"Importing Files"
);
bundleNodesAndEdgesMatching(
@@ -1020,7 +1020,7 @@ void GraphController::bundleNodes()
},
2,
true,
"Non-indexed Symbols"
L"Non-indexed Symbols"
);
bundleNodesAndEdgesMatching(
@@ -1030,7 +1030,7 @@ void GraphController::bundleNodes()
},
2,
true,
"Non-indexed Symbols"
L"Non-indexed Symbols"
);
bundleNodesAndEdgesMatching(
@@ -1040,7 +1040,7 @@ void GraphController::bundleNodes()
},
3,
false,
"Built-in Types"
L"Built-in Types"
);
bundleNodesAndEdgesMatching(
@@ -1050,7 +1050,7 @@ void GraphController::bundleNodes()
},
10,
false,
"Referencing Symbols"
L"Referencing Symbols"
);
bundleNodesAndEdgesMatching(
@@ -1060,7 +1060,7 @@ void GraphController::bundleNodes()
},
10,
false,
"Referenced Symbols"
L"Referenced Symbols"
);
bundleNodesAndEdgesMatching(
@@ -1070,7 +1070,7 @@ void GraphController::bundleNodes()
},
5,
false,
"Derived Symbols"
L"Derived Symbols"
);
bundleNodesAndEdgesMatching(
@@ -1080,7 +1080,7 @@ void GraphController::bundleNodes()
},
5,
false,
"Base Symbols"
L"Base Symbols"
);
}
@@ -1089,7 +1089,7 @@ void GraphController::bundleNodesAndEdgesMatching(
const Node* data)> matcher,
size_t count,
bool countConnectedNodes,
const std::string& name
const std::wstring& name
){
std::vector<size_t> matchedNodeIndices;
size_t connectedNodeCount = 0;
@@ -1197,7 +1197,7 @@ void GraphController::bundleNodesAndEdgesMatching(
}
std::shared_ptr<DummyNode> GraphController::bundleNodesMatching(
std::list<std::shared_ptr<DummyNode>>& nodes, std::function<bool(const DummyNode*)> matcher, const std::string& name
std::list<std::shared_ptr<DummyNode>>& nodes, std::function<bool(const DummyNode*)> matcher, const std::wstring& name
){
std::vector<std::list<std::shared_ptr<DummyNode>>::iterator> matchedNodes;
for (std::list<std::shared_ptr<DummyNode>>::iterator it = nodes.begin(); it != nodes.end(); it++)
@@ -1435,7 +1435,7 @@ void GraphController::layoutNestingRecursive(DummyNode* node) const
size_t maxNameSize = 50;
if (!node->active && node->name.size() > maxNameSize)
{
node->name = node->name.substr(0, maxNameSize - 3) + "...";
node->name = node->name.substr(0, maxNameSize - 3) + L"...";
}
width = margins.charWidth * node->name.size();
@@ -94,9 +94,9 @@ private:
void bundleNodes();
void bundleNodesAndEdgesMatching(
std::function<bool(const DummyNode::BundleInfo&, const Node*)> matcher, size_t count, bool countConnectedNodes,
const std::string& name);
const std::wstring& name);
std::shared_ptr<DummyNode> bundleNodesMatching(
std::list<std::shared_ptr<DummyNode>>& nodes, std::function<bool(const DummyNode*)> matcher, const std::string& name);
std::list<std::shared_ptr<DummyNode>>& nodes, std::function<bool(const DummyNode*)> matcher, const std::wstring& name);
std::shared_ptr<DummyNode> bundleByType(
std::list<std::shared_ptr<DummyNode>>& nodes,
const NodeType& type,
@@ -50,7 +50,7 @@ void SearchController::handleMessage(MessageActivateTokens* message)
for (const NameHierarchy& name : message->tokenNames)
{
matches.push_back(SearchMatch(name.getQualifiedName()));
matches.push_back(SearchMatch(utility::encodeToUtf8(name.getQualifiedName())));
}
if (!matches.size())
@@ -352,7 +352,7 @@ public:
// GraphNode
const Node* data;
std::string name;
std::wstring name;
bool active;
bool connected;
@@ -84,7 +84,7 @@ void ListLayouter::layoutList(std::vector<std::shared_ptr<DummyNode>>& nodes)
}
else if (textNode->name.size() == 1)
{
textNode->name += "..";
textNode->name += L"..";
}
nodes.insert(nodes.begin() + i, textNode);
@@ -273,7 +273,7 @@ void TrailLayouter::addVirtualNodes()
{
std::shared_ptr<TrailNode> virtualNode = std::make_shared<TrailNode>();
virtualNode->id = 0;
virtualNode->name = "<virtual>";
virtualNode->name = L"<virtual>";
virtualNode->dummyNode = nullptr;
virtualNode->level = i;
@@ -626,7 +626,7 @@ void TrailLayouter::print()
{
std::cout << node->id << "\t" << node->level << "\t";
std::cout << node->incomingEdges.size() << "\t" << node->outgoingEdges.size() << "\t";
std::cout << node->name << std::endl;
std::wcout << node->name << std::endl;
}
}
std::cout << std::endl;
@@ -635,7 +635,7 @@ void TrailLayouter::print()
{
if (edge->origin->id || edge->target->id)
{
std::cout << edge->id << "\t" << edge->origin->name << "\t" << edge->target->name << std::endl;
std::wcout << edge->id << L"\t" << edge->origin->name << L"\t" << edge->target->name << std::endl;
}
}
std::cout << std::endl;
@@ -35,7 +35,7 @@ private:
{
Id id;
int level;
std::string name;
std::wstring name;
Vec2i pos;
Vec2i size;
+1 -1
View File
@@ -28,7 +28,7 @@ public:
virtual void displayBookmarkEditor(
std::shared_ptr<Bookmark> bookmark, const std::vector<BookmarkCategory>& categories) = 0;
virtual void displayBookmarkCreator(
const std::vector<std::string>& names, const std::vector<BookmarkCategory>& categories, Id nodeId) = 0;
const std::vector<std::wstring>& names, const std::vector<BookmarkCategory>& categories, Id nodeId) = 0;
virtual void enableDisplayBookmarks(bool enable) = 0;
virtual bool bookmarkBrowserIsVisible() const = 0;
+1 -1
View File
@@ -31,7 +31,7 @@ void DialogView::startIndexingDialog(
}
void DialogView::updateIndexingDialog(
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, std::string sourcePath)
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const FilePath& sourcePath)
{
}
+1 -1
View File
@@ -25,7 +25,7 @@ public:
virtual void startIndexingDialog(
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info);
virtual void updateIndexingDialog(
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, std::string sourcePath);
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const FilePath& sourcePath);
virtual void finishedIndexingDialog(
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
float time, ErrorCountInfo errorInfo, bool interrupted);
+5 -6
View File
@@ -1,12 +1,11 @@
#include "component/view/GraphViewStyle.h"
#include "utility/logging/logging.h"
#include "utility/ResourcePaths.h"
#include "component/view/GraphViewStyleImpl.h"
#include "settings/ApplicationSettings.h"
#include "settings/ColorScheme.h"
#include "utility/logging/logging.h"
#include "utility/ResourcePaths.h"
#include "utility/utilityString.h"
int GraphViewStyle::s_gridCellSize = 5;
int GraphViewStyle::s_gridCellPadding = 10;
@@ -540,7 +539,7 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(
style.originOffset.y = -1;
style.targetOffset.y = 1;
style.color = getEdgeColor(Edge::getUnderscoredTypeString(type), isActive || isFocused);
style.color = getEdgeColor(utility::encodeToUtf8(Edge::getUnderscoredTypeString(type)), isActive || isFocused);
switch (type)
{
@@ -564,7 +563,7 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(
{
style.width = 3;
style.color = ColorScheme::getInstance()->getColor(
"graph/edge/" + Edge::getUnderscoredTypeString(type) + "/trail_focus", style.color);
"graph/edge/" + utility::encodeToUtf8(Edge::getUnderscoredTypeString(type)) + "/trail_focus", style.color);
}
break;
case Edge::EDGE_USAGE:
+26 -16
View File
@@ -181,41 +181,41 @@ Tree<NodeType::BundleInfo> NodeType::getOverviewBundleTree() const
switch (m_type)
{
case NodeType::NODE_FILE:
return Tree<BundleInfo>(BundleInfo("Files"));
return Tree<BundleInfo>(BundleInfo(L"Files"));
case NodeType::NODE_MACRO:
return Tree<BundleInfo>(BundleInfo("Macros"));
return Tree<BundleInfo>(BundleInfo(L"Macros"));
case NodeType::NODE_NAMESPACE:
{
Tree<BundleInfo> tree(BundleInfo("Namespaces"));
Tree<BundleInfo> tree(BundleInfo(L"Namespaces"));
tree.children.push_back(Tree<BundleInfo>(BundleInfo(
[](const std::string& nodeName)
[](const std::wstring& nodeName)
{
return nodeName.find("anonymous namespace") != std::string::npos;
return nodeName.find(L"anonymous namespace") != std::wstring::npos;
},
"Anonymous Namespaces")
L"Anonymous Namespaces")
));
return tree;
}
case NodeType::NODE_PACKAGE:
return Tree<BundleInfo>(BundleInfo("Packages"));
return Tree<BundleInfo>(BundleInfo(L"Packages"));
case NodeType::NODE_CLASS:
return Tree<BundleInfo>(BundleInfo("Classes"));
return Tree<BundleInfo>(BundleInfo(L"Classes"));
case NodeType::NODE_INTERFACE:
return Tree<BundleInfo>(BundleInfo("Interfaces"));
return Tree<BundleInfo>(BundleInfo(L"Interfaces"));
case NodeType::NODE_STRUCT:
return Tree<BundleInfo>(BundleInfo("Structs"));
return Tree<BundleInfo>(BundleInfo(L"Structs"));
case NodeType::NODE_FUNCTION:
return Tree<BundleInfo>(BundleInfo("Functions"));
return Tree<BundleInfo>(BundleInfo(L"Functions"));
case NodeType::NODE_GLOBAL_VARIABLE:
return Tree<BundleInfo>(BundleInfo("Global Variables"));
return Tree<BundleInfo>(BundleInfo(L"Global Variables"));
case NodeType::NODE_TYPE:
return Tree<BundleInfo>(BundleInfo("Types"));
return Tree<BundleInfo>(BundleInfo(L"Types"));
case NodeType::NODE_TYPEDEF:
return Tree<BundleInfo>(BundleInfo("Typedefs"));
return Tree<BundleInfo>(BundleInfo(L"Typedefs"));
case NodeType::NODE_ENUM:
return Tree<BundleInfo>(BundleInfo("Enums"));
return Tree<BundleInfo>(BundleInfo(L"Enums"));
case NodeType::NODE_UNION:
return Tree<BundleInfo>(BundleInfo("Unions"));
return Tree<BundleInfo>(BundleInfo(L"Unions"));
default:
break;
}
@@ -306,6 +306,16 @@ std::string NodeType::getReadableTypeString() const
return utility::getReadableTypeString(m_type);
}
std::wstring NodeType::getUnderscoredTypeWString() const
{
return utility::decodeFromUtf8(getUnderscoredTypeString());
}
std::wstring NodeType::getReadableTypeWString() const
{
return utility::decodeFromUtf8(getReadableTypeString());
}
int utility::nodeTypeToInt(NodeType::Type type)
{
return type;
+7 -5
View File
@@ -56,12 +56,12 @@ public:
BundleInfo()
{}
BundleInfo(std::string bundleName)
: nameMatcher([](const std::string&) { return true; })
BundleInfo(std::wstring bundleName)
: nameMatcher([](const std::wstring&) { return true; })
, bundleName(bundleName)
{}
BundleInfo(std::function<bool(std::string)> nameMatcher, std::string bundleName)
BundleInfo(std::function<bool(std::wstring)> nameMatcher, std::wstring bundleName)
: nameMatcher(nameMatcher)
, bundleName(bundleName)
{}
@@ -71,8 +71,8 @@ public:
return bundleName.size() > 0;
}
std::function<bool(const std::string&)> nameMatcher = nullptr;
std::string bundleName;
std::function<bool(const std::wstring&)> nameMatcher = nullptr;
std::wstring bundleName;
};
static std::vector<NodeType> getOverviewBundleNodeTypesOrdered();
@@ -107,6 +107,8 @@ public:
bool hasOverviewBundle() const;
std::string getUnderscoredTypeString() const;
std::string getReadableTypeString() const;
std::wstring getUnderscoredTypeWString() const;
std::wstring getReadableTypeWString() const;
private:
Type m_type;
+2 -2
View File
@@ -88,10 +88,10 @@ public:
// todo: remove bookmark related methods from storage access
virtual Id addNodeBookmark(const NodeBookmark& bookmark) = 0;
virtual Id addEdgeBookmark(const EdgeBookmark& bookmark) = 0;
virtual Id addBookmarkCategory(const std::string& categoryName) = 0;
virtual Id addBookmarkCategory(const std::wstring& categoryName) = 0;
virtual void updateBookmark(
const Id bookmarkId, const std::string& name, const std::string& comment, const std::string& categoryName) = 0;
const Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& categoryName) = 0;
virtual void removeBookmark(const Id id) = 0;
virtual void removeBookmarkCategory(const Id id) = 0;
+2 -2
View File
@@ -362,7 +362,7 @@ Id StorageAccessProxy::addEdgeBookmark(const EdgeBookmark& bookmark)
return -1;
}
Id StorageAccessProxy::addBookmarkCategory(const std::string& categoryName)
Id StorageAccessProxy::addBookmarkCategory(const std::wstring& categoryName)
{
if (hasSubject())
{
@@ -372,7 +372,7 @@ Id StorageAccessProxy::addBookmarkCategory(const std::string& categoryName)
return -1;
}
void StorageAccessProxy::updateBookmark(const Id bookmarkId, const std::string& name, const std::string& comment, const std::string& categoryName)
void StorageAccessProxy::updateBookmark(const Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& categoryName)
{
if (hasSubject())
{
+2 -2
View File
@@ -73,10 +73,10 @@ public:
// TODO: remove these from access because it's not a getter!
virtual Id addNodeBookmark(const NodeBookmark& bookmark) override;
virtual Id addEdgeBookmark(const EdgeBookmark& bookmark) override;
virtual Id addBookmarkCategory(const std::string& categoryName) override;
virtual Id addBookmarkCategory(const std::wstring& categoryName) override;
virtual void updateBookmark(
const Id bookmarkId, const std::string& name, const std::string& comment, const std::string& categoryName) override;
const Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& categoryName) override;
virtual void removeBookmark(const Id id) override;
virtual void removeBookmarkCategory(const Id id) override;
// END TODO
+5 -5
View File
@@ -1,6 +1,6 @@
#include "Bookmark.h"
Bookmark::Bookmark(const Id id, const std::string& name, const std::string& comment, const TimeStamp& timeStamp, const BookmarkCategory& category)
Bookmark::Bookmark(const Id id, const std::wstring& name, const std::wstring& comment, const TimeStamp& timeStamp, const BookmarkCategory& category)
: m_id(id)
, m_name(name)
, m_comment(comment)
@@ -24,22 +24,22 @@ void Bookmark::setId(const Id id)
m_id = id;
}
std::string Bookmark::getName() const
std::wstring Bookmark::getName() const
{
return m_name;
}
void Bookmark::setName(const std::string& name)
void Bookmark::setName(const std::wstring& name)
{
m_name = name;
}
std::string Bookmark::getComment() const
std::wstring Bookmark::getComment() const
{
return m_comment;
}
void Bookmark::setComment(const std::string& comment)
void Bookmark::setComment(const std::wstring& comment)
{
m_comment = comment;
}
+7 -7
View File
@@ -29,17 +29,17 @@ public:
ORDER_NAME_DESCENDING
};
Bookmark(const Id id, const std::string& name, const std::string& comment, const TimeStamp& timeStamp, const BookmarkCategory& category);
Bookmark(const Id id, const std::wstring& name, const std::wstring& comment, const TimeStamp& timeStamp, const BookmarkCategory& category);
virtual ~Bookmark();
Id getId() const;
void setId(const Id id);
std::string getName() const;
void setName(const std::string& name);
std::wstring getName() const;
void setName(const std::wstring& name);
std::string getComment() const;
void setComment(const std::string& comment);
std::wstring getComment() const;
void setComment(const std::wstring& comment);
TimeStamp getTimeStamp() const;
void setTimeStamp(const TimeStamp& timeStamp);
@@ -52,8 +52,8 @@ public:
private:
Id m_id;
std::string m_name;
std::string m_comment;
std::wstring m_name;
std::wstring m_comment;
TimeStamp m_timeStamp;
BookmarkCategory m_category;
bool m_isValid;
+4 -4
View File
@@ -2,11 +2,11 @@
BookmarkCategory::BookmarkCategory()
: m_id(-1)
, m_name("")
, m_name(L"")
{
}
BookmarkCategory::BookmarkCategory(const Id id, const std::string& name)
BookmarkCategory::BookmarkCategory(const Id id, const std::wstring& name)
: m_id(id)
, m_name(name)
{
@@ -26,12 +26,12 @@ void BookmarkCategory::setId(const Id id)
m_id = id;
}
std::string BookmarkCategory::getName() const
std::wstring BookmarkCategory::getName() const
{
return m_name;
}
void BookmarkCategory::setName(const std::string& name)
void BookmarkCategory::setName(const std::wstring& name)
{
m_name = name;
}
+4 -4
View File
@@ -9,18 +9,18 @@ class BookmarkCategory
{
public:
BookmarkCategory();
BookmarkCategory(const Id id, const std::string& name);
BookmarkCategory(const Id id, const std::wstring& name);
~BookmarkCategory();
Id getId() const;
void setId(const Id id);
std::string getName() const;
void setName(const std::string& name);
std::wstring getName() const;
void setName(const std::wstring& name);
private:
Id m_id;
std::string m_name;
std::wstring m_name;
};
#endif // BOOKMARK_CATEGORY_H
+1 -1
View File
@@ -1,7 +1,7 @@
#include "EdgeBookmark.h"
EdgeBookmark::EdgeBookmark(
const Id id, const std::string& name, const std::string& comment,
const Id id, const std::wstring& name, const std::wstring& comment,
const TimeStamp& timeStamp, const BookmarkCategory& category
)
: Bookmark(id, name, comment, timeStamp, category)
+1 -1
View File
@@ -7,7 +7,7 @@ class EdgeBookmark
: public Bookmark
{
public:
EdgeBookmark(const Id id, const std::string& name, const std::string& comment,
EdgeBookmark(const Id id, const std::wstring& name, const std::wstring& comment,
const TimeStamp& timeStamp, const BookmarkCategory& category);
virtual ~EdgeBookmark();
+1 -1
View File
@@ -1,6 +1,6 @@
#include "NodeBookmark.h"
NodeBookmark::NodeBookmark(const Id id, const std::string& name, const std::string& comment,
NodeBookmark::NodeBookmark(const Id id, const std::wstring& name, const std::wstring& comment,
const TimeStamp& timeStamp, const BookmarkCategory& category
)
: Bookmark(id, name, comment, timeStamp, category)
+1 -1
View File
@@ -7,7 +7,7 @@ class NodeBookmark
: public Bookmark
{
public:
NodeBookmark(const Id id, const std::string& name, const std::string& comment,
NodeBookmark(const Id id, const std::wstring& name, const std::wstring& comment,
const TimeStamp& timeStamp, const BookmarkCategory& category);
virtual ~NodeBookmark();
+32 -32
View File
@@ -104,9 +104,9 @@ Node* Edge::getTo() const
return m_to;
}
std::string Edge::getName() const
std::wstring Edge::getName() const
{
return getReadableTypeString() + ":" + getFrom()->getFullName() + "->" + getTo()->getFullName();
return getReadableTypeString() + L":" + getFrom()->getFullName() + L"->" + getTo()->getFullName();
}
bool Edge::isNode() const
@@ -123,11 +123,11 @@ void Edge::addComponentAggregation(std::shared_ptr<TokenComponentAggregation> co
{
if (getComponent<TokenComponentAggregation>())
{
LOG_ERROR("TokenComponentAggregation has been set before!");
LOG_ERROR(L"TokenComponentAggregation has been set before!");
}
else if (m_type != EDGE_AGGREGATION)
{
LOG_ERROR("TokenComponentAggregation can't be set on edge of type: " + getReadableTypeString());
LOG_ERROR(L"TokenComponentAggregation can't be set on edge of type: " + getReadableTypeString());
}
else
{
@@ -139,11 +139,11 @@ void Edge::addComponentInheritanceChain(std::shared_ptr<TokenComponentInheritanc
{
if (getComponent<TokenComponentInheritanceChain>())
{
LOG_ERROR("TokenComponentInheritanceChain has been set before!");
LOG_ERROR(L"TokenComponentInheritanceChain has been set before!");
}
else if (m_type != EDGE_INHERITANCE)
{
LOG_ERROR("TokenComponentInheritanceChain can't be set on edge of type: " + getReadableTypeString());
LOG_ERROR(L"TokenComponentInheritanceChain can't be set on edge of type: " + getReadableTypeString());
}
else
{
@@ -151,72 +151,72 @@ void Edge::addComponentInheritanceChain(std::shared_ptr<TokenComponentInheritanc
}
}
std::string Edge::getUnderscoredTypeString(EdgeType type)
std::wstring Edge::getUnderscoredTypeString(EdgeType type)
{
return utility::replace(utility::replace(getReadableTypeString(type), "-", "_"), " ", "_");
return utility::replace(utility::replace(getReadableTypeString(type), L"-", L"_"), L" ", L"_");
}
std::string Edge::getReadableTypeString(EdgeType type)
std::wstring Edge::getReadableTypeString(EdgeType type)
{
switch (type)
{
case EDGE_UNDEFINED:
return "undefined";
return L"undefined";
case EDGE_MEMBER:
return "child";
return L"child";
case EDGE_TYPE_USAGE:
return "type use";
return L"type use";
case EDGE_USAGE:
return "use";
return L"use";
case EDGE_CALL:
return "call";
return L"call";
case EDGE_INHERITANCE:
return "inheritance";
return L"inheritance";
case EDGE_OVERRIDE:
return "override";
return L"override";
case EDGE_TEMPLATE_ARGUMENT:
return "template argument";
return L"template argument";
case EDGE_TYPE_ARGUMENT:
return "type argument";
return L"type argument";
case EDGE_TEMPLATE_DEFAULT_ARGUMENT:
return "template default argument";
return L"template default argument";
case EDGE_TEMPLATE_SPECIALIZATION:
return "template specialization";
return L"template specialization";
case EDGE_TEMPLATE_MEMBER_SPECIALIZATION:
return "template member specialization";
return L"template member specialization";
case EDGE_INCLUDE:
return "include";
return L"include";
case EDGE_IMPORT:
return "import";
return L"import";
case EDGE_AGGREGATION:
return "aggregation";
return L"aggregation";
case EDGE_MACRO_USAGE:
return "macro use";
return L"macro use";
}
return "";
return L"";
}
std::string Edge::getReadableTypeString() const
std::wstring Edge::getReadableTypeString() const
{
return getReadableTypeString(m_type);
}
std::string Edge::getAsString() const
std::wstring Edge::getAsString() const
{
std::stringstream str;
str << "[" << getId() << "] " << getReadableTypeString() << ": \"" << m_from->getName() << "\" -> \"" + m_to->getName() << "\"";
std::wstringstream str;
str << L"[" << getId() << L"] " << getReadableTypeString() << L": \"" << m_from->getName() << L"\" -> \"" + m_to->getName() << L"\"";
TokenComponentAggregation* aggregation = getComponent<TokenComponentAggregation>();
if (aggregation)
{
str << " " << aggregation->getAggregationCount();
str << L" " << aggregation->getAggregationCount();
}
return str.str();
}
std::ostream& operator<<(std::ostream& ostream, const Edge& edge)
std::wostream& operator<<(std::wostream& ostream, const Edge& edge)
{
ostream << edge.getAsString();
return ostream;
+8 -8
View File
@@ -48,21 +48,21 @@ public:
Node* getFrom() const;
Node* getTo() const;
std::string getName() const;
std::wstring getName() const;
// Token implementation
virtual bool isNode() const;
virtual bool isEdge() const;
virtual bool isNode() const override;
virtual bool isEdge() const override;
// Component setters
void addComponentAggregation(std::shared_ptr<TokenComponentAggregation> component);
void addComponentInheritanceChain(std::shared_ptr<TokenComponentInheritanceChain> component);
static std::string getUnderscoredTypeString(EdgeType type);
static std::string getReadableTypeString(EdgeType type);
static std::wstring getUnderscoredTypeString(EdgeType type);
static std::wstring getReadableTypeString(EdgeType type);
// Logging.
virtual std::string getReadableTypeString() const;
std::string getAsString() const;
virtual std::wstring getReadableTypeString() const override;
std::wstring getAsString() const;
private:
void operator=(const Node&);
@@ -75,6 +75,6 @@ private:
Node* const m_to;
};
std::ostream& operator<<(std::ostream& ostream, const Edge& edge);
std::wostream& operator<<(std::wostream& ostream, const Edge& edge);
#endif // EDGE_H
+13 -13
View File
@@ -306,45 +306,45 @@ void Graph::setHasTrailOrigin(bool hasOrigin)
m_hasTrailOrigin = hasOrigin;
}
void Graph::print(std::ostream& ostream) const
void Graph::print(std::wostream& ostream) const
{
ostream << "Graph:\n";
ostream << "nodes (" << getNodeCount() << ")\n";
ostream << L"Graph:\n";
ostream << L"nodes (" << getNodeCount() << L")\n";
forEachNode(
[&ostream](Node* n)
{
ostream << *n << '\n';
ostream << *n << L'\n';
}
);
ostream << "edges (" << getEdgeCount() << ")\n";
ostream << L"edges (" << getEdgeCount() << L")\n";
forEachEdge(
[&ostream](Edge* e)
{
ostream << *e << '\n';
ostream << *e << L'\n';
}
);
}
void Graph::printBasic(std::ostream& ostream) const
void Graph::printBasic(std::wostream& ostream) const
{
ostream << getNodeCount() << " nodes:";
ostream << getNodeCount() << L" nodes:";
forEachNode(
[&ostream](Node* n)
{
ostream << ' ' << n->getReadableTypeString() << ':' << n->getFullName();
ostream << L' ' << n->getReadableTypeString() << L':' << n->getFullName();
}
);
ostream << '\n';
ostream << getEdgeCount() << " edges:";
ostream << getEdgeCount() << L" edges:";
forEachEdge(
[&ostream](Edge* e)
{
ostream << ' ' << e->getName();
ostream << L' ' << e->getName();
}
);
ostream << '\n';
ostream << L'\n';
}
void Graph::removeEdgeInternal(Edge* edge)
@@ -357,7 +357,7 @@ void Graph::removeEdgeInternal(Edge* edge)
}
}
std::ostream& operator<<(std::ostream& ostream, const Graph& graph)
std::wostream& operator<<(std::wostream& ostream, const Graph& graph)
{
graph.print(ostream);
return ostream;
+3 -3
View File
@@ -62,8 +62,8 @@ public:
bool hasTrailOrigin() const;
void setHasTrailOrigin(bool hasOrigin);
void print(std::ostream& ostream) const;
void printBasic(std::ostream& ostream) const;
void print(std::wostream& ostream) const;
void printBasic(std::wostream& ostream) const;
private:
Graph(const Graph&);
@@ -78,6 +78,6 @@ private:
bool m_hasTrailOrigin;
};
std::ostream& operator<<(std::ostream& ostream, const Graph& graph);
std::wostream& operator<<(std::wostream& ostream, const Graph& graph);
#endif // GRAPH_H
+12 -12
View File
@@ -47,7 +47,7 @@ void Node::setType(NodeType type)
if (!isType(type.getType() | NodeType::NODE_SYMBOL))
{
LOG_WARNING(
"Cannot change NodeType after it was already set from " + getReadableTypeString() + " to " + type.getReadableTypeString()
L"Cannot change NodeType after it was already set from " + getReadableTypeString() + L" to " + type.getReadableTypeWString()
);
return;
}
@@ -59,12 +59,12 @@ bool Node::isType(NodeType::TypeMask mask) const
return (m_type.getType() & mask) > 0;
}
std::string Node::getName() const
std::wstring Node::getName() const
{
return m_nameHierarchy.getRawName();
}
std::string Node::getFullName() const
std::wstring Node::getFullName() const
{
return m_nameHierarchy.getQualifiedName();
}
@@ -353,36 +353,36 @@ void Node::addComponentAccess(std::shared_ptr<TokenComponentAccess> component)
}
}
std::string Node::getReadableTypeString() const
std::wstring Node::getReadableTypeString() const
{
return m_type.getReadableTypeString();
return m_type.getReadableTypeWString();
}
std::string Node::getAsString() const
std::wstring Node::getAsString() const
{
std::stringstream str;
str << "[" << getId() << "] " << getReadableTypeString() << ": " << "\"" << getName() << "\"";
std::wstringstream str;
str << L"[" << getId() << L"] " << getReadableTypeString() << L": " << L"\"" << getName() << L"\"";
TokenComponentAccess* access = getComponent<TokenComponentAccess>();
if (access)
{
str << " " << access->getAccessString();
str << L" " << access->getAccessString();
}
if (getComponent<TokenComponentStatic>())
{
str << " static";
str << L" static";
}
if (getComponent<TokenComponentConst>())
{
str << " const";
str << L" const";
}
return str.str();
}
std::ostream& operator<<(std::ostream& ostream, const Node& node)
std::wostream& operator<<(std::wostream& ostream, const Node& node)
{
ostream << node.getAsString();
return ostream;
+7 -7
View File
@@ -30,8 +30,8 @@ public:
void setType(NodeType type);
bool isType(NodeType::TypeMask mask) const;
std::string getName() const;
std::string getFullName() const;
std::wstring getName() const;
std::wstring getFullName() const;
NameHierarchy getNameHierarchy() const;
bool isDefined() const;
@@ -66,8 +66,8 @@ public:
void forEachNodeRecursive(std::function<void(const Node*)> func) const;
// Token implementation.
virtual bool isNode() const;
virtual bool isEdge() const;
virtual bool isNode() const override;
virtual bool isEdge() const override;
// Component setters.
void addComponentAbstraction(std::shared_ptr<TokenComponentAbstraction> component);
@@ -77,8 +77,8 @@ public:
void addComponentAccess(std::shared_ptr<TokenComponentAccess> component);
// Logging.
virtual std::string getReadableTypeString() const;
std::string getAsString() const;
virtual std::wstring getReadableTypeString() const override;
std::wstring getAsString() const;
private:
void operator=(const Node&);
@@ -94,6 +94,6 @@ private:
size_t m_childCount;
};
std::ostream& operator<<(std::ostream& ostream, const Node& node);
std::wostream& operator<<(std::wostream& ostream, const Node& node);
#endif // NODE_H
+1 -1
View File
@@ -30,7 +30,7 @@ public:
std::shared_ptr<ComponentType> removeComponent();
// Logging.
virtual std::string getReadableTypeString() const = 0;
virtual std::wstring getReadableTypeString() const = 0;
protected:
Token(const Token& other);
@@ -1,25 +1,25 @@
#include "data/graph/token_component/TokenComponentAccess.h"
std::string TokenComponentAccess::getAccessString(AccessKind access)
std::wstring TokenComponentAccess::getAccessString(AccessKind access)
{
switch (access)
{
case ACCESS_NONE:
break;
case ACCESS_PUBLIC:
return "public";
return L"public";
case ACCESS_PROTECTED:
return "protected";
return L"protected";
case ACCESS_PRIVATE:
return "private";
return L"private";
case ACCESS_DEFAULT:
return "default";
return L"default";
case ACCESS_TEMPLATE_PARAMETER:
return "template parameter";
return L"template parameter";
case ACCESS_TYPE_PARAMETER:
return "type parameter";
return L"type parameter";
}
return "";
return L"";
}
@@ -42,7 +42,7 @@ AccessKind TokenComponentAccess::getAccess() const
return m_access;
}
std::string TokenComponentAccess::getAccessString() const
std::wstring TokenComponentAccess::getAccessString() const
{
return getAccessString(m_access);
}
@@ -10,7 +10,7 @@ class TokenComponentAccess
: public TokenComponent
{
public:
static std::string getAccessString(AccessKind access);
static std::wstring getAccessString(AccessKind access);
TokenComponentAccess(AccessKind access);
virtual ~TokenComponentAccess();
@@ -18,7 +18,7 @@ public:
virtual std::shared_ptr<TokenComponent> copy() const;
AccessKind getAccess() const;
std::string getAccessString() const;
std::wstring getAccessString() const;
private:
const AccessKind m_access;
+4 -4
View File
@@ -142,9 +142,9 @@ void TaskBuildIndex::doExit(std::shared_ptr<Blackboard> blackboard)
for (const FilePath& path : crashedFiles)
{
is->addError(StorageErrorData(
"The translation unit threw an exception during indexing. Please check if the source file "
L"The translation unit threw an exception during indexing. Please check if the source file "
"conforms to the specified language standard and all necessary options are defined within your project "
"setup.", path, 1, 1, true, true
"setup.", path.wstr(), 1, 1, true, true
));
LOG_INFO_STREAM(<< "crashed translation unit: " << path.str());
}
@@ -290,7 +290,7 @@ void TaskBuildIndex::updateIndexingDialog(
blackboard->get("indexed_source_file_count", indexedSourceFileCount);
}
if (sourcePaths.size())
if (!sourcePaths.empty())
{
std::vector<std::wstring> stati;
for (const FilePath& path : sourcePaths)
@@ -302,6 +302,6 @@ void TaskBuildIndex::updateIndexingDialog(
}
Application::getInstance()->getDialogView()->updateIndexingDialog(
m_indexingFileCount, indexedSourceFileCount, sourceFileCount, (sourcePaths.size() ? sourcePaths.back().str() : "")
m_indexingFileCount, indexedSourceFileCount, sourceFileCount, (sourcePaths.empty() ? FilePath() : sourcePaths.back())
);
}
@@ -25,13 +25,13 @@ void InterprocessIndexer::work()
{
try
{
LOG_INFO_STREAM(<< m_processId << " starting up indexer");
LOG_INFO(std::to_wstring(m_processId) + L" starting up indexer");
std::shared_ptr<IndexerBase> indexer = IndexerFactory::getInstance()->createCompositeIndexerForAllRegisteredModules();
while (std::shared_ptr<IndexerCommand> indexerCommand = m_interprocessIndexerCommandManager.popIndexerCommand())
{
LOG_INFO_STREAM(<< m_processId << " fetched indexer command for \"" << indexerCommand->getSourceFilePath().str() << "\"");
LOG_INFO_STREAM(<< m_processId << " indexer commands left: " << (m_interprocessIndexerCommandManager.indexerCommandCount() + 1));
LOG_INFO(std::to_wstring(m_processId) + L" fetched indexer command for \"" + indexerCommand->getSourceFilePath().wstr() + L"\"");
LOG_INFO(std::to_wstring(m_processId) + L" indexer commands left: " + std::to_wstring(m_interprocessIndexerCommandManager.indexerCommandCount() + 1));
while (true)
{
@@ -1,6 +1,7 @@
#include "InterprocessIndexingStatusManager.h"
#include "utility/logging/logging.h"
#include "utility/utilityString.h"
const char* InterprocessIndexingStatusManager::s_sharedMemoryNamePrefix = "ists_";
@@ -28,7 +29,7 @@ void InterprocessIndexingStatusManager::startIndexingSourceFile(const FilePath&
if (indexingFilesPtr)
{
SharedMemory::String fileStr(access.getAllocator());
fileStr = filePath.str().c_str();
fileStr = utility::encodeToUtf8(filePath.wstr()).c_str();
indexingFilesPtr->push_back(fileStr);
}
@@ -71,7 +72,7 @@ void InterprocessIndexingStatusManager::startIndexingSourceFile(const FilePath&
}
SharedMemory::String str(access.getAllocator());
str = filePath.str().c_str();
str = utility::encodeToUtf8(filePath.wstr()).c_str();
it = currentFilesPtr->insert(std::pair<Id, SharedMemory::String>(getProcessId(), str)).first;
it->second = str;
@@ -125,7 +126,7 @@ std::vector<FilePath> InterprocessIndexingStatusManager::getCurrentlyIndexedSour
{
while (indexingFilesPtr->size())
{
indexingFiles.push_back(FilePath(indexingFilesPtr->front().c_str()));
indexingFiles.push_back(FilePath(utility::decodeFromUtf8(indexingFilesPtr->front().c_str())));
indexingFilesPtr->pop_front();
}
}
@@ -146,7 +147,7 @@ std::vector<FilePath> InterprocessIndexingStatusManager::getCrashedSourceFilePat
{
for (size_t i = 0; i < crashedFilesPtr->size(); i++)
{
crashedFiles.push_back(FilePath(crashedFilesPtr->at(i).c_str()));
crashedFiles.push_back(FilePath(utility::decodeFromUtf8(crashedFilesPtr->at(i).c_str())));
}
}
@@ -156,7 +157,7 @@ std::vector<FilePath> InterprocessIndexingStatusManager::getCrashedSourceFilePat
{
for (SharedMemory::Map<Id, SharedMemory::String>::iterator it = currentFilesPtr->begin(); it != currentFilesPtr->end(); it++)
{
crashedFiles.push_back(FilePath(it->second.c_str()));
crashedFiles.push_back(FilePath(utility::decodeFromUtf8(it->second.c_str())));
}
}
@@ -178,7 +179,7 @@ std::set<FilePath> InterprocessIndexingStatusManager::getIndexedFiles()
for (auto& file : *files)
{
result.insert(FilePath(file.c_str()));
result.insert(FilePath(utility::decodeFromUtf8(file.c_str())));
}
return result;
@@ -206,9 +207,9 @@ void InterprocessIndexingStatusManager::addIndexedFiles(std::set<FilePath> fileP
std::set<std::string> newFiles;
for (const FilePath& filePath : filePaths)
{
if (oldFiles.find(filePath.str()) == oldFiles.end())
if (oldFiles.find(utility::encodeToUtf8(filePath.wstr())) == oldFiles.end())
{
newFiles.insert(filePath.str());
newFiles.insert(utility::encodeToUtf8(filePath.wstr()));
}
}
@@ -5,6 +5,7 @@
#include "data/indexer/IndexerCommandJava.h"
#include "utility/logging/logging.h"
#include "utility/utilityString.h"
void SharedIndexerCommand::fromLocal(IndexerCommand* indexerCommand)
{
@@ -118,12 +119,12 @@ SharedIndexerCommand::~SharedIndexerCommand()
FilePath SharedIndexerCommand::getSourceFilePath() const
{
return FilePath(m_sourceFilePath.c_str());
return FilePath(utility::decodeFromUtf8(m_sourceFilePath.c_str()));
}
void SharedIndexerCommand::setSourceFilePath(const FilePath& filePath)
{
m_sourceFilePath = filePath.str().c_str();
m_sourceFilePath = utility::encodeToUtf8(filePath.wstr()).c_str();
}
std::set<FilePath> SharedIndexerCommand::getIndexedPaths() const
@@ -132,7 +133,7 @@ std::set<FilePath> SharedIndexerCommand::getIndexedPaths() const
for (unsigned int i = 0; i < m_indexedPaths.size(); i++)
{
result.insert(FilePath(m_indexedPaths[i].c_str()));
result.insert(FilePath(utility::decodeFromUtf8(m_indexedPaths[i].c_str())));
}
return result;
@@ -142,10 +143,10 @@ void SharedIndexerCommand::setIndexedPaths(const std::set<FilePath>& indexedPath
{
m_indexedPaths.clear();
for (std::set<FilePath>::iterator it = indexedPaths.begin(); it != indexedPaths.end(); it++)
for (const FilePath& indexedPath: indexedPaths)
{
SharedMemory::String path(m_indexedPaths.get_allocator());
path = (*it).str().c_str();
path = utility::encodeToUtf8(indexedPath.wstr()).c_str();
m_indexedPaths.push_back(path);
}
}
@@ -156,7 +157,7 @@ std::set<FilePath> SharedIndexerCommand::getExcludedPaths() const
for (unsigned int i = 0; i < m_excludedPaths.size(); i++)
{
result.insert(FilePath(m_excludedPaths[i].c_str()));
result.insert(FilePath(utility::decodeFromUtf8(m_excludedPaths[i].c_str())));
}
return result;
@@ -166,22 +167,22 @@ void SharedIndexerCommand::setExcludedPaths(const std::set<FilePath>& excludedPa
{
m_excludedPaths.clear();
for (std::set<FilePath>::iterator it = excludedPaths.begin(); it != excludedPaths.end(); it++)
for (const FilePath& excludedPath : excludedPaths)
{
SharedMemory::String path(m_excludedPaths.get_allocator());
path = (*it).str().c_str();
path = utility::encodeToUtf8(excludedPath.wstr()).c_str();
m_excludedPaths.push_back(path);
}
}
FilePath SharedIndexerCommand::getWorkingDirectory() const
{
return FilePath(m_workingDirectory.c_str());
return FilePath(utility::decodeFromUtf8(m_workingDirectory.c_str()));
}
void SharedIndexerCommand::setWorkingDirectory(const FilePath& workingDirectory)
{
m_workingDirectory = workingDirectory.str().c_str();
m_workingDirectory = utility::encodeToUtf8(workingDirectory.wstr()).c_str();
}
std::string SharedIndexerCommand::getLanguageStandard() const
@@ -212,10 +213,10 @@ void SharedIndexerCommand::setCompilerFlags(const std::vector<std::string>& comp
m_compilerFlags.clear();
m_compilerFlags.reserve(compilerFlags.size());
for (unsigned int i = 0; i < compilerFlags.size(); i++)
for (const std::string& compilerFlag : compilerFlags)
{
SharedMemory::String path(m_compilerFlags.get_allocator());
path = compilerFlags[i].c_str();
path = compilerFlag.c_str();
m_compilerFlags.push_back(path);
}
}
@@ -227,7 +228,7 @@ std::vector<FilePath> SharedIndexerCommand::getSystemHeaderSearchPaths() const
for (unsigned int i = 0; i < m_systemHeaderSearchPaths.size(); i++)
{
result.push_back(FilePath(m_systemHeaderSearchPaths[i].c_str()));
result.push_back(FilePath(utility::decodeFromUtf8(m_systemHeaderSearchPaths[i].c_str())));
}
return result;
@@ -238,10 +239,10 @@ void SharedIndexerCommand::setSystemHeaderSearchPaths(const std::vector<FilePath
m_systemHeaderSearchPaths.clear();
m_systemHeaderSearchPaths.reserve(filePaths.size());
for (unsigned int i = 0; i < filePaths.size(); i++)
for (const FilePath& filePath : filePaths)
{
SharedMemory::String path(m_systemHeaderSearchPaths.get_allocator());
path = filePaths[i].str().c_str();
path = utility::encodeToUtf8(filePath.wstr()).c_str();
m_systemHeaderSearchPaths.push_back(path);
}
}
@@ -253,7 +254,7 @@ std::vector<FilePath> SharedIndexerCommand::getFrameworkSearchhPaths() const
for (unsigned int i = 0; i < m_frameworkSearchPaths.size(); i++)
{
result.push_back(FilePath(m_frameworkSearchPaths[i].c_str()));
result.push_back(FilePath(utility::decodeFromUtf8(m_frameworkSearchPaths[i].c_str())));
}
return result;
@@ -264,10 +265,10 @@ void SharedIndexerCommand::setFrameworkSearchhPaths(const std::vector<FilePath>&
m_frameworkSearchPaths.clear();
m_frameworkSearchPaths.reserve(searchPaths.size());
for (unsigned int i = 0; i < searchPaths.size(); i++)
for (const FilePath& searchPath : searchPaths)
{
SharedMemory::String path(m_frameworkSearchPaths.get_allocator());
path = searchPaths[i].str().c_str();
path = utility::encodeToUtf8(searchPath.wstr()).c_str();
m_frameworkSearchPaths.push_back(path);
}
}
@@ -279,7 +280,7 @@ std::vector<FilePath> SharedIndexerCommand::getClassPaths() const
for (unsigned int i = 0; i < m_classPaths.size(); i++)
{
result.push_back(FilePath(m_classPaths[i].c_str()));
result.push_back(FilePath(utility::decodeFromUtf8(m_classPaths[i].c_str())));
}
return result;
@@ -290,10 +291,10 @@ void SharedIndexerCommand::setClassPaths(const std::vector<FilePath>& classPaths
m_classPaths.clear();
m_classPaths.reserve(classPaths.size());
for (unsigned int i = 0; i < classPaths.size(); i++)
for (const FilePath& classPath : classPaths)
{
SharedMemory::String path(m_classPaths.get_allocator());
path = classPaths[i].str().c_str();
path = utility::encodeToUtf8(classPath.wstr()).c_str();
m_classPaths.push_back(path);
}
}
@@ -13,6 +13,7 @@
#include "data/storage/type/StorageSymbol.h"
#include "utility/types.h"
#include "utility/interprocess/SharedMemory.h"
#include "utility/utilityString.h"
// macro creating SharedStorageType from StorageType
// - arguments: StorageType & SharedStorageType
@@ -54,12 +55,12 @@ struct SharedStorageNode
inline SharedStorageNode toShared(const StorageNode& node, SharedMemory::Allocator* allocator)
{
return SharedStorageNode(node.id, node.type, node.serializedName, allocator);
return SharedStorageNode(node.id, node.type, utility::encodeToUtf8(node.serializedName), allocator);
}
inline StorageNode fromShared(const SharedStorageNode& node)
{
return StorageNode(node.id, node.type, node.serializedName.c_str());
return StorageNode(node.id, node.type, utility::decodeFromUtf8(node.serializedName.c_str()));
}
@@ -82,12 +83,12 @@ struct SharedStorageFile
inline SharedStorageFile toShared(const StorageFile& file, SharedMemory::Allocator* allocator)
{
return SharedStorageFile(file.id, file.filePath, file.modificationTime, file.complete, allocator);
return SharedStorageFile(file.id, utility::encodeToUtf8(file.filePath), file.modificationTime, file.complete, allocator);
}
inline StorageFile fromShared(const SharedStorageFile& file)
{
return StorageFile(file.id, file.filePath.c_str(), file.modificationTime.c_str(), file.complete);
return StorageFile(file.id, utility::decodeFromUtf8(file.filePath.c_str()), file.modificationTime.c_str(), file.complete);
}
@@ -104,12 +105,12 @@ struct SharedStorageLocalSymbol
inline SharedStorageLocalSymbol toShared(const StorageLocalSymbol& symbol, SharedMemory::Allocator* allocator)
{
return SharedStorageLocalSymbol(symbol.id, symbol.name, allocator);
return SharedStorageLocalSymbol(symbol.id, utility::encodeToUtf8(symbol.name), allocator);
}
inline StorageLocalSymbol fromShared(const SharedStorageLocalSymbol& symbol)
{
return StorageLocalSymbol(symbol.id, symbol.name.c_str());
return StorageLocalSymbol(symbol.id, utility::decodeFromUtf8(symbol.name.c_str()));
}
@@ -145,15 +146,25 @@ struct SharedStorageErrorData
inline SharedStorageErrorData toShared(const StorageErrorData& error, SharedMemory::Allocator* allocator)
{
return SharedStorageErrorData(
error.message, error.filePath.str(),
error.lineNumber, error.columnNumber, error.fatal, error.indexed, allocator);
utility::encodeToUtf8(error.message),
utility::encodeToUtf8(error.filePath),
error.lineNumber,
error.columnNumber,
error.fatal,
error.indexed, allocator
);
}
inline StorageErrorData fromShared(const SharedStorageErrorData& error)
{
return StorageErrorData(
error.message.c_str(), FilePath(error.filePath.c_str()),
error.lineNumber, error.columnNumber, error.fatal, error.indexed);
utility::decodeFromUtf8(error.message.c_str()),
utility::decodeFromUtf8(error.filePath.c_str()),
error.lineNumber,
error.columnNumber,
error.fatal,
error.indexed
);
}
#endif // SHARED_STORAGE_TYPES_H
+8 -8
View File
@@ -2,23 +2,23 @@
#include <vector>
std::string nameDelimiterTypeToString(NameDelimiterType delimiter)
std::wstring nameDelimiterTypeToString(NameDelimiterType delimiter)
{
switch(delimiter)
{
case NAME_DELIMITER_FILE:
return "/";
return L"/";
case NAME_DELIMITER_CXX:
return "::";
return L"::";
case NAME_DELIMITER_JAVA:
return ".";
return L".";
default:
break;
}
return "@";
return L"@";
}
NameDelimiterType stringToNameDelimiterType(const std::string& s)
NameDelimiterType stringToNameDelimiterType(const std::wstring& s)
{
if (s == nameDelimiterTypeToString(NAME_DELIMITER_FILE))
{
@@ -35,13 +35,13 @@ NameDelimiterType stringToNameDelimiterType(const std::string& s)
return NAME_DELIMITER_UNKNOWN;
}
NameDelimiterType detectDelimiterType(const std::string& name)
NameDelimiterType detectDelimiterType(const std::wstring& name)
{
std::vector<NameDelimiterType> allDelimiters {NAME_DELIMITER_FILE, NAME_DELIMITER_CXX, NAME_DELIMITER_JAVA};
for (NameDelimiterType delimiter: allDelimiters)
{
if (name.find(nameDelimiterTypeToString(delimiter)) != std::string::npos)
if (name.find(nameDelimiterTypeToString(delimiter)) != std::wstring::npos)
{
return delimiter;
}
+3 -3
View File
@@ -11,9 +11,9 @@ enum NameDelimiterType
NAME_DELIMITER_JAVA
};
std::string nameDelimiterTypeToString(NameDelimiterType delimiter);
NameDelimiterType stringToNameDelimiterType(const std::string& s);
std::wstring nameDelimiterTypeToString(NameDelimiterType delimiter);
NameDelimiterType stringToNameDelimiterType(const std::wstring& s);
NameDelimiterType detectDelimiterType(const std::string& name);
NameDelimiterType detectDelimiterType(const std::wstring& name);
#endif // NAME_DELIMITER_TYPE_H
+18 -18
View File
@@ -3,51 +3,51 @@
#include "utility/logging/logging.h"
#include "utility/utilityString.h"
std::string NameElement::Signature::serialize(Signature signature)
std::wstring NameElement::Signature::serialize(Signature signature)
{
return signature.m_prefix + "\tp" + signature.m_postfix;
return signature.m_prefix + L"\tp" + signature.m_postfix;
}
NameElement::Signature NameElement::Signature::deserialize(const std::string& serialized)
NameElement::Signature NameElement::Signature::deserialize(const std::wstring& serialized)
{
if (serialized == "\tp")
if (serialized == L"\tp")
{
return Signature();
}
std::vector<std::string> serializedElements = utility::splitToVector(serialized, "\tp");
std::vector<std::wstring> serializedElements = utility::splitToVector(serialized, L"\tp");
if (serializedElements.size() != 2)
{
LOG_ERROR("unable to deserialize name signature: " + serialized); // todo: obfuscate serialized!
LOG_ERROR(L"unable to deserialize name signature: " + serialized); // todo: obfuscate serialized!
}
return Signature(serializedElements[0], serializedElements[1]);
}
NameElement::Signature::Signature()
: m_prefix("")
, m_postfix("")
: m_prefix(L"")
, m_postfix(L"")
{
}
NameElement::Signature::Signature(std::string prefix, std::string postfix)
NameElement::Signature::Signature(std::wstring prefix, std::wstring postfix)
: m_prefix(prefix)
, m_postfix(postfix)
{
}
std::string NameElement::Signature::qualifyName(const std::string& name) const
std::wstring NameElement::Signature::qualifyName(const std::wstring& name) const
{
if (!isValid())
{
return name;
}
std::string qualifiedName = m_prefix;
std::wstring qualifiedName = m_prefix;
if (!name.empty())
{
if (!m_prefix.empty())
{
qualifiedName += " ";
qualifiedName += L" ";
}
qualifiedName += name;
}
@@ -61,22 +61,22 @@ bool NameElement::Signature::isValid() const
return ((m_prefix + m_postfix).size() > 0);
}
const std::string& NameElement::Signature::getPrefix() const
const std::wstring& NameElement::Signature::getPrefix() const
{
return m_prefix;
}
const std::string& NameElement::Signature::getPostfix() const
const std::wstring& NameElement::Signature::getPostfix() const
{
return m_postfix;
}
NameElement::NameElement(const std::string& name)
NameElement::NameElement(const std::wstring& name)
: m_name(name)
{
}
NameElement::NameElement(const std::string& name, const Signature& signature)
NameElement::NameElement(const std::wstring& name, const Signature& signature)
: m_name(name)
, m_signature(signature)
{
@@ -86,12 +86,12 @@ NameElement::~NameElement()
{
}
std::string NameElement::getName() const
std::wstring NameElement::getName() const
{
return m_name;
}
std::string NameElement::getNameWithSignature() const
std::wstring NameElement::getNameWithSignature() const
{
return m_signature.qualifyName(m_name);
}
+13 -13
View File
@@ -13,33 +13,33 @@ public:
class Signature
{
public:
static std::string serialize(Signature signature);
static Signature deserialize(const std::string& serialized);
static std::wstring serialize(Signature signature);
static Signature deserialize(const std::wstring& serialized);
Signature();
Signature(std::string prefix, std::string postfix);
std::string qualifyName(const std::string& name) const;
Signature(std::wstring prefix, std::wstring postfix);
std::wstring qualifyName(const std::wstring& name) const;
bool isValid() const;
const std::string& getPrefix() const;
const std::string& getPostfix() const;
const std::wstring& getPrefix() const;
const std::wstring& getPostfix() const;
private:
std::string m_prefix;
std::string m_postfix;
std::wstring m_prefix;
std::wstring m_postfix;
};
NameElement(const std::string& name);
NameElement(const std::string& name, const Signature& signature);
NameElement(const std::wstring& name);
NameElement(const std::wstring& name, const Signature& signature);
~NameElement();
std::string getName() const;
std::string getNameWithSignature() const;
std::wstring getName() const;
std::wstring getNameWithSignature() const;
bool hasSignature() const;
Signature getSignature();
private:
std::string m_name;
std::wstring m_name;
Signature m_signature;
};
+21 -21
View File
@@ -3,40 +3,40 @@
#include "utility/logging/logging.h"
#include "utility/utilityString.h"
std::string NameHierarchy::serialize(const NameHierarchy& nameHierarchy)
std::wstring NameHierarchy::serialize(const NameHierarchy& nameHierarchy)
{
std::string serializedName = nameDelimiterTypeToString(nameHierarchy.getDelimiter()) + "\tm";
std::wstring serializedName = nameDelimiterTypeToString(nameHierarchy.getDelimiter()) + L"\tm";
for (size_t i = 0; i < nameHierarchy.size(); i++)
{
if (i > 0)
{
serializedName += "\tn";
serializedName += L"\tn";
}
serializedName += nameHierarchy[i]->getName() + "\ts";
serializedName += nameHierarchy[i]->getName() + L"\ts";
serializedName += NameElement::Signature::serialize(nameHierarchy[i]->getSignature());
}
return serializedName;
}
NameHierarchy NameHierarchy::deserialize(const std::string& serializedName)
NameHierarchy NameHierarchy::deserialize(const std::wstring& serializedName)
{
std::vector<std::string> serializedNameAndMetaElements = utility::splitToVector(serializedName, "\tm");
std::vector<std::wstring> serializedNameAndMetaElements = utility::splitToVector(serializedName, L"\tm");
if (serializedNameAndMetaElements.size() != 2)
{
LOG_ERROR("unable to deserialize name hierarchy: " + serializedName); // todo: obfuscate serializedName!
LOG_ERROR(L"unable to deserialize name hierarchy: " + serializedName); // todo: obfuscate serializedName!
return NameHierarchy(NAME_DELIMITER_UNKNOWN);
}
const NameDelimiterType delimiter = stringToNameDelimiterType(serializedNameAndMetaElements[0]);
NameHierarchy nameHierarchy(delimiter);
std::vector<std::string> serializedNameElements = utility::splitToVector(serializedNameAndMetaElements[1], "\tn");
std::vector<std::wstring> serializedNameElements = utility::splitToVector(serializedNameAndMetaElements[1], L"\tn");
for (size_t i = 0; i < serializedNameElements.size(); i++)
{
std::vector<std::string> nameParts = utility::splitToVector(serializedNameElements[i], "\ts");
std::vector<std::wstring> nameParts = utility::splitToVector(serializedNameElements[i], L"\ts");
if (nameParts.size() != 2)
{
LOG_ERROR("unable to deserialize name hierarchy: " + serializedName); // todo: obfuscate serializedName!
LOG_ERROR(L"unable to deserialize name hierarchy: " + serializedName); // todo: obfuscate serializedName!
return NameHierarchy(delimiter);
}
nameHierarchy.push(std::make_shared<NameElement>(nameParts[0], NameElement::Signature::deserialize(nameParts[1])));
@@ -60,16 +60,16 @@ NameHierarchy::NameHierarchy(const NameDelimiterType delimiter)
{
}
NameHierarchy::NameHierarchy(const std::string& name, const NameDelimiterType delimiter)
NameHierarchy::NameHierarchy(const std::wstring& name, const NameDelimiterType delimiter)
: m_delimiter(delimiter)
{
push(std::make_shared<NameElement>(name));
}
NameHierarchy::NameHierarchy(const std::vector<std::string>& names, const NameDelimiterType delimiter)
NameHierarchy::NameHierarchy(const std::vector<std::wstring>& names, const NameDelimiterType delimiter)
: m_delimiter(delimiter)
{
for (const std::string& name : names)
for (const std::wstring& name : names)
{
push(std::make_shared<NameElement>(name));
}
@@ -146,9 +146,9 @@ size_t NameHierarchy::size() const
return m_elements.size();
}
std::string NameHierarchy::getQualifiedName() const
std::wstring NameHierarchy::getQualifiedName() const
{
std::string name;
std::wstring name;
for (size_t i = 0; i < m_elements.size(); i++)
{
if (i > 0)
@@ -160,9 +160,9 @@ std::string NameHierarchy::getQualifiedName() const
return name;
}
std::string NameHierarchy::getQualifiedNameWithSignature() const
std::wstring NameHierarchy::getQualifiedNameWithSignature() const
{
std::string name = getQualifiedName();
std::wstring name = getQualifiedName();
if (m_elements.size())
{
name = m_elements.back()->getSignature().qualifyName(name); // todo: use separator for signature!
@@ -170,22 +170,22 @@ std::string NameHierarchy::getQualifiedNameWithSignature() const
return name;
}
std::string NameHierarchy::getRawName() const
std::wstring NameHierarchy::getRawName() const
{
if (m_elements.size())
{
return m_elements.back()->getName();
}
return "";
return L"";
}
std::string NameHierarchy::getRawNameWithSignature() const
std::wstring NameHierarchy::getRawNameWithSignature() const
{
if (m_elements.size())
{
return m_elements.back()->getNameWithSignature();
}
return "";
return L"";
}
bool NameHierarchy::hasSignature() const
+8 -8
View File
@@ -11,12 +11,12 @@
class NameHierarchy
{
public:
static std::string serialize(const NameHierarchy& nameHierarchy);
static NameHierarchy deserialize(const std::string& serializedName);
static std::wstring serialize(const NameHierarchy& nameHierarchy);
static NameHierarchy deserialize(const std::wstring& serializedName);
NameHierarchy(const NameDelimiterType delimiter);
NameHierarchy(const std::string& name, const NameDelimiterType delimiter);
NameHierarchy(const std::vector<std::string>& names, const NameDelimiterType delimiter);
NameHierarchy(const std::wstring& name, const NameDelimiterType delimiter);
NameHierarchy(const std::vector<std::wstring>& names, const NameDelimiterType delimiter);
NameHierarchy(const NameHierarchy& other);
NameHierarchy(NameHierarchy&& other);
~NameHierarchy();
@@ -36,10 +36,10 @@ public:
size_t size() const;
std::string getQualifiedName() const;
std::string getQualifiedNameWithSignature() const;
std::string getRawName() const;
std::string getRawNameWithSignature() const;
std::wstring getQualifiedName() const;
std::wstring getQualifiedNameWithSignature() const;
std::wstring getRawName() const;
std::wstring getRawNameWithSignature() const;
bool hasSignature() const;
NameElement::Signature getSignature() const;
+22 -22
View File
@@ -4,54 +4,54 @@
#include "data/parser/ParseLocation.h"
std::string ParserClient::addAccessPrefix(const std::string& str, AccessKind access)
std::wstring ParserClient::addAccessPrefix(const std::wstring& str, AccessKind access)
{
switch (access)
{
case ACCESS_PUBLIC:
return "public " + str;
return L"public " + str;
case ACCESS_PROTECTED:
return "protected " + str;
return L"protected " + str;
case ACCESS_PRIVATE:
return "private " + str;
return L"private " + str;
case ACCESS_DEFAULT:
return "default " + str;
return L"default " + str;
default:
break;
}
return str;
}
std::string ParserClient::addStaticPrefix(const std::string& str, bool isStatic)
std::wstring ParserClient::addStaticPrefix(const std::wstring& str, bool isStatic)
{
if (isStatic)
{
return "static " + str;
return L"static " + str;
}
return str;
}
std::string ParserClient::addConstPrefix(const std::string& str, bool isConst, bool atFront)
std::wstring ParserClient::addConstPrefix(const std::wstring& str, bool isConst, bool atFront)
{
if (isConst)
{
return atFront ? "const " + str : str + " const";
return atFront ? L"const " + str : str + L" const";
}
return str;
}
std::string ParserClient::addLocationSuffix(const std::string& str, const ParseLocation& location)
std::wstring ParserClient::addLocationSuffix(const std::wstring& str, const ParseLocation& location)
{
std::stringstream ss;
std::wstringstream ss;
ss << str;
ss << " <" << location.startLineNumber << ":" << location.startColumnNumber << " ";
ss << location.endLineNumber << ":" << location.endColumnNumber << ">";
ss << L" <" << location.startLineNumber << L":" << location.startColumnNumber << L" ";
ss << location.endLineNumber << L":" << location.endColumnNumber << L">";
return ss.str();
}
std::string ParserClient::addLocationSuffix(
const std::string& str, const ParseLocation& location, const ParseLocation& scopeLocation
){
std::wstring ParserClient::addLocationSuffix(
const std::wstring& str, const ParseLocation& location, const ParseLocation& scopeLocation
) {
if (!location.isValid())
{
return addLocationSuffix(str, scopeLocation);
@@ -61,12 +61,12 @@ std::string ParserClient::addLocationSuffix(
return addLocationSuffix(str, location);
}
std::stringstream ss;
std::wstringstream ss;
ss << str;
ss << " <" << scopeLocation.startLineNumber << ":" << scopeLocation.startColumnNumber;
ss << " <" << location.startLineNumber << ":" << location.startColumnNumber << " ";
ss << location.endLineNumber << ":" << location.endColumnNumber << "> ";
ss << scopeLocation.endLineNumber << ":" << scopeLocation.endColumnNumber << ">";
ss << L" <" << scopeLocation.startLineNumber << L":" << scopeLocation.startColumnNumber;
ss << L" <" << location.startLineNumber << L":" << location.startColumnNumber << L" ";
ss << location.endLineNumber << L":" << location.endColumnNumber << L"> ";
ss << scopeLocation.endLineNumber << L":" << scopeLocation.endColumnNumber << L">";
return ss.str();
}
@@ -80,7 +80,7 @@ ParserClient::~ParserClient()
}
void ParserClient::recordError(
const ParseLocation& location, const std::string& message, bool fatal, bool indexed)
const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed)
{
doRecordError(location, message, fatal, indexed);
+9 -9
View File
@@ -18,12 +18,12 @@ class DataType;
class ParserClient
{
public:
static std::string addAccessPrefix(const std::string& str, AccessKind access);
static std::string addStaticPrefix(const std::string& str, bool isStatic);
static std::string addConstPrefix(const std::string& str, bool isConst, bool atFront);
static std::string addLocationSuffix(const std::string& str, const ParseLocation& location);
static std::string addLocationSuffix(
const std::string& str, const ParseLocation& location, const ParseLocation& scopeLocation);
static std::wstring addAccessPrefix(const std::wstring& str, AccessKind access);
static std::wstring addStaticPrefix(const std::wstring& str, bool isStatic);
static std::wstring addConstPrefix(const std::wstring& str, bool isConst, bool atFront);
static std::wstring addLocationSuffix(const std::wstring& str, const ParseLocation& location);
static std::wstring addLocationSuffix(
const std::wstring& str, const ParseLocation& location, const ParseLocation& scopeLocation);
ParserClient();
virtual ~ParserClient();
@@ -50,9 +50,9 @@ public:
const NameHierarchy& qualifierName, const ParseLocation& location) = 0;
void recordError(
const ParseLocation& location, const std::string& message, bool fatal, bool indexed);
const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed);
virtual void recordLocalSymbol(const std::string& name, const ParseLocation& location) = 0;
virtual void recordLocalSymbol(const std::wstring& name, const ParseLocation& location) = 0;
virtual void recordFile(const FileInfo& fileInfo) = 0;
virtual void recordComment(const ParseLocation& location) = 0;
@@ -60,7 +60,7 @@ public:
protected:
virtual void doRecordError(
const ParseLocation& location, const std::string& message, bool fatal, bool indexed) = 0;
const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed) = 0;
bool m_hasFatalErrors;
};
+9 -9
View File
@@ -73,7 +73,7 @@ void ParserClientImpl::recordQualifierLocation(const NameHierarchy& qualifierNam
addSourceLocation(nodeId, location, locationTypeToInt(LOCATION_QUALIFIER));
}
void ParserClientImpl::recordLocalSymbol(const std::string& name, const ParseLocation& location)
void ParserClientImpl::recordLocalSymbol(const std::wstring& name, const ParseLocation& location)
{
const Id localSymbolId = addLocalSymbol(name);
addSourceLocation(localSymbolId, location, locationTypeToInt(LOCATION_LOCAL_SYMBOL));
@@ -81,7 +81,7 @@ void ParserClientImpl::recordLocalSymbol(const std::string& name, const ParseLoc
void ParserClientImpl::recordFile(const FileInfo& fileInfo)
{
const Id nodeId = addNodeHierarchy(NameHierarchy(fileInfo.path.str(), NAME_DELIMITER_FILE), NodeType::NODE_FILE);
const Id nodeId = addNodeHierarchy(NameHierarchy(fileInfo.path.wstr(), NAME_DELIMITER_FILE), NodeType::NODE_FILE);
addFile(nodeId, fileInfo.path, fileInfo.lastWriteTime.toString());
}
@@ -91,7 +91,7 @@ void ParserClientImpl::recordComment(const ParseLocation& location)
}
void ParserClientImpl::doRecordError(
const ParseLocation& location, const std::string& message, bool fatal, bool indexed)
const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed)
{
if (location.isValid())
{
@@ -232,7 +232,7 @@ void ParserClientImpl::addFile(Id id, const FilePath& filePath, const std::strin
return;
}
m_storage->addFile(StorageFile(id, filePath.str(), modificationTime, true));
m_storage->addFile(StorageFile(id, filePath.wstr(), modificationTime, true));
}
void ParserClientImpl::addSymbol(Id id, DefinitionKind definitionKind)
@@ -263,7 +263,7 @@ Id ParserClientImpl::addEdge(int type, Id sourceId, Id targetId)
return m_storage->addEdge(StorageEdgeData(type, sourceId, targetId));
}
Id ParserClientImpl::addLocalSymbol(const std::string& name)
Id ParserClientImpl::addLocalSymbol(const std::wstring& name)
{
if (!m_storage)
{
@@ -292,7 +292,7 @@ void ParserClientImpl::addSourceLocation(Id elementId, const ParseLocation& loca
}
Id sourceLocationId = m_storage->addSourceLocation(StorageSourceLocationData(
addNodeHierarchy(NameHierarchy(location.filePath.str(), NAME_DELIMITER_FILE), NodeType::NODE_FILE),
addNodeHierarchy(NameHierarchy(location.filePath.wstr(), NAME_DELIMITER_FILE), NodeType::NODE_FILE),
location.startLineNumber,
location.startColumnNumber,
location.endLineNumber,
@@ -324,7 +324,7 @@ void ParserClientImpl::addCommentLocation(const ParseLocation& location)
}
m_storage->addCommentLocation(StorageCommentLocationData(
addNodeHierarchy(NameHierarchy(location.filePath.str(), NAME_DELIMITER_FILE), NodeType::NODE_FILE),
addNodeHierarchy(NameHierarchy(location.filePath.wstr(), NAME_DELIMITER_FILE), NodeType::NODE_FILE),
location.startLineNumber,
location.startColumnNumber,
location.endLineNumber,
@@ -333,7 +333,7 @@ void ParserClientImpl::addCommentLocation(const ParseLocation& location)
}
void ParserClientImpl::addError(
const std::string& message, bool fatal, bool indexed, const ParseLocation& location)
const std::wstring& message, bool fatal, bool indexed, const ParseLocation& location)
{
if (!m_storage)
{
@@ -341,6 +341,6 @@ void ParserClientImpl::addError(
}
m_storage->addError(StorageErrorData(
message, location.filePath, location.startLineNumber, location.startColumnNumber, fatal, indexed
message, location.filePath.wstr(), location.startLineNumber, location.startColumnNumber, fatal, indexed
));
}
+4 -4
View File
@@ -39,13 +39,13 @@ public:
virtual void recordQualifierLocation(
const NameHierarchy& qualifierName, const ParseLocation& location) override;
virtual void recordLocalSymbol(const std::string& name, const ParseLocation& location) override;
virtual void recordLocalSymbol(const std::wstring& name, const ParseLocation& location) override;
virtual void recordFile(const FileInfo& fileInfo) override;
virtual void recordComment(const ParseLocation& location) override;
private:
virtual void doRecordError(
const ParseLocation& location, const std::string& message, bool fatal, bool indexed) override;
const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed) override;
NodeType symbolKindToNodeType(SymbolKind symbolType) const;
Edge::EdgeType referenceKindToEdgeType(ReferenceKind referenceKind) const;
@@ -56,11 +56,11 @@ private:
void addFile(Id id, const FilePath& filePath, const std::string& modificationTime);
void addSymbol(Id id, DefinitionKind definitionKind);
Id addEdge(int type, Id sourceId, Id targetId);
Id addLocalSymbol(const std::string& name);
Id addLocalSymbol(const std::wstring& name);
void addSourceLocation(Id elementId, const ParseLocation& location, int type);
void addComponentAccess(Id nodeId , int type);
void addCommentLocation(const ParseLocation& location);
void addError(const std::string& message, bool fatal, bool indexed,
void addError(const std::wstring& message, bool fatal, bool indexed,
const ParseLocation& location);
std::shared_ptr<IntermediateStorage> m_storage;
+1 -1
View File
@@ -22,7 +22,7 @@ void TaskParseWrapper::doEnter(std::shared_ptr<Blackboard> blackboard)
if (std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView())
{
dialogView->hideDialogs(false);
dialogView->updateIndexingDialog(0, 0, sourceFileCount, "");
dialogView->updateIndexingDialog(0, 0, sourceFileCount, FilePath());
}
m_start = utility::durationStart();
+48 -50
View File
@@ -42,7 +42,7 @@ size_t IntermediateStorage::getByteSize(size_t stringSize) const
for (const StorageErrorData& storageError: getErrors())
{
byteSize += sizeof(StorageErrorData);
byteSize += stringSize + storageError.filePath.str().size();
byteSize += stringSize + storageError.filePath.size();
byteSize += stringSize + storageError.message.size();
}
@@ -83,10 +83,10 @@ void IntermediateStorage::setAllFilesIncomplete()
void IntermediateStorage::setFilesWithErrorsIncomplete()
{
std::set<std::string> errorFileNames;
std::set<std::wstring> errorFileNames;
for (const StorageErrorData& error : m_errors)
{
errorFileNames.insert(error.filePath.str());
errorFileNames.insert(error.filePath);
}
for (StorageFile& file : m_files)
@@ -100,9 +100,8 @@ void IntermediateStorage::setFilesWithErrorsIncomplete()
Id IntermediateStorage::addNode(const StorageNodeData& nodeData)
{
const std::string serialized = serialize(nodeData);
std::unordered_map<std::string, size_t>::iterator it = m_nodesIndex.find(serialized);
const std::wstring serialized = serialize(nodeData);
std::unordered_map<std::wstring, size_t>::iterator it = m_nodesIndex.find(serialized);
if (it != m_nodesIndex.end())
{
StorageNode& storedNode = m_nodes[it->second];
@@ -126,20 +125,19 @@ void IntermediateStorage::addSymbol(const StorageSymbol& symbol)
void IntermediateStorage::addFile(const StorageFile& file)
{
const std::string serialized = serialize(file);
const std::wstring serialized = serialize(file);
if (m_serializedFiles.find(serialized) == m_serializedFiles.end())
{
m_files.push_back(file);
m_serializedFiles.insert(serialized);
}
}
Id IntermediateStorage::addEdge(const StorageEdgeData& edgeData)
{
const std::string serialized = serialize(edgeData);
std::unordered_map<std::string, size_t>::const_iterator it = m_edgesIndex.find(serialized);
const std::wstring serialized = serialize(edgeData);
std::unordered_map<std::wstring, size_t>::const_iterator it = m_edgesIndex.find(serialized);
if (it != m_edgesIndex.end())
{
return m_edges[it->second].id;
@@ -154,8 +152,8 @@ Id IntermediateStorage::addEdge(const StorageEdgeData& edgeData)
Id IntermediateStorage::addLocalSymbol(const StorageLocalSymbolData& localSymbolData)
{
const std::string serialized = serialize(localSymbolData);
std::unordered_map<std::string, StorageLocalSymbol>::const_iterator it = m_localSymbols.find(serialized);
const std::wstring serialized = serialize(localSymbolData);
std::unordered_map<std::wstring, StorageLocalSymbol>::const_iterator it = m_localSymbols.find(serialized);
if (it != m_localSymbols.end())
{
return it->second.id;
@@ -168,8 +166,8 @@ Id IntermediateStorage::addLocalSymbol(const StorageLocalSymbolData& localSymbol
Id IntermediateStorage::addSourceLocation(const StorageSourceLocationData& sourceLocationData)
{
const std::string serialized = serialize(sourceLocationData);
std::unordered_map<std::string, StorageSourceLocation>::const_iterator it = m_sourceLocations.find(serialized);
const std::wstring serialized = serialize(sourceLocationData);
std::unordered_map<std::wstring, StorageSourceLocation>::const_iterator it = m_sourceLocations.find(serialized);
if (it != m_sourceLocations.end())
{
return it->second.id;
@@ -182,7 +180,7 @@ Id IntermediateStorage::addSourceLocation(const StorageSourceLocationData& sourc
void IntermediateStorage::addOccurrence(const StorageOccurrence& occurrence)
{
const std::string serialized = serialize(occurrence);
const std::wstring serialized = serialize(occurrence);
if (m_serializedOccurrences.find(serialized) == m_serializedOccurrences.end())
{
@@ -193,7 +191,7 @@ void IntermediateStorage::addOccurrence(const StorageOccurrence& occurrence)
void IntermediateStorage::addComponentAccess(const StorageComponentAccessData& componentAccessData)
{
const std::string serialized = serialize(componentAccessData);
const std::wstring serialized = serialize(componentAccessData);
if (m_serializedComponentAccesses.find(serialized) == m_serializedComponentAccesses.end())
{
@@ -204,7 +202,7 @@ void IntermediateStorage::addComponentAccess(const StorageComponentAccessData& c
void IntermediateStorage::addCommentLocation(const StorageCommentLocationData& commentLocationData)
{
const std::string serialized = serialize(commentLocationData);
const std::wstring serialized = serialize(commentLocationData);
if (m_serializedCommentLocations.find(serialized) == m_serializedCommentLocations.end())
{
@@ -215,7 +213,7 @@ void IntermediateStorage::addCommentLocation(const StorageCommentLocationData& c
void IntermediateStorage::addError(const StorageErrorData& errorData)
{
const std::string serialized = serialize(errorData);
const std::wstring serialized = serialize(errorData);
if (m_serializedErrors.find(serialized) == m_serializedErrors.end())
{
@@ -258,7 +256,7 @@ void IntermediateStorage::forEachEdge(std::function<void(const StorageEdge& /*da
void IntermediateStorage::forEachLocalSymbol(std::function<void(const StorageLocalSymbol& /*data*/)> callback) const
{
for (std::unordered_map<std::string, StorageLocalSymbol>::const_iterator it = m_localSymbols.begin();
for (std::unordered_map<std::wstring, StorageLocalSymbol>::const_iterator it = m_localSymbols.begin();
it != m_localSymbols.end(); it++)
{
callback(it->second);
@@ -267,7 +265,7 @@ void IntermediateStorage::forEachLocalSymbol(std::function<void(const StorageLoc
void IntermediateStorage::forEachSourceLocation(std::function<void(const StorageSourceLocation& /*data*/)> callback) const
{
for (std::unordered_map<std::string, StorageSourceLocation>::const_iterator it = m_sourceLocations.begin();
for (std::unordered_map<std::wstring, StorageSourceLocation>::const_iterator it = m_sourceLocations.begin();
it != m_sourceLocations.end(); it++)
{
callback(it->second);
@@ -448,73 +446,73 @@ void IntermediateStorage::setNextId(const Id nextId)
m_nextId = nextId;
}
std::string IntermediateStorage::serialize(const StorageNodeData& nodeData) const
std::wstring IntermediateStorage::serialize(const StorageNodeData& nodeData) const
{
return nodeData.serializedName;
}
std::string IntermediateStorage::serialize(const StorageFile& file) const
std::wstring IntermediateStorage::serialize(const StorageFile& file) const
{
return file.filePath;
}
std::string IntermediateStorage::serialize(const StorageEdgeData& edgeData) const
std::wstring IntermediateStorage::serialize(const StorageEdgeData& edgeData) const
{
return (
std::to_string(edgeData.type) + ";" +
std::to_string(edgeData.sourceNodeId) + ";" +
std::to_string(edgeData.targetNodeId)
std::to_wstring(edgeData.type) + L";" +
std::to_wstring(edgeData.sourceNodeId) + L";" +
std::to_wstring(edgeData.targetNodeId)
);
}
std::string IntermediateStorage::serialize(const StorageLocalSymbolData& localSymbolData) const
std::wstring IntermediateStorage::serialize(const StorageLocalSymbolData& localSymbolData) const
{
return localSymbolData.name;
}
std::string IntermediateStorage::serialize(const StorageSourceLocationData& sourceLocationData) const
std::wstring IntermediateStorage::serialize(const StorageSourceLocationData& sourceLocationData) const
{
return (
std::to_string(sourceLocationData.fileNodeId) + ";" +
std::to_string(sourceLocationData.startLine) + ";" +
std::to_string(sourceLocationData.startCol) + ";" +
std::to_string(sourceLocationData.endLine) + ";" +
std::to_string(sourceLocationData.endCol) + ";" +
std::to_string(sourceLocationData.type)
std::to_wstring(sourceLocationData.fileNodeId) + L";" +
std::to_wstring(sourceLocationData.startLine) + L";" +
std::to_wstring(sourceLocationData.startCol) + L";" +
std::to_wstring(sourceLocationData.endLine) + L";" +
std::to_wstring(sourceLocationData.endCol) + L";" +
std::to_wstring(sourceLocationData.type)
);
}
std::string IntermediateStorage::serialize(const StorageOccurrence& occurrence) const
std::wstring IntermediateStorage::serialize(const StorageOccurrence& occurrence) const
{
return std::to_string(occurrence.elementId) + ";" + std::to_string(occurrence.sourceLocationId);
return std::to_wstring(occurrence.elementId) + L";" + std::to_wstring(occurrence.sourceLocationId);
}
std::string IntermediateStorage::serialize(const StorageComponentAccessData& componentAccessData) const
std::wstring IntermediateStorage::serialize(const StorageComponentAccessData& componentAccessData) const
{
return std::to_string(componentAccessData.nodeId);
return std::to_wstring(componentAccessData.nodeId);
}
std::string IntermediateStorage::serialize(const StorageCommentLocationData& commentLocationData) const
std::wstring IntermediateStorage::serialize(const StorageCommentLocationData& commentLocationData) const
{
return (
std::to_string(commentLocationData.fileNodeId) + ";" +
std::to_string(commentLocationData.startLine) + ";" +
std::to_string(commentLocationData.startCol) + ";" +
std::to_string(commentLocationData.endLine) + ";" +
std::to_string(commentLocationData.endCol)
std::to_wstring(commentLocationData.fileNodeId) + L";" +
std::to_wstring(commentLocationData.startLine) + L";" +
std::to_wstring(commentLocationData.startCol) + L";" +
std::to_wstring(commentLocationData.endLine) + L";" +
std::to_wstring(commentLocationData.endCol)
);
}
std::string IntermediateStorage::serialize(const StorageErrorData& errorData) const
std::wstring IntermediateStorage::serialize(const StorageErrorData& errorData) const
{
return (
errorData.message + ";" +
std::to_string(errorData.fatal) + ";" +
errorData.filePath.str() + ";" +
std::to_string(errorData.lineNumber) + ";" +
std::to_string(errorData.columnNumber)
errorData.message + L";" +
std::to_wstring(errorData.fatal) + L";" +
errorData.filePath + L";" +
std::to_wstring(errorData.lineNumber) + L";" +
std::to_wstring(errorData.columnNumber)
);
}
+18 -18
View File
@@ -83,41 +83,41 @@ public:
void setNextId(const Id nextId);
private:
std::string serialize(const StorageNodeData& nodeData) const;
std::string serialize(const StorageFile& file) const;
std::string serialize(const StorageEdgeData& edgeData) const;
std::string serialize(const StorageLocalSymbolData& localSymbolData) const;
std::string serialize(const StorageSourceLocationData& sourceLocationData) const;
std::string serialize(const StorageOccurrence& occurrence) const;
std::string serialize(const StorageComponentAccessData& componentAccessData) const;
std::string serialize(const StorageCommentLocationData& commentLocationData) const;
std::string serialize(const StorageErrorData& errorData) const;
std::wstring serialize(const StorageNodeData& nodeData) const;
std::wstring serialize(const StorageFile& file) const;
std::wstring serialize(const StorageEdgeData& edgeData) const;
std::wstring serialize(const StorageLocalSymbolData& localSymbolData) const;
std::wstring serialize(const StorageSourceLocationData& sourceLocationData) const;
std::wstring serialize(const StorageOccurrence& occurrence) const;
std::wstring serialize(const StorageComponentAccessData& componentAccessData) const;
std::wstring serialize(const StorageCommentLocationData& commentLocationData) const;
std::wstring serialize(const StorageErrorData& errorData) const;
std::unordered_map<std::string, size_t> m_nodesIndex;
std::unordered_map<std::wstring, size_t> m_nodesIndex;
std::vector<StorageNode> m_nodes;
std::unordered_set<std::string> m_serializedFiles; // this is used to prevent duplicates (unique)
std::unordered_set<std::wstring> m_serializedFiles; // this is used to prevent duplicates (unique)
std::vector<StorageFile> m_files;
std::vector<StorageSymbol> m_symbols;
std::unordered_map<std::string, size_t> m_edgesIndex;
std::unordered_map<std::wstring, size_t> m_edgesIndex;
std::vector<StorageEdge> m_edges;
std::unordered_map<std::string, StorageLocalSymbol> m_localSymbols;
std::unordered_map<std::wstring, StorageLocalSymbol> m_localSymbols;
std::unordered_map<std::string, StorageSourceLocation> m_sourceLocations;
std::unordered_map<std::wstring, StorageSourceLocation> m_sourceLocations;
std::unordered_set<std::string> m_serializedOccurrences; // this is used to prevent duplicates (unique)
std::unordered_set<std::wstring> m_serializedOccurrences; // this is used to prevent duplicates (unique)
std::vector<StorageOccurrence> m_occurrences;
std::unordered_set<std::string> m_serializedComponentAccesses; // this is used to prevent duplicates (unique)
std::unordered_set<std::wstring> m_serializedComponentAccesses; // this is used to prevent duplicates (unique)
std::vector<StorageComponentAccessData> m_componentAccesses;
std::unordered_set<std::string> m_serializedCommentLocations; // this is used to prevent duplicates (unique)
std::unordered_set<std::wstring> m_serializedCommentLocations; // this is used to prevent duplicates (unique)
std::vector<StorageCommentLocationData> m_commentLocations;
std::unordered_set<std::string> m_serializedErrors; // this is used to prevent duplicates (unique)
std::unordered_set<std::wstring> m_serializedErrors; // this is used to prevent duplicates (unique)
std::vector<StorageErrorData> m_errors;
Id m_nextId;
+25 -25
View File
@@ -402,7 +402,7 @@ void PersistentStorage::optimizeMemory()
Id PersistentStorage::getNodeIdForFileNode(const FilePath& filePath) const
{
return m_sqliteIndexStorage.getFileByPath(filePath.str()).id;
return m_sqliteIndexStorage.getFileByPath(filePath.wstr()).id;
}
Id PersistentStorage::getNodeIdForNameHierarchy(const NameHierarchy& nameHierarchy) const
@@ -657,11 +657,11 @@ std::vector<SearchMatch> PersistentStorage::getAutocompletionSymbolMatches(
match.text = result.text;
NameHierarchy name = NameHierarchy::deserialize(firstNode->serializedName);
if (name.getQualifiedName() == match.name)
if (utility::encodeToUtf8(name.getQualifiedName()) == match.name)
{
const size_t idx = m_hierarchyCache.getIndexOfLastVisibleParentNode(firstNode->id);
match.text = name.getRange(idx, name.size()).getQualifiedName();
match.subtext = name.getRange(0, idx).getQualifiedName();
match.text = utility::encodeToUtf8(name.getRange(idx, name.size()).getQualifiedName());
match.subtext = utility::encodeToUtf8(name.getRange(0, idx).getQualifiedName());
}
match.delimiter = name.getDelimiter();
@@ -786,8 +786,8 @@ std::vector<SearchMatch> PersistentStorage::getSearchMatchesForTokenIds(const st
SearchMatch match;
const NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName);
match.name = nameHierarchy.getQualifiedName();
match.text = nameHierarchy.getRawName();
match.name = utility::encodeToUtf8(nameHierarchy.getQualifiedName());
match.text = utility::encodeToUtf8(nameHierarchy.getRawName());
match.tokenIds.push_back(elementId);
match.nodeType = utility::intToType(node.type);
@@ -1364,12 +1364,12 @@ std::shared_ptr<TextAccess> PersistentStorage::getFileContent(const FilePath& fi
{
TRACE();
return m_sqliteIndexStorage.getFileContentByPath(filePath.str());
return m_sqliteIndexStorage.getFileContentByPath(filePath.wstr());
}
FileInfo PersistentStorage::getFileInfoForFilePath(const FilePath& filePath) const
{
return FileInfo(filePath, m_sqliteIndexStorage.getFileByPath(filePath.str()).modificationTime);
return FileInfo(filePath, m_sqliteIndexStorage.getFileByPath(filePath.wstr()).modificationTime);
}
std::vector<FileInfo> PersistentStorage::getFileInfosForFilePaths(const std::vector<FilePath>& filePaths) const
@@ -1477,7 +1477,7 @@ std::shared_ptr<SourceLocationCollection> PersistentStorage::getErrorSourceLocat
LOCATION_ERROR,
locationId,
std::vector<Id>(1, error.id),
error.filePath,
FilePath(error.filePath),
error.lineNumber,
error.columnNumber,
error.lineNumber,
@@ -1534,7 +1534,7 @@ Id PersistentStorage::addEdgeBookmark(const EdgeBookmark& bookmark)
return id;
}
Id PersistentStorage::addBookmarkCategory(const std::string& name)
Id PersistentStorage::addBookmarkCategory(const std::wstring& name)
{
if (name.empty())
{
@@ -1550,7 +1550,7 @@ Id PersistentStorage::addBookmarkCategory(const std::string& name)
}
void PersistentStorage::updateBookmark(
const Id bookmarkId, const std::string& name, const std::string& comment, const std::string& categoryName)
const Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& categoryName)
{
const Id categoryId = addBookmarkCategory(categoryName); // only creates category if id didn't exist before;
m_sqliteBookmarkStorage.updateBookmark(bookmarkId, name, comment, categoryId);
@@ -1621,8 +1621,8 @@ std::vector<EdgeBookmark> PersistentStorage::getAllEdgeBookmarks() const
std::vector<EdgeBookmark> edgeBookmarks;
UnorderedCache<std::string, Id> nodeIdCache(
[&](const std::string& serializedNodeName)
UnorderedCache<std::wstring, Id> nodeIdCache(
[&](const std::wstring& serializedNodeName)
{
return m_sqliteIndexStorage.getNodeBySerializedName(serializedNodeName).id;
}
@@ -1767,16 +1767,16 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
const NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName);
TooltipSnippet snippet;
snippet.code = nameHierarchy.getQualifiedNameWithSignature();
snippet.code = utility::encodeToUtf8(nameHierarchy.getQualifiedNameWithSignature());
snippet.locationFile = std::make_shared<SourceLocationFile>(
FilePath(nameHierarchy.getDelimiter() == NAME_DELIMITER_JAVA ? "main.java" : "main.cpp"), true, true);
FilePath(nameHierarchy.getDelimiter() == NAME_DELIMITER_JAVA ? L"main.java" : L"main.cpp"), true, true);
if (nameHierarchy.hasSignature())
{
snippet.code = utility::breakSignature(
nameHierarchy.getSignature().getPrefix(),
nameHierarchy.getQualifiedName(),
nameHierarchy.getSignature().getPostfix(),
utility::encodeToUtf8(nameHierarchy.getSignature().getPrefix()),
utility::encodeToUtf8(nameHierarchy.getQualifiedName()),
utility::encodeToUtf8(nameHierarchy.getSignature().getPostfix()),
50,
ApplicationSettings::getInstance()->getCodeTabWidth()
);
@@ -1802,11 +1802,11 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
}
);
typeNames.insert(std::make_pair(nameHierarchy.getQualifiedName(), node.id));
typeNames.insert(std::make_pair(utility::encodeToUtf8(nameHierarchy.getQualifiedName()), node.id));
for (const auto& typeNode : m_sqliteIndexStorage.getAllByIds<StorageNode>(typeNodeIds))
{
typeNames.insert(std::make_pair(
NameHierarchy::deserialize(typeNode.serializedName).getQualifiedName(),
utility::encodeToUtf8(NameHierarchy::deserialize(typeNode.serializedName).getQualifiedName()),
typeNode.id
));
}
@@ -1866,7 +1866,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForSourceLocationIdsAndLocalSymbolI
return info;
}
if (locationIds.size())
if (!locationIds.empty())
{
const std::vector<Id> nodeIds = getNodeIdsForLocationIds(locationIds);
@@ -1875,7 +1875,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForSourceLocationIdsAndLocalSymbolI
TooltipSnippet snippet;
const NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName);
snippet.code = nameHierarchy.getQualifiedName();
snippet.code = utility::encodeToUtf8(nameHierarchy.getQualifiedName());
snippet.locationFile = std::make_shared<SourceLocationFile>(
FilePath(nameHierarchy.getDelimiter() == NAME_DELIMITER_JAVA ? "main.java" : "main.cpp"), true, true);
@@ -1896,7 +1896,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForSourceLocationIdsAndLocalSymbolI
TooltipSnippet snippet;
snippet.code = "local symbol";
snippet.locationFile = std::make_shared<SourceLocationFile>(FilePath("main.cpp"), true, true);
snippet.locationFile = std::make_shared<SourceLocationFile>(FilePath(L"main.cpp"), true, true);
snippet.locationFile->addSourceLocation(
LOCATION_LOCAL_SYMBOL, 0, std::vector<Id>(1, id), 1, 1, 1, snippet.code.size());
@@ -2182,7 +2182,7 @@ void PersistentStorage::addNodesToGraph(const std::vector<Id>& newNodeIds, Graph
Node* node = graph->createNode(
storageNode.id,
type,
NameHierarchy(filePath.fileName(), NAME_DELIMITER_FILE),
NameHierarchy(filePath.wFileName(), NAME_DELIMITER_FILE),
defined
);
node->addComponentFilePath(std::make_shared<TokenComponentFilePath>(filePath));
@@ -2558,7 +2558,7 @@ void PersistentStorage::buildSearchIndex()
const NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName);
// we don't use the signature here, so elements with the same signature share the same node.
std::string name = nameHierarchy.getQualifiedName();
std::string name = utility::encodeToUtf8(nameHierarchy.getQualifiedName());
// replace template arguments with .. to avoid clutter in search results and have different
// template specializations share the same node.
+2 -2
View File
@@ -129,9 +129,9 @@ public:
virtual Id addNodeBookmark(const NodeBookmark& bookmark) override;
virtual Id addEdgeBookmark(const EdgeBookmark& bookmark) override;
virtual Id addBookmarkCategory(const std::string& categoryName) override;
virtual Id addBookmarkCategory(const std::wstring& categoryName) override;
virtual void updateBookmark(const Id bookmarkId, const std::string& name, const std::string& comment, const std::string& categoryName) override;
virtual void updateBookmark(const Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& categoryName) override;
virtual void removeBookmark(const Id id) override;
virtual void removeBookmarkCategory(const Id id) override;
@@ -4,6 +4,7 @@
#include "data/storage/migration/SqliteStorageMigrator.h"
#include "settings/ProjectSettings.h"
#include "utility/logging/logging.h"
#include "utility/utilityString.h"
#include "Application.h"
const size_t SqliteBookmarkStorage::s_storageVersion = 2;
@@ -51,7 +52,7 @@ StorageBookmarkCategory SqliteBookmarkStorage::addBookmarkCategory(const Storage
"VALUES (NULL, ?);";
CppSQLite3Statement stmt = m_database.compileStatement(statement.c_str());
stmt.bind(1, data.name.c_str());
stmt.bind(1, utility::encodeToUtf8(data.name).c_str());
executeStatement(stmt);
return StorageBookmarkCategory(m_database.lastRowId(), data);
@@ -65,8 +66,8 @@ StorageBookmark SqliteBookmarkStorage::addBookmark(const StorageBookmarkData& da
try
{
CppSQLite3Statement stmt = m_database.compileStatement(statement.c_str());
stmt.bind(1, data.name.c_str());
stmt.bind(2, data.comment.c_str());
stmt.bind(1, utility::encodeToUtf8(data.name).c_str());
stmt.bind(2, utility::encodeToUtf8(data.comment).c_str());
stmt.bind(3, data.timestamp.c_str());
executeStatement(stmt);
@@ -87,7 +88,7 @@ StorageBookmarkedNode SqliteBookmarkStorage::addBookmarkedNode(const StorageBook
std::string statement = "INSERT INTO bookmarked_node(id, serialized_node_name) "
"VALUES (" + std::to_string(id) + ", ?);";
CppSQLite3Statement stmt = m_database.compileStatement(statement.c_str());
stmt.bind(1, data.serializedNodeName.c_str());
stmt.bind(1, utility::encodeToUtf8(data.serializedNodeName).c_str());
executeStatement(stmt);
return StorageBookmarkedNode(id, data);
@@ -101,8 +102,8 @@ StorageBookmarkedEdge SqliteBookmarkStorage::addBookmarkedEdge(const StorageBook
std::string statement = "INSERT INTO bookmarked_edge(id, serialized_source_node_name, serialized_target_node_name, edge_type, source_node_active) "
"VALUES (" + std::to_string(id) + ", ?, ?, " + std::to_string(data.edgeType) + ", " + std::to_string(data.sourceNodeActive) + ");";
CppSQLite3Statement stmt = m_database.compileStatement(statement.c_str());
stmt.bind(1, data.serializedSourceNodeName.c_str());
stmt.bind(2, data.serializedTargetNodeName.c_str());
stmt.bind(1, utility::encodeToUtf8(data.serializedSourceNodeName).c_str());
stmt.bind(2, utility::encodeToUtf8(data.serializedTargetNodeName).c_str());
executeStatement(stmt);
return StorageBookmarkedEdge(id, data);
@@ -130,10 +131,10 @@ std::vector<StorageBookmarkedEdge> SqliteBookmarkStorage::getAllBookmarkedEdges(
return doGetAll<StorageBookmarkedEdge>("");
}
void SqliteBookmarkStorage::updateBookmark(const Id bookmarkId, const std::string& name, const std::string& comment, const Id categoryId)
void SqliteBookmarkStorage::updateBookmark(const Id bookmarkId, const std::wstring& name, const std::wstring& comment, const Id categoryId)
{
executeStatement("UPDATE bookmark SET name = '" + name + "' WHERE id == " + std::to_string(bookmarkId) + ";");
executeStatement("UPDATE bookmark SET comment = '" + comment + "' WHERE id == " + std::to_string(bookmarkId) + ";");
executeStatement("UPDATE bookmark SET name = '" + utility::encodeToUtf8(name) + "' WHERE id == " + std::to_string(bookmarkId) + ";");
executeStatement("UPDATE bookmark SET comment = '" + utility::encodeToUtf8(comment) + "' WHERE id == " + std::to_string(bookmarkId) + ";");
executeStatement("UPDATE bookmark SET category_id = " + std::to_string(categoryId) + " WHERE id == " + std::to_string(bookmarkId) + ";");
}
@@ -142,9 +143,9 @@ std::vector<StorageBookmarkCategory> SqliteBookmarkStorage::getAllBookmarkCatego
return doGetAll<StorageBookmarkCategory>("");
}
StorageBookmarkCategory SqliteBookmarkStorage::getBookmarkCategoryByName(const std::string& name) const
StorageBookmarkCategory SqliteBookmarkStorage::getBookmarkCategoryByName(const std::wstring& name) const
{
return doGetFirst<StorageBookmarkCategory>("WHERE name == '" + name + "'");
return doGetFirst<StorageBookmarkCategory>("WHERE name == '" + utility::encodeToUtf8(name) + "'");
}
void SqliteBookmarkStorage::removeBookmarkCategory(Id id)
@@ -260,7 +261,7 @@ std::vector<StorageBookmarkCategory> SqliteBookmarkStorage::doGetAll<StorageBook
if (id != 0 && name != "")
{
categories.push_back(StorageBookmarkCategory(id, name));
categories.push_back(StorageBookmarkCategory(id, utility::decodeFromUtf8(name)));
}
q.nextRow();
@@ -286,7 +287,7 @@ std::vector<StorageBookmark> SqliteBookmarkStorage::doGetAll<StorageBookmark>(co
if (id != 0 && name != "" && timestamp != "")
{
bookmarks.push_back(StorageBookmark(id, name, comment, timestamp, categoryId));
bookmarks.push_back(StorageBookmark(id, utility::decodeFromUtf8(name), utility::decodeFromUtf8(comment), timestamp, categoryId));
}
q.nextRow();
@@ -314,7 +315,7 @@ std::vector<StorageBookmarkedNode> SqliteBookmarkStorage::doGetAll<StorageBookma
if (id != 0 && bookmarkId != 0 && serializedNodeName != "")
{
bookmarkedNodes.push_back(StorageBookmarkedNode(id, bookmarkId, serializedNodeName));
bookmarkedNodes.push_back(StorageBookmarkedNode(id, bookmarkId, utility::decodeFromUtf8(serializedNodeName)));
}
q.nextRow();
@@ -345,7 +346,14 @@ std::vector<StorageBookmarkedEdge> SqliteBookmarkStorage::doGetAll<StorageBookma
if (id != 0 && bookmarkId != 0 && serializedSourceNodeName != "" && serializedTargetNodeName != "" && edgeType != -1 && sourceNodeActive != -1)
{
bookmarkedEdges.push_back(StorageBookmarkedEdge(id, bookmarkId, serializedSourceNodeName, serializedTargetNodeName, edgeType, sourceNodeActive));
bookmarkedEdges.push_back(StorageBookmarkedEdge(
id,
bookmarkId,
utility::decodeFromUtf8(serializedSourceNodeName),
utility::decodeFromUtf8(serializedTargetNodeName),
edgeType,
sourceNodeActive
));
}
q.nextRow();
@@ -31,10 +31,10 @@ public:
std::vector<StorageBookmarkedNode> getAllBookmarkedNodes() const;
std::vector<StorageBookmarkedEdge> getAllBookmarkedEdges() const;
void updateBookmark(const Id bookmarkId, const std::string& name, const std::string& comment, const Id categoryId);
void updateBookmark(const Id bookmarkId, const std::wstring& name, const std::wstring& comment, const Id categoryId);
std::vector<StorageBookmarkCategory> getAllBookmarkCategories() const;
StorageBookmarkCategory getBookmarkCategoryByName(const std::string& name) const;
StorageBookmarkCategory getBookmarkCategoryByName(const std::wstring& name) const;
private:
static const size_t s_storageVersion;
@@ -4,6 +4,7 @@
#include "utility/logging/logging.h"
#include "utility/text/TextAccess.h"
#include "utility/utilityString.h"
const size_t SqliteIndexStorage::s_storageVersion = 15;
@@ -42,7 +43,7 @@ StorageNode SqliteIndexStorage::addNode(const StorageNodeData& data)
{
m_inserNodeStmt.bind(1, int(id));
m_inserNodeStmt.bind(2, data.type);
m_inserNodeStmt.bind(3, data.serializedName.c_str());
m_inserNodeStmt.bind(3, utility::encodeToUtf8(data.serializedName).c_str());
executeStatement(m_inserNodeStmt);
m_inserNodeStmt.reset();
}
@@ -70,7 +71,7 @@ void SqliteIndexStorage::addFile(const StorageFile& data)
bool success = false;
{
m_insertFileStmt.bind(1, int(data.id));
m_insertFileStmt.bind(2, data.filePath.c_str());
m_insertFileStmt.bind(2, utility::encodeToUtf8(data.filePath).c_str());
m_insertFileStmt.bind(3, data.modificationTime.c_str());
m_insertFileStmt.bind(4, data.complete);
m_insertFileStmt.bind(5, lineCount);
@@ -116,7 +117,7 @@ StorageLocalSymbol SqliteIndexStorage::addLocalSymbol(const StorageLocalSymbolDa
}
{
m_inserLocalSymbolStmt.bind(1, int(id));
m_inserLocalSymbolStmt.bind(2, data.name.c_str());
m_inserLocalSymbolStmt.bind(2, utility::encodeToUtf8(data.name).c_str());
executeStatement(m_inserLocalSymbolStmt);
m_inserLocalSymbolStmt.reset();
}
@@ -248,13 +249,13 @@ StorageCommentLocation SqliteIndexStorage::addCommentLocation(const StorageComme
StorageError SqliteIndexStorage::addError(const StorageErrorData& data)
{
const std::string sanitizedMessage = utility::replace(data.message, "'", "''");
const std::wstring sanitizedMessage = utility::replace(data.message, L"'", L"''");
Id id = 0;
{
m_checkErrorExistsStmt.bind(1, sanitizedMessage.c_str());
m_checkErrorExistsStmt.bind(1, utility::encodeToUtf8(sanitizedMessage).c_str());
m_checkErrorExistsStmt.bind(2, int(data.fatal));
m_checkErrorExistsStmt.bind(3, data.filePath.str().c_str());
m_checkErrorExistsStmt.bind(3, utility::encodeToUtf8(data.filePath).c_str());
m_checkErrorExistsStmt.bind(4, int(data.lineNumber));
m_checkErrorExistsStmt.bind(5, int(data.columnNumber));
@@ -269,10 +270,10 @@ StorageError SqliteIndexStorage::addError(const StorageErrorData& data)
if (id == 0)
{
m_insertErrorStmt.bind(1, sanitizedMessage.c_str());
m_insertErrorStmt.bind(1, utility::encodeToUtf8(sanitizedMessage).c_str());
m_insertErrorStmt.bind(2, data.fatal);
m_insertErrorStmt.bind(3, data.indexed);
m_insertErrorStmt.bind(4, data.filePath.str().c_str());
m_insertErrorStmt.bind(4, utility::encodeToUtf8(data.filePath).c_str());
m_insertErrorStmt.bind(5, int(data.lineNumber));
m_insertErrorStmt.bind(6, int(data.columnNumber));
@@ -552,38 +553,38 @@ StorageNode SqliteIndexStorage::getNodeById(Id id) const
return StorageNode();
}
StorageNode SqliteIndexStorage::getNodeBySerializedName(const std::string& serializedName) const
StorageNode SqliteIndexStorage::getNodeBySerializedName(const std::wstring& serializedName) const
{
CppSQLite3Statement stmt = m_database.compileStatement(
"SELECT id, type, serialized_name FROM node WHERE serialized_name == ? LIMIT 1;"
);
stmt.bind(1, serializedName.c_str());
stmt.bind(1, utility::encodeToUtf8(serializedName).c_str());
CppSQLite3Query q = executeQuery(stmt);
if (!q.eof())
{
const Id id = q.getIntField(0, 0);
const int type = q.getIntField(1, -1);
const std::string serializedName = q.getStringField(2, "");
const std::string name = q.getStringField(2, "");
if (id != 0 && type != -1)
{
return StorageNode(id, type, serializedName);
return StorageNode(id, type, utility::decodeFromUtf8(name));
}
}
return StorageNode();
}
StorageLocalSymbol SqliteIndexStorage::getLocalSymbolByName(const std::string& name) const
StorageLocalSymbol SqliteIndexStorage::getLocalSymbolByName(const std::wstring& name) const
{
return doGetFirst<StorageLocalSymbol>("WHERE name == '" + name + "'");
return doGetFirst<StorageLocalSymbol>("WHERE name == '" + utility::encodeToUtf8(name) + "'");
}
StorageFile SqliteIndexStorage::getFileByPath(const std::string& filePath) const
StorageFile SqliteIndexStorage::getFileByPath(const std::wstring& filePath) const
{
return doGetFirst<StorageFile>("WHERE file.path == '" + filePath + "'");
return doGetFirst<StorageFile>("WHERE file.path == '" + utility::encodeToUtf8(filePath) + "'");
}
std::vector<StorageFile> SqliteIndexStorage::getFilesByPaths(const std::vector<FilePath>& filePaths) const
@@ -604,7 +605,7 @@ std::shared_ptr<TextAccess> SqliteIndexStorage::getFileContentById(Id fileId) co
return TextAccess::createFromString("");
}
std::shared_ptr<TextAccess> SqliteIndexStorage::getFileContentByPath(const std::string& filePath) const
std::shared_ptr<TextAccess> SqliteIndexStorage::getFileContentByPath(const std::wstring& filePath) const
{
try
{
@@ -612,7 +613,7 @@ std::shared_ptr<TextAccess> SqliteIndexStorage::getFileContentByPath(const std::
"SELECT filecontent.content "
"FROM filecontent "
"INNER JOIN file ON filecontent.id = file.id "
"WHERE file.path = '" + filePath + "';"
"WHERE file.path = '" + utility::encodeToUtf8(filePath) + "';"
);
if (!q.eof())
@@ -646,7 +647,7 @@ std::shared_ptr<SourceLocationFile> SqliteIndexStorage::getSourceLocationsForFil
{
std::shared_ptr<SourceLocationFile> ret = std::make_shared<SourceLocationFile>(filePath, true, false);
const StorageFile file = getFileByPath(filePath.str());
const StorageFile file = getFileByPath(filePath.wstr());
if (file.id == 0) // early out
{
return ret;
@@ -717,7 +718,7 @@ std::vector<StorageComponentAccess> SqliteIndexStorage::getComponentAccessesByNo
std::vector<StorageCommentLocation> SqliteIndexStorage::getCommentLocationsInFile(const FilePath& filePath) const
{
Id fileNodeId = getFileByPath(filePath.str()).id;
Id fileNodeId = getFileByPath(filePath.wstr()).id;
return doGetAll<StorageCommentLocation>("WHERE file_node_id == " + std::to_string(fileNodeId));
}
@@ -1090,7 +1091,7 @@ std::vector<StorageNode> SqliteIndexStorage::doGetAll<StorageNode>(const std::st
if (id != 0 && type != -1)
{
nodes.push_back(StorageNode(id, type, serializedName));
nodes.push_back(StorageNode(id, type, utility::decodeFromUtf8(serializedName)));
}
q.nextRow();
@@ -1138,7 +1139,7 @@ std::vector<StorageFile> SqliteIndexStorage::doGetAll<StorageFile>(const std::st
if (id != 0)
{
files.push_back(StorageFile(id, filePath, modificationTime, complete));
files.push_back(StorageFile(id, utility::decodeFromUtf8(filePath), modificationTime, complete));
}
q.nextRow();
}
@@ -1162,7 +1163,7 @@ std::vector<StorageLocalSymbol> SqliteIndexStorage::doGetAll<StorageLocalSymbol>
if (id != 0)
{
localSymbols.push_back(StorageLocalSymbol(id, name));
localSymbols.push_back(StorageLocalSymbol(id, utility::decodeFromUtf8(name)));
}
q.nextRow();
@@ -1299,7 +1300,7 @@ std::vector<StorageError> SqliteIndexStorage::doGetAll<StorageError>(const std::
if (lineNumber != -1 && columnNumber != -1)
{
errors.push_back(StorageError(
id, message, FilePath(filePath), lineNumber, columnNumber, fatal, indexed)
id, utility::decodeFromUtf8(message), utility::decodeFromUtf8(filePath), lineNumber, columnNumber, fatal, indexed)
);
id++;
}
@@ -75,14 +75,14 @@ public:
std::vector<StorageEdge> getEdgesByTargetsType(const std::vector<Id>& targetIds, int type) const;
StorageNode getNodeById(Id id) const;
StorageNode getNodeBySerializedName(const std::string& serializedName) const;
StorageNode getNodeBySerializedName(const std::wstring& serializedName) const;
StorageLocalSymbol getLocalSymbolByName(const std::string& name) const;
StorageLocalSymbol getLocalSymbolByName(const std::wstring& name) const;
StorageFile getFileByPath(const std::string& filePath) const;
StorageFile getFileByPath(const std::wstring& filePath) const;
std::vector<StorageFile> getFilesByPaths(const std::vector<FilePath>& filePaths) const;
std::shared_ptr<TextAccess> getFileContentByPath(const std::string& filePath) const;
std::shared_ptr<TextAccess> getFileContentByPath(const std::wstring& filePath) const;
std::shared_ptr<TextAccess> getFileContentById(Id fileId) const;
void setFileComplete(bool complete, Id fileId);
+8 -8
View File
@@ -8,15 +8,15 @@
struct StorageBookmarkData
{
StorageBookmarkData()
: name("")
, comment("")
: name(L"")
, comment(L"")
, timestamp("")
, categoryId(0)
{}
StorageBookmarkData(
const std::string& name,
const std::string& comment,
const std::wstring& name,
const std::wstring& comment,
const std::string& timestamp,
const Id categoryId
)
@@ -26,8 +26,8 @@ struct StorageBookmarkData
, categoryId(categoryId)
{}
std::string name;
std::string comment;
std::wstring name;
std::wstring comment;
std::string timestamp;
Id categoryId;
};
@@ -46,8 +46,8 @@ struct StorageBookmark: public StorageBookmarkData
StorageBookmark(
Id id,
const std::string& name,
const std::string& comment,
const std::wstring& name,
const std::wstring& comment,
const std::string& timestamp,
const Id categoryId
)
@@ -8,14 +8,14 @@
struct StorageBookmarkCategoryData
{
StorageBookmarkCategoryData()
: name("")
: name(L"")
{}
StorageBookmarkCategoryData(const std::string& name)
StorageBookmarkCategoryData(const std::wstring& name)
: name(name)
{}
std::string name;
std::wstring name;
};
struct StorageBookmarkCategory: public StorageBookmarkCategoryData
@@ -30,7 +30,7 @@ struct StorageBookmarkCategory: public StorageBookmarkCategoryData
, id(id)
{}
StorageBookmarkCategory(Id id, const std::string& name)
StorageBookmarkCategory(Id id, const std::wstring& name)
: StorageBookmarkCategoryData(name)
, id(id)
{}
@@ -9,16 +9,16 @@ struct StorageBookmarkedEdgeData
{
StorageBookmarkedEdgeData()
: bookmarkId(0)
, serializedSourceNodeName("")
, serializedTargetNodeName("")
, serializedSourceNodeName(L"")
, serializedTargetNodeName(L"")
, edgeType(0)
, sourceNodeActive(false)
{}
StorageBookmarkedEdgeData(
Id bookmarkId,
const std::string& serializedSourceNodeName,
const std::string& serializedTargetNodeName,
const std::wstring& serializedSourceNodeName,
const std::wstring& serializedTargetNodeName,
int edgeType,
bool sourceNodeActive
)
@@ -30,8 +30,8 @@ struct StorageBookmarkedEdgeData
{}
Id bookmarkId;
std::string serializedSourceNodeName;
std::string serializedTargetNodeName;
std::wstring serializedSourceNodeName;
std::wstring serializedTargetNodeName;
int edgeType;
bool sourceNodeActive;
};
@@ -51,8 +51,8 @@ struct StorageBookmarkedEdge: public StorageBookmarkedEdgeData
StorageBookmarkedEdge(
Id id,
Id bookmarkId,
const std::string& serializedSourceNodeName,
const std::string& serializedTargetNodeName,
const std::wstring& serializedSourceNodeName,
const std::wstring& serializedTargetNodeName,
int edgeType,
bool sourceNodeActive
)
@@ -9,16 +9,16 @@ struct StorageBookmarkedNodeData
{
StorageBookmarkedNodeData()
: bookmarkId(0)
, serializedNodeName("")
, serializedNodeName(L"")
{}
StorageBookmarkedNodeData(Id bookmarkId, const std::string& serializedNodeName)
StorageBookmarkedNodeData(Id bookmarkId, const std::wstring& serializedNodeName)
: bookmarkId(bookmarkId)
, serializedNodeName(serializedNodeName)
{}
Id bookmarkId;
std::string serializedNodeName;
std::wstring serializedNodeName;
};
struct StorageBookmarkedNode: public StorageBookmarkedNodeData
@@ -36,7 +36,7 @@ struct StorageBookmarkedNode: public StorageBookmarkedNodeData
StorageBookmarkedNode(
Id id,
Id bookmarkId,
const std::string& serializedNodeName
const std::wstring& serializedNodeName
)
: StorageBookmarkedNodeData(bookmarkId, serializedNodeName)
, id(id)
+8 -7
View File
@@ -9,7 +9,8 @@
struct StorageErrorData
{
StorageErrorData()
: message("")
: message(L"")
, filePath(L"")
, lineNumber(-1)
, columnNumber(-1)
, fatal(0)
@@ -17,8 +18,8 @@ struct StorageErrorData
{}
StorageErrorData(
const std::string& message,
const FilePath& filePath,
const std::wstring& message,
const std::wstring& filePath,
uint lineNumber,
uint columnNumber,
bool fatal,
@@ -32,9 +33,9 @@ struct StorageErrorData
, indexed(indexed)
{}
std::string message;
std::wstring message;
FilePath filePath;
std::wstring filePath;
uint lineNumber;
uint columnNumber;
@@ -56,8 +57,8 @@ struct StorageError: public StorageErrorData
StorageError(
Id id,
const std::string& message,
const FilePath& filePath,
const std::wstring& message,
const std::wstring& filePath,
uint lineNumber,
uint columnNumber,
bool fatal,
+3 -3
View File
@@ -9,12 +9,12 @@ struct StorageFile
{
StorageFile()
: id(0)
, filePath("")
, filePath(L"")
, modificationTime("")
, complete(true)
{}
StorageFile(Id id, const std::string& filePath, const std::string& modificationTime, bool complete)
StorageFile(Id id, const std::wstring& filePath, const std::string& modificationTime, bool complete)
: id(id)
, filePath(filePath)
, modificationTime(modificationTime)
@@ -22,7 +22,7 @@ struct StorageFile
{}
Id id;
std::string filePath;
std::wstring filePath;
std::string modificationTime;
bool complete;
};
@@ -8,14 +8,14 @@
struct StorageLocalSymbolData
{
StorageLocalSymbolData()
: name("")
: name(L"")
{}
StorageLocalSymbolData(const std::string& name)
StorageLocalSymbolData(const std::wstring& name)
: name(name)
{}
std::string name;
std::wstring name;
};
struct StorageLocalSymbol: public StorageLocalSymbolData
@@ -30,7 +30,7 @@ struct StorageLocalSymbol: public StorageLocalSymbolData
, id(id)
{}
StorageLocalSymbol(Id id, const std::string& name)
StorageLocalSymbol(Id id, const std::wstring& name)
: StorageLocalSymbolData(name)
, id(id)
{}
+4 -4
View File
@@ -9,16 +9,16 @@ struct StorageNodeData
{
StorageNodeData()
: type(0)
, serializedName("")
, serializedName(L"")
{}
StorageNodeData(int type, const std::string& serializedName)
StorageNodeData(int type, const std::wstring& serializedName)
: type(type)
, serializedName(serializedName)
{}
int type;
std::string serializedName;
std::wstring serializedName;
};
struct StorageNode: public StorageNodeData
@@ -28,7 +28,7 @@ struct StorageNode: public StorageNodeData
, id(0)
{}
StorageNode(Id id, int type, const std::string& serializedName)
StorageNode(Id id, int type, const std::wstring& serializedName)
: StorageNodeData(type, serializedName)
, id(id)
{}
+3 -1
View File
@@ -1,5 +1,7 @@
#include "settings/ColorScheme.h"
#include "utility/utilityString.h"
std::shared_ptr<ColorScheme> ColorScheme::s_instance;
std::shared_ptr<ColorScheme> ColorScheme::getInstance()
@@ -60,7 +62,7 @@ std::string ColorScheme::getNodeTypeColor(const std::string& typeStr, const std:
std::string ColorScheme::getEdgeTypeColor(Edge::EdgeType type, ColorState state) const
{
return getEdgeTypeColor(Edge::getUnderscoredTypeString(type), state);
return getEdgeTypeColor(utility::encodeToUtf8(Edge::getUnderscoredTypeString(type)), state);
}
std::string ColorScheme::getEdgeTypeColor(const std::string& typeStr, ColorState state) const
+3 -2
View File
@@ -30,10 +30,11 @@ void ConsoleLogger::logMessage(const std::string& type, const LogMessage& messag
{
std::cout << message.getTimeString("%H:%M:%S") << " | ";
if (message.filePath.size())
if (!message.filePath.empty())
{
std::cout << message.getFileName() << ':' << message.line << ' ' << message.functionName << "() | ";
}
std::cout << type << ": " << message.message << std::endl;
std::cout << type << ": ";
std::wcout << message.message << std::endl;
}
+2 -1
View File
@@ -5,6 +5,7 @@
#include <cstdio>
#include "utility/file/FileSystem.h"
#include "utility/utilityString.h"
FileLogger::FileLogger()
: Logger("FileLogger")
@@ -124,7 +125,7 @@ void FileLogger::logMessage(const std::string& type, const LogMessage& message)
fileStream << message.getFileName() << ':' << message.line << ' ' << message.functionName << "() | ";
}
fileStream << type << ": " << message.message << std::endl;
fileStream << type << ": " << utility::encodeToUtf8(message.message) << std::endl;
fileStream.close();
m_currentLogLineCount++;
+19 -19
View File
@@ -93,7 +93,7 @@ void LogManager::logInfo(
{
if (m_loggingEnabled)
{
m_logManagerImplementation.logInfo(message, file, function, line);
m_logManagerImplementation.logInfo(utility::decodeFromUtf8(message), file, function, line);
}
}
@@ -106,7 +106,7 @@ void LogManager::logInfo(
{
if (m_loggingEnabled)
{
m_logManagerImplementation.logInfo(utility::encodeToUtf8(message), file, function, line);
m_logManagerImplementation.logInfo(message, file, function, line);
}
}
@@ -116,6 +116,19 @@ void LogManager::logWarning(
const std::string& function,
const unsigned int line
)
{
if (m_loggingEnabled)
{
m_logManagerImplementation.logWarning(utility::decodeFromUtf8(message), file, function, line);
}
}
void LogManager::logWarning(
const std::wstring& message,
const std::string& file,
const std::string& function,
const unsigned int line
)
{
if (m_loggingEnabled)
{
@@ -123,8 +136,8 @@ void LogManager::logWarning(
}
}
void LogManager::logWarning(
const std::wstring& message,
void LogManager::logError(
const std::string& message,
const std::string& file,
const std::string& function,
const unsigned int line
@@ -132,12 +145,12 @@ void LogManager::logWarning(
{
if (m_loggingEnabled)
{
m_logManagerImplementation.logWarning(utility::encodeToUtf8(message), file, function, line);
m_logManagerImplementation.logError(utility::decodeFromUtf8(message), file, function, line);
}
}
void LogManager::logError(
const std::string& message,
const std::wstring& message,
const std::string& file,
const std::string& function,
const unsigned int line
@@ -149,19 +162,6 @@ void LogManager::logError(
}
}
void LogManager::logError(
const std::wstring& message,
const std::string& file,
const std::string& function,
const unsigned int line
)
{
if (m_loggingEnabled)
{
m_logManagerImplementation.logError(utility::encodeToUtf8(message), file, function, line);
}
}
std::shared_ptr<LogManager> LogManager::s_instance;
LogManager::LogManager()
@@ -86,7 +86,7 @@ int LogManagerImplementation::getLoggerCount() const
}
void LogManagerImplementation::logInfo(
const std::string& message,
const std::wstring& message,
const std::string& file,
const std::string& function,
const unsigned int line
@@ -100,7 +100,7 @@ void LogManagerImplementation::logInfo(
}
void LogManagerImplementation::logWarning(
const std::string& message,
const std::wstring& message,
const std::string& file,
const std::string& function,
const unsigned int line
@@ -114,7 +114,7 @@ void LogManagerImplementation::logWarning(
}
void LogManagerImplementation::logError(
const std::string& message,
const std::wstring& message,
const std::string& file,
const std::string& function,
const unsigned int line
@@ -30,19 +30,19 @@ public:
Logger* getLoggerByType(const std::string& type);
void logInfo(
const std::string& message,
const std::wstring& message,
const std::string& file,
const std::string& function,
const unsigned int line
);
void logWarning(
const std::string& message,
const std::wstring& message,
const std::string& file,
const std::string& function,
const unsigned int line
);
void logError(
const std::string& message,
const std::wstring& message,
const std::string& file,
const std::string& function,
const unsigned int line
+2 -2
View File
@@ -9,7 +9,7 @@ struct LogMessage
{
public:
LogMessage(
const std::string& message,
const std::wstring& message,
const std::string& filePath,
const std::string& functionName,
const unsigned int line,
@@ -36,7 +36,7 @@ public:
return filePath.substr(filePath.find_last_of("/\\") + 1);
}
const std::string message;
const std::wstring message;
const std::string filePath;
const std::string functionName;
const unsigned int line;
@@ -1,12 +1,13 @@
#ifndef MESSAGE_ACTIVATE_EDGE_H
#define MESSAGE_ACTIVATE_EDGE_H
#include "utility/messaging/Message.h"
#include "utility/types.h"
#include "data/graph/Edge.h"
#include "data/name/NameHierarchy.h"
#include "utility/messaging/Message.h"
#include "utility/types.h"
#include "utility/utilityString.h"
class MessageActivateEdge
: public Message<MessageActivateEdge>
{
@@ -35,10 +36,10 @@ public:
std::string getFullName() const
{
std::string name = Edge::getReadableTypeString(type) + ":";
name += sourceNameHierarchy.getQualifiedNameWithSignature() + "->";
std::wstring name = Edge::getReadableTypeString(type) + L":";
name += sourceNameHierarchy.getQualifiedNameWithSignature() + L"->";
name += targetNameHierarchy.getQualifiedNameWithSignature();
return name;
return utility::encodeToUtf8(name);
}
virtual void print(std::ostream& os) const
@@ -1,12 +1,13 @@
#ifndef MESSAGE_ACTIVATE_TRAIL_EDGE_H
#define MESSAGE_ACTIVATE_TRAIL_EDGE_H
#include "utility/messaging/Message.h"
#include "utility/types.h"
#include "data/graph/Edge.h"
#include "data/name/NameHierarchy.h"
#include "utility/messaging/Message.h"
#include "utility/types.h"
#include "utility/utilityString.h"
class MessageActivateTrailEdge
: public Message<MessageActivateTrailEdge>
{
@@ -28,10 +29,10 @@ public:
std::string getFullName() const
{
std::string name = Edge::getReadableTypeString(type) + ":";
name += sourceNameHierarchy.getQualifiedNameWithSignature() + "->";
std::wstring name = Edge::getReadableTypeString(type) + L":";
name += sourceNameHierarchy.getQualifiedNameWithSignature() + L"->";
name += targetNameHierarchy.getQualifiedNameWithSignature();
return name;
return utility::encodeToUtf8(name);
}
virtual void print(std::ostream& os) const
+2 -1
View File
@@ -16,6 +16,7 @@
#include "utility/file/FilePath.h"
#include "utility/math/Vector2.h"
#include "utility/TimeStamp.h"
#include "utility/utilityString.h"
namespace utility
{
@@ -250,7 +251,7 @@ inline std::vector<std::string> utility::toStrings<FilePath>(const std::vector<F
std::vector<std::string> v;
for (const FilePath& t : d)
{
v.push_back(t.str());
v.push_back(utility::encodeToUtf8(t.wstr()));
}
return v;
}
+38
View File
@@ -61,6 +61,16 @@ namespace utility
return split<std::vector<std::string>>(str, delimiter);
}
std::vector<std::wstring> splitToVector(const std::wstring& str, wchar_t delimiter)
{
return split<std::vector<std::wstring>>(str, std::wstring(1, delimiter));
}
std::vector<std::wstring> splitToVector(const std::wstring& str, const std::wstring& delimiter)
{
return split<std::vector<std::wstring>>(str, delimiter);
}
std::string join(const std::deque<std::string>& list, char delimiter)
{
return join<std::deque<std::string> >(list, std::string(1, delimiter));
@@ -164,6 +174,16 @@ namespace utility
return str;
}
std::wstring substrBeforeLast(const std::wstring& str, wchar_t delimiter)
{
size_t pos = str.rfind(delimiter);
if (pos != std::wstring::npos)
{
return str.substr(0, pos);
}
return str;
}
std::string substrAfter(const std::string& str, char delimiter)
{
size_t pos = str.find(delimiter);
@@ -452,6 +472,24 @@ namespace utility
}
}
std::wstring elide(const std::wstring& str, ElideMode mode, size_t size)
{
if (str.size() <= size || str.size() <= 3)
{
return str;
}
switch (mode)
{
case ELIDE_LEFT:
return L"..." + str.substr(str.size() - size - 3, str.size());
case ELIDE_MIDDLE:
return str.substr(0, size / 2 - 1) + L"..." + str.substr(str.size() - (size / 2 - 2), str.size());
case ELIDE_RIGHT:
return str.substr(0, size - 3) + L"...";
}
}
std::string substrBetween(const std::string &str, const std::string &delimiter1, const std::string &delimiter2)
{
size_t found_delimiter1 = str.find(delimiter1);
+4
View File
@@ -21,6 +21,8 @@ namespace utility
std::deque<std::string> split(const std::string& str, const std::string& delimiter);
std::vector<std::string> splitToVector(const std::string& str, char delimiter);
std::vector<std::string> splitToVector(const std::string& str, const std::string& delimiter);
std::vector<std::wstring> splitToVector(const std::wstring& str, wchar_t delimiter);
std::vector<std::wstring> splitToVector(const std::wstring& str, const std::wstring& delimiter);
template <typename ContainerType>
std::string join(const ContainerType& list, const std::string& delimiter);
@@ -38,6 +40,7 @@ namespace utility
std::string substrBeforeFirst(const std::string& str, char delimiter);
std::string substrBeforeFirst(const std::string& str, const std::string& delimiter);
std::string substrBeforeLast(const std::string& str, char delimiter);
std::wstring substrBeforeLast(const std::wstring& str, wchar_t delimiter);
std::string substrAfter(const std::string& str, char delimiter);
std::string substrAfter(const std::string& str, const std::string& delimiter);
@@ -71,6 +74,7 @@ namespace utility
};
std::string elide(const std::string& str, ElideMode mode, size_t size);
std::wstring elide(const std::wstring& str, ElideMode mode, size_t size);
template <typename ContainerType>
ContainerType split(const std::string& str, const std::string& delimiter)
@@ -9,18 +9,18 @@ FilePath CanonicalFilePathCache::getCanonicalFilePath(const clang::FileEntry* en
return getCanonicalFilePath(utility::getFileNameOfFileEntry(entry));
}
FilePath CanonicalFilePathCache::getCanonicalFilePath(const std::string& path)
FilePath CanonicalFilePathCache::getCanonicalFilePath(const std::wstring& path)
{
const std::string lowercasePath = utility::toLowerCase(path);
const std::wstring lowercasePath = utility::toLowerCase(path);
std::unordered_map<std::string, FilePath>::const_iterator it = m_map.find(lowercasePath);
std::unordered_map<std::wstring, FilePath>::const_iterator it = m_map.find(lowercasePath);
if (it != m_map.end())
{
return it->second;
}
const FilePath canonicalPath = FilePath(path).makeCanonical();
const std::string lowercaseCanonicalPath = utility::toLowerCase(canonicalPath.str());
const std::wstring lowercaseCanonicalPath = utility::toLowerCase(canonicalPath.wstr());
m_map.insert(std::make_pair(lowercasePath, canonicalPath));
m_map.insert(std::make_pair(lowercaseCanonicalPath, canonicalPath));
@@ -11,10 +11,10 @@ class CanonicalFilePathCache
{
public:
FilePath getCanonicalFilePath(const clang::FileEntry* entry);
FilePath getCanonicalFilePath(const std::string& path);
FilePath getCanonicalFilePath(const std::wstring& path);
private:
std::unordered_map<std::string, FilePath> m_map;
std::unordered_map<std::wstring, FilePath> m_map;
};
#endif // CANONICAL_FILE_PATH_CACHE_H
@@ -17,6 +17,7 @@
#include "data/parser/ParserClient.h"
#include "data/parser/ParseLocation.h"
#include "utility/utilityString.h"
CxxAstVisitor::CxxAstVisitor(
clang::ASTContext* astContext,
@@ -41,7 +42,7 @@ CxxAstVisitor::CxxAstVisitor(
return declName->toNameHierarchy();
}
}
return NameHierarchy("global", NAME_DELIMITER_UNKNOWN);
return NameHierarchy(L"global", NAME_DELIMITER_UNKNOWN);
}
);
m_typeNameCache = std::make_shared<TypeNameCache>([&](const clang::Type* type) -> NameHierarchy
@@ -54,7 +55,7 @@ CxxAstVisitor::CxxAstVisitor(
return typeName->toNameHierarchy();
}
}
return NameHierarchy("global", NAME_DELIMITER_UNKNOWN);
return NameHierarchy(L"global", NAME_DELIMITER_UNKNOWN);
}
);
@@ -738,7 +739,7 @@ ParseLocation CxxAstVisitor::getParseLocation(const clang::SourceRange& sourceRa
}
else
{
filePath = m_canonicalFilePathCache->getCanonicalFilePath(presumedBegin.getFilename());
filePath = m_canonicalFilePathCache->getCanonicalFilePath(utility::decodeFromUtf8(presumedBegin.getFilename()));
}
}
@@ -146,10 +146,10 @@ void CxxAstVisitorComponentIndexer::beginTraverseLambdaCapture(clang::LambdaExpr
if (!d->getNameAsString().empty()) // don't record anonymous parameters
{
ParseLocation declLocation = getParseLocation(d->getLocation());
std::string name =
declLocation.filePath.fileName() + "<" +
std::to_string(declLocation.startLineNumber) + ":" +
std::to_string(declLocation.startColumnNumber) + ">";
std::wstring name =
declLocation.filePath.wFileName() + L"<" +
std::to_wstring(declLocation.startLineNumber) + L":" +
std::to_wstring(declLocation.startColumnNumber) + L">";
m_client->recordLocalSymbol(name, getParseLocation(capture->getLocation()));
}
}
@@ -233,10 +233,10 @@ void CxxAstVisitorComponentIndexer::visitVarDecl(clang::VarDecl* d)
if (!d->getNameAsString().empty()) // don't record anonymous parameters
{
ParseLocation declLocation = getParseLocation(d->getLocation());
std::string name =
declLocation.filePath.fileName() + "<" +
std::to_string(declLocation.startLineNumber) + ":" +
std::to_string(declLocation.startColumnNumber) + ">";
std::wstring name =
declLocation.filePath.wFileName() + L"<" +
std::to_wstring(declLocation.startLineNumber) + L":" +
std::to_wstring(declLocation.startColumnNumber) + L">";
m_client->recordLocalSymbol(name, getParseLocation(d->getLocation()));
}
}
@@ -474,7 +474,7 @@ void CxxAstVisitorComponentIndexer::visitUsingDirectiveDecl(clang::UsingDirectiv
m_client->recordReference(
REFERENCE_USAGE,
nameHierarchy,
getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getContextName(NameHierarchy(loc.filePath.str(), NAME_DELIMITER_FILE)),
getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getContextName(NameHierarchy(loc.filePath.wstr(), NAME_DELIMITER_FILE)),
loc
);
}
@@ -488,7 +488,7 @@ void CxxAstVisitorComponentIndexer::visitUsingDecl(clang::UsingDecl* d)
m_client->recordReference(
REFERENCE_USAGE,
getAstVisitor()->getDeclNameCache()->getValue(d),
getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getContextName(NameHierarchy(loc.filePath.str(), NAME_DELIMITER_FILE)),
getAstVisitor()->getComponent<CxxAstVisitorComponentContext>()->getContextName(NameHierarchy(loc.filePath.wstr(), NAME_DELIMITER_FILE)),
loc
);
}
@@ -575,9 +575,9 @@ void CxxAstVisitorComponentIndexer::visitDeclRefExpr(clang::DeclRefExpr* s)
(clang::isa<clang::VarDecl>(decl) && decl->getParentFunctionOrMethod() != NULL)
) {
ParseLocation declLocation = getParseLocation(decl->getLocation());
std::string name = declLocation.filePath.fileName() + "<" +
std::to_string(declLocation.startLineNumber) + ":" +
std::to_string(declLocation.startColumnNumber) + ">";
std::wstring name = declLocation.filePath.wFileName() + L"<" +
std::to_wstring(declLocation.startLineNumber) + L":" +
std::to_wstring(declLocation.startColumnNumber) + L">";
m_client->recordLocalSymbol(name, getParseLocation(s->getLocation()));
}
@@ -8,6 +8,7 @@
#include "data/parser/ParseLocation.h"
#include "data/parser/ParserClient.h"
#include "utility/file/FileRegister.h"
#include "utility/utilityString.h"
CxxDiagnosticConsumer::CxxDiagnosticConsumer(
clang::raw_ostream &os,
@@ -93,7 +94,7 @@ void CxxDiagnosticConsumer::HandleDiagnostic(clang::DiagnosticsEngine::Level lev
m_client->recordError(
location,
message,
utility::decodeFromUtf8(message),
level == clang::DiagnosticsEngine::Fatal,
m_register->hasFilePath(location.filePath)
);
+4 -4
View File
@@ -24,9 +24,9 @@ namespace
return utility::concat({ "clang-tool", "-fsyntax-only" }, args);
}
std::vector<std::string> appendFilePath(const std::vector<std::string>& args, llvm::StringRef fileName)
std::vector<std::string> appendFilePath(const std::vector<std::string>& args, llvm::StringRef filePath)
{
return utility::concat(args, { fileName.str() });
return utility::concat(args, { filePath.str() });
}
// custom implementation of clang::runToolOnCodeWithArgs which also sets our custon DiagnosticConsumer
@@ -92,9 +92,9 @@ void CxxParser::buildIndex(std::shared_ptr<IndexerCommandCxxCdb> indexerCommand)
void CxxParser::buildIndex(std::shared_ptr<IndexerCommandCxxEmpty> indexerCommand)
{
clang::tooling::CompileCommand compileCommand;
compileCommand.Filename = indexerCommand->getSourceFilePath().str();
compileCommand.Filename = utility::encodeToUtf8(indexerCommand->getSourceFilePath().wstr());
compileCommand.Directory = indexerCommand->getWorkingDirectory().str();
compileCommand.CommandLine = prependSyntaxOnlyToolArgs(appendFilePath(getCommandlineArguments(indexerCommand), indexerCommand->getSourceFilePath().str()));
compileCommand.CommandLine = prependSyntaxOnlyToolArgs(appendFilePath(getCommandlineArguments(indexerCommand), utility::encodeToUtf8(indexerCommand->getSourceFilePath().wstr())));
CxxCompilationDatabaseSingle compilationDatabase(compileCommand);
runTool(&compilationDatabase, indexerCommand->getSourceFilePath());
@@ -11,6 +11,7 @@
#include "utility/file/FileSystem.h"
#include "utility/file/FileRegister.h"
#include "utility/utilityString.h"
PreprocessorCallbacks::PreprocessorCallbacks(
clang::SourceManager& sourceManager,
@@ -64,8 +65,8 @@ void PreprocessorCallbacks::InclusionDirective(
FilePath includedFilePath = m_canonicalFilePathCache->getCanonicalFilePath(fileEntry);
if (m_fileRegister->hasFilePath(includedFilePath))
{
const NameHierarchy referencedNameHierarchy(includedFilePath.str(), NAME_DELIMITER_FILE);
const NameHierarchy contextNameHierarchy(m_currentPath.str(), NAME_DELIMITER_FILE);
const NameHierarchy referencedNameHierarchy(includedFilePath.wstr(), NAME_DELIMITER_FILE);
const NameHierarchy contextNameHierarchy(m_currentPath.wstr(), NAME_DELIMITER_FILE);
m_client->recordReference(
REFERENCE_INCLUDE,
@@ -87,7 +88,7 @@ void PreprocessorCallbacks::MacroDefined(const clang::Token& macroNameToken, con
return;
}
const NameHierarchy nameHierarchy(macroNameToken.getIdentifierInfo()->getName().str(), NAME_DELIMITER_CXX);
const NameHierarchy nameHierarchy(utility::decodeFromUtf8(macroNameToken.getIdentifierInfo()->getName().str()), NAME_DELIMITER_CXX);
m_client->recordSymbol(
nameHierarchy,
@@ -136,8 +137,8 @@ void PreprocessorCallbacks::onMacroUsage(const clang::Token& macroNameToken)
{
const ParseLocation loc = getParseLocation(macroNameToken);
const NameHierarchy referencedNameHierarchy(macroNameToken.getIdentifierInfo()->getName().str(), NAME_DELIMITER_CXX);
const NameHierarchy contextNameHierarchy(loc.filePath.str(), NAME_DELIMITER_FILE);
const NameHierarchy referencedNameHierarchy(utility::decodeFromUtf8(macroNameToken.getIdentifierInfo()->getName().str()), NAME_DELIMITER_CXX);
const NameHierarchy contextNameHierarchy(loc.filePath.wstr(), NAME_DELIMITER_FILE);
m_client->recordReference(
REFERENCE_MACRO_USAGE,
@@ -1,20 +1,20 @@
#include "data/parser/cxx/name/CxxDeclName.h"
//CxxDeclName::CxxDeclName(const std::string& name, const std::vector<std::string>& templateParameterNames)
//CxxDeclName::CxxDeclName(const std::wstring& name, const std::vector<std::wstring>& templateParameterNames)
// : m_name(name)
// , m_templateParameterNames(templateParameterNames)
//{
//}
CxxDeclName::CxxDeclName(std::string&& name, std::vector<std::string>&& templateParameterNames)
CxxDeclName::CxxDeclName(std::wstring&& name, std::vector<std::wstring>&& templateParameterNames)
: m_name(std::move(name))
, m_templateParameterNames(std::move(templateParameterNames))
{
}
//CxxDeclName::CxxDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxName> parent
//)
// : CxxName(parent)
@@ -24,8 +24,8 @@ CxxDeclName::CxxDeclName(std::string&& name, std::vector<std::string>&& template
//}
CxxDeclName::CxxDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxName> parent
)
: CxxName(parent)
@@ -36,19 +36,19 @@ CxxDeclName::CxxDeclName(
NameHierarchy CxxDeclName::toNameHierarchy() const
{
std::string nameString = m_name;
std::wstring nameString = m_name;
if (!m_templateParameterNames.empty())
{
nameString += "<";
nameString += L"<";
for (size_t i = 0; i < m_templateParameterNames.size(); i++)
{
if (i != 0)
{
nameString += ", ";
nameString += L", ";
}
nameString += m_templateParameterNames[i];
}
nameString += ">";
nameString += L">";
}
NameHierarchy ret = getParent() ? getParent()->toNameHierarchy(): NameHierarchy(NAME_DELIMITER_CXX);
@@ -57,12 +57,12 @@ NameHierarchy CxxDeclName::toNameHierarchy() const
return ret;
}
std::string CxxDeclName::getName() const
std::wstring CxxDeclName::getName() const
{
return m_name;
}
std::vector<std::string> CxxDeclName::getTemplateParameterNames() const
std::vector<std::wstring> CxxDeclName::getTemplateParameterNames() const
{
return m_templateParameterNames;
}
@@ -18,8 +18,8 @@ public:
//);
CxxDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames
);
// uncomment this constructor if required, but try to use the one using move constructors for the members
@@ -30,19 +30,19 @@ public:
//);
CxxDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxName> parent
);
virtual NameHierarchy toNameHierarchy() const;
std::string getName() const;
std::vector<std::string> getTemplateParameterNames() const;
std::wstring getName() const;
std::vector<std::wstring> getTemplateParameterNames() const;
private:
std::string m_name;
std::vector<std::string> m_templateParameterNames;
std::wstring m_name;
std::vector<std::wstring> m_templateParameterNames;
};
#endif // CXX_DECL_NAME_H
@@ -1,8 +1,8 @@
#include "data/parser/cxx/name/CxxFunctionDeclName.h"
//CxxFunctionDeclName::CxxFunctionDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> returnTypeName,
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
// const bool isConst,
@@ -17,8 +17,8 @@
//}
CxxFunctionDeclName::CxxFunctionDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> returnTypeName,
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
const bool isConst,
@@ -33,8 +33,8 @@ CxxFunctionDeclName::CxxFunctionDeclName(
}
//CxxFunctionDeclName::CxxFunctionDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> returnTypeName,
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
// const bool isConst,
@@ -50,8 +50,8 @@ CxxFunctionDeclName::CxxFunctionDeclName(
//}
CxxFunctionDeclName::CxxFunctionDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> returnTypeName,
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
const bool isConst,
@@ -68,26 +68,26 @@ CxxFunctionDeclName::CxxFunctionDeclName(
NameHierarchy CxxFunctionDeclName::toNameHierarchy() const
{
std::string signaturePrefix;
std::wstring signaturePrefix;
if (m_isStatic)
{
signaturePrefix += "static ";
signaturePrefix += L"static ";
}
signaturePrefix += CxxTypeName::makeUnsolvedIfNull(m_returnTypeName)->toString();
std::string signaturePostfix = "(";
std::wstring signaturePostfix = L"(";
for (size_t i = 0; i < m_parameterTypeNames.size(); i++)
{
if (i != 0)
{
signaturePostfix += ", ";
signaturePostfix += L", ";
}
signaturePostfix += CxxTypeName::makeUnsolvedIfNull(m_parameterTypeNames[i])->toString();
}
signaturePostfix += ")";
signaturePostfix += L")";
if (m_isConst)
{
signaturePostfix += " const";
signaturePostfix += L" const";
}
NameHierarchy ret = CxxDeclName::toNameHierarchy();
@@ -12,8 +12,8 @@ class CxxFunctionDeclName: public CxxDeclName
public:
// uncomment this constructor if required, but try to use the one using move constructors for the members
//CxxFunctionDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> returnTypeName,
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
// const bool isConst,
@@ -21,8 +21,8 @@ public:
//);
CxxFunctionDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> returnTypeName,
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
const bool isConst,
@@ -31,8 +31,8 @@ public:
// uncomment this constructor if required, but try to use the one using move constructors for the members
//CxxFunctionDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> returnTypeName,
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
// const bool isConst,
@@ -41,8 +41,8 @@ public:
//);
CxxFunctionDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> returnTypeName,
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
const bool isConst,
@@ -25,12 +25,12 @@ bool CxxQualifierFlags::empty() const
return m_flags == QUALIFIER_NONE;
}
std::string CxxQualifierFlags::toString() const
std::wstring CxxQualifierFlags::toString() const
{
std::string ret = "";
std::wstring ret = L"";
if (m_flags & QUALIFIER_CONST)
{
ret += "const";
ret += L"const";
}
return ret;
}
@@ -19,7 +19,7 @@ public:
void removeQualifier(QualifierType qualifier);
bool empty() const;
std::string toString() const;
std::wstring toString() const;
private:
char m_flags;
@@ -1,11 +1,11 @@
#include "data/parser/cxx/name/CxxStaticFunctionDeclName.h"
//CxxStaticFunctionDeclName::CxxStaticFunctionDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> returnTypeName,
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
// const std::string& translationUnitFileName
// const std::wstring& translationUnitFileName
//)
// : CxxFunctionDeclName(name, templateParameterNames, returnTypeName, parameterTypeNames, false, true)
// , m_translationUnitFileName(translationUnitFileName)
@@ -13,11 +13,11 @@
//}
CxxStaticFunctionDeclName::CxxStaticFunctionDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> returnTypeName,
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
std::string&& translationUnitFileName
std::wstring&& translationUnitFileName
)
: CxxFunctionDeclName(std::move(name), std::move(templateParameterNames), returnTypeName, std::move(parameterTypeNames), false, true)
, m_translationUnitFileName(std::move(translationUnitFileName))
@@ -25,11 +25,11 @@ CxxStaticFunctionDeclName::CxxStaticFunctionDeclName(
}
//CxxStaticFunctionDeclName::CxxStaticFunctionDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> returnTypeName,
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
// const std::string& translationUnitFileName,
// const std::wstring& translationUnitFileName,
// std::shared_ptr<CxxName> parent
//)
// : CxxFunctionDeclName(name, templateParameterNames, returnTypeName, parameterTypeNames, false, true, parent)
@@ -38,11 +38,11 @@ CxxStaticFunctionDeclName::CxxStaticFunctionDeclName(
//}
CxxStaticFunctionDeclName::CxxStaticFunctionDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> returnTypeName,
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
std::string&& translationUnitFileName,
std::wstring&& translationUnitFileName,
std::shared_ptr<CxxName> parent
)
: CxxFunctionDeclName(std::move(name), std::move(templateParameterNames), returnTypeName, std::move(parameterTypeNames), false, true, parent)
@@ -57,7 +57,7 @@ NameHierarchy CxxStaticFunctionDeclName::toNameHierarchy() const
std::shared_ptr<NameElement> nameElement = std::make_shared<NameElement>(
ret.back()->getName(),
NameElement::Signature(sig.getPrefix(), sig.getPostfix() + " (" + m_translationUnitFileName + ")")
NameElement::Signature(sig.getPrefix(), sig.getPostfix() + L" (" + m_translationUnitFileName + L")")
);
ret.pop();
@@ -8,44 +8,44 @@ class CxxStaticFunctionDeclName: public CxxFunctionDeclName
public:
// uncomment this constructor if required, but try to use the one using move constructors for the members
//CxxStaticFunctionDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> returnTypeName,
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
// const std::string& translationUnitFileName
// const std::wstring& translationUnitFileName
//);
CxxStaticFunctionDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> returnTypeName,
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
std::string&& translationUnitFileName
std::wstring&& translationUnitFileName
);
// uncomment this constructor if required, but try to use the one using move constructors for the members
//CxxStaticFunctionDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> returnTypeName,
// const std::vector<std::shared_ptr<CxxTypeName>>& parameterTypeNames,
// const std::string& translationUnitFileName,
// const std::wstring& translationUnitFileName,
// std::shared_ptr<CxxName> parent
//);
CxxStaticFunctionDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> returnTypeName,
std::vector<std::shared_ptr<CxxTypeName>>&& parameterTypeNames,
std::string&& translationUnitFileName,
std::wstring&& translationUnitFileName,
std::shared_ptr<CxxName> parent
);
virtual NameHierarchy toNameHierarchy() const;
private:
std::string m_translationUnitFileName;
std::wstring m_translationUnitFileName;
};
#endif // CXX_FUNCTION_DECL_NAME_H
@@ -7,30 +7,30 @@ std::shared_ptr<CxxTypeName> CxxTypeName::makeUnsolvedIfNull(std::shared_ptr<Cxx
return name;
}
return std::make_shared<CxxTypeName>(
"unsolved-type", std::vector<std::string>()
L"unsolved-type", std::vector<std::wstring>()
);
}
CxxTypeName::Modifier::Modifier(std::string&& symbol)
CxxTypeName::Modifier::Modifier(std::wstring&& symbol)
: symbol(std::move(symbol))
{
}
//CxxTypeName::CxxTypeName(const std::string& name, const std::vector<std::string>& templateArguments)
//CxxTypeName::CxxTypeName(const std::wstring& name, const std::vector<std::wstring>& templateArguments)
// : m_name(name)
// , m_templateArguments(templateArguments)
//{
//}
CxxTypeName::CxxTypeName(std::string&& name, std::vector<std::string>&& templateArguments)
CxxTypeName::CxxTypeName(std::wstring&& name, std::vector<std::wstring>&& templateArguments)
: m_name(std::move(name))
, m_templateArguments(std::move(templateArguments))
{
}
//CxxTypeName::CxxTypeName(
// const std::string& name,
// const std::vector<std::string>& templateArguments,
// const std::wstring& name,
// const std::vector<std::wstring>& templateArguments,
// std::shared_ptr<CxxName> parent
//)
// : CxxName(parent)
@@ -40,8 +40,8 @@ CxxTypeName::CxxTypeName(std::string&& name, std::vector<std::string>&& template
//}
CxxTypeName::CxxTypeName(
std::string&& name,
std::vector<std::string>&& templateArguments,
std::wstring&& name,
std::vector<std::wstring>&& templateArguments,
std::shared_ptr<CxxName> parent
)
: CxxName(parent)
@@ -74,41 +74,41 @@ void CxxTypeName::addModifier(const Modifier& modifier)
m_modifiers.push_back(modifier);
}
std::string CxxTypeName::toString() const
std::wstring CxxTypeName::toString() const
{
std::string ret = "";
std::wstring ret = L"";
if (!m_qualifierFlags.empty())
{
ret += m_qualifierFlags.toString() + " ";
ret += m_qualifierFlags.toString() + L" ";
}
ret += toNameHierarchy().getQualifiedName();
for (const Modifier& modifier: m_modifiers)
{
ret += " " + modifier.symbol;
ret += L" " + modifier.symbol;
if (!modifier.qualifierFlags.empty())
{
ret += " " + modifier.qualifierFlags.toString();
ret += L" " + modifier.qualifierFlags.toString();
}
}
return ret;
}
std::string CxxTypeName::getTypeNameString() const
std::wstring CxxTypeName::getTypeNameString() const
{
std::string ret = m_name;
std::wstring ret = m_name;
if (!m_templateArguments.empty())
{
ret += "<";
ret += L"<";
for (size_t i = 0; i < m_templateArguments.size(); i++)
{
if (i != 0)
{
ret += ", ";
ret += L", ";
}
ret += m_templateArguments[i];
}
ret += ">";
ret += L">";
}
return ret;
}
+14 -14
View File
@@ -16,32 +16,32 @@ public:
struct Modifier
{
Modifier(std::string&& symbol);
std::string symbol;
Modifier(std::wstring&& symbol);
std::wstring symbol;
CxxQualifierFlags qualifierFlags;
};
// uncomment this constructor if required, but try to use the one using move constructors for the members
//CxxTypeName(
// const std::string& name,
// const std::vector<std::string>& templateArguments
// const std::wstring& name,
// const std::vector<std::wstring>& templateArguments
//);
CxxTypeName(
std::string&& name,
std::vector<std::string>&& templateArguments
std::wstring&& name,
std::vector<std::wstring>&& templateArguments
);
// uncomment this constructor if required, but try to use the one using move constructors for the members
//CxxTypeName(
// const std::string& name,
// const std::vector<std::string>& templateArguments,
// const std::wstring& name,
// const std::vector<std::wstring>& templateArguments,
// std::shared_ptr<CxxName> parent
//);
CxxTypeName(
std::string&& name,
std::vector<std::string>&& templateArguments,
std::wstring&& name,
std::vector<std::wstring>&& templateArguments,
std::shared_ptr<CxxName> parent
);
@@ -50,13 +50,13 @@ public:
void addQualifier(const CxxQualifierFlags::QualifierType qualifier);
void addModifier(const Modifier& modifier);
std::string toString() const;
std::wstring toString() const;
private:
std::string getTypeNameString() const;
std::wstring getTypeNameString() const;
std::string m_name;
std::vector<std::string> m_templateArguments;
std::wstring m_name;
std::vector<std::wstring> m_templateArguments;
CxxQualifierFlags m_qualifierFlags;
std::vector<Modifier> m_modifiers;
@@ -1,8 +1,8 @@
#include "data/parser/cxx/name/CxxVariableDeclName.h"
//CxxVariableDeclName::CxxVariableDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> typeName,
// bool isStatic
//)
@@ -13,8 +13,8 @@
//}
CxxVariableDeclName::CxxVariableDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> typeName,
bool isStatic
)
@@ -25,8 +25,8 @@ CxxVariableDeclName::CxxVariableDeclName(
}
//CxxVariableDeclName::CxxVariableDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> typeName,
// bool isStatic,
// std::shared_ptr<CxxName> parent
@@ -38,8 +38,8 @@ CxxVariableDeclName::CxxVariableDeclName(
//}
CxxVariableDeclName::CxxVariableDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> typeName,
bool isStatic,
std::shared_ptr<CxxName> parent
@@ -52,14 +52,14 @@ CxxVariableDeclName::CxxVariableDeclName(
NameHierarchy CxxVariableDeclName::toNameHierarchy() const
{
std::string signaturePrefix;
std::wstring signaturePrefix;
if (m_isStatic)
{
signaturePrefix += "static ";
signaturePrefix += L"static ";
}
signaturePrefix += CxxTypeName::makeUnsolvedIfNull(m_typeName)->toString();
const std::string signaturePostfix;
const std::wstring signaturePostfix;
NameHierarchy ret = CxxDeclName::toNameHierarchy();
std::shared_ptr<NameElement> nameElement = std::make_shared<NameElement>(
@@ -12,31 +12,31 @@ class CxxVariableDeclName: public CxxDeclName
public:
// uncomment this constructor if required, but try to use the one using move constructors for the members
//CxxVariableDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> typeName,
// bool isStatic
//);
CxxVariableDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> typeName,
bool isStatic
);
// uncomment this constructor if required, but try to use the one using move constructors for the members
//CxxVariableDeclName(
// const std::string& name,
// const std::vector<std::string>& templateParameterNames,
// const std::wstring& name,
// const std::vector<std::wstring>& templateParameterNames,
// std::shared_ptr<CxxTypeName> typeName,
// bool isStatic,
// std::shared_ptr<CxxName> parent
//);
CxxVariableDeclName(
std::string&& name,
std::vector<std::string>&& templateParameterNames,
std::wstring&& name,
std::vector<std::wstring>&& templateParameterNames,
std::shared_ptr<CxxTypeName> typeName,
bool isStatic,
std::shared_ptr<CxxName> parent

Some files were not shown because too many files have changed in this diff Show More