diff --git a/src/lib/component/controller/ActivationController.cpp b/src/lib/component/controller/ActivationController.cpp index a1d4b73e..1171ca37 100644 --- a/src/lib/component/controller/ActivationController.cpp +++ b/src/lib/component/controller/ActivationController.cpp @@ -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(); } diff --git a/src/lib/component/controller/BookmarkController.cpp b/src/lib/component/controller/BookmarkController.cpp index 227f55b8..3042e4b6 100644 --- a/src/lib/component/controller/BookmarkController.cpp +++ b/src/lib/component/controller/BookmarkController.cpp @@ -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 = 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) { - LOG_INFO_STREAM(<< "Attempting to activate Bookmark"); + LOG_INFO("Attempting to activate Bookmark"); if (std::shared_ptr edgeBookmark = std::dynamic_pointer_cast(bookmark)) { @@ -207,7 +207,7 @@ void BookmarkController::activateBookmark(const std::shared_ptr 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 = std::dynamic_pointer_cast(bookmark)) @@ -359,7 +359,7 @@ void BookmarkController::handleMessage(MessageShowErrors* message) clear(); } -std::vector BookmarkController::getActiveTokenDisplayNames() const +std::vector BookmarkController::getActiveTokenDisplayNames() const { if (m_activeEdgeIds.size() > 0) { @@ -371,9 +371,9 @@ std::vector BookmarkController::getActiveTokenDisplayNames() const } } -std::vector BookmarkController::getDisplayNamesForNodeId(Id nodeId) const +std::vector BookmarkController::getDisplayNamesForNodeId(Id nodeId) const { - return std::vector({ getNodeDisplayName(nodeId) }); + return std::vector({ getNodeDisplayName(nodeId) }); } std::vector BookmarkController::getAllBookmarkCategories() const @@ -428,7 +428,7 @@ bool BookmarkController::canCreateBookmark() const std::vector> BookmarkController::getAllBookmarks() const { - LOG_INFO_STREAM(<< "Retrieving all bookmarks"); + LOG_INFO("Retrieving all bookmarks"); std::vector> bookmarks; @@ -475,9 +475,9 @@ std::vector> BookmarkController::getBookmarks( return bookmarks; } -std::vector BookmarkController::getActiveNodeDisplayNames() const +std::vector BookmarkController::getActiveNodeDisplayNames() const { - std::vector names; + std::vector names; for (Id nodeId : m_activeNodeIds) { names.push_back(getNodeDisplayName(nodeId)); @@ -485,27 +485,27 @@ std::vector BookmarkController::getActiveNodeDisplayNames() const return names; } -std::vector BookmarkController::getActiveEdgeDisplayNames() const +std::vector BookmarkController::getActiveEdgeDisplayNames() const { - std::vector activeEdgeDisplayNames; + std::vector 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 a, bool BookmarkController::bookmarkNameCompare(const std::shared_ptr a, const std::shared_ptr 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); diff --git a/src/lib/component/controller/BookmarkController.h b/src/lib/component/controller/BookmarkController.h index 05be8c2c..88fad54c 100644 --- a/src/lib/component/controller/BookmarkController.h +++ b/src/lib/component/controller/BookmarkController.h @@ -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 getActiveTokenDisplayNames() const; - std::vector getDisplayNamesForNodeId(Id nodeId) const; + std::vector getActiveTokenDisplayNames() const; + std::vector getDisplayNamesForNodeId(Id nodeId) const; std::vector getAllBookmarkCategories() const; @@ -92,9 +92,9 @@ private: std::vector> getBookmarks( Bookmark::BookmarkFilter filter, Bookmark::BookmarkOrder order) const; - std::vector getActiveNodeDisplayNames() const; - std::vector getActiveEdgeDisplayNames() const; - std::string getNodeDisplayName(const Id id) const; + std::vector getActiveNodeDisplayNames() const; + std::vector getActiveEdgeDisplayNames() const; + std::wstring getNodeDisplayName(const Id id) const; std::vector> getFilteredBookmarks( const std::vector>& 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; diff --git a/src/lib/component/controller/CodeController.cpp b/src/lib/component/controller/CodeController.cpp index 0d162815..a11d1cd7 100644 --- a/src/lib/component/controller/CodeController.cpp +++ b/src/lib/component/controller/CodeController.cpp @@ -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 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 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 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); diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index b120e897..244648f9 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -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 matchedNodeIndices; size_t connectedNodeCount = 0; @@ -1197,7 +1197,7 @@ void GraphController::bundleNodesAndEdgesMatching( } std::shared_ptr GraphController::bundleNodesMatching( - std::list>& nodes, std::function matcher, const std::string& name + std::list>& nodes, std::function matcher, const std::wstring& name ){ std::vector>::iterator> matchedNodes; for (std::list>::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(); diff --git a/src/lib/component/controller/GraphController.h b/src/lib/component/controller/GraphController.h index f67b3da6..c11dd9cd 100644 --- a/src/lib/component/controller/GraphController.h +++ b/src/lib/component/controller/GraphController.h @@ -94,9 +94,9 @@ private: void bundleNodes(); void bundleNodesAndEdgesMatching( std::function matcher, size_t count, bool countConnectedNodes, - const std::string& name); + const std::wstring& name); std::shared_ptr bundleNodesMatching( - std::list>& nodes, std::function matcher, const std::string& name); + std::list>& nodes, std::function matcher, const std::wstring& name); std::shared_ptr bundleByType( std::list>& nodes, const NodeType& type, diff --git a/src/lib/component/controller/SearchController.cpp b/src/lib/component/controller/SearchController.cpp index 17878e71..37e49c9e 100644 --- a/src/lib/component/controller/SearchController.cpp +++ b/src/lib/component/controller/SearchController.cpp @@ -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()) diff --git a/src/lib/component/controller/helper/DummyNode.h b/src/lib/component/controller/helper/DummyNode.h index 1c96851b..5efa8861 100644 --- a/src/lib/component/controller/helper/DummyNode.h +++ b/src/lib/component/controller/helper/DummyNode.h @@ -352,7 +352,7 @@ public: // GraphNode const Node* data; - std::string name; + std::wstring name; bool active; bool connected; diff --git a/src/lib/component/controller/helper/ListLayouter.cpp b/src/lib/component/controller/helper/ListLayouter.cpp index 5026db2c..20534250 100644 --- a/src/lib/component/controller/helper/ListLayouter.cpp +++ b/src/lib/component/controller/helper/ListLayouter.cpp @@ -84,7 +84,7 @@ void ListLayouter::layoutList(std::vector>& nodes) } else if (textNode->name.size() == 1) { - textNode->name += ".."; + textNode->name += L".."; } nodes.insert(nodes.begin() + i, textNode); diff --git a/src/lib/component/controller/helper/TrailLayouter.cpp b/src/lib/component/controller/helper/TrailLayouter.cpp index 7453fbc8..e69e0717 100644 --- a/src/lib/component/controller/helper/TrailLayouter.cpp +++ b/src/lib/component/controller/helper/TrailLayouter.cpp @@ -273,7 +273,7 @@ void TrailLayouter::addVirtualNodes() { std::shared_ptr virtualNode = std::make_shared(); virtualNode->id = 0; - virtualNode->name = ""; + virtualNode->name = L""; 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; diff --git a/src/lib/component/controller/helper/TrailLayouter.h b/src/lib/component/controller/helper/TrailLayouter.h index deb277dd..24c26aed 100644 --- a/src/lib/component/controller/helper/TrailLayouter.h +++ b/src/lib/component/controller/helper/TrailLayouter.h @@ -35,7 +35,7 @@ private: { Id id; int level; - std::string name; + std::wstring name; Vec2i pos; Vec2i size; diff --git a/src/lib/component/view/BookmarkView.h b/src/lib/component/view/BookmarkView.h index 74725b21..993e8604 100644 --- a/src/lib/component/view/BookmarkView.h +++ b/src/lib/component/view/BookmarkView.h @@ -28,7 +28,7 @@ public: virtual void displayBookmarkEditor( std::shared_ptr bookmark, const std::vector& categories) = 0; virtual void displayBookmarkCreator( - const std::vector& names, const std::vector& categories, Id nodeId) = 0; + const std::vector& names, const std::vector& categories, Id nodeId) = 0; virtual void enableDisplayBookmarks(bool enable) = 0; virtual bool bookmarkBrowserIsVisible() const = 0; diff --git a/src/lib/component/view/DialogView.cpp b/src/lib/component/view/DialogView.cpp index ec7e1141..e38fe5a2 100644 --- a/src/lib/component/view/DialogView.cpp +++ b/src/lib/component/view/DialogView.cpp @@ -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) { } diff --git a/src/lib/component/view/DialogView.h b/src/lib/component/view/DialogView.h index 96fdd84d..55755900 100644 --- a/src/lib/component/view/DialogView.h +++ b/src/lib/component/view/DialogView.h @@ -25,7 +25,7 @@ public: virtual void startIndexingDialog( Project* project, const std::vector& 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); diff --git a/src/lib/component/view/GraphViewStyle.cpp b/src/lib/component/view/GraphViewStyle.cpp index 4506c767..49d0133d 100644 --- a/src/lib/component/view/GraphViewStyle.cpp +++ b/src/lib/component/view/GraphViewStyle.cpp @@ -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: diff --git a/src/lib/data/NodeType.cpp b/src/lib/data/NodeType.cpp index 954a22dc..07252853 100644 --- a/src/lib/data/NodeType.cpp +++ b/src/lib/data/NodeType.cpp @@ -181,41 +181,41 @@ Tree NodeType::getOverviewBundleTree() const switch (m_type) { case NodeType::NODE_FILE: - return Tree(BundleInfo("Files")); + return Tree(BundleInfo(L"Files")); case NodeType::NODE_MACRO: - return Tree(BundleInfo("Macros")); + return Tree(BundleInfo(L"Macros")); case NodeType::NODE_NAMESPACE: { - Tree tree(BundleInfo("Namespaces")); + Tree tree(BundleInfo(L"Namespaces")); tree.children.push_back(Tree(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("Packages")); + return Tree(BundleInfo(L"Packages")); case NodeType::NODE_CLASS: - return Tree(BundleInfo("Classes")); + return Tree(BundleInfo(L"Classes")); case NodeType::NODE_INTERFACE: - return Tree(BundleInfo("Interfaces")); + return Tree(BundleInfo(L"Interfaces")); case NodeType::NODE_STRUCT: - return Tree(BundleInfo("Structs")); + return Tree(BundleInfo(L"Structs")); case NodeType::NODE_FUNCTION: - return Tree(BundleInfo("Functions")); + return Tree(BundleInfo(L"Functions")); case NodeType::NODE_GLOBAL_VARIABLE: - return Tree(BundleInfo("Global Variables")); + return Tree(BundleInfo(L"Global Variables")); case NodeType::NODE_TYPE: - return Tree(BundleInfo("Types")); + return Tree(BundleInfo(L"Types")); case NodeType::NODE_TYPEDEF: - return Tree(BundleInfo("Typedefs")); + return Tree(BundleInfo(L"Typedefs")); case NodeType::NODE_ENUM: - return Tree(BundleInfo("Enums")); + return Tree(BundleInfo(L"Enums")); case NodeType::NODE_UNION: - return Tree(BundleInfo("Unions")); + return Tree(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; diff --git a/src/lib/data/NodeType.h b/src/lib/data/NodeType.h index 5efe9f97..42525c59 100644 --- a/src/lib/data/NodeType.h +++ b/src/lib/data/NodeType.h @@ -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 nameMatcher, std::string bundleName) + BundleInfo(std::function nameMatcher, std::wstring bundleName) : nameMatcher(nameMatcher) , bundleName(bundleName) {} @@ -71,8 +71,8 @@ public: return bundleName.size() > 0; } - std::function nameMatcher = nullptr; - std::string bundleName; + std::function nameMatcher = nullptr; + std::wstring bundleName; }; static std::vector 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; diff --git a/src/lib/data/access/StorageAccess.h b/src/lib/data/access/StorageAccess.h index f7a9dfea..2cdf612b 100644 --- a/src/lib/data/access/StorageAccess.h +++ b/src/lib/data/access/StorageAccess.h @@ -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; diff --git a/src/lib/data/access/StorageAccessProxy.cpp b/src/lib/data/access/StorageAccessProxy.cpp index 91855e6a..bd73ca3d 100644 --- a/src/lib/data/access/StorageAccessProxy.cpp +++ b/src/lib/data/access/StorageAccessProxy.cpp @@ -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()) { diff --git a/src/lib/data/access/StorageAccessProxy.h b/src/lib/data/access/StorageAccessProxy.h index d5ba09b2..75967a2b 100644 --- a/src/lib/data/access/StorageAccessProxy.h +++ b/src/lib/data/access/StorageAccessProxy.h @@ -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 diff --git a/src/lib/data/bookmark/Bookmark.cpp b/src/lib/data/bookmark/Bookmark.cpp index 4cfc7204..72f42741 100644 --- a/src/lib/data/bookmark/Bookmark.cpp +++ b/src/lib/data/bookmark/Bookmark.cpp @@ -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; } diff --git a/src/lib/data/bookmark/Bookmark.h b/src/lib/data/bookmark/Bookmark.h index 71c91d80..ab72fc39 100644 --- a/src/lib/data/bookmark/Bookmark.h +++ b/src/lib/data/bookmark/Bookmark.h @@ -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; diff --git a/src/lib/data/bookmark/BookmarkCategory.cpp b/src/lib/data/bookmark/BookmarkCategory.cpp index cd0ee1b3..3c5c27c6 100644 --- a/src/lib/data/bookmark/BookmarkCategory.cpp +++ b/src/lib/data/bookmark/BookmarkCategory.cpp @@ -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; } diff --git a/src/lib/data/bookmark/BookmarkCategory.h b/src/lib/data/bookmark/BookmarkCategory.h index 207f7c4d..35e2e095 100644 --- a/src/lib/data/bookmark/BookmarkCategory.h +++ b/src/lib/data/bookmark/BookmarkCategory.h @@ -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 diff --git a/src/lib/data/bookmark/EdgeBookmark.cpp b/src/lib/data/bookmark/EdgeBookmark.cpp index d1be3e9c..e2727972 100644 --- a/src/lib/data/bookmark/EdgeBookmark.cpp +++ b/src/lib/data/bookmark/EdgeBookmark.cpp @@ -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) diff --git a/src/lib/data/bookmark/EdgeBookmark.h b/src/lib/data/bookmark/EdgeBookmark.h index 9ec79cd2..6fb8db92 100644 --- a/src/lib/data/bookmark/EdgeBookmark.h +++ b/src/lib/data/bookmark/EdgeBookmark.h @@ -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(); diff --git a/src/lib/data/bookmark/NodeBookmark.cpp b/src/lib/data/bookmark/NodeBookmark.cpp index b332be4f..d803f27e 100644 --- a/src/lib/data/bookmark/NodeBookmark.cpp +++ b/src/lib/data/bookmark/NodeBookmark.cpp @@ -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) diff --git a/src/lib/data/bookmark/NodeBookmark.h b/src/lib/data/bookmark/NodeBookmark.h index d23e8e64..518bff43 100644 --- a/src/lib/data/bookmark/NodeBookmark.h +++ b/src/lib/data/bookmark/NodeBookmark.h @@ -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(); diff --git a/src/lib/data/graph/Edge.cpp b/src/lib/data/graph/Edge.cpp index 6b8db45a..3f47979d 100644 --- a/src/lib/data/graph/Edge.cpp +++ b/src/lib/data/graph/Edge.cpp @@ -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 co { if (getComponent()) { - 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()) { - 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_ptrgetName() << "\" -> \"" + m_to->getName() << "\""; + std::wstringstream str; + str << L"[" << getId() << L"] " << getReadableTypeString() << L": \"" << m_from->getName() << L"\" -> \"" + m_to->getName() << L"\""; TokenComponentAggregation* aggregation = getComponent(); 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; diff --git a/src/lib/data/graph/Edge.h b/src/lib/data/graph/Edge.h index e72d0a46..fc4eb3f1 100644 --- a/src/lib/data/graph/Edge.h +++ b/src/lib/data/graph/Edge.h @@ -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 component); void addComponentInheritanceChain(std::shared_ptr 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 diff --git a/src/lib/data/graph/Graph.cpp b/src/lib/data/graph/Graph.cpp index e5f9787e..5f9b57ec 100644 --- a/src/lib/data/graph/Graph.cpp +++ b/src/lib/data/graph/Graph.cpp @@ -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; diff --git a/src/lib/data/graph/Graph.h b/src/lib/data/graph/Graph.h index c3574678..4a9b5cf8 100644 --- a/src/lib/data/graph/Graph.h +++ b/src/lib/data/graph/Graph.h @@ -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 diff --git a/src/lib/data/graph/Node.cpp b/src/lib/data/graph/Node.cpp index 5e35864c..0e19d3db 100644 --- a/src/lib/data/graph/Node.cpp +++ b/src/lib/data/graph/Node.cpp @@ -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 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(); if (access) { - str << " " << access->getAccessString(); + str << L" " << access->getAccessString(); } if (getComponent()) { - str << " static"; + str << L" static"; } if (getComponent()) { - 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; diff --git a/src/lib/data/graph/Node.h b/src/lib/data/graph/Node.h index 791a7f32..f19ea9c7 100644 --- a/src/lib/data/graph/Node.h +++ b/src/lib/data/graph/Node.h @@ -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 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 component); @@ -77,8 +77,8 @@ public: void addComponentAccess(std::shared_ptr 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 diff --git a/src/lib/data/graph/Token.h b/src/lib/data/graph/Token.h index 2e3518d3..c9b42d22 100644 --- a/src/lib/data/graph/Token.h +++ b/src/lib/data/graph/Token.h @@ -30,7 +30,7 @@ public: std::shared_ptr removeComponent(); // Logging. - virtual std::string getReadableTypeString() const = 0; + virtual std::wstring getReadableTypeString() const = 0; protected: Token(const Token& other); diff --git a/src/lib/data/graph/token_component/TokenComponentAccess.cpp b/src/lib/data/graph/token_component/TokenComponentAccess.cpp index ed265d89..73460bb0 100644 --- a/src/lib/data/graph/token_component/TokenComponentAccess.cpp +++ b/src/lib/data/graph/token_component/TokenComponentAccess.cpp @@ -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); } diff --git a/src/lib/data/graph/token_component/TokenComponentAccess.h b/src/lib/data/graph/token_component/TokenComponentAccess.h index 5bc4a523..769de850 100644 --- a/src/lib/data/graph/token_component/TokenComponentAccess.h +++ b/src/lib/data/graph/token_component/TokenComponentAccess.h @@ -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 copy() const; AccessKind getAccess() const; - std::string getAccessString() const; + std::wstring getAccessString() const; private: const AccessKind m_access; diff --git a/src/lib/data/indexer/TaskBuildIndex.cpp b/src/lib/data/indexer/TaskBuildIndex.cpp index 0de5d4e9..977ece48 100644 --- a/src/lib/data/indexer/TaskBuildIndex.cpp +++ b/src/lib/data/indexer/TaskBuildIndex.cpp @@ -142,9 +142,9 @@ void TaskBuildIndex::doExit(std::shared_ptr 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 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()) ); } diff --git a/src/lib/data/indexer/interprocess/InterprocessIndexer.cpp b/src/lib/data/indexer/interprocess/InterprocessIndexer.cpp index f87efe10..0ccb2777 100644 --- a/src/lib/data/indexer/interprocess/InterprocessIndexer.cpp +++ b/src/lib/data/indexer/interprocess/InterprocessIndexer.cpp @@ -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 indexer = IndexerFactory::getInstance()->createCompositeIndexerForAllRegisteredModules(); while (std::shared_ptr 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) { diff --git a/src/lib/data/indexer/interprocess/InterprocessIndexingStatusManager.cpp b/src/lib/data/indexer/interprocess/InterprocessIndexingStatusManager.cpp index 896d332c..e73b4b30 100644 --- a/src/lib/data/indexer/interprocess/InterprocessIndexingStatusManager.cpp +++ b/src/lib/data/indexer/interprocess/InterprocessIndexingStatusManager.cpp @@ -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(getProcessId(), str)).first; it->second = str; @@ -125,7 +126,7 @@ std::vector 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 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 InterprocessIndexingStatusManager::getCrashedSourceFilePat { for (SharedMemory::Map::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 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 fileP std::set 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())); } } diff --git a/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp b/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp index 0b82034f..fbb9a3bc 100644 --- a/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp +++ b/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp @@ -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 SharedIndexerCommand::getIndexedPaths() const @@ -132,7 +133,7 @@ std::set 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& indexedPath { m_indexedPaths.clear(); - for (std::set::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 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& excludedPa { m_excludedPaths.clear(); - for (std::set::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& 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 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 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& 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 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& 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); } } diff --git a/src/lib/data/indexer/interprocess/shared_types/SharedStorageTypes.h b/src/lib/data/indexer/interprocess/shared_types/SharedStorageTypes.h index 3a304077..5762aa03 100644 --- a/src/lib/data/indexer/interprocess/shared_types/SharedStorageTypes.h +++ b/src/lib/data/indexer/interprocess/shared_types/SharedStorageTypes.h @@ -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 diff --git a/src/lib/data/name/NameDelimiterType.cpp b/src/lib/data/name/NameDelimiterType.cpp index e6855a6f..eb88d567 100644 --- a/src/lib/data/name/NameDelimiterType.cpp +++ b/src/lib/data/name/NameDelimiterType.cpp @@ -2,23 +2,23 @@ #include -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 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; } diff --git a/src/lib/data/name/NameDelimiterType.h b/src/lib/data/name/NameDelimiterType.h index dad02a78..8ffa0f89 100644 --- a/src/lib/data/name/NameDelimiterType.h +++ b/src/lib/data/name/NameDelimiterType.h @@ -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 diff --git a/src/lib/data/name/NameElement.cpp b/src/lib/data/name/NameElement.cpp index 3b10462a..5f3e0680 100644 --- a/src/lib/data/name/NameElement.cpp +++ b/src/lib/data/name/NameElement.cpp @@ -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 serializedElements = utility::splitToVector(serialized, "\tp"); + std::vector 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); } diff --git a/src/lib/data/name/NameElement.h b/src/lib/data/name/NameElement.h index 2b9aea67..d0248815 100644 --- a/src/lib/data/name/NameElement.h +++ b/src/lib/data/name/NameElement.h @@ -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; }; diff --git a/src/lib/data/name/NameHierarchy.cpp b/src/lib/data/name/NameHierarchy.cpp index 08957050..cafc0c7d 100644 --- a/src/lib/data/name/NameHierarchy.cpp +++ b/src/lib/data/name/NameHierarchy.cpp @@ -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 serializedNameAndMetaElements = utility::splitToVector(serializedName, "\tm"); + std::vector 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 serializedNameElements = utility::splitToVector(serializedNameAndMetaElements[1], "\tn"); + std::vector serializedNameElements = utility::splitToVector(serializedNameAndMetaElements[1], L"\tn"); for (size_t i = 0; i < serializedNameElements.size(); i++) { - std::vector nameParts = utility::splitToVector(serializedNameElements[i], "\ts"); + std::vector 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(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(name)); } -NameHierarchy::NameHierarchy(const std::vector& names, const NameDelimiterType delimiter) +NameHierarchy::NameHierarchy(const std::vector& names, const NameDelimiterType delimiter) : m_delimiter(delimiter) { - for (const std::string& name : names) + for (const std::wstring& name : names) { push(std::make_shared(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 diff --git a/src/lib/data/name/NameHierarchy.h b/src/lib/data/name/NameHierarchy.h index e9602ed7..8b3a3d76 100644 --- a/src/lib/data/name/NameHierarchy.h +++ b/src/lib/data/name/NameHierarchy.h @@ -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& names, const NameDelimiterType delimiter); + NameHierarchy(const std::wstring& name, const NameDelimiterType delimiter); + NameHierarchy(const std::vector& 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; diff --git a/src/lib/data/parser/ParserClient.cpp b/src/lib/data/parser/ParserClient.cpp index c75ad7ec..aad12bc7 100644 --- a/src/lib/data/parser/ParserClient.cpp +++ b/src/lib/data/parser/ParserClient.cpp @@ -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); diff --git a/src/lib/data/parser/ParserClient.h b/src/lib/data/parser/ParserClient.h index 1ff98a46..071aaf45 100644 --- a/src/lib/data/parser/ParserClient.h +++ b/src/lib/data/parser/ParserClient.h @@ -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; }; diff --git a/src/lib/data/parser/ParserClientImpl.cpp b/src/lib/data/parser/ParserClientImpl.cpp index 1d218afa..22f50aa2 100644 --- a/src/lib/data/parser/ParserClientImpl.cpp +++ b/src/lib/data/parser/ParserClientImpl.cpp @@ -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 )); } diff --git a/src/lib/data/parser/ParserClientImpl.h b/src/lib/data/parser/ParserClientImpl.h index 68234299..61c9a110 100644 --- a/src/lib/data/parser/ParserClientImpl.h +++ b/src/lib/data/parser/ParserClientImpl.h @@ -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 m_storage; diff --git a/src/lib/data/parser/TaskParseWrapper.cpp b/src/lib/data/parser/TaskParseWrapper.cpp index 7f891948..b99444f5 100644 --- a/src/lib/data/parser/TaskParseWrapper.cpp +++ b/src/lib/data/parser/TaskParseWrapper.cpp @@ -22,7 +22,7 @@ void TaskParseWrapper::doEnter(std::shared_ptr blackboard) if (std::shared_ptr dialogView = Application::getInstance()->getDialogView()) { dialogView->hideDialogs(false); - dialogView->updateIndexingDialog(0, 0, sourceFileCount, ""); + dialogView->updateIndexingDialog(0, 0, sourceFileCount, FilePath()); } m_start = utility::durationStart(); diff --git a/src/lib/data/storage/IntermediateStorage.cpp b/src/lib/data/storage/IntermediateStorage.cpp index 60ac93bf..17a32434 100644 --- a/src/lib/data/storage/IntermediateStorage.cpp +++ b/src/lib/data/storage/IntermediateStorage.cpp @@ -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 errorFileNames; + std::set 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::iterator it = m_nodesIndex.find(serialized); + const std::wstring serialized = serialize(nodeData); + std::unordered_map::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::const_iterator it = m_edgesIndex.find(serialized); + const std::wstring serialized = serialize(edgeData); + std::unordered_map::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::const_iterator it = m_localSymbols.find(serialized); + const std::wstring serialized = serialize(localSymbolData); + std::unordered_map::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::const_iterator it = m_sourceLocations.find(serialized); + const std::wstring serialized = serialize(sourceLocationData); + std::unordered_map::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 callback) const { - for (std::unordered_map::const_iterator it = m_localSymbols.begin(); + for (std::unordered_map::const_iterator it = m_localSymbols.begin(); it != m_localSymbols.end(); it++) { callback(it->second); @@ -267,7 +265,7 @@ void IntermediateStorage::forEachLocalSymbol(std::function callback) const { - for (std::unordered_map::const_iterator it = m_sourceLocations.begin(); + for (std::unordered_map::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) ); } diff --git a/src/lib/data/storage/IntermediateStorage.h b/src/lib/data/storage/IntermediateStorage.h index b79ee635..647155fd 100644 --- a/src/lib/data/storage/IntermediateStorage.h +++ b/src/lib/data/storage/IntermediateStorage.h @@ -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 m_nodesIndex; + std::unordered_map m_nodesIndex; std::vector m_nodes; - std::unordered_set m_serializedFiles; // this is used to prevent duplicates (unique) + std::unordered_set m_serializedFiles; // this is used to prevent duplicates (unique) std::vector m_files; std::vector m_symbols; - std::unordered_map m_edgesIndex; + std::unordered_map m_edgesIndex; std::vector m_edges; - std::unordered_map m_localSymbols; + std::unordered_map m_localSymbols; - std::unordered_map m_sourceLocations; + std::unordered_map m_sourceLocations; - std::unordered_set m_serializedOccurrences; // this is used to prevent duplicates (unique) + std::unordered_set m_serializedOccurrences; // this is used to prevent duplicates (unique) std::vector m_occurrences; - std::unordered_set m_serializedComponentAccesses; // this is used to prevent duplicates (unique) + std::unordered_set m_serializedComponentAccesses; // this is used to prevent duplicates (unique) std::vector m_componentAccesses; - std::unordered_set m_serializedCommentLocations; // this is used to prevent duplicates (unique) + std::unordered_set m_serializedCommentLocations; // this is used to prevent duplicates (unique) std::vector m_commentLocations; - std::unordered_set m_serializedErrors; // this is used to prevent duplicates (unique) + std::unordered_set m_serializedErrors; // this is used to prevent duplicates (unique) std::vector m_errors; Id m_nextId; diff --git a/src/lib/data/storage/PersistentStorage.cpp b/src/lib/data/storage/PersistentStorage.cpp index 33804aff..bbc8dcbc 100644 --- a/src/lib/data/storage/PersistentStorage.cpp +++ b/src/lib/data/storage/PersistentStorage.cpp @@ -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 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 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 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 PersistentStorage::getFileInfosForFilePaths(const std::vector& filePaths) const @@ -1477,7 +1477,7 @@ std::shared_ptr PersistentStorage::getErrorSourceLocat LOCATION_ERROR, locationId, std::vector(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 PersistentStorage::getAllEdgeBookmarks() const std::vector edgeBookmarks; - UnorderedCache nodeIdCache( - [&](const std::string& serializedNodeName) + UnorderedCache 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( - 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(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 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( 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(FilePath("main.cpp"), true, true); + snippet.locationFile = std::make_shared(FilePath(L"main.cpp"), true, true); snippet.locationFile->addSourceLocation( LOCATION_LOCAL_SYMBOL, 0, std::vector(1, id), 1, 1, 1, snippet.code.size()); @@ -2182,7 +2182,7 @@ void PersistentStorage::addNodesToGraph(const std::vector& 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(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. diff --git a/src/lib/data/storage/PersistentStorage.h b/src/lib/data/storage/PersistentStorage.h index 901de018..5f5acf05 100644 --- a/src/lib/data/storage/PersistentStorage.h +++ b/src/lib/data/storage/PersistentStorage.h @@ -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; diff --git a/src/lib/data/storage/sqlite/SqliteBookmarkStorage.cpp b/src/lib/data/storage/sqlite/SqliteBookmarkStorage.cpp index b5adf77b..5e283d78 100644 --- a/src/lib/data/storage/sqlite/SqliteBookmarkStorage.cpp +++ b/src/lib/data/storage/sqlite/SqliteBookmarkStorage.cpp @@ -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 SqliteBookmarkStorage::getAllBookmarkedEdges( return doGetAll(""); } -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 SqliteBookmarkStorage::getAllBookmarkCatego return doGetAll(""); } -StorageBookmarkCategory SqliteBookmarkStorage::getBookmarkCategoryByName(const std::string& name) const +StorageBookmarkCategory SqliteBookmarkStorage::getBookmarkCategoryByName(const std::wstring& name) const { - return doGetFirst("WHERE name == '" + name + "'"); + return doGetFirst("WHERE name == '" + utility::encodeToUtf8(name) + "'"); } void SqliteBookmarkStorage::removeBookmarkCategory(Id id) @@ -260,7 +261,7 @@ std::vector SqliteBookmarkStorage::doGetAll SqliteBookmarkStorage::doGetAll(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 SqliteBookmarkStorage::doGetAll SqliteBookmarkStorage::doGetAll getAllBookmarkedNodes() const; std::vector 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 getAllBookmarkCategories() const; - StorageBookmarkCategory getBookmarkCategoryByName(const std::string& name) const; + StorageBookmarkCategory getBookmarkCategoryByName(const std::wstring& name) const; private: static const size_t s_storageVersion; diff --git a/src/lib/data/storage/sqlite/SqliteIndexStorage.cpp b/src/lib/data/storage/sqlite/SqliteIndexStorage.cpp index 821c8603..656846ae 100644 --- a/src/lib/data/storage/sqlite/SqliteIndexStorage.cpp +++ b/src/lib/data/storage/sqlite/SqliteIndexStorage.cpp @@ -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("WHERE name == '" + name + "'"); + return doGetFirst("WHERE name == '" + utility::encodeToUtf8(name) + "'"); } -StorageFile SqliteIndexStorage::getFileByPath(const std::string& filePath) const +StorageFile SqliteIndexStorage::getFileByPath(const std::wstring& filePath) const { - return doGetFirst("WHERE file.path == '" + filePath + "'"); + return doGetFirst("WHERE file.path == '" + utility::encodeToUtf8(filePath) + "'"); } std::vector SqliteIndexStorage::getFilesByPaths(const std::vector& filePaths) const @@ -604,7 +605,7 @@ std::shared_ptr SqliteIndexStorage::getFileContentById(Id fileId) co return TextAccess::createFromString(""); } -std::shared_ptr SqliteIndexStorage::getFileContentByPath(const std::string& filePath) const +std::shared_ptr SqliteIndexStorage::getFileContentByPath(const std::wstring& filePath) const { try { @@ -612,7 +613,7 @@ std::shared_ptr 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 SqliteIndexStorage::getSourceLocationsForFil { std::shared_ptr ret = std::make_shared(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 SqliteIndexStorage::getComponentAccessesByNo std::vector SqliteIndexStorage::getCommentLocationsInFile(const FilePath& filePath) const { - Id fileNodeId = getFileByPath(filePath.str()).id; + Id fileNodeId = getFileByPath(filePath.wstr()).id; return doGetAll("WHERE file_node_id == " + std::to_string(fileNodeId)); } @@ -1090,7 +1091,7 @@ std::vector SqliteIndexStorage::doGetAll(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 SqliteIndexStorage::doGetAll(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 SqliteIndexStorage::doGetAll 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 SqliteIndexStorage::doGetAll(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++; } diff --git a/src/lib/data/storage/sqlite/SqliteIndexStorage.h b/src/lib/data/storage/sqlite/SqliteIndexStorage.h index a0fdefec..d637ef22 100644 --- a/src/lib/data/storage/sqlite/SqliteIndexStorage.h +++ b/src/lib/data/storage/sqlite/SqliteIndexStorage.h @@ -75,14 +75,14 @@ public: std::vector getEdgesByTargetsType(const std::vector& 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 getFilesByPaths(const std::vector& filePaths) const; - std::shared_ptr getFileContentByPath(const std::string& filePath) const; + std::shared_ptr getFileContentByPath(const std::wstring& filePath) const; std::shared_ptr getFileContentById(Id fileId) const; void setFileComplete(bool complete, Id fileId); diff --git a/src/lib/data/storage/type/StorageBookmark.h b/src/lib/data/storage/type/StorageBookmark.h index ef7f2d3f..c37071ca 100644 --- a/src/lib/data/storage/type/StorageBookmark.h +++ b/src/lib/data/storage/type/StorageBookmark.h @@ -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 ) diff --git a/src/lib/data/storage/type/StorageBookmarkCategory.h b/src/lib/data/storage/type/StorageBookmarkCategory.h index b83e1c09..398116f4 100644 --- a/src/lib/data/storage/type/StorageBookmarkCategory.h +++ b/src/lib/data/storage/type/StorageBookmarkCategory.h @@ -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) {} diff --git a/src/lib/data/storage/type/StorageBookmarkedEdge.h b/src/lib/data/storage/type/StorageBookmarkedEdge.h index 904c748b..84202127 100644 --- a/src/lib/data/storage/type/StorageBookmarkedEdge.h +++ b/src/lib/data/storage/type/StorageBookmarkedEdge.h @@ -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 ) diff --git a/src/lib/data/storage/type/StorageBookmarkedNode.h b/src/lib/data/storage/type/StorageBookmarkedNode.h index 8a016ea6..26a50a9e 100644 --- a/src/lib/data/storage/type/StorageBookmarkedNode.h +++ b/src/lib/data/storage/type/StorageBookmarkedNode.h @@ -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) diff --git a/src/lib/data/storage/type/StorageError.h b/src/lib/data/storage/type/StorageError.h index 788c4db4..45a92a14 100644 --- a/src/lib/data/storage/type/StorageError.h +++ b/src/lib/data/storage/type/StorageError.h @@ -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, diff --git a/src/lib/data/storage/type/StorageFile.h b/src/lib/data/storage/type/StorageFile.h index b77dce51..e6e50a52 100644 --- a/src/lib/data/storage/type/StorageFile.h +++ b/src/lib/data/storage/type/StorageFile.h @@ -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; }; diff --git a/src/lib/data/storage/type/StorageLocalSymbol.h b/src/lib/data/storage/type/StorageLocalSymbol.h index d6cf33ea..3ea58fbb 100644 --- a/src/lib/data/storage/type/StorageLocalSymbol.h +++ b/src/lib/data/storage/type/StorageLocalSymbol.h @@ -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) {} diff --git a/src/lib/data/storage/type/StorageNode.h b/src/lib/data/storage/type/StorageNode.h index 72a809d8..138041c3 100644 --- a/src/lib/data/storage/type/StorageNode.h +++ b/src/lib/data/storage/type/StorageNode.h @@ -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) {} diff --git a/src/lib/settings/ColorScheme.cpp b/src/lib/settings/ColorScheme.cpp index 9604ca7d..350b408b 100644 --- a/src/lib/settings/ColorScheme.cpp +++ b/src/lib/settings/ColorScheme.cpp @@ -1,5 +1,7 @@ #include "settings/ColorScheme.h" +#include "utility/utilityString.h" + std::shared_ptr ColorScheme::s_instance; std::shared_ptr 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 diff --git a/src/lib/utility/logging/ConsoleLogger.cpp b/src/lib/utility/logging/ConsoleLogger.cpp index ba6507e5..495528d8 100644 --- a/src/lib/utility/logging/ConsoleLogger.cpp +++ b/src/lib/utility/logging/ConsoleLogger.cpp @@ -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; } diff --git a/src/lib/utility/logging/FileLogger.cpp b/src/lib/utility/logging/FileLogger.cpp index 4bb63749..09a2d2b0 100644 --- a/src/lib/utility/logging/FileLogger.cpp +++ b/src/lib/utility/logging/FileLogger.cpp @@ -5,6 +5,7 @@ #include #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++; diff --git a/src/lib/utility/logging/LogManager.cpp b/src/lib/utility/logging/LogManager.cpp index 611faef0..0f47476b 100644 --- a/src/lib/utility/logging/LogManager.cpp +++ b/src/lib/utility/logging/LogManager.cpp @@ -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::s_instance; LogManager::LogManager() diff --git a/src/lib/utility/logging/LogManagerImplementation.cpp b/src/lib/utility/logging/LogManagerImplementation.cpp index 5a431cdf..7dd76151 100644 --- a/src/lib/utility/logging/LogManagerImplementation.cpp +++ b/src/lib/utility/logging/LogManagerImplementation.cpp @@ -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 diff --git a/src/lib/utility/logging/LogManagerImplementation.h b/src/lib/utility/logging/LogManagerImplementation.h index 52097e53..f001e9ed 100644 --- a/src/lib/utility/logging/LogManagerImplementation.h +++ b/src/lib/utility/logging/LogManagerImplementation.h @@ -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 diff --git a/src/lib/utility/logging/LogMessage.h b/src/lib/utility/logging/LogMessage.h index 05c0564d..dbea6ea5 100644 --- a/src/lib/utility/logging/LogMessage.h +++ b/src/lib/utility/logging/LogMessage.h @@ -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; diff --git a/src/lib/utility/messaging/type/MessageActivateEdge.h b/src/lib/utility/messaging/type/MessageActivateEdge.h index a8775b38..1bd93a65 100644 --- a/src/lib/utility/messaging/type/MessageActivateEdge.h +++ b/src/lib/utility/messaging/type/MessageActivateEdge.h @@ -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 { @@ -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 diff --git a/src/lib/utility/messaging/type/MessageActivateTrailEdge.h b/src/lib/utility/messaging/type/MessageActivateTrailEdge.h index 8cfb79dc..44d75a43 100644 --- a/src/lib/utility/messaging/type/MessageActivateTrailEdge.h +++ b/src/lib/utility/messaging/type/MessageActivateTrailEdge.h @@ -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 { @@ -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 diff --git a/src/lib/utility/utility.h b/src/lib/utility/utility.h index 04bba2c8..4e926826 100644 --- a/src/lib/utility/utility.h +++ b/src/lib/utility/utility.h @@ -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 utility::toStrings(const std::vector v; for (const FilePath& t : d) { - v.push_back(t.str()); + v.push_back(utility::encodeToUtf8(t.wstr())); } return v; } diff --git a/src/lib/utility/utilityString.cpp b/src/lib/utility/utilityString.cpp index fa825150..46ed7df2 100644 --- a/src/lib/utility/utilityString.cpp +++ b/src/lib/utility/utilityString.cpp @@ -61,6 +61,16 @@ namespace utility return split>(str, delimiter); } + std::vector splitToVector(const std::wstring& str, wchar_t delimiter) + { + return split>(str, std::wstring(1, delimiter)); + } + + std::vector splitToVector(const std::wstring& str, const std::wstring& delimiter) + { + return split>(str, delimiter); + } + std::string join(const std::deque& list, char delimiter) { return join >(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); diff --git a/src/lib/utility/utilityString.h b/src/lib/utility/utilityString.h index 463d97a4..424df661 100644 --- a/src/lib/utility/utilityString.h +++ b/src/lib/utility/utilityString.h @@ -21,6 +21,8 @@ namespace utility std::deque split(const std::string& str, const std::string& delimiter); std::vector splitToVector(const std::string& str, char delimiter); std::vector splitToVector(const std::string& str, const std::string& delimiter); + std::vector splitToVector(const std::wstring& str, wchar_t delimiter); + std::vector splitToVector(const std::wstring& str, const std::wstring& delimiter); template 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 ContainerType split(const std::string& str, const std::string& delimiter) diff --git a/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.cpp b/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.cpp index 206191cb..29a17d9e 100644 --- a/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.cpp +++ b/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.cpp @@ -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::const_iterator it = m_map.find(lowercasePath); + std::unordered_map::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)); diff --git a/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.h b/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.h index c6ec1c1e..1606bfc4 100644 --- a/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.h +++ b/src/lib_cxx/data/parser/cxx/CanonicalFilePathCache.h @@ -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 m_map; + std::unordered_map m_map; }; #endif // CANONICAL_FILE_PATH_CACHE_H diff --git a/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp b/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp index c5e40cb5..18670acf 100644 --- a/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxAstVisitor.cpp @@ -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([&](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())); } } diff --git a/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp b/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp index 6d159785..7d2a0def 100644 --- a/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxAstVisitorComponentIndexer.cpp @@ -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()->getContextName(NameHierarchy(loc.filePath.str(), NAME_DELIMITER_FILE)), + getAstVisitor()->getComponent()->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()->getContextName(NameHierarchy(loc.filePath.str(), NAME_DELIMITER_FILE)), + getAstVisitor()->getComponent()->getContextName(NameHierarchy(loc.filePath.wstr(), NAME_DELIMITER_FILE)), loc ); } @@ -575,9 +575,9 @@ void CxxAstVisitorComponentIndexer::visitDeclRefExpr(clang::DeclRefExpr* s) (clang::isa(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())); } diff --git a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp index 84a7b78a..3b88d6aa 100644 --- a/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxDiagnosticConsumer.cpp @@ -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) ); diff --git a/src/lib_cxx/data/parser/cxx/CxxParser.cpp b/src/lib_cxx/data/parser/cxx/CxxParser.cpp index 0abe1e7f..0e760473 100644 --- a/src/lib_cxx/data/parser/cxx/CxxParser.cpp +++ b/src/lib_cxx/data/parser/cxx/CxxParser.cpp @@ -24,9 +24,9 @@ namespace return utility::concat({ "clang-tool", "-fsyntax-only" }, args); } - std::vector appendFilePath(const std::vector& args, llvm::StringRef fileName) + std::vector appendFilePath(const std::vector& 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 indexerCommand) void CxxParser::buildIndex(std::shared_ptr 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()); diff --git a/src/lib_cxx/data/parser/cxx/PreprocessorCallbacks.cpp b/src/lib_cxx/data/parser/cxx/PreprocessorCallbacks.cpp index 21c2bbe2..d699d07a 100644 --- a/src/lib_cxx/data/parser/cxx/PreprocessorCallbacks.cpp +++ b/src/lib_cxx/data/parser/cxx/PreprocessorCallbacks.cpp @@ -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, diff --git a/src/lib_cxx/data/parser/cxx/name/CxxDeclName.cpp b/src/lib_cxx/data/parser/cxx/name/CxxDeclName.cpp index 3e097dca..fc553a7c 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxDeclName.cpp +++ b/src/lib_cxx/data/parser/cxx/name/CxxDeclName.cpp @@ -1,20 +1,20 @@ #include "data/parser/cxx/name/CxxDeclName.h" -//CxxDeclName::CxxDeclName(const std::string& name, const std::vector& templateParameterNames) +//CxxDeclName::CxxDeclName(const std::wstring& name, const std::vector& templateParameterNames) // : m_name(name) // , m_templateParameterNames(templateParameterNames) //{ //} -CxxDeclName::CxxDeclName(std::string&& name, std::vector&& templateParameterNames) +CxxDeclName::CxxDeclName(std::wstring&& name, std::vector&& templateParameterNames) : m_name(std::move(name)) , m_templateParameterNames(std::move(templateParameterNames)) { } //CxxDeclName::CxxDeclName( -// const std::string& name, -// const std::vector& templateParameterNames, +// const std::wstring& name, +// const std::vector& templateParameterNames, // std::shared_ptr parent //) // : CxxName(parent) @@ -24,8 +24,8 @@ CxxDeclName::CxxDeclName(std::string&& name, std::vector&& template //} CxxDeclName::CxxDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr 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 CxxDeclName::getTemplateParameterNames() const +std::vector CxxDeclName::getTemplateParameterNames() const { return m_templateParameterNames; } diff --git a/src/lib_cxx/data/parser/cxx/name/CxxDeclName.h b/src/lib_cxx/data/parser/cxx/name/CxxDeclName.h index c3abc7d2..3f1d1db9 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxDeclName.h +++ b/src/lib_cxx/data/parser/cxx/name/CxxDeclName.h @@ -18,8 +18,8 @@ public: //); CxxDeclName( - std::string&& name, - std::vector&& templateParameterNames + std::wstring&& name, + std::vector&& 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&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr parent ); virtual NameHierarchy toNameHierarchy() const; - std::string getName() const; - std::vector getTemplateParameterNames() const; + std::wstring getName() const; + std::vector getTemplateParameterNames() const; private: - std::string m_name; - std::vector m_templateParameterNames; + std::wstring m_name; + std::vector m_templateParameterNames; }; #endif // CXX_DECL_NAME_H diff --git a/src/lib_cxx/data/parser/cxx/name/CxxFunctionDeclName.cpp b/src/lib_cxx/data/parser/cxx/name/CxxFunctionDeclName.cpp index 57c47799..7ca32c5a 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxFunctionDeclName.cpp +++ b/src/lib_cxx/data/parser/cxx/name/CxxFunctionDeclName.cpp @@ -1,8 +1,8 @@ #include "data/parser/cxx/name/CxxFunctionDeclName.h" //CxxFunctionDeclName::CxxFunctionDeclName( -// const std::string& name, -// const std::vector& templateParameterNames, +// const std::wstring& name, +// const std::vector& templateParameterNames, // std::shared_ptr returnTypeName, // const std::vector>& parameterTypeNames, // const bool isConst, @@ -17,8 +17,8 @@ //} CxxFunctionDeclName::CxxFunctionDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr returnTypeName, std::vector>&& parameterTypeNames, const bool isConst, @@ -33,8 +33,8 @@ CxxFunctionDeclName::CxxFunctionDeclName( } //CxxFunctionDeclName::CxxFunctionDeclName( -// const std::string& name, -// const std::vector& templateParameterNames, +// const std::wstring& name, +// const std::vector& templateParameterNames, // std::shared_ptr returnTypeName, // const std::vector>& parameterTypeNames, // const bool isConst, @@ -50,8 +50,8 @@ CxxFunctionDeclName::CxxFunctionDeclName( //} CxxFunctionDeclName::CxxFunctionDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr returnTypeName, std::vector>&& 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(); diff --git a/src/lib_cxx/data/parser/cxx/name/CxxFunctionDeclName.h b/src/lib_cxx/data/parser/cxx/name/CxxFunctionDeclName.h index 613f36d3..fbc2511f 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxFunctionDeclName.h +++ b/src/lib_cxx/data/parser/cxx/name/CxxFunctionDeclName.h @@ -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& templateParameterNames, + // const std::wstring& name, + // const std::vector& templateParameterNames, // std::shared_ptr returnTypeName, // const std::vector>& parameterTypeNames, // const bool isConst, @@ -21,8 +21,8 @@ public: //); CxxFunctionDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr returnTypeName, std::vector>&& 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& templateParameterNames, + // const std::wstring& name, + // const std::vector& templateParameterNames, // std::shared_ptr returnTypeName, // const std::vector>& parameterTypeNames, // const bool isConst, @@ -41,8 +41,8 @@ public: //); CxxFunctionDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr returnTypeName, std::vector>&& parameterTypeNames, const bool isConst, diff --git a/src/lib_cxx/data/parser/cxx/name/CxxQualifierFlags.cpp b/src/lib_cxx/data/parser/cxx/name/CxxQualifierFlags.cpp index 4522aec4..c192e121 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxQualifierFlags.cpp +++ b/src/lib_cxx/data/parser/cxx/name/CxxQualifierFlags.cpp @@ -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; } diff --git a/src/lib_cxx/data/parser/cxx/name/CxxQualifierFlags.h b/src/lib_cxx/data/parser/cxx/name/CxxQualifierFlags.h index f1c5e1a5..83eb5e28 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxQualifierFlags.h +++ b/src/lib_cxx/data/parser/cxx/name/CxxQualifierFlags.h @@ -19,7 +19,7 @@ public: void removeQualifier(QualifierType qualifier); bool empty() const; - std::string toString() const; + std::wstring toString() const; private: char m_flags; diff --git a/src/lib_cxx/data/parser/cxx/name/CxxStaticFunctionDeclName.cpp b/src/lib_cxx/data/parser/cxx/name/CxxStaticFunctionDeclName.cpp index 32e66064..6e7d7513 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxStaticFunctionDeclName.cpp +++ b/src/lib_cxx/data/parser/cxx/name/CxxStaticFunctionDeclName.cpp @@ -1,11 +1,11 @@ #include "data/parser/cxx/name/CxxStaticFunctionDeclName.h" //CxxStaticFunctionDeclName::CxxStaticFunctionDeclName( -// const std::string& name, -// const std::vector& templateParameterNames, +// const std::wstring& name, +// const std::vector& templateParameterNames, // std::shared_ptr returnTypeName, // const std::vector>& 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&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr returnTypeName, std::vector>&& 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& templateParameterNames, +// const std::wstring& name, +// const std::vector& templateParameterNames, // std::shared_ptr returnTypeName, // const std::vector>& parameterTypeNames, -// const std::string& translationUnitFileName, +// const std::wstring& translationUnitFileName, // std::shared_ptr parent //) // : CxxFunctionDeclName(name, templateParameterNames, returnTypeName, parameterTypeNames, false, true, parent) @@ -38,11 +38,11 @@ CxxStaticFunctionDeclName::CxxStaticFunctionDeclName( //} CxxStaticFunctionDeclName::CxxStaticFunctionDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr returnTypeName, std::vector>&& parameterTypeNames, - std::string&& translationUnitFileName, + std::wstring&& translationUnitFileName, std::shared_ptr 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 = std::make_shared( ret.back()->getName(), - NameElement::Signature(sig.getPrefix(), sig.getPostfix() + " (" + m_translationUnitFileName + ")") + NameElement::Signature(sig.getPrefix(), sig.getPostfix() + L" (" + m_translationUnitFileName + L")") ); ret.pop(); diff --git a/src/lib_cxx/data/parser/cxx/name/CxxStaticFunctionDeclName.h b/src/lib_cxx/data/parser/cxx/name/CxxStaticFunctionDeclName.h index 14c974eb..cf7548a5 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxStaticFunctionDeclName.h +++ b/src/lib_cxx/data/parser/cxx/name/CxxStaticFunctionDeclName.h @@ -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& templateParameterNames, + // const std::wstring& name, + // const std::vector& templateParameterNames, // std::shared_ptr returnTypeName, // const std::vector>& parameterTypeNames, - // const std::string& translationUnitFileName + // const std::wstring& translationUnitFileName //); CxxStaticFunctionDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr returnTypeName, std::vector>&& 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& templateParameterNames, + // const std::wstring& name, + // const std::vector& templateParameterNames, // std::shared_ptr returnTypeName, // const std::vector>& parameterTypeNames, - // const std::string& translationUnitFileName, + // const std::wstring& translationUnitFileName, // std::shared_ptr parent //); CxxStaticFunctionDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr returnTypeName, std::vector>&& parameterTypeNames, - std::string&& translationUnitFileName, + std::wstring&& translationUnitFileName, std::shared_ptr parent ); virtual NameHierarchy toNameHierarchy() const; private: - std::string m_translationUnitFileName; + std::wstring m_translationUnitFileName; }; #endif // CXX_FUNCTION_DECL_NAME_H diff --git a/src/lib_cxx/data/parser/cxx/name/CxxTypeName.cpp b/src/lib_cxx/data/parser/cxx/name/CxxTypeName.cpp index 2da0554c..b5ac460f 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxTypeName.cpp +++ b/src/lib_cxx/data/parser/cxx/name/CxxTypeName.cpp @@ -7,30 +7,30 @@ std::shared_ptr CxxTypeName::makeUnsolvedIfNull(std::shared_ptr( - "unsolved-type", std::vector() + L"unsolved-type", std::vector() ); } -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& templateArguments) +//CxxTypeName::CxxTypeName(const std::wstring& name, const std::vector& templateArguments) // : m_name(name) // , m_templateArguments(templateArguments) //{ //} -CxxTypeName::CxxTypeName(std::string&& name, std::vector&& templateArguments) +CxxTypeName::CxxTypeName(std::wstring&& name, std::vector&& templateArguments) : m_name(std::move(name)) , m_templateArguments(std::move(templateArguments)) { } //CxxTypeName::CxxTypeName( -// const std::string& name, -// const std::vector& templateArguments, +// const std::wstring& name, +// const std::vector& templateArguments, // std::shared_ptr parent //) // : CxxName(parent) @@ -40,8 +40,8 @@ CxxTypeName::CxxTypeName(std::string&& name, std::vector&& template //} CxxTypeName::CxxTypeName( - std::string&& name, - std::vector&& templateArguments, + std::wstring&& name, + std::vector&& templateArguments, std::shared_ptr 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; } diff --git a/src/lib_cxx/data/parser/cxx/name/CxxTypeName.h b/src/lib_cxx/data/parser/cxx/name/CxxTypeName.h index 3b77e7b0..9de16442 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxTypeName.h +++ b/src/lib_cxx/data/parser/cxx/name/CxxTypeName.h @@ -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& templateArguments + // const std::wstring& name, + // const std::vector& templateArguments //); CxxTypeName( - std::string&& name, - std::vector&& templateArguments + std::wstring&& name, + std::vector&& 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& templateArguments, + // const std::wstring& name, + // const std::vector& templateArguments, // std::shared_ptr parent //); CxxTypeName( - std::string&& name, - std::vector&& templateArguments, + std::wstring&& name, + std::vector&& templateArguments, std::shared_ptr 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 m_templateArguments; + std::wstring m_name; + std::vector m_templateArguments; CxxQualifierFlags m_qualifierFlags; std::vector m_modifiers; diff --git a/src/lib_cxx/data/parser/cxx/name/CxxVariableDeclName.cpp b/src/lib_cxx/data/parser/cxx/name/CxxVariableDeclName.cpp index 569252be..9234820d 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxVariableDeclName.cpp +++ b/src/lib_cxx/data/parser/cxx/name/CxxVariableDeclName.cpp @@ -1,8 +1,8 @@ #include "data/parser/cxx/name/CxxVariableDeclName.h" //CxxVariableDeclName::CxxVariableDeclName( -// const std::string& name, -// const std::vector& templateParameterNames, +// const std::wstring& name, +// const std::vector& templateParameterNames, // std::shared_ptr typeName, // bool isStatic //) @@ -13,8 +13,8 @@ //} CxxVariableDeclName::CxxVariableDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr typeName, bool isStatic ) @@ -25,8 +25,8 @@ CxxVariableDeclName::CxxVariableDeclName( } //CxxVariableDeclName::CxxVariableDeclName( -// const std::string& name, -// const std::vector& templateParameterNames, +// const std::wstring& name, +// const std::vector& templateParameterNames, // std::shared_ptr typeName, // bool isStatic, // std::shared_ptr parent @@ -38,8 +38,8 @@ CxxVariableDeclName::CxxVariableDeclName( //} CxxVariableDeclName::CxxVariableDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr typeName, bool isStatic, std::shared_ptr 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 = std::make_shared( diff --git a/src/lib_cxx/data/parser/cxx/name/CxxVariableDeclName.h b/src/lib_cxx/data/parser/cxx/name/CxxVariableDeclName.h index 4bacb866..b94689a6 100644 --- a/src/lib_cxx/data/parser/cxx/name/CxxVariableDeclName.h +++ b/src/lib_cxx/data/parser/cxx/name/CxxVariableDeclName.h @@ -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& templateParameterNames, + // const std::wstring& name, + // const std::vector& templateParameterNames, // std::shared_ptr typeName, // bool isStatic //); CxxVariableDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr 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& templateParameterNames, + // const std::wstring& name, + // const std::vector& templateParameterNames, // std::shared_ptr typeName, // bool isStatic, // std::shared_ptr parent //); CxxVariableDeclName( - std::string&& name, - std::vector&& templateParameterNames, + std::wstring&& name, + std::vector&& templateParameterNames, std::shared_ptr typeName, bool isStatic, std::shared_ptr parent diff --git a/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp b/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp index 60cb0047..cbbd49b2 100644 --- a/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp +++ b/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp @@ -49,7 +49,7 @@ std::shared_ptr CxxDeclNameResolver::getName(const clang::NamedDecl if (Calls.empty()) { declaration = nullptr; - declName = std::make_shared("unsolved-lambda", std::vector()); + declName = std::make_shared(L"unsolved-lambda", std::vector()); } else { @@ -170,12 +170,12 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named { ScopedSwitcher switcher(m_currentDecl, declaration); - std::string declNameString = declaration->getNameAsString(); + std::wstring declNameString = utility::decodeFromUtf8(declaration->getNameAsString()); if (const clang::TagDecl* tagDecl = clang::dyn_cast_or_null(declaration)) { if (const clang::TypedefNameDecl* typedefNameDecl = tagDecl->getTypedefNameForAnonDecl()) { - declNameString = typedefNameDecl->getNameAsString(); + declNameString = utility::decodeFromUtf8(typedefNameDecl->getNameAsString()); } } @@ -196,17 +196,17 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named } else if (declNameString.empty()) { - std::string symbolKindName = "class"; + std::wstring symbolKindName = L"class"; if (recordDecl->isStruct()) { - symbolKindName = "struct"; + symbolKindName = L"struct"; } else if (recordDecl->isUnion()) { - symbolKindName = "union"; + symbolKindName = L"union"; } - return std::make_shared(getNameForAnonymousSymbol(symbolKindName, declaration), std::vector()); + return std::make_shared(getNameForAnonymousSymbol(symbolKindName, declaration), std::vector()); } else if (const clang::CXXRecordDecl* cxxRecordDecl = clang::dyn_cast_or_null(declaration)) { @@ -226,7 +226,7 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named } else if (clang::isa(declaration)) { - std::vector templateArguments; + std::vector templateArguments; const clang::TemplateArgumentList& templateArgumentList = clang::dyn_cast(declaration)->getTemplateArgs(); for (size_t i = 0; i < templateArgumentList.size(); i++) { @@ -240,15 +240,15 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named { const clang::FunctionDecl* functionDecl = clang::dyn_cast(declaration); - std::string functionName = declNameString; - std::vector templateArguments; + std::wstring functionName = declNameString; + std::vector templateArguments; if ((clang::dyn_cast_or_null(functionDecl)) && (clang::dyn_cast_or_null(functionDecl)->getParent()->isLambda())) { const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager(); const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(clang::dyn_cast_or_null(functionDecl)->getParent()->getLocStart()); - functionName = "lambda at " + std::to_string(presumedBegin.getLine()) + ":" + std::to_string(presumedBegin.getColumn()); + functionName = L"lambda at " + std::to_wstring(presumedBegin.getLine()) + L":" + std::to_wstring(presumedBegin.getColumn()); } else if (clang::FunctionTemplateDecl* templateFunctionDeclaration = functionDecl->getDescribedFunctionTemplate()) { @@ -319,15 +319,15 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named CxxTypeNameResolver typenNameResolver(getCanonicalFilePathCache(), getIgnoredContextDecls()); typenNameResolver.ignoreContextDecl(fieldDecl); std::shared_ptr typeName = CxxTypeName::makeUnsolvedIfNull(typenNameResolver.getName(fieldDecl->getType())); - return std::make_shared(std::move(declNameString), std::vector(), typeName, false); + return std::make_shared(std::move(declNameString), std::vector(), typeName, false); } else if (clang::isa(declaration) && clang::dyn_cast(declaration)->isAnonymousNamespace()) { - return std::make_shared(getNameForAnonymousSymbol("namespace", declaration), std::vector()); + return std::make_shared(getNameForAnonymousSymbol(L"namespace", declaration), std::vector()); } else if (clang::isa(declaration) && declNameString.empty()) { - return std::make_shared(getNameForAnonymousSymbol("enum", declaration), std::vector()); + return std::make_shared(getNameForAnonymousSymbol(L"enum", declaration), std::vector()); } else if ( ( @@ -336,11 +336,11 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named clang::isa(declaration) ) && declNameString.empty()) { - return std::make_shared(getNameForAnonymousSymbol("template parameter", declaration), std::vector()); + return std::make_shared(getNameForAnonymousSymbol(L"template parameter", declaration), std::vector()); } else if (clang::isa(declaration) && declNameString.empty()) { - return std::make_shared(getNameForAnonymousSymbol("parameter", declaration), std::vector()); + return std::make_shared(getNameForAnonymousSymbol(L"parameter", declaration), std::vector()); } else if (clang::isa(declaration)) { @@ -362,7 +362,7 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named typenNameResolver.ignoreContextDecl(varDecl); std::shared_ptr typeName = CxxTypeName::makeUnsolvedIfNull(typenNameResolver.getName(varDecl->getType())); - std::string varName = declNameString; + std::wstring varName = declNameString; if (utility::getSymbolKind(varDecl) == SYMBOL_GLOBAL_VARIABLE && varDecl->getStorageClass() == clang::SC_Static) { @@ -370,7 +370,7 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named // may be generated (one for each translation unit) we add the name of the translation unit's source file. // If that global variable definition is const, we add the name of the (maybe header) file that variable is defined in instead. This causes // different instances of the variable that all MUST contain the same value to be merged into a single node in Sourcetrail. - std::string scopeFileName = ""; + std::wstring scopeFileName = L""; { if (varDecl->getType().isConstQualified()) { @@ -383,11 +383,11 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named } if (!scopeFileName.empty()) { - varName = declNameString + " (" + scopeFileName + ")"; + varName = declNameString + L" (" + scopeFileName + L")"; } } - std::vector templateParameterNames; + std::vector templateParameterNames; if (varDecl->getDescribedVarTemplate()) { const clang::VarTemplateDecl* templateDeclaration = varDecl->getDescribedVarTemplate(); @@ -423,53 +423,53 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named if (!declNameString.empty()) { - return std::make_shared(std::move(declNameString), std::vector(), std::shared_ptr()); + return std::make_shared(std::move(declNameString), std::vector(), std::shared_ptr()); } } // LOG_ERROR("could not resolve name of decl at: " + declaration->getLocation().printToString(sourceManager)); - return std::make_shared(getNameForAnonymousSymbol("symbol", declaration), std::vector()); + return std::make_shared(getNameForAnonymousSymbol(L"symbol", declaration), std::vector()); } -std::string CxxDeclNameResolver::getTranslationUnitMainFileName(const clang::Decl* declaration) +std::wstring CxxDeclNameResolver::getTranslationUnitMainFileName(const clang::Decl* declaration) { const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager(); clang::FileID fileId = sourceManager.getMainFileID(); if (fileId.isValid()) { const clang::FileEntry* fileEntry = sourceManager.getFileEntryForID(fileId); - return getCanonicalFilePathCache()->getCanonicalFilePath(fileEntry).fileName(); + return getCanonicalFilePathCache()->getCanonicalFilePath(fileEntry).wFileName(); } - return ""; + return L""; } -std::string CxxDeclNameResolver::getDeclarationFileName(const clang::Decl* declaration) +std::wstring CxxDeclNameResolver::getDeclarationFileName(const clang::Decl* declaration) { const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager(); const clang::FileEntry* fileEntry = sourceManager.getFileEntryForID(sourceManager.getFileID(declaration->getLocStart())); if (fileEntry != nullptr && fileEntry->isValid()) { - return getCanonicalFilePathCache()->getCanonicalFilePath(fileEntry).fileName(); + return getCanonicalFilePathCache()->getCanonicalFilePath(fileEntry).wFileName(); } - return getCanonicalFilePathCache()->getCanonicalFilePath(sourceManager.getPresumedLoc(declaration->getLocStart()).getFilename()).fileName(); + return getCanonicalFilePathCache()->getCanonicalFilePath(utility::decodeFromUtf8(sourceManager.getPresumedLoc(declaration->getLocStart()).getFilename())).wFileName(); } -std::string CxxDeclNameResolver::getNameForAnonymousSymbol(const std::string& symbolKindName, const clang::Decl* declaration) +std::wstring CxxDeclNameResolver::getNameForAnonymousSymbol(const std::wstring& symbolKindName, const clang::Decl* declaration) { const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager(); const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(declaration->getLocStart()); if (presumedBegin.isValid()) { - return "anonymous " + symbolKindName + - " (" + getDeclarationFileName(declaration) + "<" + std::to_string(presumedBegin.getLine()) + ":" + std::to_string(presumedBegin.getColumn()) + ">)"; + return L"anonymous " + symbolKindName + + L" (" + getDeclarationFileName(declaration) + L"<" + std::to_wstring(presumedBegin.getLine()) + L":" + std::to_wstring(presumedBegin.getColumn()) + L">)"; } - return "anonymous " + symbolKindName; + return L"anonymous " + symbolKindName; } -std::vector CxxDeclNameResolver::getTemplateParameterStrings(const clang::TemplateDecl* templateDecl) +std::vector CxxDeclNameResolver::getTemplateParameterStrings(const clang::TemplateDecl* templateDecl) { - std::vector templateParameterStrings; + std::vector templateParameterStrings; clang::TemplateParameterList* parameterList = templateDecl->getTemplateParameters(); for (size_t i = 0; i < parameterList->size(); i++) { @@ -478,13 +478,13 @@ std::vector CxxDeclNameResolver::getTemplateParameterStrings(const return templateParameterStrings; } -std::string CxxDeclNameResolver::getTemplateParameterString(const clang::NamedDecl* parameter) +std::wstring CxxDeclNameResolver::getTemplateParameterString(const clang::NamedDecl* parameter) { - std::string templateParameterTypeString; + std::wstring templateParameterTypeString; if (parameter) { - clang::Decl::Kind templateParameterKind = parameter->getKind(); + const clang::Decl::Kind templateParameterKind = parameter->getKind(); switch (templateParameterKind) { case clang::Decl::NonTypeTemplateParm: @@ -501,16 +501,16 @@ std::string CxxDeclNameResolver::getTemplateParameterString(const clang::NamedDe break; } - std::string parameterName = parameter->getName(); + std::wstring parameterName = utility::decodeFromUtf8(parameter->getName()); if (!parameterName.empty()) { - templateParameterTypeString += " " + parameterName; + templateParameterTypeString += L" " + parameterName; } } return templateParameterTypeString; } -std::string CxxDeclNameResolver::getTemplateParameterTypeString(const clang::NonTypeTemplateParmDecl* parameter) +std::wstring CxxDeclNameResolver::getTemplateParameterTypeString(const clang::NonTypeTemplateParmDecl* parameter) { CxxTypeNameResolver typeNameResolver(getCanonicalFilePathCache(), getIgnoredContextDecls()); @@ -523,49 +523,49 @@ std::string CxxDeclNameResolver::getTemplateParameterTypeString(const clang::Non typeNameResolver.ignoreContextDecl(m_currentDecl); } - std::string typeString; + std::wstring typeString; std::shared_ptr typeName = CxxTypeName::makeUnsolvedIfNull(typeNameResolver.getName(parameter->getType())); typeString = typeName->toString(); if (parameter->isTemplateParameterPack()) { - typeString += "..."; + typeString += L"..."; } return typeString; } -std::string CxxDeclNameResolver::getTemplateParameterTypeString(const clang::TemplateTypeParmDecl* parameter) +std::wstring CxxDeclNameResolver::getTemplateParameterTypeString(const clang::TemplateTypeParmDecl* parameter) { - std::string typeString = (parameter->wasDeclaredWithTypename() ? "typename" : "class"); + std::wstring typeString = (parameter->wasDeclaredWithTypename() ? L"typename" : L"class"); if (parameter->isTemplateParameterPack()) { - typeString += "..."; + typeString += L"..."; } return typeString; } -std::string CxxDeclNameResolver::getTemplateParameterTypeString(const clang::TemplateTemplateParmDecl* parameter) +std::wstring CxxDeclNameResolver::getTemplateParameterTypeString(const clang::TemplateTemplateParmDecl* parameter) { - std::string templateParameterTypeString = "template<"; + std::wstring templateParameterTypeString = L"template<"; clang::TemplateParameterList* parameterList = parameter->getTemplateParameters(); for (size_t i = 0; i < parameterList->size(); i++) { templateParameterTypeString += getTemplateParameterString(parameterList->getParam(i)); - templateParameterTypeString += (i < parameterList->size() - 1) ? ", " : ""; + templateParameterTypeString += (i < parameterList->size() - 1) ? L", " : L""; } - templateParameterTypeString += ">"; - templateParameterTypeString += " typename"; // TODO: what if template template parameter is defined with class keyword? + templateParameterTypeString += L">"; + templateParameterTypeString += L" typename"; // TODO: what if template template parameter is defined with class keyword? if (parameter->isTemplateParameterPack()) { - templateParameterTypeString += "..."; + templateParameterTypeString += L"..."; } return templateParameterTypeString; } -std::string CxxDeclNameResolver::getTemplateArgumentName(const clang::TemplateArgument& argument) +std::wstring CxxDeclNameResolver::getTemplateArgumentName(const clang::TemplateArgument& argument) { CxxTemplateArgumentNameResolver resolver(getCanonicalFilePathCache(), getIgnoredContextDecls()); return resolver.getTemplateArgumentName(argument); diff --git a/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.h b/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.h index b5d96bbb..c1bcd1d7 100644 --- a/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.h +++ b/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.h @@ -23,26 +23,26 @@ public: private: std::shared_ptr getContextName(const clang::DeclContext* declaration); std::shared_ptr getDeclName(const clang::NamedDecl* declaration); - std::string getTranslationUnitMainFileName(const clang::Decl* declaration); - std::string getDeclarationFileName(const clang::Decl* declaration); - std::string getNameForAnonymousSymbol(const std::string& symbolKindName, const clang::Decl* declaration); - std::vector getTemplateParameterStrings(const clang::TemplateDecl* templateDecl); + std::wstring getTranslationUnitMainFileName(const clang::Decl* declaration); + std::wstring getDeclarationFileName(const clang::Decl* declaration); + std::wstring getNameForAnonymousSymbol(const std::wstring& symbolKindName, const clang::Decl* declaration); + std::vector getTemplateParameterStrings(const clang::TemplateDecl* templateDecl); template - std::vector getTemplateParameterStringsOfPatrialSpecialitarion(const T* templateDecl); - std::string getTemplateParameterString(const clang::NamedDecl* parameter); - std::string getTemplateParameterTypeString(const clang::NonTypeTemplateParmDecl* parameter); - std::string getTemplateParameterTypeString(const clang::TemplateTypeParmDecl* parameter); - std::string getTemplateParameterTypeString(const clang::TemplateTemplateParmDecl* parameter); - std::string getTemplateArgumentName(const clang::TemplateArgument& argument); + std::vector getTemplateParameterStringsOfPatrialSpecialitarion(const T* templateDecl); + std::wstring getTemplateParameterString(const clang::NamedDecl* parameter); + std::wstring getTemplateParameterTypeString(const clang::NonTypeTemplateParmDecl* parameter); + std::wstring getTemplateParameterTypeString(const clang::TemplateTypeParmDecl* parameter); + std::wstring getTemplateParameterTypeString(const clang::TemplateTemplateParmDecl* parameter); + std::wstring getTemplateArgumentName(const clang::TemplateArgument& argument); const clang::NamedDecl* m_currentDecl; }; template -std::vector CxxDeclNameResolver::getTemplateParameterStringsOfPatrialSpecialitarion(const T* partialSpecializationDecl) +std::vector CxxDeclNameResolver::getTemplateParameterStringsOfPatrialSpecialitarion(const T* partialSpecializationDecl) { - std::vector templateParameterNames; + std::vector templateParameterNames; clang::TemplateParameterList* parameterList = partialSpecializationDecl->getTemplateParameters(); unsigned int currentParameterIndex = 0; diff --git a/src/lib_cxx/data/parser/cxx/name_resolver/CxxSpecifierNameResolver.cpp b/src/lib_cxx/data/parser/cxx/name_resolver/CxxSpecifierNameResolver.cpp index fb92e485..a023a647 100644 --- a/src/lib_cxx/data/parser/cxx/name_resolver/CxxSpecifierNameResolver.cpp +++ b/src/lib_cxx/data/parser/cxx/name_resolver/CxxSpecifierNameResolver.cpp @@ -6,6 +6,7 @@ #include "data/parser/cxx/name_resolver/CxxTypeNameResolver.h" #include "data/parser/cxx/name_resolver/CxxDeclNameResolver.h" +#include "utility/utilityString.h" CxxSpecifierNameResolver::CxxSpecifierNameResolver(std::shared_ptr canonicalFilePathCache) : CxxNameResolver(canonicalFilePathCache, std::vector()) @@ -36,7 +37,7 @@ std::shared_ptr CxxSpecifierNameResolver::getName(const clang::NestedNa case clang::NestedNameSpecifier::Identifier: { name = std::make_shared( - nestedNameSpecifier->getAsIdentifier()->getName(), std::vector() + utility::decodeFromUtf8(nestedNameSpecifier->getAsIdentifier()->getName()), std::vector() ); if (const clang::NestedNameSpecifier* prefix = nestedNameSpecifier->getPrefix()) diff --git a/src/lib_cxx/data/parser/cxx/name_resolver/CxxTemplateArgumentNameResolver.cpp b/src/lib_cxx/data/parser/cxx/name_resolver/CxxTemplateArgumentNameResolver.cpp index 012b15c4..c683a2a0 100644 --- a/src/lib_cxx/data/parser/cxx/name_resolver/CxxTemplateArgumentNameResolver.cpp +++ b/src/lib_cxx/data/parser/cxx/name_resolver/CxxTemplateArgumentNameResolver.cpp @@ -4,6 +4,7 @@ #include #include "data/parser/cxx/name_resolver/CxxTypeNameResolver.h" +#include "utility/utilityString.h" CxxTemplateArgumentNameResolver::CxxTemplateArgumentNameResolver(std::shared_ptr canonicalFilePathCache) : CxxNameResolver(canonicalFilePathCache, std::vector()) @@ -22,7 +23,7 @@ CxxTemplateArgumentNameResolver::~CxxTemplateArgumentNameResolver() { } -std::string CxxTemplateArgumentNameResolver::getTemplateArgumentName(const clang::TemplateArgument& argument) +std::wstring CxxTemplateArgumentNameResolver::getTemplateArgumentName(const clang::TemplateArgument& argument) { // This doesn't work correctly if the template argument is dependent. // If that's required: build name from depth and index of template arg. @@ -52,25 +53,25 @@ std::string CxxTemplateArgumentNameResolver::getTemplateArgumentName(const clang argument.print(pp, os); const std::string typeName = os.str(); - return typeName; + return utility::decodeFromUtf8(typeName); } case clang::TemplateArgument::Pack: { - std::string typeName = "<"; + std::wstring typeName = L"<"; llvm::ArrayRef pack = argument.getPackAsArray(); for (size_t i = 0; i < pack.size(); i++) { typeName += getTemplateArgumentName(pack[i]); if (i < pack.size() - 1) { - typeName += ", "; + typeName += L", "; } } - typeName += ">"; + typeName += L">"; return typeName; } } - return ""; + return L""; } diff --git a/src/lib_cxx/data/parser/cxx/name_resolver/CxxTemplateArgumentNameResolver.h b/src/lib_cxx/data/parser/cxx/name_resolver/CxxTemplateArgumentNameResolver.h index 4c4e473d..edd72086 100644 --- a/src/lib_cxx/data/parser/cxx/name_resolver/CxxTemplateArgumentNameResolver.h +++ b/src/lib_cxx/data/parser/cxx/name_resolver/CxxTemplateArgumentNameResolver.h @@ -17,7 +17,7 @@ public: ); virtual ~CxxTemplateArgumentNameResolver(); - std::string getTemplateArgumentName(const clang::TemplateArgument& argument); + std::wstring getTemplateArgumentName(const clang::TemplateArgument& argument); }; #endif // CXX_TEMPLATE_ARGUMENT_NAME_RESOLVER_H diff --git a/src/lib_cxx/data/parser/cxx/name_resolver/CxxTypeNameResolver.cpp b/src/lib_cxx/data/parser/cxx/name_resolver/CxxTypeNameResolver.cpp index 1b5ebf28..4b597b7b 100644 --- a/src/lib_cxx/data/parser/cxx/name_resolver/CxxTypeNameResolver.cpp +++ b/src/lib_cxx/data/parser/cxx/name_resolver/CxxTypeNameResolver.cpp @@ -8,6 +8,7 @@ #include "data/parser/cxx/name_resolver/CxxSpecifierNameResolver.h" #include "data/parser/cxx/name_resolver/CxxTemplateArgumentNameResolver.h" #include "utility/logging/logging.h" +#include "utility/utilityString.h" CxxTypeNameResolver::CxxTypeNameResolver(std::shared_ptr canonicalFilePathCache) : CxxNameResolver(canonicalFilePathCache, std::vector()) @@ -67,7 +68,7 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ { typeName = std::make_shared( declName->getName(), - std::vector(), + std::vector(), declName->getParent() ); } @@ -79,7 +80,7 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ typeName = getName(type->getPointeeType()); if (typeName) { - typeName->addModifier(CxxTypeName::Modifier("*")); + typeName->addModifier(CxxTypeName::Modifier(L"*")); } break; } @@ -91,7 +92,7 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ typeName = getName(clang::dyn_cast(type)->getElementType()); if (typeName) { - typeName->addModifier(CxxTypeName::Modifier("[]")); + typeName->addModifier(CxxTypeName::Modifier(L"[]")); } break; } @@ -100,7 +101,7 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ typeName = getName(type->getPointeeType()); if (typeName) { - typeName->addModifier(CxxTypeName::Modifier("&")); + typeName->addModifier(CxxTypeName::Modifier(L"&")); } break; } @@ -109,7 +110,7 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ typeName = getName(type->getPointeeType()); if (typeName) { - typeName->addModifier(CxxTypeName::Modifier("&&")); + typeName->addModifier(CxxTypeName::Modifier(L"&&")); } break; } @@ -140,7 +141,7 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ pp.Bool = true; // value "true": prints bool type as "bool" instead of "_Bool" typeName = std::make_shared( - type->getAs()->getName(pp), std::vector() + utility::decodeFromUtf8(type->getAs()->getName(pp)), std::vector() ); break; } @@ -168,7 +169,7 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ if (declName) { - std::vector templateArguments; + std::vector templateArguments; CxxTemplateArgumentNameResolver resolver(getCanonicalFilePathCache(), getIgnoredContextDecls()); resolver.ignoreContextDecl(templateSpecializationType->getTemplateName().getAsTemplateDecl()->getTemplatedDecl()); for (size_t i = 0; i < templateSpecializationType->getNumArgs(); i++) @@ -214,9 +215,10 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ CxxSpecifierNameResolver specifierNameResolver(getCanonicalFilePathCache(), getIgnoredContextDecls()); std::shared_ptr specifierName = specifierNameResolver.getName(dependentType->getQualifier()); - typeName = std::make_shared( - dependentType->getIdentifier()->getName().str(), std::vector(), specifierName + utility::decodeFromUtf8(dependentType->getIdentifier()->getName().str()), + std::vector(), + specifierName ); break; } @@ -227,7 +229,7 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ CxxSpecifierNameResolver specifierNameResolver(getCanonicalFilePathCache(), getIgnoredContextDecls()); std::shared_ptr specifierName = specifierNameResolver.getName(dependentType->getQualifier()); - std::vector templateArguments; + std::vector templateArguments; CxxTemplateArgumentNameResolver resolver(getCanonicalFilePathCache(), getIgnoredContextDecls()); for (size_t i = 0; i < dependentType->getNumArgs(); i++) { @@ -235,7 +237,9 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ } typeName = std::make_shared( - dependentType->getIdentifier()->getName().str(), std::move(templateArguments), specifierName + utility::decodeFromUtf8(dependentType->getIdentifier()->getName().str()), + std::move(templateArguments), + specifierName ); break; } @@ -254,7 +258,7 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ else { typeName = std::make_shared( - "auto", std::vector() + L"auto", std::vector() // TODO: can we actually resolve this case? would be great! ); } break; @@ -267,20 +271,20 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ case clang::Type::FunctionProto: { const clang::FunctionProtoType* protoType = clang::dyn_cast(type); - std::string nameString = CxxTypeName::makeUnsolvedIfNull(getName(protoType->getReturnType()))->toString(); - nameString += "("; + std::wstring nameString = CxxTypeName::makeUnsolvedIfNull(getName(protoType->getReturnType()))->toString(); + nameString += L"("; for (size_t i = 0; i < protoType->getNumParams(); i++) { if (i != 0) { - nameString += ", "; + nameString += L", "; } nameString += CxxTypeName::makeUnsolvedIfNull(getName(protoType->getParamType(i)))->toString(); } - nameString += ")"; + nameString += L")"; typeName = std::make_shared( - std::move(nameString), std::vector() + std::move(nameString), std::vector() ); break; } @@ -292,8 +296,8 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ } default: { - std::string typeClassName = type->getTypeClassName(); - LOG_INFO(std::string("Unhandled kind of type encountered: ") + typeClassName); + const std::string typeClassName = type->getTypeClassName(); + LOG_INFO("Unhandled kind of type encountered: " + typeClassName); clang::PrintingPolicy pp = clang::PrintingPolicy(clang::LangOptions()); pp.SuppressTagKeyword = true; // value "true": for a class A it prints "A" instead of "class A" pp.Bool = true; // value "true": prints bool type as "bool" instead of "_Bool" @@ -301,10 +305,10 @@ std::shared_ptr CxxTypeNameResolver::getName(const clang::Type* typ clang::SmallString<64> Buf; llvm::raw_svector_ostream StrOS(Buf); clang::QualType::print(type, clang::Qualifiers(), StrOS, pp, clang::Twine()); - std::string nameString = StrOS.str(); + std::wstring nameString = utility::decodeFromUtf8(StrOS.str()); typeName = std::make_shared( - std::move(nameString), std::vector() + std::move(nameString), std::vector() ); break; } diff --git a/src/lib_cxx/data/parser/cxx/utilityClang.cpp b/src/lib_cxx/data/parser/cxx/utilityClang.cpp index 69eb0994..cf4d18eb 100644 --- a/src/lib_cxx/data/parser/cxx/utilityClang.cpp +++ b/src/lib_cxx/data/parser/cxx/utilityClang.cpp @@ -4,6 +4,7 @@ #include #include "utility/file/FilePath.h" +#include "utility/utilityString.h" bool utility::isImplicit(const clang::Decl* d) { @@ -108,19 +109,19 @@ SymbolKind utility::getSymbolKind(const clang::VarDecl* d) return symbolKind; } -std::string utility::getFileNameOfFileEntry(const clang::FileEntry* entry) +std::wstring utility::getFileNameOfFileEntry(const clang::FileEntry* entry) { - std::string fileName = ""; + std::wstring fileName = L""; if (entry != nullptr && entry->isValid()) { - fileName = entry->tryGetRealPathName(); + fileName = utility::decodeFromUtf8(entry->tryGetRealPathName()); if (fileName.empty()) { - fileName = entry->getName(); + fileName = utility::decodeFromUtf8(entry->getName()); } else { - fileName = FilePath(entry->getName().str()).getParentDirectory().concatenate(FilePath(fileName).wFileName()).str(); + fileName = FilePath(utility::decodeFromUtf8(entry->getName().str())).getParentDirectory().concatenate(FilePath(fileName).wFileName()).wstr(); } } return fileName; diff --git a/src/lib_cxx/data/parser/cxx/utilityClang.h b/src/lib_cxx/data/parser/cxx/utilityClang.h index 6072ed34..fca5df73 100644 --- a/src/lib_cxx/data/parser/cxx/utilityClang.h +++ b/src/lib_cxx/data/parser/cxx/utilityClang.h @@ -14,7 +14,7 @@ namespace utility AccessKind convertAccessSpecifier(clang::AccessSpecifier access); SymbolKind convertTagKind(const clang::TagTypeKind tagKind); SymbolKind getSymbolKind(const clang::VarDecl* d); - std::string getFileNameOfFileEntry(const clang::FileEntry* entry); + std::wstring getFileNameOfFileEntry(const clang::FileEntry* entry); } template diff --git a/src/lib_gui/platform_includes/includesWindows.h b/src/lib_gui/platform_includes/includesWindows.h index 78f7c125..34fedcc3 100644 --- a/src/lib_gui/platform_includes/includesWindows.h +++ b/src/lib_gui/platform_includes/includesWindows.h @@ -24,18 +24,18 @@ void setupApp(int argc, char *argv[]) WCHAR path[MAX_PATH]; GetModuleFileNameW(hModule, path, MAX_PATH); - const std::wstring wPath(path); - std::string appPath = std::string(wPath.begin(), wPath.end()); + std::wstring appPath(path); - size_t pos = appPath.find_last_of("/"); - if (pos == std::string::npos) + size_t pos = appPath.find_last_of(L"/"); + if (pos == std::wstring::npos) { - pos = appPath.find_last_of("\\"); + pos = appPath.find_last_of(L"\\"); } - if (pos != std::string::npos) + if (pos != std::wstring::npos) { appPath = appPath.substr(0, pos + 1); } + AppPath::setAppPath(FilePath(appPath)); } { diff --git a/src/lib_gui/qt/element/QtBookmark.cpp b/src/lib_gui/qt/element/QtBookmark.cpp index 1de181a3..c6e89023 100644 --- a/src/lib_gui/qt/element/QtBookmark.cpp +++ b/src/lib_gui/qt/element/QtBookmark.cpp @@ -12,7 +12,7 @@ QtBookmark::QtBookmark(ControllerProxy* controllerProxy) : m_controllerProxy(controllerProxy) , m_treeWidgetItem(NULL) - , m_arrowImageName("arrow_line_down.png") + , m_arrowImageName(L"arrow_line_down.png") , m_hovered(false) , m_ignoreNextResize(false) { @@ -94,7 +94,7 @@ void QtBookmark::setBookmark(const std::shared_ptr bookmark) { m_bookmark = bookmark; - m_activateButton->setText(m_bookmark->getName().c_str()); + m_activateButton->setText(QString::fromStdWString(m_bookmark->getName())); if (m_bookmark->isValid() == false) { @@ -104,7 +104,7 @@ void QtBookmark::setBookmark(const std::shared_ptr bookmark) if (m_bookmark->getComment().length() > 0) { - m_comment->setText(m_bookmark->getComment().c_str()); + m_comment->setText(QString::fromStdWString(m_bookmark->getComment())); m_toggleCommentButton->show(); } else @@ -142,13 +142,13 @@ void QtBookmark::commentToggled() if (m_comment->isVisible() == false) { - m_arrowImageName = "arrow_line_up.png"; + m_arrowImageName = L"arrow_line_up.png"; m_comment->show(); m_comment->setMinimumHeight(m_comment->heightForWidth(m_comment->width())); } else { - m_arrowImageName = "arrow_line_down.png"; + m_arrowImageName = L"arrow_line_down.png"; m_comment->hide(); } @@ -170,7 +170,7 @@ void QtBookmark::resizeEvent(QResizeEvent* event) return; } - m_activateButton->setText(m_bookmark->getName().c_str()); + m_activateButton->setText(QString::fromStdWString(m_bookmark->getName())); QTimer::singleShot(10, this, &QtBookmark::elideButtonText); } @@ -226,12 +226,12 @@ void QtBookmark::deleteClicked() void QtBookmark::elideButtonText() { m_activateButton->setText(m_activateButton->fontMetrics().elidedText( - m_bookmark->getName().c_str(), Qt::ElideMiddle, m_activateButton->width() - 16)); + QString::fromStdWString(m_bookmark->getName()), Qt::ElideMiddle, m_activateButton->width() - 16)); } void QtBookmark::updateArrow() { - QPixmap pixmap((ResourcePaths::getGuiPath().str() + "bookmark_view/images/" + m_arrowImageName).c_str()); + QPixmap pixmap(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"bookmark_view/images/" + m_arrowImageName).wstr())); m_toggleCommentButton->setIcon(QIcon(utility::colorizePixmap(pixmap, m_hovered ? "#707070" : "black"))); } diff --git a/src/lib_gui/qt/element/QtBookmark.h b/src/lib_gui/qt/element/QtBookmark.h index 95697c22..d6bb5124 100644 --- a/src/lib_gui/qt/element/QtBookmark.h +++ b/src/lib_gui/qt/element/QtBookmark.h @@ -65,7 +65,7 @@ private: // (sizeHintChanged signal can't be emitted here...) QTreeWidgetItem* m_treeWidgetItem; - std::string m_arrowImageName; + std::wstring m_arrowImageName; bool m_hovered; bool m_ignoreNextResize; diff --git a/src/lib_gui/qt/element/QtBookmarkCategory.cpp b/src/lib_gui/qt/element/QtBookmarkCategory.cpp index 7af98bd0..19684159 100644 --- a/src/lib_gui/qt/element/QtBookmarkCategory.cpp +++ b/src/lib_gui/qt/element/QtBookmarkCategory.cpp @@ -54,14 +54,14 @@ QtBookmarkCategory::~QtBookmarkCategory() { } -void QtBookmarkCategory::setName(const std::string& name) +void QtBookmarkCategory::setName(const std::wstring& name) { - m_name->setText(name.c_str()); + m_name->setText(QString::fromStdWString(name)); } -std::string QtBookmarkCategory::getName() const +std::wstring QtBookmarkCategory::getName() const { - return m_name->text().toStdString(); + return m_name->text().toStdWString(); } void QtBookmarkCategory::setId(const Id id) diff --git a/src/lib_gui/qt/element/QtBookmarkCategory.h b/src/lib_gui/qt/element/QtBookmarkCategory.h index 0db1bbb0..6d04f774 100644 --- a/src/lib_gui/qt/element/QtBookmarkCategory.h +++ b/src/lib_gui/qt/element/QtBookmarkCategory.h @@ -20,8 +20,8 @@ public: QtBookmarkCategory(ControllerProxy* controllerProxy); ~QtBookmarkCategory(); - void setName(const std::string& name); - std::string getName() const; + void setName(const std::wstring& name); + std::wstring getName() const; void setId(const Id id); Id getId() const; diff --git a/src/lib_gui/qt/element/QtCodeArea.cpp b/src/lib_gui/qt/element/QtCodeArea.cpp index c2e03806..5317711c 100644 --- a/src/lib_gui/qt/element/QtCodeArea.cpp +++ b/src/lib_gui/qt/element/QtCodeArea.cpp @@ -579,8 +579,8 @@ void QtCodeArea::mouseMoveEvent(QMouseEvent* event) if (m_navigator->hasErrors() && annotations.size() == 1 && annotations[0]->tokenIds.size()) { - std::string errorMessage = m_navigator->getErrorMessageForId(*annotations[0]->tokenIds.begin()); - QToolTip::showText(event->globalPos(), QString::fromStdString(errorMessage)); + std::wstring errorMessage = m_navigator->getErrorMessageForId(*annotations[0]->tokenIds.begin()); + QToolTip::showText(event->globalPos(), QString::fromStdWString(errorMessage)); } } } diff --git a/src/lib_gui/qt/element/QtCodeNavigator.cpp b/src/lib_gui/qt/element/QtCodeNavigator.cpp index f224da71..6bda371f 100644 --- a/src/lib_gui/qt/element/QtCodeNavigator.cpp +++ b/src/lib_gui/qt/element/QtCodeNavigator.cpp @@ -329,7 +329,7 @@ void QtCodeNavigator::setFocusedTokenIds(const std::vector& focusedTokenIds) m_focusedTokenIds = std::set(focusedTokenIds.begin(), focusedTokenIds.end()); } -std::string QtCodeNavigator::getErrorMessageForId(Id errorId) const +std::wstring QtCodeNavigator::getErrorMessageForId(Id errorId) const { std::map::const_iterator it = m_errorInfos.find(errorId); @@ -338,7 +338,7 @@ std::string QtCodeNavigator::getErrorMessageForId(Id errorId) const return it->second.message; } - return ""; + return L""; } void QtCodeNavigator::setErrorInfos(const std::vector& errorInfos) @@ -362,7 +362,7 @@ size_t QtCodeNavigator::getFatalErrorCountForFile(const FilePath& filePath) cons for (const std::pair& p : m_errorInfos) { const ErrorInfo& error = p.second; - if (error.filePath == filePath && error.fatal) + if (error.filePath == filePath.wstr() && error.fatal) { fatalErrorCount++; } diff --git a/src/lib_gui/qt/element/QtCodeNavigator.h b/src/lib_gui/qt/element/QtCodeNavigator.h index 15062cf0..362a69b7 100644 --- a/src/lib_gui/qt/element/QtCodeNavigator.h +++ b/src/lib_gui/qt/element/QtCodeNavigator.h @@ -69,7 +69,7 @@ public: const std::set& getFocusedTokenIds() const; void setFocusedTokenIds(const std::vector& focusedTokenIds); - std::string getErrorMessageForId(Id errorId) const; + std::wstring getErrorMessageForId(Id errorId) const; void setErrorInfos(const std::vector& errorInfos); bool hasErrors() const; diff --git a/src/lib_gui/qt/element/QtSmartSearchBox.cpp b/src/lib_gui/qt/element/QtSmartSearchBox.cpp index 3ba0790d..a78b1424 100644 --- a/src/lib_gui/qt/element/QtSmartSearchBox.cpp +++ b/src/lib_gui/qt/element/QtSmartSearchBox.cpp @@ -194,7 +194,7 @@ bool QtSmartSearchBox::event(QEvent *event) } else if (m_highlightedMatch.hasChildren) { - setEditText((m_highlightedMatch.getFullName() + nameDelimiterTypeToString(m_highlightedMatch.delimiter)).c_str()); + setEditText((m_highlightedMatch.getFullName() + utility::encodeToUtf8(nameDelimiterTypeToString(m_highlightedMatch.delimiter))).c_str()); requestAutoCompletions(); } else @@ -302,7 +302,7 @@ void QtSmartSearchBox::keyPressEvent(QKeyEvent* event) } else { - const NameDelimiterType delimiter = detectDelimiterType(text().toStdString()); + const NameDelimiterType delimiter = detectDelimiterType(text().toStdWString()); std::vector names = utility::splitToVector(text().toStdString(), delimiter); if (names.back() == "") { diff --git a/src/lib_gui/qt/graphics/QtGraphicsView.cpp b/src/lib_gui/qt/graphics/QtGraphicsView.cpp index 15cd5f37..5caffcb7 100644 --- a/src/lib_gui/qt/graphics/QtGraphicsView.cpp +++ b/src/lib_gui/qt/graphics/QtGraphicsView.cpp @@ -327,7 +327,7 @@ void QtGraphicsView::wheelEvent(QWheelEvent* event) void QtGraphicsView::contextMenuEvent(QContextMenuEvent* event) { - m_clipboardNodeName = ""; + m_clipboardNodeName = L""; m_hideNodeId = 0; m_hideEdgeId = 0; m_bookmarkNodeId = 0; @@ -370,7 +370,7 @@ void QtGraphicsView::contextMenuEvent(QContextMenuEvent* event) m_hideEdgeAction->setEnabled(m_hideEdgeId); m_bookmarkNodeAction->setEnabled(m_bookmarkNodeId); - m_copyNodeNameAction->setEnabled(m_clipboardNodeName.size()); + m_copyNodeNameAction->setEnabled(!m_clipboardNodeName.empty()); QtContextMenu menu(event, this); @@ -496,7 +496,7 @@ void QtGraphicsView::exportGraph() void QtGraphicsView::copyNodeName() { - QApplication::clipboard()->setText(m_clipboardNodeName.c_str()); + QApplication::clipboard()->setText(QString::fromStdWString(m_clipboardNodeName)); } void QtGraphicsView::hideNode() diff --git a/src/lib_gui/qt/graphics/QtGraphicsView.h b/src/lib_gui/qt/graphics/QtGraphicsView.h index 5ed10023..72a166e2 100644 --- a/src/lib_gui/qt/graphics/QtGraphicsView.h +++ b/src/lib_gui/qt/graphics/QtGraphicsView.h @@ -84,7 +84,7 @@ private: bool m_right; bool m_shift; - std::string m_clipboardNodeName; + std::wstring m_clipboardNodeName; Id m_hideNodeId; Id m_hideEdgeId; Id m_bookmarkNodeId; diff --git a/src/lib_gui/qt/view/QtBookmarkView.cpp b/src/lib_gui/qt/view/QtBookmarkView.cpp index 4fff2c39..0abbc8ab 100644 --- a/src/lib_gui/qt/view/QtBookmarkView.cpp +++ b/src/lib_gui/qt/view/QtBookmarkView.cpp @@ -113,7 +113,7 @@ void QtBookmarkView::setCreateButtonState(const CreateButtonState& state) } void QtBookmarkView::displayBookmarkCreator( - const std::vector& names, const std::vector& categories, Id nodeId + const std::vector& names, const std::vector& categories, Id nodeId ){ m_onQtThread( [=]() @@ -124,7 +124,7 @@ void QtBookmarkView::displayBookmarkCreator( ); bookmarkCreator->setupBookmarkCreator(); - std::string displayName = ""; + std::wstring displayName = L""; for (unsigned int i = 0; i < names.size(); i++) { @@ -132,7 +132,7 @@ void QtBookmarkView::displayBookmarkCreator( if (i < names.size() - 1) { - displayName += "; "; + displayName += L"; "; } } diff --git a/src/lib_gui/qt/view/QtBookmarkView.h b/src/lib_gui/qt/view/QtBookmarkView.h index 273e9915..b1a7956a 100644 --- a/src/lib_gui/qt/view/QtBookmarkView.h +++ b/src/lib_gui/qt/view/QtBookmarkView.h @@ -29,7 +29,7 @@ public: virtual void setCreateButtonState(const CreateButtonState& state); virtual void displayBookmarkCreator( - const std::vector& names, const std::vector& categories, Id nodeId); + const std::vector& names, const std::vector& categories, Id nodeId); virtual void displayBookmarkEditor( std::shared_ptr bookmark, const std::vector& categories); diff --git a/src/lib_gui/qt/view/QtDialogView.cpp b/src/lib_gui/qt/view/QtDialogView.cpp index 5eb1bd79..f5feeb5b 100644 --- a/src/lib_gui/qt/view/QtDialogView.cpp +++ b/src/lib_gui/qt/view/QtDialogView.cpp @@ -197,7 +197,7 @@ void QtDialogView::startIndexingDialog( } void QtDialogView::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) { m_onQtThread( [=]() diff --git a/src/lib_gui/qt/view/QtDialogView.h b/src/lib_gui/qt/view/QtDialogView.h index d8b5cd04..23e0ccb6 100644 --- a/src/lib_gui/qt/view/QtDialogView.h +++ b/src/lib_gui/qt/view/QtDialogView.h @@ -38,7 +38,7 @@ public: virtual void startIndexingDialog( Project* project, const std::vector& enabledModes, const RefreshInfo& info) override; virtual void updateIndexingDialog( - size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, std::string sourcePath) override; + size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const FilePath& sourcePath) override; virtual void finishedIndexingDialog( size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo, bool interrupted) override; diff --git a/src/lib_gui/qt/view/QtErrorView.cpp b/src/lib_gui/qt/view/QtErrorView.cpp index 8299d987..47f4b992 100644 --- a/src/lib_gui/qt/view/QtErrorView.cpp +++ b/src/lib_gui/qt/view/QtErrorView.cpp @@ -330,10 +330,10 @@ void QtErrorView::addErrorToTable(const ErrorInfo& error) } m_model->item(rowNumber, COLUMN::TYPE)->setIcon(s_errorIcon); - m_model->setItem(rowNumber, COLUMN::MESSAGE, new QStandardItem(error.message.c_str())); + m_model->setItem(rowNumber, COLUMN::MESSAGE, new QStandardItem(QString::fromStdWString(error.message))); - m_model->setItem(rowNumber, COLUMN::FILE, new QStandardItem(error.filePath.str().c_str())); - m_model->item(rowNumber, COLUMN::FILE)->setToolTip(error.filePath.str().c_str()); + m_model->setItem(rowNumber, COLUMN::FILE, new QStandardItem(QString::fromStdWString(error.filePath))); + m_model->item(rowNumber, COLUMN::FILE)->setToolTip(QString::fromStdWString(error.filePath)); m_model->setItem(rowNumber, COLUMN::LINE, new QStandardItem(QString::number(error.lineNumber))); diff --git a/src/lib_gui/qt/view/graphElements/QtGraphEdge.cpp b/src/lib_gui/qt/view/graphElements/QtGraphEdge.cpp index 680e53d5..4ddc5011 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphEdge.cpp +++ b/src/lib_gui/qt/view/graphElements/QtGraphEdge.cpp @@ -302,7 +302,7 @@ void QtGraphEdge::focusIn() Edge::EdgeType type = (getData() ? getData()->getType() : Edge::EDGE_AGGREGATION); TooltipInfo info; - info.title = Edge::getReadableTypeString(type); + info.title = utility::encodeToUtf8(Edge::getReadableTypeString(type)); if (type == Edge::EDGE_AGGREGATION && m_direction == TokenComponentAggregation::DIRECTION_NONE) { diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp b/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp index 1aeca187..4bb5db1e 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp +++ b/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp @@ -182,14 +182,14 @@ void QtGraphNode::setMultipleActive(bool multipleActive) m_multipleActive = multipleActive; } -std::string QtGraphNode::getName() const +std::wstring QtGraphNode::getName() const { - return m_text->text().toStdString(); + return m_text->text().toStdWString(); } -void QtGraphNode::setName(const std::string& name) +void QtGraphNode::setName(const std::wstring& name) { - m_text->setText(QString::fromStdString(name)); + m_text->setText(QString::fromStdWString(name)); } void QtGraphNode::addComponent(const std::shared_ptr& component) @@ -458,7 +458,7 @@ void QtGraphNode::notifyEdgesAfterMove() void QtGraphNode::matchName(const std::string& query, std::vector* matchedNodes) { m_isActiveMatch = false; - std::string name = getName(); + std::string name = utility::encodeToUtf8(getName()); size_t pos = utility::toLowerCase(name).find(query); if (pos != std::string::npos) diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNode.h b/src/lib_gui/qt/view/graphElements/QtGraphNode.h index 8a64cdca..dab7b5d9 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNode.h +++ b/src/lib_gui/qt/view/graphElements/QtGraphNode.h @@ -64,8 +64,8 @@ public: void setIsActive(bool isActive); void setMultipleActive(bool multipleActive); - std::string getName() const; - void setName(const std::string& name); + std::wstring getName() const; + void setName(const std::wstring& name); void addComponent(const std::shared_ptr& component); diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNodeAccess.cpp b/src/lib_gui/qt/view/graphElements/QtGraphNodeAccess.cpp index f9324da8..f014b404 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNodeAccess.cpp +++ b/src/lib_gui/qt/view/graphElements/QtGraphNodeAccess.cpp @@ -17,28 +17,28 @@ QtGraphNodeAccess::QtGraphNodeAccess(AccessKind accessKind) , m_accessIcon(nullptr) , m_accessIconSize(16) { - std::string accessString = TokenComponentAccess::getAccessString(m_accessKind); + std::wstring accessString = TokenComponentAccess::getAccessString(m_accessKind); this->setName(accessString); m_text->hide(); - std::string iconFileName; + std::wstring iconFileName; switch (m_accessKind) { case ACCESS_PUBLIC: - iconFileName = "public"; + iconFileName = L"public"; break; case ACCESS_PROTECTED: - iconFileName = "protected"; + iconFileName = L"protected"; break; case ACCESS_PRIVATE: - iconFileName = "private"; + iconFileName = L"private"; break; case ACCESS_DEFAULT: - iconFileName = "default"; + iconFileName = L"default"; break; case ACCESS_TEMPLATE_PARAMETER: case ACCESS_TYPE_PARAMETER: - iconFileName = "template"; + iconFileName = L"template"; break; default: break; @@ -47,7 +47,7 @@ QtGraphNodeAccess::QtGraphNodeAccess(AccessKind accessKind) if (iconFileName.size() > 0) { QtDeviceScaledPixmap pixmap( - QString::fromStdString(ResourcePaths::getGuiPath().str() + "graph_view/images/" + iconFileName + ".png")); + QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"graph_view/images/" + iconFileName + L".png").wstr())); pixmap.scaleToHeight(m_accessIconSize); m_accessIcon = new QGraphicsPixmapItem(pixmap.pixmap(), this); diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.cpp b/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.cpp index af2ca601..1884f409 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.cpp +++ b/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.cpp @@ -9,7 +9,7 @@ #include "component/view/GraphViewStyle.h" #include "qt/graphics/QtCountCircleItem.h" -QtGraphNodeBundle::QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::string name) +QtGraphNodeBundle::QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::wstring name) : QtGraphNode() , m_tokenId(tokenId) , m_type(type) @@ -42,7 +42,7 @@ void QtGraphNodeBundle::onClick() { MessageGraphNodeBundleSplit( m_tokenId, - !m_type.isUnknownSymbol() && getName() != "Anonymous Namespaces", + !m_type.isUnknownSymbol() && getName() != L"Anonymous Namespaces", // TODO: move to language package !m_type.isUnknownSymbol() ).dispatch(); } diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.h b/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.h index 78b5d3cd..76c5509a 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.h +++ b/src/lib_gui/qt/view/graphElements/QtGraphNodeBundle.h @@ -11,7 +11,7 @@ class QtGraphNodeBundle { Q_OBJECT public: - QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::string name); + QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::wstring name); virtual ~QtGraphNodeBundle(); // QtGraphNode implementation diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNodeData.cpp b/src/lib_gui/qt/view/graphElements/QtGraphNodeData.cpp index ebf3326b..95926c3a 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNodeData.cpp +++ b/src/lib_gui/qt/view/graphElements/QtGraphNodeData.cpp @@ -9,7 +9,7 @@ #include "data/graph/token_component/TokenComponentFilePath.h" -QtGraphNodeData::QtGraphNodeData(const Node* data, const std::string& name, bool hasParent, bool childVisible, bool hasQualifier) +QtGraphNodeData::QtGraphNodeData(const Node* data, const std::wstring& name, bool hasParent, bool childVisible, bool hasQualifier) : m_data(data) , m_childVisible(childVisible) , m_hasQualifier(hasQualifier) @@ -59,7 +59,7 @@ void QtGraphNodeData::onClick() FilePath path = getFilePath(); MessageActivateNodes message; - message.addNode(m_data->getId(), path.empty() ? m_data->getNameHierarchy() : NameHierarchy(path.str(), NAME_DELIMITER_FILE)); + message.addNode(m_data->getId(), path.empty() ? m_data->getNameHierarchy() : NameHierarchy(path.wstr(), NAME_DELIMITER_FILE)); message.dispatch(); } diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNodeData.h b/src/lib_gui/qt/view/graphElements/QtGraphNodeData.h index e1d257fa..60c1e1c9 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNodeData.h +++ b/src/lib_gui/qt/view/graphElements/QtGraphNodeData.h @@ -10,7 +10,7 @@ class QtGraphNodeData { Q_OBJECT public: - QtGraphNodeData(const Node* data, const std::string& name, bool hasParent, bool childVisible, bool hasQualifier); + QtGraphNodeData(const Node* data, const std::wstring& name, bool hasParent, bool childVisible, bool hasQualifier); virtual ~QtGraphNodeData(); const Node* getData() const; diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNodeQualifier.cpp b/src/lib_gui/qt/view/graphElements/QtGraphNodeQualifier.cpp index b15dc72a..bd1180be 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNodeQualifier.cpp +++ b/src/lib_gui/qt/view/graphElements/QtGraphNodeQualifier.cpp @@ -27,7 +27,7 @@ QtGraphNodeQualifier::QtGraphNodeQualifier(const NameHierarchy& name) m_name = new QGraphicsSimpleTextItem(this); m_name->setFont(font); - m_name->setText(QString::fromStdString(name.getQualifiedName())); + m_name->setText(QString::fromStdWString(name.getQualifiedName())); } QtGraphNodeQualifier::~QtGraphNodeQualifier() diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNodeText.cpp b/src/lib_gui/qt/view/graphElements/QtGraphNodeText.cpp index 3cdacf1d..fa0e3e03 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNodeText.cpp +++ b/src/lib_gui/qt/view/graphElements/QtGraphNodeText.cpp @@ -1,6 +1,6 @@ #include "qt/view/graphElements/QtGraphNodeText.h" -QtGraphNodeText::QtGraphNodeText(const std::string& name) +QtGraphNodeText::QtGraphNodeText(const std::wstring& name) { setName(name); } diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNodeText.h b/src/lib_gui/qt/view/graphElements/QtGraphNodeText.h index 176ea815..da391bca 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNodeText.h +++ b/src/lib_gui/qt/view/graphElements/QtGraphNodeText.h @@ -8,7 +8,7 @@ class QtGraphNodeText { Q_OBJECT public: - QtGraphNodeText(const std::string& name); + QtGraphNodeText(const std::wstring& name); virtual ~QtGraphNodeText(); // QtGraphNode implementation diff --git a/src/lib_gui/qt/window/QtBookmarkBrowser.cpp b/src/lib_gui/qt/window/QtBookmarkBrowser.cpp index 804e86a7..971c9e47 100644 --- a/src/lib_gui/qt/window/QtBookmarkBrowser.cpp +++ b/src/lib_gui/qt/window/QtBookmarkBrowser.cpp @@ -131,7 +131,7 @@ void QtBookmarkBrowser::setBookmarks(const std::vector m_bookmarkTree->clear(); - std::map categoryNamesOrdered; + std::map categoryNamesOrdered; for (const std::shared_ptr& bookmark : bookmarks) { categoryNamesOrdered.emplace(bookmark->getCategory().getName(), bookmark->getCategory()); @@ -255,7 +255,7 @@ QTreeWidgetItem* QtBookmarkBrowser::findOrCreateTreeCategory(const BookmarkCateg { QTreeWidgetItem* item = m_bookmarkTree->topLevelItem(i); - if (item->whatsThis(0).toStdString() == category.getName()) + if (item->whatsThis(0).toStdWString() == category.getName()) { return item; } @@ -268,12 +268,12 @@ QTreeWidgetItem* QtBookmarkBrowser::findOrCreateTreeCategory(const BookmarkCateg } else { - categoryItem->setName("No Category"); + categoryItem->setName(L"No Category"); } categoryItem->setId(category.getId()); QTreeWidgetItem* newItem = new QTreeWidgetItem(m_bookmarkTree); - newItem->setWhatsThis(0, category.getName().c_str()); + newItem->setWhatsThis(0, QString::fromStdWString(category.getName())); categoryItem->setTreeWidgetItem(newItem); diff --git a/src/lib_gui/qt/window/QtBookmarkCreator.cpp b/src/lib_gui/qt/window/QtBookmarkCreator.cpp index 889c3e2e..f0c94d75 100644 --- a/src/lib_gui/qt/window/QtBookmarkCreator.cpp +++ b/src/lib_gui/qt/window/QtBookmarkCreator.cpp @@ -111,27 +111,27 @@ void QtBookmarkCreator::refreshStyle() ).c_str()); } -void QtBookmarkCreator::setDisplayName(const std::string& name) +void QtBookmarkCreator::setDisplayName(const std::wstring& name) { - m_displayName->setText(name.c_str()); + m_displayName->setText(QString::fromStdWString(name)); } -void QtBookmarkCreator::setComment(const std::string& comment) +void QtBookmarkCreator::setComment(const std::wstring& comment) { - m_commentBox->setText(comment.c_str()); + m_commentBox->setText(QString::fromStdWString(comment)); } void QtBookmarkCreator::setBookmarkCategories(const std::vector& categories) { for (unsigned int i = 0; i < categories.size(); i++) { - m_categoryBox->addItem(categories[i].getName().c_str()); + m_categoryBox->addItem(QString::fromStdWString(categories[i].getName())); } } void QtBookmarkCreator::setCurrentBookmarkCategory(const BookmarkCategory& category) { - int index = m_categoryBox->findText(category.getName().c_str()); + int index = m_categoryBox->findText(QString::fromStdWString(category.getName())); if (index > -1) { @@ -139,7 +139,7 @@ void QtBookmarkCreator::setCurrentBookmarkCategory(const BookmarkCategory& categ } else { - m_categoryBox->addItem(category.getName().c_str()); + m_categoryBox->addItem(QString::fromStdWString(category.getName())); m_categoryBox->setCurrentIndex(1); } } @@ -158,9 +158,9 @@ void QtBookmarkCreator::resizeEvent(QResizeEvent* event) void QtBookmarkCreator::handleNext() { - std::string name = m_displayName->text().toStdString(); - std::string comment = m_commentBox->toPlainText().toStdString(); - std::string category = m_categoryBox->currentText().toStdString(); + std::wstring name = m_displayName->text().toStdWString(); + std::wstring comment = m_commentBox->toPlainText().toStdWString(); + std::wstring category = m_categoryBox->currentText().toStdWString(); if (m_editBookmarkId) { diff --git a/src/lib_gui/qt/window/QtBookmarkCreator.h b/src/lib_gui/qt/window/QtBookmarkCreator.h index 83db3900..17d4e3ad 100644 --- a/src/lib_gui/qt/window/QtBookmarkCreator.h +++ b/src/lib_gui/qt/window/QtBookmarkCreator.h @@ -26,8 +26,8 @@ public: void refreshStyle(); - void setDisplayName(const std::string& name); - void setComment(const std::string& comment); + void setDisplayName(const std::wstring& name); + void setComment(const std::wstring& comment); void setBookmarkCategories(const std::vector& categories); void setCurrentBookmarkCategory(const BookmarkCategory& category); diff --git a/src/lib_gui/qt/window/QtIndexingDialog.cpp b/src/lib_gui/qt/window/QtIndexingDialog.cpp index 322dee0a..a3fbe946 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.cpp +++ b/src/lib_gui/qt/window/QtIndexingDialog.cpp @@ -296,7 +296,7 @@ size_t QtIndexingDialog::getProgress() const return m_progressBar->getProgress(); } -void QtIndexingDialog::updateIndexingProgress(size_t fileCount, size_t totalFileCount, std::string sourcePath) +void QtIndexingDialog::updateIndexingProgress(size_t fileCount, size_t totalFileCount, const FilePath& sourcePath) { updateMessage(QString::number(fileCount) + "/" + QString::number(totalFileCount) + " File" + (totalFileCount > 1 ? "s" : "")); @@ -306,9 +306,9 @@ void QtIndexingDialog::updateIndexingProgress(size_t fileCount, size_t totalFile progress = fileCount * 100 / totalFileCount; } - if (sourcePath.size()) + if (!sourcePath.empty()) { - m_sourcePath = QString::fromStdString(sourcePath); + m_sourcePath = QString::fromStdWString(sourcePath.wstr()); } updateProgress(progress); diff --git a/src/lib_gui/qt/window/QtIndexingDialog.h b/src/lib_gui/qt/window/QtIndexingDialog.h index 941d5595..db305d9a 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.h +++ b/src/lib_gui/qt/window/QtIndexingDialog.h @@ -51,7 +51,7 @@ public: std::string getMessage() const; void updateProgress(size_t progress); size_t getProgress() const; - void updateIndexingProgress(size_t fileCount, size_t totalFileCount, std::string sourcePath); + void updateIndexingProgress(size_t fileCount, size_t totalFileCount, const FilePath& sourcePath); void updateErrorCount(size_t errorCount, size_t fatalCount); protected: diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index 41ff5e99..5d1db5be 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -925,10 +925,10 @@ void QtMainWindow::setupBookmarksMenu() for (size_t i = 0; i < m_bookmarks.size(); i++) { Bookmark* bookmark = m_bookmarks[i].get(); - std::string name = utility::elide(bookmark->getName(), utility::ELIDE_RIGHT, 50); + std::wstring name = utility::elide(bookmark->getName(), utility::ELIDE_RIGHT, 50); QAction* action = new QAction(); - action->setText(name.c_str()); + action->setText(QString::fromStdWString(name)); action->setData(QVariant(int(i))); connect(action, &QAction::triggered, this, &QtMainWindow::activateBookmarkAction); diff --git a/src/lib_java/data/parser/java/JavaParser.cpp b/src/lib_java/data/parser/java/JavaParser.cpp index 301af8b5..bb864181 100644 --- a/src/lib_java/data/parser/java/JavaParser.cpp +++ b/src/lib_java/data/parser/java/JavaParser.cpp @@ -167,7 +167,7 @@ void JavaParser::doRecordSymbol( DefinitionKind definitionKind = intToDefinitionKind(jDefinitionKind); m_client->recordSymbol( - NameHierarchy::deserialize(m_javaEnvironment->toStdString(jSymbolName)), + NameHierarchy::deserialize(utility::decodeFromUtf8(m_javaEnvironment->toStdString(jSymbolName))), intToSymbolKind(jSymbolKind), access, definitionKind @@ -184,7 +184,7 @@ void JavaParser::doRecordSymbolWithLocation( DefinitionKind definitionKind = intToDefinitionKind(jDefinitionKind); m_client->recordSymbol( - NameHierarchy::deserialize(m_javaEnvironment->toStdString(jSymbolName)), + NameHierarchy::deserialize(utility::decodeFromUtf8(m_javaEnvironment->toStdString(jSymbolName))), intToSymbolKind(jSymbolKind), ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn), access, @@ -203,7 +203,7 @@ void JavaParser::doRecordSymbolWithLocationAndScope( DefinitionKind definitionKind = intToDefinitionKind(jDefinitionKind); m_client->recordSymbol( - NameHierarchy::deserialize(m_javaEnvironment->toStdString(jSymbolName)), + NameHierarchy::deserialize(utility::decodeFromUtf8(m_javaEnvironment->toStdString(jSymbolName))), intToSymbolKind(jSymbolKind), ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn), ParseLocation(m_currentFilePath, scopeBeginLine, scopeBeginColumn, scopeEndLine, scopeEndColumn), @@ -219,8 +219,8 @@ void JavaParser::doRecordReference( { m_client->recordReference( intToReferenceKind(jReferenceKind), - NameHierarchy::deserialize(m_javaEnvironment->toStdString(jReferencedName)), - NameHierarchy::deserialize(m_javaEnvironment->toStdString(jContextName)), + NameHierarchy::deserialize(utility::decodeFromUtf8(m_javaEnvironment->toStdString(jReferencedName))), + NameHierarchy::deserialize(utility::decodeFromUtf8(m_javaEnvironment->toStdString(jContextName))), ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn) ); } @@ -231,7 +231,7 @@ void JavaParser::doRecordQualifierLocation( ) { m_client->recordQualifierLocation( - NameHierarchy::deserialize(m_javaEnvironment->toStdString(jQualifierName)), + NameHierarchy::deserialize(utility::decodeFromUtf8(m_javaEnvironment->toStdString(jQualifierName))), ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn) ); } @@ -239,7 +239,7 @@ void JavaParser::doRecordQualifierLocation( void JavaParser::doRecordLocalSymbol(jstring jSymbolName, jint beginLine, jint beginColumn, jint endLine, jint endColumn) { m_client->recordLocalSymbol( - NameHierarchy::deserialize(m_javaEnvironment->toStdString(jSymbolName)).getQualifiedName(), + NameHierarchy::deserialize(utility::decodeFromUtf8(m_javaEnvironment->toStdString(jSymbolName))).getQualifiedName(), ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn) ); } @@ -263,7 +263,7 @@ void JavaParser::doRecordError( m_client->recordError( ParseLocation(m_currentFilePath, beginLine, beginColumn, endLine, endColumn), - m_javaEnvironment->toStdString(jMessage), + utility::decodeFromUtf8(m_javaEnvironment->toStdString(jMessage)), fatal, indexed ); diff --git a/src/test/CxxIndexSampleProjectsTestSuite.h b/src/test/CxxIndexSampleProjectsTestSuite.h index 90db677d..76143b3c 100644 --- a/src/test/CxxIndexSampleProjectsTestSuite.h +++ b/src/test/CxxIndexSampleProjectsTestSuite.h @@ -150,6 +150,6 @@ private: parser.buildIndex(command); - return TextAccess::createFromString(parserClient->m_lines); + return TextAccess::createFromString(utility::encodeToUtf8(parserClient->m_lines)); } }; \ No newline at end of file diff --git a/src/test/CxxParserTestSuite.h b/src/test/CxxParserTestSuite.h index 690e7e7a..401ca632 100644 --- a/src/test/CxxParserTestSuite.h +++ b/src/test/CxxParserTestSuite.h @@ -27,8 +27,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void A::foo(int) -> int A::bar <6:7 6:9>" + TS_ASSERT(utility::containsElement( + client->usages, L"void A::foo(int) -> int A::bar <6:7 6:9>" )); } @@ -46,8 +46,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void A::foo(int) -> A * A::a <6:3 6:3>" + TS_ASSERT(utility::containsElement( + client->usages, L"void A::foo(int) -> A * A::a <6:3 6:3>" )); } @@ -60,8 +60,8 @@ public: "int x;\n" ); - TS_ASSERT(utility::containsElement( - client->globalVariables, "int x <1:5 1:5>" + TS_ASSERT(utility::containsElement( + client->globalVariables, L"int x <1:5 1:5>" )); } @@ -71,8 +71,8 @@ public: "static int x;\n" ); - TS_ASSERT(utility::containsElement( - client->globalVariables, "int x (input.cc) <1:12 1:12>" + TS_ASSERT(utility::containsElement( + client->globalVariables, L"int x (input.cc) <1:12 1:12>" )); } @@ -82,8 +82,8 @@ public: "static const int x;\n" ); - TS_ASSERT(utility::containsElement( - client->globalVariables, "const int x (input.cc) <1:18 1:18>" + TS_ASSERT(utility::containsElement( + client->globalVariables, L"const int x (input.cc) <1:18 1:18>" )); } @@ -95,8 +95,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "A <1:1 <1:7 1:7> 3:1>" + TS_ASSERT(utility::containsElement( + client->classes, L"A <1:1 <1:7 1:7> 3:1>" )); } @@ -106,8 +106,8 @@ public: "class A;\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "A <1:7 1:7>" + TS_ASSERT(utility::containsElement( + client->classes, L"A <1:7 1:7>" )); } @@ -119,8 +119,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->structs, "A <1:1 <1:8 1:8> 3:1>" + TS_ASSERT(utility::containsElement( + client->structs, L"A <1:1 <1:8 1:8> 3:1>" )); } @@ -130,8 +130,8 @@ public: "struct A;\n" ); - TS_ASSERT(utility::containsElement( - client->structs, "A <1:8 1:8>" + TS_ASSERT(utility::containsElement( + client->structs, L"A <1:8 1:8>" )); } @@ -141,8 +141,8 @@ public: "int x;\n" ); - TS_ASSERT(utility::containsElement( - client->globalVariables, "int x <1:5 1:5>" + TS_ASSERT(utility::containsElement( + client->globalVariables, L"int x <1:5 1:5>" )); } @@ -162,17 +162,17 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->fields, "private int A::a <3:6 3:6>" + TS_ASSERT(utility::containsElement( + client->fields, L"private int A::a <3:6 3:6>" )); - TS_ASSERT(utility::containsElement( - client->fields, "public int A::b <6:6 6:6>" + TS_ASSERT(utility::containsElement( + client->fields, L"public int A::b <6:6 6:6>" )); - TS_ASSERT(utility::containsElement( - client->fields, "protected static int A::c <8:13 8:13>" + TS_ASSERT(utility::containsElement( + client->fields, L"protected static int A::c <8:13 8:13>" )); - TS_ASSERT(utility::containsElement( - client->fields, "private const int A::d <10:12 10:12>" + TS_ASSERT(utility::containsElement( + client->fields, L"private const int A::d <10:12 10:12>" )); } @@ -185,8 +185,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->functions, "int ceil(float) <1:1 <1:5 1:8> 4:1>" + TS_ASSERT(utility::containsElement( + client->functions, L"int ceil(float) <1:1 <1:5 1:8> 4:1>" )); } @@ -199,8 +199,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->functions, "static int ceil(float) (input.cc) <1:1 <1:12 1:15> 4:1>" + TS_ASSERT(utility::containsElement( + client->functions, L"static int ceil(float) (input.cc) <1:1 <1:12 1:15> 4:1>" )); } @@ -214,8 +214,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->methods, "public void B::B() <4:2 4:2>" + TS_ASSERT(utility::containsElement( + client->methods, L"public void B::B() <4:2 4:2>" )); } @@ -229,8 +229,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->methods, "public B & B::operator=(const B &) <4:5 4:13>" + TS_ASSERT(utility::containsElement( + client->methods, L"public B & B::operator=(const B &) <4:5 4:13>" )); } @@ -247,8 +247,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->methods, "public void B::B() <6:1 <6:4 6:4> 8:1>" + TS_ASSERT(utility::containsElement( + client->methods, L"public void B::B() <6:1 <6:4 6:4> 8:1>" )); } @@ -262,8 +262,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->methods, "public void B::process() <4:15 4:21>" + TS_ASSERT(utility::containsElement( + client->methods, L"public void B::process() <4:15 4:21>" )); } @@ -277,8 +277,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->methods, "protected void B::process() <4:15 4:21>" + TS_ASSERT(utility::containsElement( + client->methods, L"protected void B::process() <4:15 4:21>" )); } @@ -290,8 +290,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->namespaces, "A <1:1 <1:11 1:11> 3:1>" + TS_ASSERT(utility::containsElement( + client->namespaces, L"A <1:1 <1:11 1:11> 3:1>" )); } @@ -303,8 +303,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->namespaces, "anonymous namespace (input.cc<1:1>) <1:1 <2:1 2:1> 3:1>" + TS_ASSERT(utility::containsElement( + client->namespaces, L"anonymous namespace (input.cc<1:1>) <1:1 <2:1 2:1> 3:1>" )); } @@ -317,8 +317,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->structs, "anonymous struct (input.cc<1:9>) <1:9 <1:9 1:14> 4:1>" + TS_ASSERT(utility::containsElement( + client->structs, L"anonymous struct (input.cc<1:9>) <1:9 <1:9 1:14> 4:1>" )); } @@ -350,8 +350,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->unions, "anonymous union (input.cc<1:9>) <1:9 <1:9 1:13> 5:1>" + TS_ASSERT(utility::containsElement( + client->unions, L"anonymous union (input.cc<1:9>) <1:9 <1:9 1:13> 5:1>" )); } @@ -364,11 +364,11 @@ public: "} Foo;\n" ); - TS_ASSERT(utility::containsElement( - client->structs, "Foo <1:9 <1:9 1:14> 4:1>" + TS_ASSERT(utility::containsElement( + client->structs, L"Foo <1:9 <1:9 1:14> 4:1>" )); - TS_ASSERT(utility::containsElement( - client->structs, "Foo <4:3 4:5>" + TS_ASSERT(utility::containsElement( + client->structs, L"Foo <4:3 4:5>" )); } @@ -381,11 +381,11 @@ public: "} Foo;\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "Foo <1:9 <1:9 1:13> 4:1>" + TS_ASSERT(utility::containsElement( + client->classes, L"Foo <1:9 <1:9 1:13> 4:1>" )); - TS_ASSERT(utility::containsElement( - client->classes, "Foo <4:3 4:5>" + TS_ASSERT(utility::containsElement( + client->classes, L"Foo <4:3 4:5>" )); } @@ -398,11 +398,11 @@ public: "} Foo;\n" ); - TS_ASSERT(utility::containsElement( - client->enums, "Foo <1:9 <1:9 1:12> 4:1>" + TS_ASSERT(utility::containsElement( + client->enums, L"Foo <1:9 <1:9 1:12> 4:1>" )); - TS_ASSERT(utility::containsElement( - client->enums, "Foo <4:3 4:5>" + TS_ASSERT(utility::containsElement( + client->enums, L"Foo <4:3 4:5>" )); } @@ -416,11 +416,11 @@ public: "} Foo;\n" ); - TS_ASSERT(utility::containsElement( - client->unions, "Foo <1:9 <1:9 1:13> 5:1>" + TS_ASSERT(utility::containsElement( + client->unions, L"Foo <1:9 <1:9 1:13> 5:1>" )); - TS_ASSERT(utility::containsElement( - client->unions, "Foo <5:3 5:5>" + TS_ASSERT(utility::containsElement( + client->unions, L"Foo <5:3 5:5>" )); } @@ -433,11 +433,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->structs, "Foo <1:13 <1:13 1:18> 4:1>" + TS_ASSERT(utility::containsElement( + client->structs, L"Foo <1:13 <1:13 1:18> 4:1>" )); - TS_ASSERT(utility::containsElement( - client->structs, "Foo <1:7 1:9>" + TS_ASSERT(utility::containsElement( + client->structs, L"Foo <1:7 1:9>" )); } @@ -450,11 +450,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "Foo <1:13 <1:13 1:17> 4:1>" + TS_ASSERT(utility::containsElement( + client->classes, L"Foo <1:13 <1:13 1:17> 4:1>" )); - TS_ASSERT(utility::containsElement( - client->classes, "Foo <1:7 1:9>" + TS_ASSERT(utility::containsElement( + client->classes, L"Foo <1:7 1:9>" )); } @@ -467,11 +467,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->enums, "Foo <1:13 <1:13 1:16> 4:1>" + TS_ASSERT(utility::containsElement( + client->enums, L"Foo <1:13 <1:13 1:16> 4:1>" )); - TS_ASSERT(utility::containsElement( - client->enums, "Foo <1:7 1:9>" + TS_ASSERT(utility::containsElement( + client->enums, L"Foo <1:7 1:9>" )); } @@ -485,11 +485,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->unions, "Foo <1:13 <1:13 1:17> 5:1>" + TS_ASSERT(utility::containsElement( + client->unions, L"Foo <1:13 <1:13 1:17> 5:1>" )); - TS_ASSERT(utility::containsElement( - client->unions, "Foo <1:7 1:9>" + TS_ASSERT(utility::containsElement( + client->unions, L"Foo <1:7 1:9>" )); } @@ -501,8 +501,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->enums, "E <1:1 <1:6 1:6> 3:1>" + TS_ASSERT(utility::containsElement( + client->enums, L"E <1:1 <1:6 1:6> 3:1>" )); } @@ -515,8 +515,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->enumConstants, "E::P <3:2 3:2>" + TS_ASSERT(utility::containsElement( + client->enumConstants, L"E::P <3:2 3:2>" )); } @@ -526,8 +526,8 @@ public: "typedef unsigned int uint;\n" ); - TS_ASSERT(utility::containsElement( - client->typedefs, "uint <1:22 1:25>" + TS_ASSERT(utility::containsElement( + client->typedefs, L"uint <1:22 1:25>" )); } @@ -540,8 +540,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typedefs, "test::uint <3:23 3:26>" + TS_ASSERT(utility::containsElement( + client->typedefs, L"test::uint <3:23 3:26>" )); } @@ -554,8 +554,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typedefs, "anonymous namespace (input.cc<1:1>)::uint <3:23 3:26>" + TS_ASSERT(utility::containsElement( + client->typedefs, L"anonymous namespace (input.cc<1:1>)::uint <3:23 3:26>" )); } @@ -568,8 +568,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typedefs, "private Foo::Bar <3:8 3:10>" + TS_ASSERT(utility::containsElement( + client->typedefs, L"private Foo::Bar <3:8 3:10>" )); } @@ -582,8 +582,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->macros, "PI <1:9 <1:9 1:10> 1:8>" + TS_ASSERT(utility::containsElement( + client->macros, L"PI <1:9 <1:9 1:10> 1:8>" )); } @@ -596,8 +596,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->macroUses, "input.cc -> PI <1:8 1:9>" + TS_ASSERT(utility::containsElement( + client->macroUses, L"input.cc -> PI <1:8 1:9>" )); } @@ -612,8 +612,8 @@ public: "#endif\n" ); - TS_ASSERT(utility::containsElement( - client->macroUses, "input.cc -> PI <2:8 2:9>" + TS_ASSERT(utility::containsElement( + client->macroUses, L"input.cc -> PI <2:8 2:9>" )); } @@ -628,8 +628,8 @@ public: "#endif\n" ); - TS_ASSERT(utility::containsElement( - client->macroUses, "input.cc -> PI <2:9 2:10>" + TS_ASSERT(utility::containsElement( + client->macroUses, L"input.cc -> PI <2:9 2:10>" )); } @@ -644,8 +644,8 @@ public: "#endif\n" ); - TS_ASSERT(utility::containsElement( - client->macroUses, "input.cc -> PI <2:13 2:14>" + TS_ASSERT(utility::containsElement( + client->macroUses, L"input.cc -> PI <2:13 2:14>" )); } @@ -659,8 +659,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->macroUses, "input.cc -> PI <4:12 4:13>" + TS_ASSERT(utility::containsElement( + client->macroUses, L"input.cc -> PI <4:12 4:13>" )); } @@ -675,8 +675,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->macroUses, "input.cc -> PI <2:18 2:19>" + TS_ASSERT(utility::containsElement( + client->macroUses, L"input.cc -> PI <2:18 2:19>" )); } @@ -687,8 +687,8 @@ public: " ((a)>(b)?(a):(b))" ); - TS_ASSERT(utility::containsElement( - client->macros, "MAX <1:9 <1:9 1:11> 2:17>" + TS_ASSERT(utility::containsElement( + client->macros, L"MAX <1:9 <1:9 1:11> 2:17>" )); } @@ -700,7 +700,7 @@ public: // ); // TS_ASSERT_EQUALS(client->templateParameterTypes.size(), 1); - // TS_ASSERT_EQUALS(client->templateParameterTypes[0], "MyType::T <1:17 1:17>"); + // TS_ASSERT_EQUALS(client->templateParameterTypes[0], L"MyType::T <1:17 1:17>"); //} void test_cxx_parser_finds_type_template_parameter_type_of_class_template() @@ -712,8 +712,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A::T <1:20 1:20>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A::T <1:20 1:20>" )); } @@ -730,8 +730,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A::T <5:20 5:20>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A::T <5:20 5:20>" )); } @@ -742,8 +742,8 @@ public: "T v;\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "v::T <1:20 1:20>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"v::T <1:20 1:20>" )); } @@ -757,8 +757,8 @@ public: "int t = 9;\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "t::R <4:20 4:20>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"t::R <4:20 4:20>" )); } @@ -771,8 +771,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A::T <1:17 1:17>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A::T <1:17 1:17>" )); } @@ -785,8 +785,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A::T <1:15 1:15>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A::T <1:15 1:15>" )); } @@ -799,8 +799,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A::T <1:16 1:16>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A::T <1:16 1:16>" )); } @@ -814,8 +814,8 @@ public: "{};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A

::p <3:14 3:14>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A

::p <3:14 3:14>" )); } @@ -829,8 +829,8 @@ public: "{};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A

::p <3:14 3:14>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A

::p <3:14 3:14>" )); } @@ -842,8 +842,8 @@ public: "{};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A::T2 <1:28 1:29>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A::T2 <1:28 1:29>" )); } @@ -855,8 +855,8 @@ public: "{};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A typename T1, T1 & T2>::T2 <1:49 1:50>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A typename T1, T1 & T2>::T2 <1:49 1:50>" )); } @@ -868,8 +868,8 @@ public: "{};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A typename T1, T1 & T2>::T1 -> int <1:43 1:45>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A typename T1, T1 & T2>::T1 -> int <1:43 1:45>" )); } @@ -888,8 +888,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "B typename T>::T <4:36 4:36>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"B typename T>::T <4:36 4:36>" )); } @@ -902,8 +902,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A::T <1:23 1:23>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A::T <1:23 1:23>" )); } @@ -916,8 +916,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A::T <1:18 1:18>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A::T <1:18 1:18>" )); } @@ -930,8 +930,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A typename... T>::T <1:42 1:42>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A typename... T>::T <1:42 1:42>" )); } @@ -944,11 +944,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A::T <1:20 1:20>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A::T <1:20 1:20>" )); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A::U <1:32 1:32>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A::U <1:32 1:32>" )); } @@ -962,8 +962,8 @@ public: ); TS_ASSERT_EQUALS(client->templateParameterTypes.size(), 0); - TS_ASSERT(utility::containsElement( - client->classes, "A <1:1 <2:7 2:7> 4:1>" + TS_ASSERT(utility::containsElement( + client->classes, L"A <1:1 <2:7 2:7> 4:1>" )); } @@ -982,8 +982,8 @@ public: "{}\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "A::foo::U <8:20 8:20>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"A::foo::U <8:20 8:20>" )); } @@ -1000,8 +1000,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "A <5:1 <6:7 6:7> 8:1>" + TS_ASSERT(utility::containsElement( + client->classes, L"A <5:1 <6:7 6:7> 8:1>" )); } @@ -1015,8 +1015,8 @@ public: "int t = 99;\n" ); - TS_ASSERT(utility::containsElement( - client->globalVariables, "int t <5:5 5:5>" + TS_ASSERT(utility::containsElement( + client->globalVariables, L"int t <5:5 5:5>" )); } @@ -1033,8 +1033,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "A <5:1 <6:7 6:7> 8:1>" + TS_ASSERT(utility::containsElement( + client->classes, L"A <5:1 <6:7 6:7> 8:1>" )); } @@ -1048,8 +1048,8 @@ public: "int t = 9;\n" ); - TS_ASSERT(utility::containsElement( - client->globalVariables, "int t <5:5 5:5>" + TS_ASSERT(utility::containsElement( + client->globalVariables, L"int t <5:5 5:5>" )); } @@ -1063,8 +1063,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->fields, "private int A::foo <4:6 4:8>" + TS_ASSERT(utility::containsElement( + client->fields, L"private int A::foo <4:6 4:8>" )); } @@ -1078,8 +1078,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "A::T A::foo -> A::T <4:2 4:2>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A::T A::foo -> A::T <4:2 4:2>" )); } @@ -1093,8 +1093,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->methods, "private int A::foo() <4:6 4:8>" + TS_ASSERT(utility::containsElement( + client->methods, L"private int A::foo() <4:6 4:8>" )); } @@ -1108,8 +1108,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "test::T <1:20 1:20>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"test::T <1:20 1:20>" )); } @@ -1123,8 +1123,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "test::T <1:15 1:15>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"test::T <1:15 1:15>" )); } @@ -1138,8 +1138,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "test::T <1:16 1:16>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"test::T <1:16 1:16>" )); } @@ -1155,8 +1155,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "test

::p <3:14 3:14>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"test

::p <3:14 3:14>" )); } @@ -1172,8 +1172,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "test

::p <3:14 3:14>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"test

::p <3:14 3:14>" )); } @@ -1190,8 +1190,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "test typename T>::T <4:36 4:36>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"test typename T>::T <4:36 4:36>" )); } @@ -1210,8 +1210,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->functions, "int test(int) <2:1 <2:3 2:6> 5:1>" + TS_ASSERT(utility::containsElement( + client->functions, L"int test(int) <2:1 <2:3 2:6> 5:1>" )); } @@ -1224,11 +1224,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->functions, "void lambdaCaller::lambda at 3:2() const <3:5 <3:2 3:2> 3:7>" + TS_ASSERT(utility::containsElement( + client->functions, L"void lambdaCaller::lambda at 3:2() const <3:5 <3:2 3:2> 3:7>" )); - TS_ASSERT(utility::containsElement( - client->calls, "void lambdaCaller() -> void lambdaCaller::lambda at 3:2() const <3:8 3:8>" + TS_ASSERT(utility::containsElement( + client->calls, L"void lambdaCaller() -> void lambdaCaller::lambda at 3:2() const <3:8 3:8>" )); } @@ -1241,8 +1241,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->functions, "int lambdaWrapper::lambda at 3:2(int) <3:14 <3:2 3:2> 3:36>" + TS_ASSERT(utility::containsElement( + client->functions, L"int lambdaWrapper::lambda at 3:2(int) <3:14 <3:2 3:2> 3:36>" )); } @@ -1255,11 +1255,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<3:3> <3:3 3:3>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<3:3> <3:3 3:3>" )); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<3:3> <3:21 3:21>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<3:3> <3:21 3:21>" )); } @@ -1271,8 +1271,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<1:15> <1:15 1:15>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<1:15> <1:15 1:15>" )); } @@ -1285,8 +1285,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<3:6> <3:6 3:6>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<3:6> <3:6 3:6>" )); } @@ -1303,8 +1303,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "public A::B <4:8 4:8>" + TS_ASSERT(utility::containsElement( + client->classes, L"public A::B <4:8 4:8>" )); } @@ -1317,8 +1317,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "a::B <3:8 3:8>" + TS_ASSERT(utility::containsElement( + client->classes, L"a::B <3:8 3:8>" )); } @@ -1333,8 +1333,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->structs, "private A::B <3:2 <3:9 3:9> 5:2>" + TS_ASSERT(utility::containsElement( + client->structs, L"private A::B <3:2 <3:9 3:9> 5:2>" )); } @@ -1349,8 +1349,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->structs, "A::B <3:2 <3:9 3:9> 5:2>" + TS_ASSERT(utility::containsElement( + client->structs, L"A::B <3:2 <3:9 3:9> 5:2>" )); } @@ -1371,11 +1371,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->structs, "foo::B <3:2 <3:9 3:9> 5:2>" + TS_ASSERT(utility::containsElement( + client->structs, L"foo::B <3:2 <3:9 3:9> 5:2>" )); - TS_ASSERT(utility::containsElement( - client->structs, "foo::B <9:2 <9:9 9:9> 11:2>" + TS_ASSERT(utility::containsElement( + client->structs, L"foo::B <9:2 <9:9 9:9> 11:2>" )); } @@ -1388,8 +1388,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->globalVariables, "int n::x <2:6 2:6>" + TS_ASSERT(utility::containsElement( + client->globalVariables, L"int n::x <2:6 2:6>" )); } @@ -1407,8 +1407,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->fields, "private static const int B::C::amount <7:20 7:25>" + TS_ASSERT(utility::containsElement( + client->fields, L"private static const int B::C::amount <7:20 7:25>" )); } @@ -1421,8 +1421,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->functions, "int anonymous namespace (input.cc<1:1>)::sum(int, int) <3:6 3:8>" + TS_ASSERT(utility::containsElement( + client->functions, L"int anonymous namespace (input.cc<1:1>)::sum(int, int) <3:6 3:8>" )); } @@ -1438,8 +1438,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->methods, "private bool B::C::isGreat() const <5:8 5:14>" + TS_ASSERT(utility::containsElement( + client->methods, L"private bool B::C::isGreat() const <5:8 5:14>" )); } @@ -1454,8 +1454,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->namespaces, "A::B <3:2 <3:12 3:12> 5:2>" + TS_ASSERT(utility::containsElement( + client->namespaces, L"A::B <3:2 <3:12 3:12> 5:2>" )); } @@ -1471,8 +1471,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->enums, "public B::Z <4:2 <4:7 4:7> 6:2>" + TS_ASSERT(utility::containsElement( + client->enums, L"public B::Z <4:2 <4:7 4:7> 6:2>" )); } @@ -1487,8 +1487,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->enums, "n::Z <3:2 <3:7 3:7> 5:2>" + TS_ASSERT(utility::containsElement( + client->enums, L"n::Z <3:2 <3:7 3:7> 5:2>" )); } @@ -1506,8 +1506,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->enums, "private A::TestType <4:2 <4:7 4:14> 8:2>" + TS_ASSERT(utility::containsElement( + client->enums, L"private A::TestType <4:2 <4:7 4:14> 8:2>" )); } @@ -1525,8 +1525,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->enumConstants, "A::TestType::TEST_ONE <6:3 6:10>" + TS_ASSERT(utility::containsElement( + client->enumConstants, L"A::TestType::TEST_ONE <6:3 6:10>" )); } @@ -1546,8 +1546,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement(client->qualifiers, "foo <7:2 7:4>")); - TS_ASSERT(utility::containsElement(client->qualifiers, "foo::bar <7:7 7:9>")); + TS_ASSERT(utility::containsElement(client->qualifiers, L"foo <7:2 7:4>")); + TS_ASSERT(utility::containsElement(client->qualifiers, L"foo::bar <7:7 7:9>")); } void test_cxx_parser_finds_qualifier_of_access_to_static_field() @@ -1565,8 +1565,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement(client->qualifiers, "Foo <9:2 9:4>")); - TS_ASSERT(utility::containsElement(client->qualifiers, "Foo::Bar <9:7 9:9>")); + TS_ASSERT(utility::containsElement(client->qualifiers, L"Foo <9:2 9:4>")); + TS_ASSERT(utility::containsElement(client->qualifiers, L"Foo::Bar <9:7 9:9>")); } void test_cxx_parser_finds_qualifier_of_access_to_enum_constant() @@ -1580,7 +1580,7 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement(client->qualifiers, "Foo <5:10 5:12>")); + TS_ASSERT(utility::containsElement(client->qualifiers, L"Foo <5:10 5:12>")); } void test_cxx_parser_finds_qualifier_of_reference_to_method() @@ -1598,7 +1598,7 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement(client->qualifiers, "Foo <9:9 9:11>")); + TS_ASSERT(utility::containsElement(client->qualifiers, L"Foo <9:9 9:11>")); } void test_cxx_parser_finds_qualifier_of_constructor_call() @@ -1615,7 +1615,7 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement(client->qualifiers, "Foo <8:10 8:12>")); + TS_ASSERT(utility::containsElement(client->qualifiers, L"Foo <8:10 8:12>")); } /////////////////////////////////////////////////////////////////////////////// @@ -1630,11 +1630,11 @@ public: "void t4(bool v) {}\n" ); - TS_ASSERT(utility::containsElement(client->builtinTypes, "void")); - TS_ASSERT(utility::containsElement(client->builtinTypes, "int")); - TS_ASSERT(utility::containsElement(client->builtinTypes, "float")); - TS_ASSERT(utility::containsElement(client->builtinTypes, "double")); - TS_ASSERT(utility::containsElement(client->builtinTypes, "bool")); + TS_ASSERT(utility::containsElement(client->builtinTypes, L"void")); + TS_ASSERT(utility::containsElement(client->builtinTypes, L"int")); + TS_ASSERT(utility::containsElement(client->builtinTypes, L"float")); + TS_ASSERT(utility::containsElement(client->builtinTypes, L"double")); + TS_ASSERT(utility::containsElement(client->builtinTypes, L"bool")); } void test_cxx_parser_finds_implicit_copy_constructor() @@ -1648,9 +1648,9 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement(client->methods, "public void TestClass::TestClass() <1:7 <1:7 1:15> 1:15>")); - TS_ASSERT(utility::containsElement(client->methods, "public void TestClass::TestClass(const TestClass &) <1:7 <1:7 1:15> 1:15>")); - TS_ASSERT(utility::containsElement(client->methods, "public void TestClass::TestClass(TestClass &&) <1:7 1:15>")); + TS_ASSERT(utility::containsElement(client->methods, L"public void TestClass::TestClass() <1:7 <1:7 1:15> 1:15>")); + TS_ASSERT(utility::containsElement(client->methods, L"public void TestClass::TestClass(const TestClass &) <1:7 <1:7 1:15> 1:15>")); + TS_ASSERT(utility::containsElement(client->methods, L"public void TestClass::TestClass(TestClass &&) <1:7 1:15>")); } /////////////////////////////////////////////////////////////////////////////// @@ -1671,8 +1671,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "A::TestType A::foo -> A::TestType <9:2 9:9>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A::TestType A::foo -> A::TestType <9:2 9:9>" )); } @@ -1689,8 +1689,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "A::T A::B::foo -> A::T <6:3 6:3>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A::T A::B::foo -> A::T <6:3 6:3>" )); } @@ -1700,8 +1700,8 @@ public: "int x;\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "int x -> int <1:1 1:3>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"int x -> int <1:1 1:3>" )); } @@ -1711,8 +1711,8 @@ public: "typedef unsigned int uint;\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "uint -> unsigned int <1:9 1:16>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"uint -> unsigned int <1:9 1:16>" )); } @@ -1726,8 +1726,8 @@ public: "typedef test::TestStruct globalTestStruct;\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "globalTestStruct -> test::TestStruct <5:15 5:24>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"globalTestStruct -> test::TestStruct <5:15 5:24>" )); } @@ -1738,8 +1738,8 @@ public: "uint number;\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "uint number -> uint <2:1 2:4>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"uint number -> uint <2:1 2:4>" )); } @@ -1750,8 +1750,8 @@ public: "class B : A {};\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "B -> A <2:11 2:11>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"B -> A <2:11 2:11>" )); } @@ -1762,8 +1762,8 @@ public: "class B : public A {};\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "B -> A <2:18 2:18>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"B -> A <2:18 2:18>" )); } @@ -1774,8 +1774,8 @@ public: "class B : protected A {};\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "B -> A <2:21 2:21>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"B -> A <2:21 2:21>" )); } @@ -1786,8 +1786,8 @@ public: "class B : private A {};\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "B -> A <2:19 2:19>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"B -> A <2:19 2:19>" )); } @@ -1802,11 +1802,11 @@ public: "{};\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "C -> A <4:11 4:11>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"C -> A <4:11 4:11>" )); - TS_ASSERT(utility::containsElement( - client->inheritances, "C -> B <5:12 5:12>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"C -> B <5:12 5:12>" )); } @@ -1817,8 +1817,8 @@ public: "struct B : A {};\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "B -> A <2:12 2:12>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"B -> A <2:12 2:12>" )); } @@ -1829,8 +1829,8 @@ public: "struct B : public A {};\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "B -> A <2:19 2:19>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"B -> A <2:19 2:19>" )); } @@ -1841,8 +1841,8 @@ public: "struct B : protected A {};\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "B -> A <2:22 2:22>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"B -> A <2:22 2:22>" )); } @@ -1853,8 +1853,8 @@ public: "struct B : private A {};\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "B -> A <2:20 2:20>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"B -> A <2:20 2:20>" )); } @@ -1869,11 +1869,11 @@ public: "{};\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "C -> A <4:11 4:11>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"C -> A <4:11 4:11>" )); - TS_ASSERT(utility::containsElement( - client->inheritances, "C -> B <5:12 5:12>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"C -> B <5:12 5:12>" )); } @@ -1888,8 +1888,8 @@ public: "};" ); - TS_ASSERT(utility::containsElement( - client->overrides, "void B::foo() -> void A::foo() <5:7 5:9>" + TS_ASSERT(utility::containsElement( + client->overrides, L"void B::foo() -> void A::foo() <5:7 5:9>" )); } @@ -1907,11 +1907,11 @@ public: "};" ); - TS_ASSERT(utility::containsElement( - client->overrides, "void B::foo() -> void A::foo() <5:7 5:9>" + TS_ASSERT(utility::containsElement( + client->overrides, L"void B::foo() -> void A::foo() <5:7 5:9>" )); - TS_ASSERT(utility::containsElement( - client->overrides, "void C::foo() -> void B::foo() <8:7 8:9>" + TS_ASSERT(utility::containsElement( + client->overrides, L"void C::foo() -> void B::foo() <8:7 8:9>" )); } @@ -1927,8 +1927,8 @@ public: ); TS_ASSERT_EQUALS(client->errors.size(), 1); - TS_ASSERT(utility::containsElement( - client->overrides, "int B::foo() -> void A::foo() <5:6 5:8>" + TS_ASSERT(utility::containsElement( + client->overrides, L"int B::foo() -> void A::foo() <5:6 5:8>" )); } @@ -1969,8 +1969,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void foo() -> std <3:18 3:20>" + TS_ASSERT(utility::containsElement( + client->usages, L"void foo() -> std <3:18 3:20>" )); } @@ -1980,8 +1980,8 @@ public: "using namespace std;\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "input.cc -> std <1:17 1:19>" + TS_ASSERT(utility::containsElement( + client->usages, L"input.cc -> std <1:17 1:19>" )); } @@ -1998,8 +1998,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void bar() -> foo::a <7:13 7:13>" + TS_ASSERT(utility::containsElement( + client->usages, L"void bar() -> foo::a <7:13 7:13>" )); } @@ -2013,8 +2013,8 @@ public: "using foo::a;\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "input.cc -> foo::a <5:12 5:12>" + TS_ASSERT(utility::containsElement( + client->usages, L"input.cc -> foo::a <5:12 5:12>" )); } @@ -2031,8 +2031,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int main() -> int sum(int, int) <7:2 7:4>" + TS_ASSERT(utility::containsElement( + client->calls, L"int main() -> int sum(int, int) <7:2 7:4>" )); } @@ -2052,8 +2052,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "void func(bool) -> int sum(int, int) <10:2 10:4>" + TS_ASSERT(utility::containsElement( + client->calls, L"void func(bool) -> int sum(int, int) <10:2 10:4>" )); } @@ -2075,11 +2075,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int main() -> int sum(int, int) <11:2 11:4>" + TS_ASSERT(utility::containsElement( + client->calls, L"int main() -> int sum(int, int) <11:2 11:4>" )); - TS_ASSERT(utility::containsElement( - client->calls, "int main() -> float sum(float, float) <12:2 12:4>" + TS_ASSERT(utility::containsElement( + client->calls, L"int main() -> float sum(float, float) <12:2 12:4>" )); } @@ -2096,8 +2096,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int main() -> int sum(int, int) <7:16 7:18>" + TS_ASSERT(utility::containsElement( + client->calls, L"int main() -> int sum(int, int) <7:16 7:18>" )); } @@ -2117,8 +2117,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int App::main() -> int sum(int, int) <9:10 9:12>" + TS_ASSERT(utility::containsElement( + client->calls, L"int App::main() -> int sum(int, int) <9:10 9:12>" )); } @@ -2134,8 +2134,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int main() -> void App::App() <6:6 6:8>" + TS_ASSERT(utility::containsElement( + client->calls, L"int main() -> void App::App() <6:6 6:8>" )); } @@ -2153,8 +2153,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int main() -> void App::App() <8:2 8:4>" + TS_ASSERT(utility::containsElement( + client->calls, L"int main() -> void App::App() <8:2 8:4>" )); } @@ -2172,8 +2172,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "void App::App() -> void Item::Item() <7:10 7:13>" + TS_ASSERT(utility::containsElement( + client->calls, L"void App::App() -> void Item::Item() <7:10 7:13>" )); } @@ -2195,8 +2195,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "void App::App() -> int one() <10:10 10:12>" + TS_ASSERT(utility::containsElement( + client->calls, L"void App::App() -> int one() <10:10 10:12>" )); } @@ -2216,8 +2216,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int main() -> void App::App(const App &) <10:6 10:9>" + TS_ASSERT(utility::containsElement( + client->calls, L"int main() -> void App::App(const App &) <10:6 10:9>" )); } @@ -2232,8 +2232,8 @@ public: "App app;\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "App app -> void App::App() <6:5 6:7>" + TS_ASSERT(utility::containsElement( + client->calls, L"App app -> void App::App() <6:5 6:7>" )); } @@ -2244,8 +2244,8 @@ public: "int a = one();\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int a -> int one() <2:9 2:11>" + TS_ASSERT(utility::containsElement( + client->calls, L"int a -> int one() <2:9 2:11>" )); } @@ -2266,8 +2266,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int main() -> void App::operator+(int) <11:6 11:6>" + TS_ASSERT(utility::containsElement( + client->calls, L"int main() -> void App::operator+(int) <11:6 11:6>" )); } @@ -2285,8 +2285,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void test() -> void my_int_func(int) <8:9 8:19>" + TS_ASSERT(utility::containsElement( + client->usages, L"void test() -> void my_int_func(int) <8:9 8:19>" )); } @@ -2301,8 +2301,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "int main() -> int bar <5:2 5:4>" + TS_ASSERT(utility::containsElement( + client->usages, L"int main() -> int bar <5:2 5:4>" )); } @@ -2313,8 +2313,8 @@ public: "int b[] = {a};\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "int [] b -> int a <2:12 2:12>" + TS_ASSERT(utility::containsElement( + client->usages, L"int [] b -> int a <2:12 2:12>" )); } @@ -2332,8 +2332,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void App::foo() -> int bar <7:3 7:5>" + TS_ASSERT(utility::containsElement( + client->usages, L"void App::foo() -> int bar <7:3 7:5>" )); } @@ -2351,11 +2351,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void App::foo() -> int App::bar <5:3 5:5>" + TS_ASSERT(utility::containsElement( + client->usages, L"void App::foo() -> int App::bar <5:3 5:5>" )); - TS_ASSERT(utility::containsElement( - client->usages, "void App::foo() -> int App::bar <6:9 6:11>" + TS_ASSERT(utility::containsElement( + client->usages, L"void App::foo() -> int App::bar <6:9 6:11>" )); } @@ -2371,8 +2371,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void App::App() -> int App::bar <4:5 4:7>" + TS_ASSERT(utility::containsElement( + client->usages, L"void App::App() -> int App::bar <4:5 4:7>" )); } @@ -2392,8 +2392,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "T B::run() -> A B::a <7:10 7:10>" + TS_ASSERT(utility::containsElement( + client->usages, L"T B::run() -> A B::a <7:10 7:10>" )); } @@ -2421,8 +2421,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void Bar::baba() -> const Foo Bar::m_i <15:7 15:9>" + TS_ASSERT(utility::containsElement( + client->usages, L"void Bar::baba() -> const Foo Bar::m_i <15:7 15:9>" )); } @@ -2441,8 +2441,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void A::foo() -> A::T A::m_t <8:3 8:5>" + TS_ASSERT(utility::containsElement( + client->usages, L"void A::foo() -> A::T A::m_t <8:3 8:5>" )); } @@ -2455,8 +2455,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "double PI() -> double <1:1 1:6>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"double PI() -> double <1:1 1:6>" )); } @@ -2468,8 +2468,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "void ceil(float) -> float <1:11 1:15>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"void ceil(float) -> float <1:11 1:15>" )); } @@ -2484,8 +2484,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "void VectorBase::VectorBase(VectorBase::T []) -> VectorBase::T <5:13 5:13>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"void VectorBase::VectorBase(VectorBase::T []) -> VectorBase::T <5:13 5:13>" )); } @@ -2499,11 +2499,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "Foo & Foo::operator=(const Foo &) -> Foo <4:2 4:4>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"Foo & Foo::operator=(const Foo &) -> Foo <4:2 4:4>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "Foo & Foo::operator=(const Foo &) -> Foo <4:23 4:25>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"Foo & Foo::operator=(const Foo &) -> Foo <4:23 4:25>" )); } @@ -2515,8 +2515,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "void test(const int) -> int <1:17 1:19>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"void test(const int) -> int <1:17 1:19>" )); } @@ -2529,8 +2529,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "void A::A(int) -> int <3:4 3:6>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"void A::A(int) -> int <3:4 3:6>" )); } @@ -2543,8 +2543,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "int main() -> int <3:2 3:4>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"int main() -> int <3:2 3:4>" )); } @@ -2561,8 +2561,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "int A::main() -> int <5:3 5:5>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"int A::main() -> int <5:3 5:5>" )); } @@ -2582,14 +2582,14 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "int main() -> int <5:3 5:5>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"int main() -> int <5:3 5:5>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "int main() -> int <7:7 7:9>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"int main() -> int <7:7 7:9>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "int main() -> int <9:3 9:5>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"int main() -> int <9:3 9:5>" )); } @@ -2608,8 +2608,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "void B::B() -> A <9:8 9:8>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"void B::B() -> A <9:8 9:8>" )); } @@ -2625,17 +2625,17 @@ public: "A* aPtr = new A;\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "A a -> A::B <6:7 6:7>" + TS_ASSERT(utility::containsElement( + client->usages, L"A a -> A::B <6:7 6:7>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "A a -> A <6:1 6:1>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A a -> A <6:1 6:1>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "A * aPtr -> A <7:1 7:1>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A * aPtr -> A <7:1 7:1>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "A * aPtr -> A <7:15 7:15>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A * aPtr -> A <7:15 7:15>" )); } @@ -2654,17 +2654,17 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "int main() -> A::B <8:8 8:8>" + TS_ASSERT(utility::containsElement( + client->usages, L"int main() -> A::B <8:8 8:8>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "int main() -> A <8:2 8:2>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"int main() -> A <8:2 8:2>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "int main() -> A <9:2 9:2>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"int main() -> A <9:2 9:2>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "int main() -> A <9:16 9:16>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"int main() -> A <9:16 9:16>" )); } @@ -2679,11 +2679,11 @@ public: "const bool IsBaseType::value;\n" ); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "IsBaseType::T <1:20 1:20>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"IsBaseType::T <1:20 1:20>" )); - TS_ASSERT(utility::containsElement( - client->templateParameterTypes, "IsBaseType::T <5:20 5:20>" + TS_ASSERT(utility::containsElement( + client->templateParameterTypes, L"IsBaseType::T <5:20 5:20>" )); } @@ -2702,11 +2702,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "void A::foo(Q) -> A::T <7:3 7:3>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"void A::foo(Q) -> A::T <7:3 7:3>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "void A::foo(Q) -> A::foo::Q <5:11 5:11>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"void A::foo(Q) -> A::foo::Q <5:11 5:11>" )); } @@ -2730,11 +2730,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "A::T A::B::foo(A::B::R) -> A::T <13:3 13:3>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A::T A::B::foo(A::B::R) -> A::T <13:3 13:3>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "A::T A::B::foo(A::B::R) -> A::B::R <13:9 13:9>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A::T A::B::foo(A::B::R) -> A::B::R <13:9 13:9>" )); } @@ -2752,8 +2752,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "void B typename T>::foo(B typename T>::T) -> B typename T>::T <7:11 7:11>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"void B typename T>::foo(B typename T>::T) -> B typename T>::T <7:11 7:11>" )); } @@ -2772,8 +2772,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "void B typename T>::foo(B typename T>::T) -> B typename T>::T typename T>::foo::U> <8:11 8:11>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"void B typename T>::foo(B typename T>::T) -> B typename T>::T typename T>::foo::U> <8:11 8:11>" )); } @@ -2795,14 +2795,14 @@ public: "B::type f = 0;\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "B::type -> A::U>::type <11:25 11:28>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"B::type -> A::U>::type <11:25 11:28>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "B::type -> A::type <11:25 11:28>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"B::type -> A::type <11:25 11:28>" )); - //TS_ASSERT_EQUALS(client->typeUses[3], "A::type -> int <13:9 13:12>"); TODO: make this work! + //TS_ASSERT_EQUALS(client->typeUses[3], L"A::type -> int <13:9 13:12>"); TODO: make this work! } void test_cxx_parser_finds_use_of_dependent_template_specialization_type() @@ -2823,8 +2823,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "B::type -> A::U>::type <12:10 12:17>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"B::type -> A::U>::type <12:10 12:17>" )); } @@ -2842,8 +2842,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A -> int <7:4 7:6>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A -> int <7:4 7:6>" )); } @@ -2860,8 +2860,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A -> int <7:4 7:6>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A -> int <7:4 7:6>" )); } @@ -2878,11 +2878,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<> -> int <7:6 7:8>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<> -> int <7:6 7:8>" )); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<> -> float <7:11 7:15>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<> -> float <7:11 7:15>" )); } @@ -2901,8 +2901,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A -> int <9:4 9:6>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A -> int <9:4 9:6>" )); } @@ -2921,8 +2921,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A -> int <9:4 9:6>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A -> int <9:4 9:6>" )); } @@ -2941,8 +2941,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A -> int <9:8 9:10>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A -> int <9:8 9:10>" )); } @@ -2995,8 +2995,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<&g_p> -> P g_p <9:5 9:7>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<&g_p> -> P g_p <9:5 9:7>" )); } @@ -3015,8 +3015,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<&g_p> -> P g_p <9:4 9:6>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<&g_p> -> P g_p <9:4 9:6>" )); } @@ -3051,8 +3051,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "B -> A <9:4 9:4>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"B -> A <9:4 9:4>" )); } @@ -3073,11 +3073,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "B<> -> A <11:4 11:4>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"B<> -> A <11:4 11:4>" )); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "B<> -> A <11:7 11:7>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"B<> -> A <11:7 11:7>" )); } @@ -3096,8 +3096,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateMemberSpecializations, "int A::foo() -> A::T A::foo() <5:4 5:6>" + TS_ASSERT(utility::containsElement( + client->templateMemberSpecializations, L"int A::foo() -> A::T A::foo() <5:4 5:6>" )); } @@ -3116,8 +3116,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateMemberSpecializations, "static int A::foo -> static A::T A::foo <5:11 5:13>" + TS_ASSERT(utility::containsElement( + client->templateMemberSpecializations, L"static int A::foo -> static A::T A::foo <5:11 5:13>" )); } @@ -3136,8 +3136,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateMemberSpecializations, "int A::foo -> A::T A::foo <5:4 5:6>" + TS_ASSERT(utility::containsElement( + client->templateMemberSpecializations, L"int A::foo -> A::T A::foo <5:4 5:6>" )); } @@ -3159,8 +3159,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateMemberSpecializations, "int A::B::foo -> A::T A::B::foo <7:5 7:7>" + TS_ASSERT(utility::containsElement( + client->templateMemberSpecializations, L"int A::B::foo -> A::T A::B::foo <7:5 7:7>" )); } @@ -3179,8 +3179,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateMemberSpecializations, "A::B -> A::B <5:8 5:8>" + TS_ASSERT(utility::containsElement( + client->templateMemberSpecializations, L"A::B -> A::B <5:8 5:8>" )); } @@ -3197,8 +3197,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A -> int <6:9 6:11>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A -> int <6:9 6:11>" )); } @@ -3249,8 +3249,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<&g_p> -> P g_p <8:10 8:12>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<&g_p> -> P g_p <8:10 8:12>" )); } @@ -3269,8 +3269,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<&g_p> -> P g_p <8:9 8:11>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<&g_p> -> P g_p <8:9 8:11>" )); } @@ -3289,8 +3289,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "B -> A <8:9 8:9>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"B -> A <8:9 8:9>" )); } @@ -3307,11 +3307,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A -> A::T <6:9 6:9>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A -> A::T <6:9 6:9>" )); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A -> int <6:12 6:14>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A -> int <6:12 6:14>" )); } @@ -3328,8 +3328,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<3, int U> -> A<3, int U>::U <6:12 6:12>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<3, int U> -> A<3, int U>::U <6:12 6:12>" )); } @@ -3346,8 +3346,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A -> A::U <6:15 6:15>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A -> A::U <6:15 6:15>" )); } @@ -3366,11 +3366,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<&g_p, P * q> -> P g_p <8:10 8:12>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<&g_p, P * q> -> P g_p <8:10 8:12>" )); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<&g_p, P * q> -> A<&g_p, P * q>::q <8:15 8:15>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<&g_p, P * q> -> A<&g_p, P * q>::q <8:15 8:15>" )); } @@ -3389,11 +3389,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<&g_p, P & q> -> P g_p <8:9 8:11>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<&g_p, P & q> -> P g_p <8:9 8:11>" )); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<&g_p, P & q> -> A<&g_p, P & q>::q <8:14 8:14>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<&g_p, P & q> -> A<&g_p, P & q>::q <8:14 8:14>" )); } @@ -3412,11 +3412,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "B typename U> -> A <8:9 8:9>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"B typename U> -> A <8:9 8:9>" )); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "B typename U> -> B typename U>::U <8:12 8:12>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"B typename U> -> B typename U>::U <8:12 8:12>" )); } @@ -3433,8 +3433,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A<3, typename T2, T2 T3> -> A<3, typename T2, T2 T3>::T3 <6:16 6:17>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A<3, typename T2, T2 T3> -> A<3, typename T2, T2 T3>::T3 <6:16 6:17>" )); } @@ -3452,8 +3452,8 @@ public: // ); // TS_ASSERT_EQUALS(client->templateArgumentTypes.size(), 2); - // TS_ASSERT_EQUALS(client->templateArgumentTypes[0], "A<3, template typename T2, T2 T3> -> A<3, template typename T2, T2 T3>::T2 <6:12 6:13>"); - // TS_ASSERT_EQUALS(client->templateArgumentTypes[1], "A<3, template typename T2, T2 T3> -> A<3, template typename T2, T2 T3>::T3 <6:16 6:17>"); + // TS_ASSERT_EQUALS(client->templateArgumentTypes[0], L"A<3, template typename T2, T2 T3> -> A<3, template typename T2, T2 T3>::T2 <6:12 6:13>"); + // TS_ASSERT_EQUALS(client->templateArgumentTypes[1], L"A<3, template typename T2, T2 T3> -> A<3, template typename T2, T2 T3>::T3 <6:16 6:17>"); //} void test_cxx_parser_finds_implicit_template_class_specialization() @@ -3468,8 +3468,8 @@ public: "A a;\n" ); - TS_ASSERT(utility::containsElement( - client->templateSpecializations, "A -> A <2:7 2:7>" + TS_ASSERT(utility::containsElement( + client->templateSpecializations, L"A -> A <2:7 2:7>" )); } @@ -3487,8 +3487,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "B -> A <7:17 7:17>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"B -> A <7:17 7:17>" )); } @@ -3507,8 +3507,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "A::U> -> B::U <8:19 8:19>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"A::U> -> B::U <8:19 8:19>" )); } @@ -3523,8 +3523,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void A::A() -> A::T A::foo <4:7 4:9>" + TS_ASSERT(utility::containsElement( + client->usages, L"void A::A() -> A::T A::foo <4:7 4:9>" )); } @@ -3538,8 +3538,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "A::T A::foo() -> A::T <4:2 4:2>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A::T A::foo() -> A::T <4:2 4:2>" )); } @@ -3552,8 +3552,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateDefaultArgumentTypes, "A::T -> int <1:24 1:26>" + TS_ASSERT(utility::containsElement( + client->templateDefaultArgumentTypes, L"A::T -> int <1:24 1:26>" )); } @@ -3580,8 +3580,8 @@ public: "{};\n" ); - TS_ASSERT(utility::containsElement( - client->templateDefaultArgumentTypes, "B typename T>::T -> A <4:40 4:40>" + TS_ASSERT(utility::containsElement( + client->templateDefaultArgumentTypes, L"B typename T>::T -> A <4:40 4:40>" )); } @@ -3600,8 +3600,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateSpecializations, "int test(int) -> T test(T) <2:3 2:6>" + TS_ASSERT(utility::containsElement( + client->templateSpecializations, L"int test(int) -> T test(T) <2:3 2:6>" )); } @@ -3621,8 +3621,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateSpecializations, "int test(int) -> T test(T) <8:5 8:8>" + TS_ASSERT(utility::containsElement( + client->templateSpecializations, L"int test(int) -> T test(T) <8:5 8:8>" )); } @@ -3640,8 +3640,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "void test() -> int <7:11 7:13>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"void test() -> int <7:11 7:13>" )); } @@ -3658,8 +3658,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "void test() -> int <6:7 6:9>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"void test() -> int <6:7 6:9>" )); } @@ -3693,8 +3693,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "void test() -> A <7:7 7:7>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"void test() -> A <7:7 7:7>" )); } @@ -3726,8 +3726,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "int test() -> int <6:17 6:19>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"int test() -> int <6:17 6:19>" )); } @@ -3761,8 +3761,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateDefaultArgumentTypes, "test::T -> int <1:24 1:26>" + TS_ASSERT(utility::containsElement( + client->templateDefaultArgumentTypes, L"test::T -> int <1:24 1:26>" )); } @@ -3790,8 +3790,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->templateDefaultArgumentTypes, "test typename T>::T -> A <4:40 4:40>" + TS_ASSERT(utility::containsElement( + client->templateDefaultArgumentTypes, L"test typename T>::T -> A <4:40 4:40>" )); } @@ -3808,8 +3808,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "void lambdaCaller::lambda at 4:2() const -> void func() <6:3 6:6>" + TS_ASSERT(utility::containsElement( + client->calls, L"void lambdaCaller::lambda at 4:2() const -> void func() <6:3 6:6>" )); } @@ -3823,8 +3823,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<3:6> <4:3 4:3>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<3:6> <4:3 4:3>" )); } @@ -3843,12 +3843,12 @@ public: { "--target=i686-pc-windows-msvc" } ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<3:6> <6:11 6:11>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<3:6> <6:11 6:11>" )); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<3:6> <7:6 7:6>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<3:6> <7:6 7:6>" )); } @@ -3867,8 +3867,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->templateArgumentTypes, "void dispatch() -> dispatch::MessageType <9:4 9:14>" + TS_ASSERT(utility::containsElement( + client->templateArgumentTypes, L"void dispatch() -> dispatch::MessageType <9:4 9:14>" )); } @@ -3892,8 +3892,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int main() -> void n::App::App(int) <11:16 11:18>" + TS_ASSERT(utility::containsElement( + client->calls, L"int main() -> void n::App::App(int) <11:16 11:18>" )); } @@ -3906,8 +3906,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->fields, "private int A::m_value <3:16 3:22>" + TS_ASSERT(utility::containsElement( + client->fields, L"private int A::m_value <3:16 3:22>" )); } @@ -3920,8 +3920,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->fields, "private int A::m_value <3:2 3:14>" + TS_ASSERT(utility::containsElement( + client->fields, L"private int A::m_value <3:2 3:14>" )); } @@ -3936,8 +3936,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int A::m_value -> int foo() <4:25 4:27>" + TS_ASSERT(utility::containsElement( + client->calls, L"int A::m_value -> int foo() <4:25 4:27>" )); } @@ -3952,8 +3952,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "int A::m_value -> int foo() <4:2 4:14>" + TS_ASSERT(utility::containsElement( + client->calls, L"int A::m_value -> int foo() <4:2 4:14>" )); } @@ -3968,7 +3968,7 @@ public: // ); // TS_ASSERT_EQUALS(client->templateArgumentTypes.size(), 1); - // TS_ASSERT_EQUALS(client->templateArgumentTypes[0], "A<1> -> int <0:0 0:0>"); + // TS_ASSERT_EQUALS(client->templateArgumentTypes[0], L"A<1> -> int <0:0 0:0>"); //} //void _test_cxx_parser_finds_implicit_constructor_call_in_initialization() @@ -3985,7 +3985,7 @@ public: // ); // TS_ASSERT_EQUALS(client->calls.size(), 1); - // TS_ASSERT_EQUALS(client->calls[0], "void B::B() -> A::A() <6:2 6:2>"); + // TS_ASSERT_EQUALS(client->calls[0], L"void B::B() -> A::A() <6:2 6:2>"); //} void test_cxx_parser_parses_multiple_files() @@ -4038,8 +4038,8 @@ public: "int a = b;\n" ); - TS_ASSERT(utility::containsElement( - client->errors, "use of undeclared identifier \'b\' <1:9 1:9>" + TS_ASSERT(utility::containsElement( + client->errors, L"use of undeclared identifier \'b\' <1:9 1:9>" )); } @@ -4049,8 +4049,8 @@ public: "// this is a line comment\n" ); - TS_ASSERT(utility::containsElement( - client->comments, "comment <1:1 1:26>" + TS_ASSERT(utility::containsElement( + client->comments, L"comment <1:1 1:26>" )); } @@ -4061,8 +4061,8 @@ public: "block comment */\n" ); - TS_ASSERT(utility::containsElement( - client->comments, "comment <1:1 2:17>" + TS_ASSERT(utility::containsElement( + client->comments, L"comment <1:1 2:17>" )); } diff --git a/src/test/CxxTypeNameTestSuite.h b/src/test/CxxTypeNameTestSuite.h index 80c6911e..cf0221f7 100644 --- a/src/test/CxxTypeNameTestSuite.h +++ b/src/test/CxxTypeNameTestSuite.h @@ -7,37 +7,37 @@ class CxxTypeNameTestSuite: public CxxTest::TestSuite public: void test_type_name_created_with_name_has_no_qualifiers_or_modifiers() { - CxxTypeName typeName("int", std::vector(), std::shared_ptr()); - TS_ASSERT_EQUALS("int", typeName.toString()); + CxxTypeName typeName(L"int", std::vector(), std::shared_ptr()); + TS_ASSERT_EQUALS(L"int", typeName.toString()); } void test_type_name_created_with_name_and_const_qualifier_has_no_modifiers() { - CxxTypeName typeName("int", std::vector(), std::shared_ptr()); + CxxTypeName typeName(L"int", std::vector(), std::shared_ptr()); typeName.addQualifier(CxxQualifierFlags::QUALIFIER_CONST); - TS_ASSERT_EQUALS("const int", typeName.toString()); + TS_ASSERT_EQUALS(L"const int", typeName.toString()); } void test_type_name_created_with_name_and_array_modifier_has_array_modifier() { - CxxTypeName typeName("int", std::vector(), std::shared_ptr()); - typeName.addModifier(CxxTypeName::Modifier("[]")); - TS_ASSERT_EQUALS("int []", typeName.toString()); + CxxTypeName typeName(L"int", std::vector(), std::shared_ptr()); + typeName.addModifier(CxxTypeName::Modifier(L"[]")); + TS_ASSERT_EQUALS(L"int []", typeName.toString()); } void test_type_name_created_with_name_and_const_pointer_modifier_has_const_pointer_modifier() { - CxxTypeName typeName("int", std::vector(), std::shared_ptr()); - typeName.addModifier(CxxTypeName::Modifier("*")); + CxxTypeName typeName(L"int", std::vector(), std::shared_ptr()); + typeName.addModifier(CxxTypeName::Modifier(L"*")); typeName.addQualifier(CxxQualifierFlags::QUALIFIER_CONST); - TS_ASSERT_EQUALS("int * const", typeName.toString()); + TS_ASSERT_EQUALS(L"int * const", typeName.toString()); } void test_type_name_created_with_name_and_pointer_pointer_modifier_has_pointer_pointer_modifier() { - CxxTypeName typeName("int", std::vector(), std::shared_ptr()); - typeName.addModifier(CxxTypeName::Modifier("*")); - typeName.addModifier(CxxTypeName::Modifier("*")); - TS_ASSERT_EQUALS("int * *", typeName.toString()); + CxxTypeName typeName(L"int", std::vector(), std::shared_ptr()); + typeName.addModifier(CxxTypeName::Modifier(L"*")); + typeName.addModifier(CxxTypeName::Modifier(L"*")); + TS_ASSERT_EQUALS(L"int * *", typeName.toString()); } }; diff --git a/src/test/GraphTestSuite.h b/src/test/GraphTestSuite.h index 8b4ca581..b7e36f51 100644 --- a/src/test/GraphTestSuite.h +++ b/src/test/GraphTestSuite.h @@ -90,7 +90,7 @@ public: void test_nodes_are_nodes() { - Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("A", NAME_DELIMITER_CXX), false); + Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); TS_ASSERT(a.isNode()); TS_ASSERT(!a.isEdge()); @@ -98,8 +98,8 @@ public: void test_edges_are_edges() { - Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("A", NAME_DELIMITER_CXX), false); - Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("B", NAME_DELIMITER_CXX), false); + Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); + Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"B", NAME_DELIMITER_CXX), false); Edge e(3, Edge::EDGE_USAGE, &a, &b); TS_ASSERT(!e.isNode()); @@ -108,27 +108,27 @@ public: void test_set_type_of_node_from_constructor() { - Node n(1, NodeType(NodeType::NODE_FUNCTION), NameHierarchy("A", NAME_DELIMITER_CXX), false); + Node n(1, NodeType(NodeType::NODE_FUNCTION), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); TS_ASSERT_EQUALS(NodeType(NodeType::NODE_FUNCTION), n.getType()); } void test_set_type_of_node_from_non_indexed() { - Node n(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("A", NAME_DELIMITER_CXX), false); + Node n(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); n.setType(NodeType(NodeType::NODE_CLASS)); TS_ASSERT_EQUALS(NodeType(NodeType::NODE_CLASS), n.getType()); } void test_can_not_change_type_of_node_after_it_was_set() { - Node n(3, NodeType(NodeType::NODE_NAMESPACE), NameHierarchy("A", NAME_DELIMITER_CXX), false); + Node n(3, NodeType(NodeType::NODE_NAMESPACE), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); n.setType(NodeType(NodeType::NODE_CLASS)); TS_ASSERT_DIFFERS(NodeType(NodeType::NODE_CLASS), n.getType()); } void test_node_can_be_copied_and_keeps_same_id() { - Node n(4, NodeType(NodeType::NODE_NAMESPACE), NameHierarchy("A", NAME_DELIMITER_CXX), false); + Node n(4, NodeType(NodeType::NODE_NAMESPACE), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); Node n2(n); TS_ASSERT_DIFFERS(&n, &n2); @@ -139,15 +139,15 @@ public: void test_node_type_bit_masking() { - Node n(1, NodeType(NodeType::NODE_NAMESPACE), NameHierarchy("A", NAME_DELIMITER_CXX), false); + Node n(1, NodeType(NodeType::NODE_NAMESPACE), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); TS_ASSERT(n.isType(NodeType::NODE_FUNCTION | NodeType::NODE_NAMESPACE | NodeType::NODE_CLASS)); TS_ASSERT(!n.isType(NodeType::NODE_FUNCTION | NodeType::NODE_METHOD | NodeType::NODE_CLASS)); } void test_get_type_of_edges() { - Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("A", NAME_DELIMITER_CXX), false); - Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("B", NAME_DELIMITER_CXX), false); + Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); + Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"B", NAME_DELIMITER_CXX), false); Edge e(3, Edge::EDGE_USAGE, &a, &b); TS_ASSERT_EQUALS(Edge::EDGE_USAGE, e.getType()); @@ -155,8 +155,8 @@ public: void test_edge_can_be_copied_and_keeps_same_id() { - Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("A", NAME_DELIMITER_CXX), false); - Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("B", NAME_DELIMITER_CXX), false); + Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); + Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"B", NAME_DELIMITER_CXX), false); Edge e(3, Edge::EDGE_USAGE, &a, &b); Edge e2(e, &a, &b); @@ -167,8 +167,8 @@ public: void test_edge_type_bit_masking() { - Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("A", NAME_DELIMITER_CXX), false); - Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("B", NAME_DELIMITER_CXX), false); + Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); + Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"B", NAME_DELIMITER_CXX), false); Edge e(3, Edge::EDGE_USAGE, &a, &b); TS_ASSERT(e.isType(Edge::EDGE_MEMBER | Edge::EDGE_CALL | Edge::EDGE_USAGE)); @@ -177,16 +177,16 @@ public: void test_node_finds_child_node() { - Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("A", NAME_DELIMITER_CXX), false); - Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("B", NAME_DELIMITER_CXX), false); - Node c(3, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("C", NAME_DELIMITER_CXX), false); + Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); + Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"B", NAME_DELIMITER_CXX), false); + Node c(3, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"C", NAME_DELIMITER_CXX), false); Edge e(4, Edge::EDGE_MEMBER, &a, &b); Edge e2(5, Edge::EDGE_MEMBER, &a, &c); Node* x = a.findChildNode( [](Node* n) { - return n->getName() == "C"; + return n->getName() == L"C"; } ); @@ -196,16 +196,16 @@ public: void test_node_can_not_find_child_node() { - Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("A", NAME_DELIMITER_CXX), false); - Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("B", NAME_DELIMITER_CXX), false); - Node c(3, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("C", NAME_DELIMITER_CXX), false); + Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); + Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"B", NAME_DELIMITER_CXX), false); + Node c(3, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"C", NAME_DELIMITER_CXX), false); Edge e(4, Edge::EDGE_MEMBER, &a, &b); Edge e2(5, Edge::EDGE_MEMBER, &a, &c); Node* x = a.findChildNode( [](Node* n) { - return n->getName() == "D"; + return n->getName() == L"D"; } ); @@ -214,9 +214,9 @@ public: void test_node_visits_child_nodes() { - Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("A", NAME_DELIMITER_CXX), false); - Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("B", NAME_DELIMITER_CXX), false); - Node c(3, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("C", NAME_DELIMITER_CXX), false); + Node a(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); + Node b(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"B", NAME_DELIMITER_CXX), false); + Node c(3, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"C", NAME_DELIMITER_CXX), false); Edge e(4, Edge::EDGE_MEMBER, &a, &b); Edge e2(5, Edge::EDGE_MEMBER, &a, &c); @@ -236,17 +236,17 @@ public: void test_graph_saves_nodes() { Graph graph; - Node* a = graph.createNode(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("A", NAME_DELIMITER_CXX), false); - Node* b = graph.createNode(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("B", NAME_DELIMITER_CXX), false); + Node* a = graph.createNode(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); + Node* b = graph.createNode(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"B", NAME_DELIMITER_CXX), false); TS_ASSERT_EQUALS(2, graph.getNodeCount()); TS_ASSERT_EQUALS(0, graph.getEdgeCount()); TS_ASSERT(graph.getNodeById(a->getId())); - TS_ASSERT_EQUALS("A", graph.getNodeById(a->getId())->getName()); + TS_ASSERT_EQUALS(L"A", graph.getNodeById(a->getId())->getName()); TS_ASSERT(graph.getNodeById(b->getId())); - TS_ASSERT_EQUALS("B", graph.getNodeById(b->getId())->getName()); + TS_ASSERT_EQUALS(L"B", graph.getNodeById(b->getId())->getName()); TS_ASSERT(!graph.getNodeById(0)); } @@ -255,8 +255,8 @@ public: { Graph graph; - Node* a = graph.createNode(1, NodeType(NodeType::NODE_FUNCTION), NameHierarchy("A", NAME_DELIMITER_CXX), false); - Node* b = graph.createNode(2, NodeType(NodeType::NODE_FUNCTION), NameHierarchy("B", NAME_DELIMITER_CXX), false); + Node* a = graph.createNode(1, NodeType(NodeType::NODE_FUNCTION), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); + Node* b = graph.createNode(2, NodeType(NodeType::NODE_FUNCTION), NameHierarchy(L"B", NAME_DELIMITER_CXX), false); Edge* e = graph.createEdge(3, Edge::EDGE_CALL, a, b); @@ -271,8 +271,8 @@ public: { Graph graph; - Node* a = graph.createNode(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("A", NAME_DELIMITER_CXX), false); - graph.createNode(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy("B", NAME_DELIMITER_CXX), false); + Node* a = graph.createNode(1, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"A", NAME_DELIMITER_CXX), false); + graph.createNode(2, NodeType(NodeType::NODE_SYMBOL), NameHierarchy(L"B", NAME_DELIMITER_CXX), false); TS_ASSERT_EQUALS(2, graph.getNodeCount()); TS_ASSERT_EQUALS(0, graph.getEdgeCount()); @@ -317,9 +317,9 @@ private: return Token::removeComponent(); } - virtual std::string getReadableTypeString() const + virtual std::wstring getReadableTypeString() const { - return ""; + return L""; } }; diff --git a/src/test/JavaIndexSampleProjectsTestSuite.h b/src/test/JavaIndexSampleProjectsTestSuite.h index ee7a7f31..c3d07046 100644 --- a/src/test/JavaIndexSampleProjectsTestSuite.h +++ b/src/test/JavaIndexSampleProjectsTestSuite.h @@ -264,6 +264,6 @@ private: parser.buildIndex(command); - return TextAccess::createFromString(parserClient->m_lines); + return TextAccess::createFromString(utility::encodeToUtf8(parserClient->m_lines)); } }; \ No newline at end of file diff --git a/src/test/JavaParserTestSuite.h b/src/test/JavaParserTestSuite.h index 7a4029d2..f9e1ef8c 100644 --- a/src/test/JavaParserTestSuite.h +++ b/src/test/JavaParserTestSuite.h @@ -46,8 +46,8 @@ public: "package foo;\n" ); - TS_ASSERT(utility::containsElement( - client->packages, "foo <1:9 1:11>" + TS_ASSERT(utility::containsElement( + client->packages, L"foo <1:9 1:11>" )); } @@ -59,8 +59,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "public A <1:1 <1:14 1:14> 3:1>" + TS_ASSERT(utility::containsElement( + client->classes, L"public A <1:1 <1:14 1:14> 3:1>" )); } @@ -72,8 +72,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->interfaces, "public A <1:1 <1:18 1:18> 3:1>" + TS_ASSERT(utility::containsElement( + client->interfaces, L"public A <1:1 <1:18 1:18> 3:1>" )); } @@ -86,8 +86,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "public foo.A <2:1 <2:14 2:14> 4:1>" + TS_ASSERT(utility::containsElement( + client->classes, L"public foo.A <2:1 <2:14 2:14> 4:1>" )); } @@ -100,8 +100,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "public foo.bar.A <2:1 <2:14 2:14> 4:1>" + TS_ASSERT(utility::containsElement( + client->classes, L"public foo.bar.A <2:1 <2:14 2:14> 4:1>" )); } @@ -114,8 +114,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->enums, "public foo.A <2:1 <2:13 2:13> 4:1>" + TS_ASSERT(utility::containsElement( + client->enums, L"public foo.A <2:1 <2:13 2:13> 4:1>" )); } @@ -129,8 +129,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->enumConstants, "foo.A.A_TEST <4:2 4:7>" + TS_ASSERT(utility::containsElement( + client->enumConstants, L"foo.A.A_TEST <4:2 4:7>" )); } @@ -146,8 +146,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->methods, "public foo.A.A() <4:2 <4:9 4:9> 6:2>" + TS_ASSERT(utility::containsElement( + client->methods, L"public foo.A.A() <4:2 <4:9 4:9> 6:2>" )); } @@ -163,8 +163,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->methods, "public void foo.A.bar(foo.A) <4:2 <4:14 4:16> 6:2>" + TS_ASSERT(utility::containsElement( + client->methods, L"public void foo.A.bar(foo.A) <4:2 <4:14 4:16> 6:2>" )); } @@ -182,8 +182,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "foo.A.bar.anonymous class (input.cc<7:17>) <7:17 <7:17 7:17> 7:19>" + TS_ASSERT(utility::containsElement( + client->classes, L"foo.A.bar.anonymous class (input.cc<7:17>) <7:17 <7:17 7:17> 7:19>" )); } @@ -206,8 +206,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->methods, "public void foo.A.bar.anonymous class (input.cc<10:3>).foo() <11:4 <11:16 11:18> 11:23>" + TS_ASSERT(utility::containsElement( + client->methods, L"public void foo.A.bar.anonymous class (input.cc<10:3>).foo() <11:4 <11:16 11:18> 11:23>" )); } @@ -223,8 +223,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->methods, "public static void foo.A.bar() <4:2 <4:21 4:23> 6:2>" + TS_ASSERT(utility::containsElement( + client->methods, L"public static void foo.A.bar() <4:2 <4:21 4:23> 6:2>" )); } @@ -238,8 +238,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->fields, "default int foo.A.bar <4:6 4:8>" + TS_ASSERT(utility::containsElement( + client->fields, L"default int foo.A.bar <4:6 4:8>" )); } @@ -253,8 +253,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->fields, "public int foo.A.bar <4:13 4:15>" + TS_ASSERT(utility::containsElement( + client->fields, L"public int foo.A.bar <4:13 4:15>" )); } @@ -268,8 +268,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->fields, "protected int foo.A.bar <4:16 4:18>" + TS_ASSERT(utility::containsElement( + client->fields, L"protected int foo.A.bar <4:16 4:18>" )); } @@ -283,8 +283,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->fields, "private int foo.A.bar <4:14 4:16>" + TS_ASSERT(utility::containsElement( + client->fields, L"private int foo.A.bar <4:14 4:16>" )); } @@ -298,8 +298,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->fields, "default static int foo.A.bar <4:13 4:15>" + TS_ASSERT(utility::containsElement( + client->fields, L"default static int foo.A.bar <4:13 4:15>" )); } @@ -315,8 +315,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "foo.A.bar<0> <4:15 4:15>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"foo.A.bar<0> <4:15 4:15>" )); } @@ -333,8 +333,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "foo.A.bar<0> <6:7 6:7>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"foo.A.bar<0> <6:7 6:7>" )); } @@ -346,8 +346,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeParameters, "A.T <1:17 1:17>" + TS_ASSERT(utility::containsElement( + client->typeParameters, L"A.T <1:17 1:17>" )); } @@ -362,8 +362,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeParameters, "A.foo.T <3:10 3:10>" + TS_ASSERT(utility::containsElement( + client->typeParameters, L"A.foo.T <3:10 3:10>" )); } @@ -376,8 +376,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->fields, "default static int A.b <3:6 3:6>" + TS_ASSERT(utility::containsElement( + client->fields, L"default static int A.b <3:6 3:6>" )); } @@ -388,8 +388,8 @@ public: "package foo;\n" ); - TS_ASSERT(utility::containsElement( - client->comments, "comment <1:1 1:25>" + TS_ASSERT(utility::containsElement( + client->comments, L"comment <1:1 1:25>" )); } @@ -400,8 +400,8 @@ public: "package foo;\n" ); - TS_ASSERT(utility::containsElement( - client->comments, "comment <1:1 1:27>" + TS_ASSERT(utility::containsElement( + client->comments, L"comment <1:1 1:27>" )); } @@ -411,8 +411,8 @@ public: "package foo\n" ); - TS_ASSERT(utility::containsElement( - client->errors, "Syntax error on token \"foo\", ; expected after this token <1:9 1:11>" + TS_ASSERT(utility::containsElement( + client->errors, L"Syntax error on token \"foo\", ; expected after this token <1:9 1:11>" )); } @@ -422,8 +422,8 @@ public: "import foo;\n" ); - TS_ASSERT(utility::containsElement( - client->errors, "The import foo cannot be resolved <1:8 1:10>" + TS_ASSERT(utility::containsElement( + client->errors, L"The import foo cannot be resolved <1:8 1:10>" )); } @@ -445,8 +445,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "public foo.bar.A.B <4:2 <4:15 4:15> 6:2>" + TS_ASSERT(utility::containsElement( + client->classes, L"public foo.bar.A.B <4:2 <4:15 4:15> 6:2>" )); } @@ -465,8 +465,8 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->classes, "default foo.bar.A.bar.B <6:3 <6:9 6:9> 8:3>" + TS_ASSERT(utility::containsElement( + client->classes, L"default foo.bar.A.bar.B <6:3 <6:9 6:9> 8:3>" )); } @@ -496,8 +496,8 @@ public: "import foo.bar;\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo <1:8 1:10>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo <1:8 1:10>" )); } @@ -514,11 +514,11 @@ public: "};\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo <6:3 6:5>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo <6:3 6:5>" )); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo.bar <6:7 6:9>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo.bar <6:7 6:9>" )); } @@ -537,8 +537,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo.X <8:3 8:6>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo.X <8:3 8:6>" )); } @@ -560,12 +560,12 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo.B <11:3 11:3>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo.B <11:3 11:3>" )); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo.A <11:5 11:9>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo.A <11:5 11:9>" )); } @@ -584,8 +584,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo.A <8:9 8:9>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo.A <8:9 8:9>" )); } @@ -602,12 +602,12 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo <6:3 6:5>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo <6:3 6:5>" )); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo.X <6:7 6:7>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo.X <6:7 6:7>" )); } @@ -624,8 +624,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo.X <6:3 6:6>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo.X <6:3 6:6>" )); } @@ -652,20 +652,20 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo <15:4 15:6>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo <15:4 15:6>" )); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo.X <15:8 15:8>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo.X <15:8 15:8>" )); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo.X.B <15:10 15:10>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo.X.B <15:10 15:10>" )); - TS_ASSERT(utility::containsElement( - client->qualifiers, "foo.X.A <15:12 15:16>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"foo.X.A <15:12 15:16>" )); } @@ -690,12 +690,12 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "A <14:20 14:20>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"A <14:20 14:20>" )); - TS_ASSERT(utility::containsElement( - client->qualifiers, "A.Bar <14:22 14:24>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"A.Bar <14:22 14:24>" )); } @@ -723,8 +723,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "A.B <17:20 17:20>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"A.B <17:20 17:20>" )); } @@ -749,8 +749,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "A.B <13:21 13:25>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"A.B <13:21 13:25>" )); } @@ -770,8 +770,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->qualifiers, "A <8:14 8:14>" + TS_ASSERT(utility::containsElement( + client->qualifiers, L"A <8:14 8:14>" )); } @@ -792,8 +792,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "foo.B -> foo.A <6:24 6:24>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"foo.B -> foo.A <6:24 6:24>" )); } @@ -810,8 +810,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "foo.B -> foo.A <6:27 6:27>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"foo.B -> foo.A <6:27 6:27>" )); } @@ -833,8 +833,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->inheritances, "A.foo.anonymous class (input.cc<10:3>) -> A.Base <9:16 9:19>" + TS_ASSERT(utility::containsElement( + client->inheritances, L"A.foo.anonymous class (input.cc<10:3>) -> A.Base <9:16 9:19>" )); } @@ -849,11 +849,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "A A.foo(A) -> A <3:9 3:9>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A A.foo(A) -> A <3:9 3:9>" )); - TS_ASSERT(utility::containsElement( - client->typeUses, "A A.foo(A) -> A <3:21 3:21>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A A.foo(A) -> A <3:21 3:21>" )); } @@ -871,8 +871,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "Foo.Base.X Foo.Derived.x -> Foo.Base.X <7:10 7:10>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"Foo.Base.X Foo.Derived.x -> Foo.Base.X <7:10 7:10>" )); } @@ -891,8 +891,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "void A.bar() -> A.B <8:5 8:5>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"void A.bar() -> A.B <8:5 8:5>" )); } @@ -919,8 +919,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "void foo.X.B.bar() -> void foo.X.A.bar() <15:10 15:12>" + TS_ASSERT(utility::containsElement( + client->calls, L"void foo.X.B.bar() -> void foo.X.A.bar() <15:10 15:12>" )); } @@ -941,8 +941,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "foo.Bar.Bar(int) -> foo.Bar.Bar() <10:3 10:6>" + TS_ASSERT(utility::containsElement( + client->calls, L"foo.Bar.Bar(int) -> foo.Bar.Bar() <10:3 10:6>" )); } @@ -965,8 +965,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "A.Derived.Derived() -> A.Base.Base() <11:4 11:8>" + TS_ASSERT(utility::containsElement( + client->calls, L"A.Derived.Derived() -> A.Base.Base() <11:4 11:8>" )); } @@ -989,8 +989,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->calls, "void Main.anonymous class (input.cc<6:40>).foo() -> void Main.anonymous class (input.cc<6:40>).bar() <8:4 8:6>" + TS_ASSERT(utility::containsElement( + client->calls, L"void Main.anonymous class (input.cc<6:40>).foo() -> void Main.anonymous class (input.cc<6:40>).bar() <8:4 8:6>" )); } @@ -1009,8 +1009,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->overrides, "void Main.C.foo(int) -> void Main.Interfaze.foo(int) <7:15 7:17>" + TS_ASSERT(utility::containsElement( + client->overrides, L"void Main.C.foo(int) -> void Main.Interfaze.foo(int) <7:15 7:17>" )); } @@ -1029,8 +1029,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->overrides, "void Main.C.foo(Main.X) -> void Main.Interfaze.foo(Main.Interfaze.T) <7:15 7:17>" + TS_ASSERT(utility::containsElement( + client->overrides, L"void Main.C.foo(Main.X) -> void Main.Interfaze.foo(Main.Interfaze.T) <7:15 7:17>" )); } @@ -1055,8 +1055,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void A.foo() -> A.B.B() <14:23 14:25>" + TS_ASSERT(utility::containsElement( + client->usages, L"void A.foo() -> A.B.B() <14:23 14:25>" )); } @@ -1084,8 +1084,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void A.foo() -> void A.B.bar() <17:23 17:25>" + TS_ASSERT(utility::containsElement( + client->usages, L"void A.foo() -> void A.B.bar() <17:23 17:25>" )); } @@ -1110,8 +1110,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void A.C.foo() -> void A.B.bar() <13:28 13:30>" + TS_ASSERT(utility::containsElement( + client->usages, L"void A.C.foo() -> void A.B.bar() <13:28 13:30>" )); } @@ -1169,8 +1169,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "foo.X.X(int) -> int foo.X.t <7:8 7:8>" + TS_ASSERT(utility::containsElement( + client->usages, L"foo.X.X(int) -> int foo.X.t <7:8 7:8>" )); } @@ -1188,8 +1188,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->usages, "void foo.X.foo() -> int foo.X.foo <7:8 7:10>" + TS_ASSERT(utility::containsElement( + client->usages, L"void foo.X.foo() -> int foo.X.foo <7:8 7:10>" )); } @@ -1206,8 +1206,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "foo.A.bar<0> <6:3 6:3>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"foo.A.bar<0> <6:3 6:3>" )); } @@ -1225,8 +1225,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "foo.A.bar<0> <7:3 7:3>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"foo.A.bar<0> <7:3 7:3>" )); } @@ -1238,11 +1238,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<2:1> <2:1 2:1>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<2:1> <2:1 2:1>" )); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<2:1> <3:1 3:1>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<2:1> <3:1 3:1>" )); } @@ -1254,11 +1254,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<2:1> <2:1 2:1>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<2:1> <2:1 2:1>" )); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<2:1> <3:1 3:1>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<2:1> <3:1 3:1>" )); } @@ -1273,11 +1273,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<4:2> <4:2 4:2>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<4:2> <4:2 4:2>" )); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<4:2> <5:2 5:2>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<4:2> <5:2 5:2>" )); } @@ -1292,11 +1292,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<4:2> <4:2 4:2>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<4:2> <4:2 4:2>" )); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<4:2> <5:2 5:2>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<4:2> <5:2 5:2>" )); } @@ -1316,11 +1316,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<6:3> <6:3 6:3>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<6:3> <6:3 6:3>" )); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<6:3> <9:3 9:3>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<6:3> <9:3 9:3>" )); } @@ -1337,11 +1337,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<5:3> <5:3 5:3>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<5:3> <5:3 5:3>" )); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<5:3> <6:3 6:3>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<5:3> <6:3 6:3>" )); } @@ -1354,11 +1354,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<3:24> <3:24 3:24>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<3:24> <3:24 3:24>" )); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<3:24> <3:29 3:29>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<3:24> <3:29 3:29>" )); } @@ -1380,11 +1380,11 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<10:3> <10:3 10:3>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<10:3> <10:3 10:3>" )); - TS_ASSERT(utility::containsElement( - client->localSymbols, "input.cc<10:3> <11:3 11:3>" + TS_ASSERT(utility::containsElement( + client->localSymbols, L"input.cc<10:3> <11:3 11:3>" )); } @@ -1397,8 +1397,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "A.T A.t -> A.T <3:2 3:2>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A.T A.t -> A.T <3:2 3:2>" )); } @@ -1411,8 +1411,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "void A.foo(T) -> A.foo.T <3:22 3:22>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"void A.foo(T) -> A.foo.T <3:22 3:22>" )); } @@ -1425,8 +1425,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "A A.t -> A <3:2 3:2>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A A.t -> A <3:2 3:2>" )); } @@ -1438,8 +1438,8 @@ public: "}\n" ); - TS_ASSERT(utility::containsElement( - client->typeUses, "A.T -> java.lang.Void <1:27 1:30>" + TS_ASSERT(utility::containsElement( + client->typeUses, L"A.T -> java.lang.Void <1:27 1:30>" )); } @@ -1452,7 +1452,7 @@ public: // ); // TS_ASSERT_EQUALS(client->errors.size(), 1); - // TS_ASSERT_EQUALS(client->errors[0], "use of undeclared identifier \'b\' <1:9 1:9>"); + // TS_ASSERT_EQUALS(client->errors[0], L"use of undeclared identifier \'b\' <1:9 1:9>"); //} //void test_cxx_parser_finds_location_of_line_comment() @@ -1462,7 +1462,7 @@ public: // ); // TS_ASSERT_EQUALS(client->comments.size(), 1); - // TS_ASSERT_EQUALS(client->comments[0], "comment <1:1 1:26>"); + // TS_ASSERT_EQUALS(client->comments[0], L"comment <1:1 1:26>"); //} //void test_cxx_parser_finds_location_of_block_comment() @@ -1473,7 +1473,7 @@ public: // ); // TS_ASSERT_EQUALS(client->comments.size(), 1); - // TS_ASSERT_EQUALS(client->comments[0], "comment <1:1 2:17>"); + // TS_ASSERT_EQUALS(client->comments[0], L"comment <1:1 2:17>"); //} diff --git a/src/test/LogManagerTestSuite.h b/src/test/LogManagerTestSuite.h index ab780efc..45a2cc79 100644 --- a/src/test/LogManagerTestSuite.h +++ b/src/test/LogManagerTestSuite.h @@ -39,13 +39,13 @@ public: { LogManagerImplementation logManagerImplementation; - std::string log = "test"; + const std::wstring log = L"test"; std::shared_ptr logger = std::make_shared(); logManagerImplementation.addLogger(logger); logManagerImplementation.logInfo(log, __FILE__, __FUNCTION__, __LINE__); - int logCount = logger->getMessageCount(); - std::string lastLog = logger->getLastMessage(); + const int logCount = logger->getMessageCount(); + const std::wstring lastLog = logger->getLastInfo(); TS_ASSERT_EQUALS(1, logCount); TS_ASSERT_EQUALS(log, lastLog); @@ -55,14 +55,14 @@ public: { LogManagerImplementation logManagerImplementation; - std::string log = "test"; + const std::wstring log = L"test"; std::shared_ptr logger = std::make_shared(); logManagerImplementation.addLogger(logger); logManagerImplementation.logWarning(log, __FILE__, __FUNCTION__, __LINE__); - int logCount = logger->getWarningCount(); - std::string lastLog = logger->getLastWarning(); + const int logCount = logger->getWarningCount(); + const std::wstring lastLog = logger->getLastWarning(); TS_ASSERT_EQUALS(1, logCount); TS_ASSERT_EQUALS(log, lastLog); @@ -72,14 +72,14 @@ public: { LogManagerImplementation logManagerImplementation; - std::string log = "test"; + std::wstring log = L"test"; std::shared_ptr logger = std::make_shared(); logManagerImplementation.addLogger(logger); logManagerImplementation.logError(log, __FILE__, __FUNCTION__, __LINE__); - int logCount = logger->getErrorCount(); - std::string lastLog = logger->getLastError(); + const int logCount = logger->getErrorCount(); + const std::wstring lastLog = logger->getLastError(); TS_ASSERT_EQUALS(1, logCount); TS_ASSERT_EQUALS(log, lastLog); @@ -89,9 +89,9 @@ public: { LogManagerImplementation logManagerImplementation; - std::string info = "info"; - std::string warning = "warning"; - std::string error = "error"; + std::wstring info = L"info"; + std::wstring warning = L"warning"; + std::wstring error = L"error"; std::shared_ptr logger = std::make_shared(); @@ -107,7 +107,7 @@ public: TS_ASSERT_EQUALS(0, logger->getWarningCount()); TS_ASSERT_EQUALS(1, logger->getErrorCount()); - TS_ASSERT_EQUALS(info, logger->getLastMessage()); + TS_ASSERT_EQUALS(info, logger->getLastInfo()); TS_ASSERT_EQUALS(error, logger->getLastError()); } @@ -143,7 +143,7 @@ public: { LogManagerImplementation logManagerImplementation; - std::string log = "foo"; + std::wstring log = L"foo"; unsigned int messageCount = 100; std::shared_ptr logger = std::make_shared(); logManagerImplementation.addLogger(logger); @@ -182,7 +182,7 @@ private: static void logSomeMessages( LogManagerImplementation* logManagerImplementation, - const std::string& message, + const std::wstring& message, const unsigned int messageCount ) { @@ -205,9 +205,9 @@ private: int getWarningCount() const; int getErrorCount() const; - std::string getLastMessage() const; - std::string getLastWarning() const; - std::string getLastError() const; + std::wstring getLastInfo() const; + std::wstring getLastWarning() const; + std::wstring getLastError() const; private: void logInfo(const LogMessage& message); @@ -218,9 +218,9 @@ private: int m_logWarningCount; int m_logErrorCount; - std::string m_lastMessage; - std::string m_lastWarning; - std::string m_lastError; + std::wstring m_lastInfo; + std::wstring m_lastWarning; + std::wstring m_lastError; }; }; @@ -230,9 +230,9 @@ LogManagerTestSuite::TestLogger::TestLogger() , m_logMessageCount(0) , m_logWarningCount(0) , m_logErrorCount(0) - , m_lastMessage("") - , m_lastWarning("") - , m_lastError("") + , m_lastInfo(L"") + , m_lastWarning(L"") + , m_lastError(L"") { } @@ -262,24 +262,24 @@ int LogManagerTestSuite::TestLogger::getErrorCount() const return m_logErrorCount; } -std::string LogManagerTestSuite::TestLogger::getLastMessage() const +std::wstring LogManagerTestSuite::TestLogger::getLastInfo() const { - return m_lastMessage; + return m_lastInfo; } -std::string LogManagerTestSuite::TestLogger::getLastWarning() const +std::wstring LogManagerTestSuite::TestLogger::getLastWarning() const { return m_lastWarning; } -std::string LogManagerTestSuite::TestLogger::getLastError() const +std::wstring LogManagerTestSuite::TestLogger::getLastError() const { return m_lastError; } void LogManagerTestSuite::TestLogger::logInfo(const LogMessage& message) { - m_lastMessage = message.message; + m_lastInfo = message.message; m_logMessageCount++; } diff --git a/src/test/SearchIndexTestSuite.h b/src/test/SearchIndexTestSuite.h index ed26c74b..a2b453c8 100644 --- a/src/test/SearchIndexTestSuite.h +++ b/src/test/SearchIndexTestSuite.h @@ -10,7 +10,7 @@ public: void test_search_index_finds_id_of_element_added() { SearchIndex index; - index.addNode(1, NameHierarchy::deserialize("::\tmfoo\tsvoid\tp() const").getQualifiedName()); + index.addNode(1, utility::encodeToUtf8(NameHierarchy::deserialize(L"::\tmfoo\tsvoid\tp() const").getQualifiedName())); index.finishSetup(); std::vector results = index.search("oo", NodeTypeSet::all(), 0); @@ -22,7 +22,7 @@ public: void test_search_index_finds_correct_indices_for_query() { SearchIndex index; - index.addNode(1, NameHierarchy::deserialize("::\tmfoo\tsvoid\tp() const").getQualifiedName()); + index.addNode(1, utility::encodeToUtf8(NameHierarchy::deserialize(L"::\tmfoo\tsvoid\tp() const").getQualifiedName())); index.finishSetup(); std::vector results = index.search("oo", NodeTypeSet::all(), 0); @@ -35,8 +35,8 @@ public: void test_search_index_finds_ids_for_ambiguous_query() { SearchIndex index; - index.addNode(1, NameHierarchy::deserialize("::\tmfor\tsvoid\tp() const").getQualifiedName()); - index.addNode(2, NameHierarchy::deserialize("::\tmfos\tsvoid\tp() const").getQualifiedName()); + index.addNode(1, utility::encodeToUtf8(NameHierarchy::deserialize(L"::\tmfor\tsvoid\tp() const").getQualifiedName())); + index.addNode(2, utility::encodeToUtf8(NameHierarchy::deserialize(L"::\tmfos\tsvoid\tp() const").getQualifiedName())); index.finishSetup(); std::vector results = index.search("fo", NodeTypeSet::all(), 0); @@ -50,7 +50,7 @@ public: void test_search_index_does_not_find_anything_after_clear() { SearchIndex index; - index.addNode(1, NameHierarchy::deserialize("::\tmfoo\tsvoid\tp() const").getQualifiedName()); + index.addNode(1, utility::encodeToUtf8(NameHierarchy::deserialize(L"::\tmfoo\tsvoid\tp() const").getQualifiedName())); index.finishSetup(); index.clear(); std::vector results = index.search("oo", NodeTypeSet::all(), 0); @@ -61,8 +61,8 @@ public: void test_search_index_does_not_find_all_results_when_max_amount_is_limited() { SearchIndex index; - index.addNode(1, NameHierarchy::deserialize("::\tmfoo1\tsvoid\tp() const").getQualifiedName()); - index.addNode(2, NameHierarchy::deserialize("::\tmfoo2\tsvoid\tp() const").getQualifiedName()); + index.addNode(1, utility::encodeToUtf8(NameHierarchy::deserialize(L"::\tmfoo1\tsvoid\tp() const").getQualifiedName())); + index.addNode(2, utility::encodeToUtf8(NameHierarchy::deserialize(L"::\tmfoo2\tsvoid\tp() const").getQualifiedName())); index.finishSetup(); std::vector results = index.search("oo", NodeTypeSet::all(), 1); @@ -72,8 +72,8 @@ public: void test_search_index_query_is_case_insensitive() { SearchIndex index; - index.addNode(1, NameHierarchy::deserialize("::\tmfoo1\tsvoid\tp() const").getQualifiedName()); - index.addNode(2, NameHierarchy::deserialize("::\tmFOO2\tsvoid\tp() const").getQualifiedName()); + index.addNode(1, utility::encodeToUtf8(NameHierarchy::deserialize(L"::\tmfoo1\tsvoid\tp() const").getQualifiedName())); + index.addNode(2, utility::encodeToUtf8(NameHierarchy::deserialize(L"::\tmFOO2\tsvoid\tp() const").getQualifiedName())); index.finishSetup(); std::vector results = index.search("oo", NodeTypeSet::all(), 0); @@ -84,8 +84,8 @@ public: { SearchIndex index; - index.addNode(1, NameHierarchy::deserialize("::\tmoaabbcc\tsvoid\tp() const").getQualifiedName()); - index.addNode(2, NameHierarchy::deserialize("::\tmocbcabc\tsvoid\tp() const").getQualifiedName()); + index.addNode(1, utility::encodeToUtf8(NameHierarchy::deserialize(L"::\tmoaabbcc\tsvoid\tp() const").getQualifiedName())); + index.addNode(2, utility::encodeToUtf8(NameHierarchy::deserialize(L"::\tmocbcabc\tsvoid\tp() const").getQualifiedName())); index.finishSetup(); std::vector results = index.search("abc", NodeTypeSet::all(), 0); diff --git a/src/test/SqliteBookmarkStorageTestSuite.h b/src/test/SqliteBookmarkStorageTestSuite.h index 5cd6160a..6f579ac5 100644 --- a/src/test/SqliteBookmarkStorageTestSuite.h +++ b/src/test/SqliteBookmarkStorageTestSuite.h @@ -19,8 +19,8 @@ public: for (size_t i = 0; i < bookmarkCount; i++) { - const Id categoryId = storage.addBookmarkCategory(StorageBookmarkCategoryData("test category")).id; - storage.addBookmark(StorageBookmarkData("test bookmark", "test comment", TimeStamp::now().toString(), categoryId)); + const Id categoryId = storage.addBookmarkCategory(StorageBookmarkCategoryData(L"test category")).id; + storage.addBookmark(StorageBookmarkData(L"test bookmark", L"test comment", TimeStamp::now().toString(), categoryId)); } result = storage.getAllBookmarks().size(); @@ -41,12 +41,12 @@ public: SqliteBookmarkStorage storage(databasePath); storage.setup(); - const Id categoryId = storage.addBookmarkCategory(StorageBookmarkCategoryData("test category")).id; - const Id bookmarkId = storage.addBookmark(StorageBookmarkData("test bookmark", "test comment", TimeStamp::now().toString(), categoryId)).id; + const Id categoryId = storage.addBookmarkCategory(StorageBookmarkCategoryData(L"test category")).id; + const Id bookmarkId = storage.addBookmark(StorageBookmarkData(L"test bookmark", L"test comment", TimeStamp::now().toString(), categoryId)).id; for (size_t i = 0; i < bookmarkCount; i++) { - storage.addBookmarkedNode(StorageBookmarkedNodeData(bookmarkId, "test name")); + storage.addBookmarkedNode(StorageBookmarkedNodeData(bookmarkId, L"test name")); } result = storage.getAllBookmarkedNodes().size(); @@ -66,9 +66,9 @@ public: SqliteBookmarkStorage storage(databasePath); storage.setup(); - const Id categoryId = storage.addBookmarkCategory(StorageBookmarkCategoryData("test category")).id; - const Id bookmarkId = storage.addBookmark(StorageBookmarkData("test bookmark", "test comment", TimeStamp::now().toString(), categoryId)).id; - storage.addBookmarkedNode(StorageBookmarkedNodeData(bookmarkId, "test name")); + const Id categoryId = storage.addBookmarkCategory(StorageBookmarkCategoryData(L"test category")).id; + const Id bookmarkId = storage.addBookmark(StorageBookmarkData(L"test bookmark", L"test comment", TimeStamp::now().toString(), categoryId)).id; + storage.addBookmarkedNode(StorageBookmarkedNodeData(bookmarkId, L"test name")); storage.removeBookmark(bookmarkId); @@ -84,8 +84,8 @@ public: { FilePath databasePath(L"data/SQLiteTestSuite/bookmarkTest.sqlite"); - const std::string updatedName = "updated name"; - const std::string updatedComment = "updated comment"; + const std::wstring updatedName = L"updated name"; + const std::wstring updatedComment = L"updated comment"; StorageBookmark storageBookmark; { @@ -93,9 +93,9 @@ public: SqliteBookmarkStorage storage(databasePath); storage.setup(); - const Id categoryId = storage.addBookmarkCategory(StorageBookmarkCategoryData("test category")).id; - const Id bookmarkId = storage.addBookmark(StorageBookmarkData("test bookmark", "test comment", TimeStamp::now().toString(), categoryId)).id; - storage.addBookmarkedNode(StorageBookmarkedNodeData(bookmarkId, "test name")); + const Id categoryId = storage.addBookmarkCategory(StorageBookmarkCategoryData(L"test category")).id; + const Id bookmarkId = storage.addBookmark(StorageBookmarkData(L"test bookmark", L"test comment", TimeStamp::now().toString(), categoryId)).id; + storage.addBookmarkedNode(StorageBookmarkedNodeData(bookmarkId, L"test name")); storage.updateBookmark(bookmarkId, updatedName, updatedComment, categoryId); diff --git a/src/test/SqliteIndexStorageTestSuite.h b/src/test/SqliteIndexStorageTestSuite.h index 7438359b..d64225f1 100644 --- a/src/test/SqliteIndexStorageTestSuite.h +++ b/src/test/SqliteIndexStorageTestSuite.h @@ -15,7 +15,7 @@ public: SqliteIndexStorage storage(databasePath); storage.setup(); storage.beginTransaction(); - storage.addNode(StorageNodeData(0, "a")); + storage.addNode(StorageNodeData(0, L"a")); storage.commitTransaction(); nodeCount = storage.getNodeCount(); } @@ -32,7 +32,7 @@ public: SqliteIndexStorage storage(databasePath); storage.setup(); storage.beginTransaction(); - int nodeId = storage.addNode(StorageNodeData(0, "a")).id; + int nodeId = storage.addNode(StorageNodeData(0, L"a")).id; storage.removeElement(nodeId); storage.commitTransaction(); nodeCount = storage.getNodeCount(); @@ -50,8 +50,8 @@ public: SqliteIndexStorage storage(databasePath); storage.setup(); storage.beginTransaction(); - int sourceNodeId = storage.addNode(StorageNodeData(0, "a")).id; - int targetNodeId = storage.addNode(StorageNodeData(0, "b")).id; + int sourceNodeId = storage.addNode(StorageNodeData(0, L"a")).id; + int targetNodeId = storage.addNode(StorageNodeData(0, L"b")).id; storage.addEdge(StorageEdgeData(0, sourceNodeId, targetNodeId)); storage.commitTransaction(); edgeCount = storage.getEdgeCount(); @@ -69,8 +69,8 @@ public: SqliteIndexStorage storage(databasePath); storage.setup(); storage.beginTransaction(); - int sourceNodeId = storage.addNode(StorageNodeData(0, "a")).id; - int targetNodeId = storage.addNode(StorageNodeData(0, "b")).id; + int sourceNodeId = storage.addNode(StorageNodeData(0, L"a")).id; + int targetNodeId = storage.addNode(StorageNodeData(0, L"b")).id; int edgeId = storage.addEdge(StorageEdgeData(0, sourceNodeId, targetNodeId)).id; storage.removeElement(edgeId); storage.commitTransaction(); diff --git a/src/test/StorageTestSuite.h b/src/test/StorageTestSuite.h index 1959126c..4964d593 100644 --- a/src/test/StorageTestSuite.h +++ b/src/test/StorageTestSuite.h @@ -18,7 +18,7 @@ public: { TestStorage storage; - std::string filePath = "path/to/test.h"; + std::wstring filePath = L"path/to/test.h"; std::shared_ptr intermetiateStorage = std::make_shared(); Id id = intermetiateStorage->addNode(StorageNodeData(utility::nodeTypeToInt(NodeType::NODE_FILE), NameHierarchy::serialize(NameHierarchy(filePath, NAME_DELIMITER_FILE)))); @@ -32,7 +32,7 @@ public: } void test_storage_saves_node() { - NameHierarchy a = createNameHierarchy("type"); + NameHierarchy a = createNameHierarchy(L"type"); TestStorage storage; @@ -50,8 +50,8 @@ public: void test_storage_saves_field_as_member() { - NameHierarchy a = createNameHierarchy("Struct"); - NameHierarchy b = createNameHierarchy("Struct::m_field"); + NameHierarchy a = createNameHierarchy(L"Struct"); + NameHierarchy b = createNameHierarchy(L"Struct::m_field"); TestStorage storage; @@ -256,19 +256,19 @@ private: return ParseLocation(m_filePath, 1, locationId, 1, locationId); } - NameHierarchy createFunctionNameHierarchy(std::string ret, std::string name, std::string parameters) const + NameHierarchy createFunctionNameHierarchy(std::wstring ret, std::wstring name, std::wstring parameters) const { NameHierarchy nameHierarchy = createNameHierarchy(name); - std::string lastName = nameHierarchy.back()->getName(); + std::wstring lastName = nameHierarchy.back()->getName(); nameHierarchy.pop(); nameHierarchy.push(std::make_shared(lastName, NameElement::Signature(ret, parameters))); return nameHierarchy; } - NameHierarchy createNameHierarchy(std::string s) const + NameHierarchy createNameHierarchy(std::wstring s) const { NameHierarchy nameHierarchy(NAME_DELIMITER_CXX); - for (std::string element: utility::splitToVector(s, nameDelimiterTypeToString(NAME_DELIMITER_CXX))) + for (std::wstring element: utility::splitToVector(s, nameDelimiterTypeToString(NAME_DELIMITER_CXX))) { nameHierarchy.push(std::make_shared(element, NameElement::Signature())); } diff --git a/src/test/helper/DumpParserClient.h b/src/test/helper/DumpParserClient.h index 93d9b8b7..cf419abc 100644 --- a/src/test/helper/DumpParserClient.h +++ b/src/test/helper/DumpParserClient.h @@ -10,7 +10,7 @@ class DumpParserClient : public ParserClient { public: DumpParserClient() - : m_lines("") + : m_lines(L"") { } @@ -18,7 +18,7 @@ public: const NameHierarchy& symbolName, SymbolKind symbolKind, AccessKind access, DefinitionKind definitionKind) override { - recordLine(symbolKindToString(symbolKind) + " " + addAccessPrefix(symbolName.getQualifiedNameWithSignature(), access) + "\n"); + recordLine(symbolKindToString(symbolKind) + L" " + addAccessPrefix(symbolName.getQualifiedNameWithSignature(), access) + L"\n"); return 0; } @@ -27,7 +27,7 @@ public: const ParseLocation& location, AccessKind access, DefinitionKind definitionKind) override { - recordLine(symbolKindToString(symbolKind) + " " + addLocationSuffix(addAccessPrefix(symbolName.getQualifiedNameWithSignature(), access) + " [" + location.filePath.fileName(), location) + "]\n"); + recordLine(symbolKindToString(symbolKind) + L" " + addLocationSuffix(addAccessPrefix(symbolName.getQualifiedNameWithSignature(), access) + L" [" + location.filePath.wFileName(), location) + L"]\n"); return 0; } @@ -36,7 +36,7 @@ public: const ParseLocation& location, const ParseLocation& scopeLocation, AccessKind access, DefinitionKind definitionKind) override { - recordLine(symbolKindToString(symbolKind) + " " + addLocationSuffix(addAccessPrefix(symbolName.getQualifiedNameWithSignature(), access) + " [" + location.filePath.fileName(), location, scopeLocation) + "]\n"); + recordLine(symbolKindToString(symbolKind) + L" " + addLocationSuffix(addAccessPrefix(symbolName.getQualifiedNameWithSignature(), access) + L" [" + location.filePath.wFileName(), location, scopeLocation) + L"]\n"); return 0; } @@ -44,51 +44,51 @@ public: ReferenceKind referenceKind, const NameHierarchy& referencedName, const NameHierarchy& contextName, const ParseLocation& location) override { - std::string contextNameString = contextName.getQualifiedNameWithSignature(); + std::wstring contextNameString = contextName.getQualifiedNameWithSignature(); try { if (FilePath(contextNameString).exists()) { - contextNameString = FilePath(contextNameString).fileName(); + contextNameString = FilePath(contextNameString).wFileName(); } } catch (const boost::filesystem::filesystem_error& e) { // do nothing and use the old contectNameString } - recordLine(referenceKindToString(referenceKind) + " " + addLocationSuffix(contextNameString + " -> " + referencedName.getQualifiedNameWithSignature() + " [" + location.filePath.fileName(), location) + "]\n"); + recordLine(referenceKindToString(referenceKind) + L" " + addLocationSuffix(contextNameString + L" -> " + referencedName.getQualifiedNameWithSignature() + L" [" + location.filePath.wFileName(), location) + L"]\n"); } void recordQualifierLocation(const NameHierarchy& qualifierName, const ParseLocation& location) override { - recordLine("QUALIFIER: " + addLocationSuffix(qualifierName.getQualifiedNameWithSignature() + " [" + location.filePath.fileName(), location) + "]\n"); + recordLine(L"QUALIFIER: " + addLocationSuffix(qualifierName.getQualifiedNameWithSignature() + L" [" + location.filePath.wFileName(), location) + L"]\n"); } - virtual void recordLocalSymbol(const std::string& name, const ParseLocation& location) override + virtual void recordLocalSymbol(const std::wstring& name, const ParseLocation& location) override { - recordLine("LOCAL_SYMBOL: " + addLocationSuffix(name + " [" + location.filePath.fileName(), location) + "]\n"); + recordLine(L"LOCAL_SYMBOL: " + addLocationSuffix(name + L" [" + location.filePath.wFileName(), location) + L"]\n"); } virtual void recordFile(const FileInfo& fileInfo) override { - recordLine("FILE: " + fileInfo.path.fileName() + "\n"); + recordLine(L"FILE: " + fileInfo.path.wFileName() + L"\n"); } virtual void recordComment(const ParseLocation& location) override { - recordLine("COMMENT: " + addLocationSuffix("comment [" + location.filePath.fileName(), location) + "]\n"); + recordLine(L"COMMENT: " + addLocationSuffix(L"comment [" + location.filePath.wFileName(), location) + L"]\n"); } - std::string m_lines; + std::wstring m_lines; private: - virtual void doRecordError(const ParseLocation& location, const std::string& message, + virtual void doRecordError(const ParseLocation& location, const std::wstring& message, bool fatal, bool indexed) override { - recordLine("ERROR: " + addLocationSuffix(message + " [" + location.filePath.fileName(), location) + "]\n"); + recordLine(L"ERROR: " + addLocationSuffix(message + L" [" + location.filePath.wFileName(), location) + L"]\n"); } - void recordLine(const std::string& message) + void recordLine(const std::wstring& message) { if (m_recordedLines.find(message) == m_recordedLines.end()) { @@ -97,87 +97,87 @@ private: } } - std::string symbolKindToString(SymbolKind symbolKind) const + std::wstring symbolKindToString(SymbolKind symbolKind) const { switch (symbolKind) { case SYMBOL_BUILTIN_TYPE: - return "SYMBOL_BUILTIN_TYPE"; + return L"SYMBOL_BUILTIN_TYPE"; case SYMBOL_CLASS: - return "SYMBOL_CLASS"; + return L"SYMBOL_CLASS"; case SYMBOL_ENUM: - return "SYMBOL_ENUM"; + return L"SYMBOL_ENUM"; case SYMBOL_ENUM_CONSTANT: - return "SYMBOL_ENUM_CONSTANT"; + return L"SYMBOL_ENUM_CONSTANT"; case SYMBOL_FIELD: - return "SYMBOL_FIELD"; + return L"SYMBOL_FIELD"; case SYMBOL_FUNCTION: - return "SYMBOL_FUNCTION"; + return L"SYMBOL_FUNCTION"; case SYMBOL_GLOBAL_VARIABLE: - return "SYMBOL_GLOBAL_VARIABLE"; + return L"SYMBOL_GLOBAL_VARIABLE"; case SYMBOL_INTERFACE: - return "SYMBOL_INTERFACE"; + return L"SYMBOL_INTERFACE"; case SYMBOL_MACRO: - return "SYMBOL_MACRO"; + return L"SYMBOL_MACRO"; case SYMBOL_METHOD: - return "SYMBOL_METHOD"; + return L"SYMBOL_METHOD"; case SYMBOL_NAMESPACE: - return "SYMBOL_NAMESPACE"; + return L"SYMBOL_NAMESPACE"; case SYMBOL_PACKAGE: - return "SYMBOL_PACKAGE"; + return L"SYMBOL_PACKAGE"; case SYMBOL_STRUCT: - return "SYMBOL_STRUCT"; + return L"SYMBOL_STRUCT"; case SYMBOL_TEMPLATE_PARAMETER: - return "SYMBOL_TEMPLATE_PARAMETER"; + return L"SYMBOL_TEMPLATE_PARAMETER"; case SYMBOL_TYPEDEF: - return "SYMBOL_TYPEDEF"; + return L"SYMBOL_TYPEDEF"; case SYMBOL_TYPE_PARAMETER: - return "SYMBOL_TYPE_PARAMETER"; + return L"SYMBOL_TYPE_PARAMETER"; case SYMBOL_UNION: - return "SYMBOL_UNION"; + return L"SYMBOL_UNION"; default: break; } - return "SYMBOL_NON_INDEXED"; + return L"SYMBOL_NON_INDEXED"; } - std::string referenceKindToString(ReferenceKind referenceKind) const + std::wstring referenceKindToString(ReferenceKind referenceKind) const { switch (referenceKind) { case REFERENCE_TYPE_USAGE: - return "REFERENCE_TYPE_USAGE"; + return L"REFERENCE_TYPE_USAGE"; case REFERENCE_USAGE: - return "REFERENCE_USAGE"; + return L"REFERENCE_USAGE"; case REFERENCE_CALL: - return "REFERENCE_CALL"; + return L"REFERENCE_CALL"; case REFERENCE_INHERITANCE: - return "REFERENCE_INHERITANCE"; + return L"REFERENCE_INHERITANCE"; case REFERENCE_OVERRIDE: - return "REFERENCE_OVERRIDE"; + return L"REFERENCE_OVERRIDE"; case REFERENCE_TEMPLATE_ARGUMENT: - return "REFERENCE_TEMPLATE_ARGUMENT"; + return L"REFERENCE_TEMPLATE_ARGUMENT"; case REFERENCE_TYPE_ARGUMENT: - return "REFERENCE_TYPE_ARGUMENT"; + return L"REFERENCE_TYPE_ARGUMENT"; case REFERENCE_TEMPLATE_DEFAULT_ARGUMENT: - return "REFERENCE_TEMPLATE_DEFAULT_ARGUMENT"; + return L"REFERENCE_TEMPLATE_DEFAULT_ARGUMENT"; case REFERENCE_TEMPLATE_SPECIALIZATION: - return "REFERENCE_TEMPLATE_SPECIALIZATION"; + return L"REFERENCE_TEMPLATE_SPECIALIZATION"; case REFERENCE_TEMPLATE_MEMBER_SPECIALIZATION: - return "REFERENCE_TEMPLATE_MEMBER_SPECIALIZATION"; + return L"REFERENCE_TEMPLATE_MEMBER_SPECIALIZATION"; case REFERENCE_INCLUDE: - return "REFERENCE_INCLUDE"; + return L"REFERENCE_INCLUDE"; case REFERENCE_IMPORT: - return "REFERENCE_IMPORT"; + return L"REFERENCE_IMPORT"; case REFERENCE_MACRO_USAGE: - return "REFERENCE_MACRO_USAGE"; + return L"REFERENCE_MACRO_USAGE"; default: break; } - return "REFERENCE_UNDEFINED"; + return L"REFERENCE_UNDEFINED"; } - std::set m_recordedLines; + std::set m_recordedLines; }; #endif // DUMP_PARSER_CLIENT_H diff --git a/src/test/helper/TestParserClient.h b/src/test/helper/TestParserClient.h index 07f040be..74f4584b 100644 --- a/src/test/helper/TestParserClient.h +++ b/src/test/helper/TestParserClient.h @@ -11,7 +11,7 @@ public: const NameHierarchy& symbolName, SymbolKind symbolKind, AccessKind access, DefinitionKind definitionKind) override { - std::vector* bin = getBinForSymbolKind(symbolKind); + std::vector* bin = getBinForSymbolKind(symbolKind); if (bin != nullptr) { bin->push_back(addAccessPrefix(symbolName.getQualifiedNameWithSignature(), access)); @@ -24,7 +24,7 @@ public: const ParseLocation& location, AccessKind access, DefinitionKind definitionKind) override { - std::vector* bin = getBinForSymbolKind(symbolKind); + std::vector* bin = getBinForSymbolKind(symbolKind); if (bin != nullptr) { bin->push_back(addLocationSuffix(addAccessPrefix(symbolName.getQualifiedNameWithSignature(), access), location)); @@ -37,7 +37,7 @@ public: const ParseLocation& location, const ParseLocation& scopeLocation, AccessKind access, DefinitionKind definitionKind) override { - std::vector* bin = getBinForSymbolKind(symbolKind); + std::vector* bin = getBinForSymbolKind(symbolKind); if (bin != nullptr) { bin->push_back(addLocationSuffix(addAccessPrefix(symbolName.getQualifiedNameWithSignature(), access), location, scopeLocation)); @@ -49,7 +49,7 @@ public: ReferenceKind referenceKind, const NameHierarchy& referencedName, const NameHierarchy& contextName, const ParseLocation& location) override { - std::vector* referenceContainer = nullptr; + std::vector* referenceContainer = nullptr; switch (referenceKind) { case REFERENCE_TYPE_USAGE: @@ -97,7 +97,7 @@ public: if (referenceContainer != nullptr) { referenceContainer->push_back(addLocationSuffix( - contextName.getQualifiedNameWithSignature() + " -> " + referencedName.getQualifiedNameWithSignature(), location) + contextName.getQualifiedNameWithSignature() + L" -> " + referencedName.getQualifiedNameWithSignature(), location) ); } } @@ -108,70 +108,70 @@ public: qualifiers.push_back(addLocationSuffix(qualifierName.getQualifiedNameWithSignature(), location)); } - virtual void recordLocalSymbol(const std::string& name, const ParseLocation& location) override + virtual void recordLocalSymbol(const std::wstring& name, const ParseLocation& location) override { localSymbols.push_back(addLocationSuffix(name, location)); } virtual void recordFile(const FileInfo& fileInfo) override { - files.insert(fileInfo.path.str()); + files.insert(fileInfo.path.wstr()); } virtual void recordComment(const ParseLocation& location) override { - comments.push_back(addLocationSuffix("comment", location)); + comments.push_back(addLocationSuffix(L"comment", location)); } - std::vector errors; - std::vector qualifiers; + std::vector errors; + std::vector qualifiers; - std::vector packages; - std::vector typedefs; - std::vector builtinTypes; - std::vector classes; - std::vector unions; - std::vector interfaces; - std::vector enums; - std::vector enumConstants; - std::vector functions; - std::vector fields; - std::vector globalVariables; - std::vector methods; - std::vector namespaces; - std::vector structs; - std::vector macros; - std::vector templateParameterTypes; - std::vector typeParameters; - std::vector localSymbols; - std::set files; - std::vector comments; + std::vector packages; + std::vector typedefs; + std::vector builtinTypes; + std::vector classes; + std::vector unions; + std::vector interfaces; + std::vector enums; + std::vector enumConstants; + std::vector functions; + std::vector fields; + std::vector globalVariables; + std::vector methods; + std::vector namespaces; + std::vector structs; + std::vector macros; + std::vector templateParameterTypes; + std::vector typeParameters; + std::vector localSymbols; + std::set files; + std::vector comments; - std::vector inheritances; - std::vector overrides; - std::vector calls; - std::vector usages; // for variables - std::vector typeUses; // for types - std::vector macroUses; - std::vector templateArgumentTypes; - std::vector typeArguments; - std::vector templateDefaultArgumentTypes; - std::vector templateSpecializations; - std::vector templateMemberSpecializations; - std::vector includes; - std::vector imports; + std::vector inheritances; + std::vector overrides; + std::vector calls; + std::vector usages; // for variables + std::vector typeUses; // for types + std::vector macroUses; + std::vector templateArgumentTypes; + std::vector typeArguments; + std::vector templateDefaultArgumentTypes; + std::vector templateSpecializations; + std::vector templateMemberSpecializations; + std::vector includes; + std::vector imports; private: virtual void doRecordError( const ParseLocation& location, - const std::string& message, + const std::wstring& message, bool fatal, bool indexed) override { errors.push_back(addLocationSuffix(message, location)); } - std::vector* getBinForSymbolKind(SymbolKind symbolType) + std::vector* getBinForSymbolKind(SymbolKind symbolType) { switch (symbolType) {