logic: use wstring in symbol and bookmark names
* use wstring in symbol and bookmark names * fixed setting apppath in windows includes * regard utf8 encoding in shared indexer commands * regard utf8 encoding in shared indexer status
This commit is contained in:
@@ -42,7 +42,7 @@ size_t IntermediateStorage::getByteSize(size_t stringSize) const
|
||||
for (const StorageErrorData& storageError: getErrors())
|
||||
{
|
||||
byteSize += sizeof(StorageErrorData);
|
||||
byteSize += stringSize + storageError.filePath.str().size();
|
||||
byteSize += stringSize + storageError.filePath.size();
|
||||
byteSize += stringSize + storageError.message.size();
|
||||
}
|
||||
|
||||
@@ -83,10 +83,10 @@ void IntermediateStorage::setAllFilesIncomplete()
|
||||
|
||||
void IntermediateStorage::setFilesWithErrorsIncomplete()
|
||||
{
|
||||
std::set<std::string> errorFileNames;
|
||||
std::set<std::wstring> errorFileNames;
|
||||
for (const StorageErrorData& error : m_errors)
|
||||
{
|
||||
errorFileNames.insert(error.filePath.str());
|
||||
errorFileNames.insert(error.filePath);
|
||||
}
|
||||
|
||||
for (StorageFile& file : m_files)
|
||||
@@ -100,9 +100,8 @@ void IntermediateStorage::setFilesWithErrorsIncomplete()
|
||||
|
||||
Id IntermediateStorage::addNode(const StorageNodeData& nodeData)
|
||||
{
|
||||
|
||||
const std::string serialized = serialize(nodeData);
|
||||
std::unordered_map<std::string, size_t>::iterator it = m_nodesIndex.find(serialized);
|
||||
const std::wstring serialized = serialize(nodeData);
|
||||
std::unordered_map<std::wstring, size_t>::iterator it = m_nodesIndex.find(serialized);
|
||||
if (it != m_nodesIndex.end())
|
||||
{
|
||||
StorageNode& storedNode = m_nodes[it->second];
|
||||
@@ -126,20 +125,19 @@ void IntermediateStorage::addSymbol(const StorageSymbol& symbol)
|
||||
|
||||
void IntermediateStorage::addFile(const StorageFile& file)
|
||||
{
|
||||
const std::string serialized = serialize(file);
|
||||
const std::wstring serialized = serialize(file);
|
||||
if (m_serializedFiles.find(serialized) == m_serializedFiles.end())
|
||||
{
|
||||
m_files.push_back(file);
|
||||
m_serializedFiles.insert(serialized);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Id IntermediateStorage::addEdge(const StorageEdgeData& edgeData)
|
||||
{
|
||||
|
||||
const std::string serialized = serialize(edgeData);
|
||||
std::unordered_map<std::string, size_t>::const_iterator it = m_edgesIndex.find(serialized);
|
||||
const std::wstring serialized = serialize(edgeData);
|
||||
std::unordered_map<std::wstring, size_t>::const_iterator it = m_edgesIndex.find(serialized);
|
||||
if (it != m_edgesIndex.end())
|
||||
{
|
||||
return m_edges[it->second].id;
|
||||
@@ -154,8 +152,8 @@ Id IntermediateStorage::addEdge(const StorageEdgeData& edgeData)
|
||||
Id IntermediateStorage::addLocalSymbol(const StorageLocalSymbolData& localSymbolData)
|
||||
{
|
||||
|
||||
const std::string serialized = serialize(localSymbolData);
|
||||
std::unordered_map<std::string, StorageLocalSymbol>::const_iterator it = m_localSymbols.find(serialized);
|
||||
const std::wstring serialized = serialize(localSymbolData);
|
||||
std::unordered_map<std::wstring, StorageLocalSymbol>::const_iterator it = m_localSymbols.find(serialized);
|
||||
if (it != m_localSymbols.end())
|
||||
{
|
||||
return it->second.id;
|
||||
@@ -168,8 +166,8 @@ Id IntermediateStorage::addLocalSymbol(const StorageLocalSymbolData& localSymbol
|
||||
|
||||
Id IntermediateStorage::addSourceLocation(const StorageSourceLocationData& sourceLocationData)
|
||||
{
|
||||
const std::string serialized = serialize(sourceLocationData);
|
||||
std::unordered_map<std::string, StorageSourceLocation>::const_iterator it = m_sourceLocations.find(serialized);
|
||||
const std::wstring serialized = serialize(sourceLocationData);
|
||||
std::unordered_map<std::wstring, StorageSourceLocation>::const_iterator it = m_sourceLocations.find(serialized);
|
||||
if (it != m_sourceLocations.end())
|
||||
{
|
||||
return it->second.id;
|
||||
@@ -182,7 +180,7 @@ Id IntermediateStorage::addSourceLocation(const StorageSourceLocationData& sourc
|
||||
|
||||
void IntermediateStorage::addOccurrence(const StorageOccurrence& occurrence)
|
||||
{
|
||||
const std::string serialized = serialize(occurrence);
|
||||
const std::wstring serialized = serialize(occurrence);
|
||||
|
||||
if (m_serializedOccurrences.find(serialized) == m_serializedOccurrences.end())
|
||||
{
|
||||
@@ -193,7 +191,7 @@ void IntermediateStorage::addOccurrence(const StorageOccurrence& occurrence)
|
||||
|
||||
void IntermediateStorage::addComponentAccess(const StorageComponentAccessData& componentAccessData)
|
||||
{
|
||||
const std::string serialized = serialize(componentAccessData);
|
||||
const std::wstring serialized = serialize(componentAccessData);
|
||||
|
||||
if (m_serializedComponentAccesses.find(serialized) == m_serializedComponentAccesses.end())
|
||||
{
|
||||
@@ -204,7 +202,7 @@ void IntermediateStorage::addComponentAccess(const StorageComponentAccessData& c
|
||||
|
||||
void IntermediateStorage::addCommentLocation(const StorageCommentLocationData& commentLocationData)
|
||||
{
|
||||
const std::string serialized = serialize(commentLocationData);
|
||||
const std::wstring serialized = serialize(commentLocationData);
|
||||
|
||||
if (m_serializedCommentLocations.find(serialized) == m_serializedCommentLocations.end())
|
||||
{
|
||||
@@ -215,7 +213,7 @@ void IntermediateStorage::addCommentLocation(const StorageCommentLocationData& c
|
||||
|
||||
void IntermediateStorage::addError(const StorageErrorData& errorData)
|
||||
{
|
||||
const std::string serialized = serialize(errorData);
|
||||
const std::wstring serialized = serialize(errorData);
|
||||
|
||||
if (m_serializedErrors.find(serialized) == m_serializedErrors.end())
|
||||
{
|
||||
@@ -258,7 +256,7 @@ void IntermediateStorage::forEachEdge(std::function<void(const StorageEdge& /*da
|
||||
|
||||
void IntermediateStorage::forEachLocalSymbol(std::function<void(const StorageLocalSymbol& /*data*/)> callback) const
|
||||
{
|
||||
for (std::unordered_map<std::string, StorageLocalSymbol>::const_iterator it = m_localSymbols.begin();
|
||||
for (std::unordered_map<std::wstring, StorageLocalSymbol>::const_iterator it = m_localSymbols.begin();
|
||||
it != m_localSymbols.end(); it++)
|
||||
{
|
||||
callback(it->second);
|
||||
@@ -267,7 +265,7 @@ void IntermediateStorage::forEachLocalSymbol(std::function<void(const StorageLoc
|
||||
|
||||
void IntermediateStorage::forEachSourceLocation(std::function<void(const StorageSourceLocation& /*data*/)> callback) const
|
||||
{
|
||||
for (std::unordered_map<std::string, StorageSourceLocation>::const_iterator it = m_sourceLocations.begin();
|
||||
for (std::unordered_map<std::wstring, StorageSourceLocation>::const_iterator it = m_sourceLocations.begin();
|
||||
it != m_sourceLocations.end(); it++)
|
||||
{
|
||||
callback(it->second);
|
||||
@@ -448,73 +446,73 @@ void IntermediateStorage::setNextId(const Id nextId)
|
||||
m_nextId = nextId;
|
||||
}
|
||||
|
||||
std::string IntermediateStorage::serialize(const StorageNodeData& nodeData) const
|
||||
std::wstring IntermediateStorage::serialize(const StorageNodeData& nodeData) const
|
||||
{
|
||||
return nodeData.serializedName;
|
||||
}
|
||||
|
||||
std::string IntermediateStorage::serialize(const StorageFile& file) const
|
||||
std::wstring IntermediateStorage::serialize(const StorageFile& file) const
|
||||
{
|
||||
return file.filePath;
|
||||
}
|
||||
|
||||
std::string IntermediateStorage::serialize(const StorageEdgeData& edgeData) const
|
||||
std::wstring IntermediateStorage::serialize(const StorageEdgeData& edgeData) const
|
||||
{
|
||||
return (
|
||||
std::to_string(edgeData.type) + ";" +
|
||||
std::to_string(edgeData.sourceNodeId) + ";" +
|
||||
std::to_string(edgeData.targetNodeId)
|
||||
std::to_wstring(edgeData.type) + L";" +
|
||||
std::to_wstring(edgeData.sourceNodeId) + L";" +
|
||||
std::to_wstring(edgeData.targetNodeId)
|
||||
);
|
||||
}
|
||||
|
||||
std::string IntermediateStorage::serialize(const StorageLocalSymbolData& localSymbolData) const
|
||||
std::wstring IntermediateStorage::serialize(const StorageLocalSymbolData& localSymbolData) const
|
||||
{
|
||||
return localSymbolData.name;
|
||||
}
|
||||
|
||||
std::string IntermediateStorage::serialize(const StorageSourceLocationData& sourceLocationData) const
|
||||
std::wstring IntermediateStorage::serialize(const StorageSourceLocationData& sourceLocationData) const
|
||||
{
|
||||
return (
|
||||
std::to_string(sourceLocationData.fileNodeId) + ";" +
|
||||
std::to_string(sourceLocationData.startLine) + ";" +
|
||||
std::to_string(sourceLocationData.startCol) + ";" +
|
||||
std::to_string(sourceLocationData.endLine) + ";" +
|
||||
std::to_string(sourceLocationData.endCol) + ";" +
|
||||
std::to_string(sourceLocationData.type)
|
||||
std::to_wstring(sourceLocationData.fileNodeId) + L";" +
|
||||
std::to_wstring(sourceLocationData.startLine) + L";" +
|
||||
std::to_wstring(sourceLocationData.startCol) + L";" +
|
||||
std::to_wstring(sourceLocationData.endLine) + L";" +
|
||||
std::to_wstring(sourceLocationData.endCol) + L";" +
|
||||
std::to_wstring(sourceLocationData.type)
|
||||
);
|
||||
}
|
||||
|
||||
std::string IntermediateStorage::serialize(const StorageOccurrence& occurrence) const
|
||||
std::wstring IntermediateStorage::serialize(const StorageOccurrence& occurrence) const
|
||||
{
|
||||
return std::to_string(occurrence.elementId) + ";" + std::to_string(occurrence.sourceLocationId);
|
||||
return std::to_wstring(occurrence.elementId) + L";" + std::to_wstring(occurrence.sourceLocationId);
|
||||
}
|
||||
|
||||
|
||||
std::string IntermediateStorage::serialize(const StorageComponentAccessData& componentAccessData) const
|
||||
std::wstring IntermediateStorage::serialize(const StorageComponentAccessData& componentAccessData) const
|
||||
{
|
||||
return std::to_string(componentAccessData.nodeId);
|
||||
return std::to_wstring(componentAccessData.nodeId);
|
||||
}
|
||||
|
||||
|
||||
std::string IntermediateStorage::serialize(const StorageCommentLocationData& commentLocationData) const
|
||||
std::wstring IntermediateStorage::serialize(const StorageCommentLocationData& commentLocationData) const
|
||||
{
|
||||
return (
|
||||
std::to_string(commentLocationData.fileNodeId) + ";" +
|
||||
std::to_string(commentLocationData.startLine) + ";" +
|
||||
std::to_string(commentLocationData.startCol) + ";" +
|
||||
std::to_string(commentLocationData.endLine) + ";" +
|
||||
std::to_string(commentLocationData.endCol)
|
||||
std::to_wstring(commentLocationData.fileNodeId) + L";" +
|
||||
std::to_wstring(commentLocationData.startLine) + L";" +
|
||||
std::to_wstring(commentLocationData.startCol) + L";" +
|
||||
std::to_wstring(commentLocationData.endLine) + L";" +
|
||||
std::to_wstring(commentLocationData.endCol)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
std::string IntermediateStorage::serialize(const StorageErrorData& errorData) const
|
||||
std::wstring IntermediateStorage::serialize(const StorageErrorData& errorData) const
|
||||
{
|
||||
return (
|
||||
errorData.message + ";" +
|
||||
std::to_string(errorData.fatal) + ";" +
|
||||
errorData.filePath.str() + ";" +
|
||||
std::to_string(errorData.lineNumber) + ";" +
|
||||
std::to_string(errorData.columnNumber)
|
||||
errorData.message + L";" +
|
||||
std::to_wstring(errorData.fatal) + L";" +
|
||||
errorData.filePath + L";" +
|
||||
std::to_wstring(errorData.lineNumber) + L";" +
|
||||
std::to_wstring(errorData.columnNumber)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -83,41 +83,41 @@ public:
|
||||
void setNextId(const Id nextId);
|
||||
|
||||
private:
|
||||
std::string serialize(const StorageNodeData& nodeData) const;
|
||||
std::string serialize(const StorageFile& file) const;
|
||||
std::string serialize(const StorageEdgeData& edgeData) const;
|
||||
std::string serialize(const StorageLocalSymbolData& localSymbolData) const;
|
||||
std::string serialize(const StorageSourceLocationData& sourceLocationData) const;
|
||||
std::string serialize(const StorageOccurrence& occurrence) const;
|
||||
std::string serialize(const StorageComponentAccessData& componentAccessData) const;
|
||||
std::string serialize(const StorageCommentLocationData& commentLocationData) const;
|
||||
std::string serialize(const StorageErrorData& errorData) const;
|
||||
std::wstring serialize(const StorageNodeData& nodeData) const;
|
||||
std::wstring serialize(const StorageFile& file) const;
|
||||
std::wstring serialize(const StorageEdgeData& edgeData) const;
|
||||
std::wstring serialize(const StorageLocalSymbolData& localSymbolData) const;
|
||||
std::wstring serialize(const StorageSourceLocationData& sourceLocationData) const;
|
||||
std::wstring serialize(const StorageOccurrence& occurrence) const;
|
||||
std::wstring serialize(const StorageComponentAccessData& componentAccessData) const;
|
||||
std::wstring serialize(const StorageCommentLocationData& commentLocationData) const;
|
||||
std::wstring serialize(const StorageErrorData& errorData) const;
|
||||
|
||||
std::unordered_map<std::string, size_t> m_nodesIndex;
|
||||
std::unordered_map<std::wstring, size_t> m_nodesIndex;
|
||||
std::vector<StorageNode> m_nodes;
|
||||
|
||||
std::unordered_set<std::string> m_serializedFiles; // this is used to prevent duplicates (unique)
|
||||
std::unordered_set<std::wstring> m_serializedFiles; // this is used to prevent duplicates (unique)
|
||||
std::vector<StorageFile> m_files;
|
||||
|
||||
std::vector<StorageSymbol> m_symbols;
|
||||
|
||||
std::unordered_map<std::string, size_t> m_edgesIndex;
|
||||
std::unordered_map<std::wstring, size_t> m_edgesIndex;
|
||||
std::vector<StorageEdge> m_edges;
|
||||
|
||||
std::unordered_map<std::string, StorageLocalSymbol> m_localSymbols;
|
||||
std::unordered_map<std::wstring, StorageLocalSymbol> m_localSymbols;
|
||||
|
||||
std::unordered_map<std::string, StorageSourceLocation> m_sourceLocations;
|
||||
std::unordered_map<std::wstring, StorageSourceLocation> m_sourceLocations;
|
||||
|
||||
std::unordered_set<std::string> m_serializedOccurrences; // this is used to prevent duplicates (unique)
|
||||
std::unordered_set<std::wstring> m_serializedOccurrences; // this is used to prevent duplicates (unique)
|
||||
std::vector<StorageOccurrence> m_occurrences;
|
||||
|
||||
std::unordered_set<std::string> m_serializedComponentAccesses; // this is used to prevent duplicates (unique)
|
||||
std::unordered_set<std::wstring> m_serializedComponentAccesses; // this is used to prevent duplicates (unique)
|
||||
std::vector<StorageComponentAccessData> m_componentAccesses;
|
||||
|
||||
std::unordered_set<std::string> m_serializedCommentLocations; // this is used to prevent duplicates (unique)
|
||||
std::unordered_set<std::wstring> m_serializedCommentLocations; // this is used to prevent duplicates (unique)
|
||||
std::vector<StorageCommentLocationData> m_commentLocations;
|
||||
|
||||
std::unordered_set<std::string> m_serializedErrors; // this is used to prevent duplicates (unique)
|
||||
std::unordered_set<std::wstring> m_serializedErrors; // this is used to prevent duplicates (unique)
|
||||
std::vector<StorageErrorData> m_errors;
|
||||
|
||||
Id m_nextId;
|
||||
|
||||
@@ -402,7 +402,7 @@ void PersistentStorage::optimizeMemory()
|
||||
|
||||
Id PersistentStorage::getNodeIdForFileNode(const FilePath& filePath) const
|
||||
{
|
||||
return m_sqliteIndexStorage.getFileByPath(filePath.str()).id;
|
||||
return m_sqliteIndexStorage.getFileByPath(filePath.wstr()).id;
|
||||
}
|
||||
|
||||
Id PersistentStorage::getNodeIdForNameHierarchy(const NameHierarchy& nameHierarchy) const
|
||||
@@ -657,11 +657,11 @@ std::vector<SearchMatch> PersistentStorage::getAutocompletionSymbolMatches(
|
||||
match.text = result.text;
|
||||
|
||||
NameHierarchy name = NameHierarchy::deserialize(firstNode->serializedName);
|
||||
if (name.getQualifiedName() == match.name)
|
||||
if (utility::encodeToUtf8(name.getQualifiedName()) == match.name)
|
||||
{
|
||||
const size_t idx = m_hierarchyCache.getIndexOfLastVisibleParentNode(firstNode->id);
|
||||
match.text = name.getRange(idx, name.size()).getQualifiedName();
|
||||
match.subtext = name.getRange(0, idx).getQualifiedName();
|
||||
match.text = utility::encodeToUtf8(name.getRange(idx, name.size()).getQualifiedName());
|
||||
match.subtext = utility::encodeToUtf8(name.getRange(0, idx).getQualifiedName());
|
||||
}
|
||||
|
||||
match.delimiter = name.getDelimiter();
|
||||
@@ -786,8 +786,8 @@ std::vector<SearchMatch> PersistentStorage::getSearchMatchesForTokenIds(const st
|
||||
|
||||
SearchMatch match;
|
||||
const NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName);
|
||||
match.name = nameHierarchy.getQualifiedName();
|
||||
match.text = nameHierarchy.getRawName();
|
||||
match.name = utility::encodeToUtf8(nameHierarchy.getQualifiedName());
|
||||
match.text = utility::encodeToUtf8(nameHierarchy.getRawName());
|
||||
|
||||
match.tokenIds.push_back(elementId);
|
||||
match.nodeType = utility::intToType(node.type);
|
||||
@@ -1364,12 +1364,12 @@ std::shared_ptr<TextAccess> PersistentStorage::getFileContent(const FilePath& fi
|
||||
{
|
||||
TRACE();
|
||||
|
||||
return m_sqliteIndexStorage.getFileContentByPath(filePath.str());
|
||||
return m_sqliteIndexStorage.getFileContentByPath(filePath.wstr());
|
||||
}
|
||||
|
||||
FileInfo PersistentStorage::getFileInfoForFilePath(const FilePath& filePath) const
|
||||
{
|
||||
return FileInfo(filePath, m_sqliteIndexStorage.getFileByPath(filePath.str()).modificationTime);
|
||||
return FileInfo(filePath, m_sqliteIndexStorage.getFileByPath(filePath.wstr()).modificationTime);
|
||||
}
|
||||
|
||||
std::vector<FileInfo> PersistentStorage::getFileInfosForFilePaths(const std::vector<FilePath>& filePaths) const
|
||||
@@ -1477,7 +1477,7 @@ std::shared_ptr<SourceLocationCollection> PersistentStorage::getErrorSourceLocat
|
||||
LOCATION_ERROR,
|
||||
locationId,
|
||||
std::vector<Id>(1, error.id),
|
||||
error.filePath,
|
||||
FilePath(error.filePath),
|
||||
error.lineNumber,
|
||||
error.columnNumber,
|
||||
error.lineNumber,
|
||||
@@ -1534,7 +1534,7 @@ Id PersistentStorage::addEdgeBookmark(const EdgeBookmark& bookmark)
|
||||
return id;
|
||||
}
|
||||
|
||||
Id PersistentStorage::addBookmarkCategory(const std::string& name)
|
||||
Id PersistentStorage::addBookmarkCategory(const std::wstring& name)
|
||||
{
|
||||
if (name.empty())
|
||||
{
|
||||
@@ -1550,7 +1550,7 @@ Id PersistentStorage::addBookmarkCategory(const std::string& name)
|
||||
}
|
||||
|
||||
void PersistentStorage::updateBookmark(
|
||||
const Id bookmarkId, const std::string& name, const std::string& comment, const std::string& categoryName)
|
||||
const Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& categoryName)
|
||||
{
|
||||
const Id categoryId = addBookmarkCategory(categoryName); // only creates category if id didn't exist before;
|
||||
m_sqliteBookmarkStorage.updateBookmark(bookmarkId, name, comment, categoryId);
|
||||
@@ -1621,8 +1621,8 @@ std::vector<EdgeBookmark> PersistentStorage::getAllEdgeBookmarks() const
|
||||
|
||||
std::vector<EdgeBookmark> edgeBookmarks;
|
||||
|
||||
UnorderedCache<std::string, Id> nodeIdCache(
|
||||
[&](const std::string& serializedNodeName)
|
||||
UnorderedCache<std::wstring, Id> nodeIdCache(
|
||||
[&](const std::wstring& serializedNodeName)
|
||||
{
|
||||
return m_sqliteIndexStorage.getNodeBySerializedName(serializedNodeName).id;
|
||||
}
|
||||
@@ -1767,16 +1767,16 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
|
||||
|
||||
const NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName);
|
||||
TooltipSnippet snippet;
|
||||
snippet.code = nameHierarchy.getQualifiedNameWithSignature();
|
||||
snippet.code = utility::encodeToUtf8(nameHierarchy.getQualifiedNameWithSignature());
|
||||
snippet.locationFile = std::make_shared<SourceLocationFile>(
|
||||
FilePath(nameHierarchy.getDelimiter() == NAME_DELIMITER_JAVA ? "main.java" : "main.cpp"), true, true);
|
||||
FilePath(nameHierarchy.getDelimiter() == NAME_DELIMITER_JAVA ? L"main.java" : L"main.cpp"), true, true);
|
||||
|
||||
if (nameHierarchy.hasSignature())
|
||||
{
|
||||
snippet.code = utility::breakSignature(
|
||||
nameHierarchy.getSignature().getPrefix(),
|
||||
nameHierarchy.getQualifiedName(),
|
||||
nameHierarchy.getSignature().getPostfix(),
|
||||
utility::encodeToUtf8(nameHierarchy.getSignature().getPrefix()),
|
||||
utility::encodeToUtf8(nameHierarchy.getQualifiedName()),
|
||||
utility::encodeToUtf8(nameHierarchy.getSignature().getPostfix()),
|
||||
50,
|
||||
ApplicationSettings::getInstance()->getCodeTabWidth()
|
||||
);
|
||||
@@ -1802,11 +1802,11 @@ TooltipSnippet PersistentStorage::getTooltipSnippetForNode(const StorageNode& no
|
||||
}
|
||||
);
|
||||
|
||||
typeNames.insert(std::make_pair(nameHierarchy.getQualifiedName(), node.id));
|
||||
typeNames.insert(std::make_pair(utility::encodeToUtf8(nameHierarchy.getQualifiedName()), node.id));
|
||||
for (const auto& typeNode : m_sqliteIndexStorage.getAllByIds<StorageNode>(typeNodeIds))
|
||||
{
|
||||
typeNames.insert(std::make_pair(
|
||||
NameHierarchy::deserialize(typeNode.serializedName).getQualifiedName(),
|
||||
utility::encodeToUtf8(NameHierarchy::deserialize(typeNode.serializedName).getQualifiedName()),
|
||||
typeNode.id
|
||||
));
|
||||
}
|
||||
@@ -1866,7 +1866,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForSourceLocationIdsAndLocalSymbolI
|
||||
return info;
|
||||
}
|
||||
|
||||
if (locationIds.size())
|
||||
if (!locationIds.empty())
|
||||
{
|
||||
const std::vector<Id> nodeIds = getNodeIdsForLocationIds(locationIds);
|
||||
|
||||
@@ -1875,7 +1875,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForSourceLocationIdsAndLocalSymbolI
|
||||
TooltipSnippet snippet;
|
||||
|
||||
const NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName);
|
||||
snippet.code = nameHierarchy.getQualifiedName();
|
||||
snippet.code = utility::encodeToUtf8(nameHierarchy.getQualifiedName());
|
||||
snippet.locationFile = std::make_shared<SourceLocationFile>(
|
||||
FilePath(nameHierarchy.getDelimiter() == NAME_DELIMITER_JAVA ? "main.java" : "main.cpp"), true, true);
|
||||
|
||||
@@ -1896,7 +1896,7 @@ TooltipInfo PersistentStorage::getTooltipInfoForSourceLocationIdsAndLocalSymbolI
|
||||
TooltipSnippet snippet;
|
||||
|
||||
snippet.code = "local symbol";
|
||||
snippet.locationFile = std::make_shared<SourceLocationFile>(FilePath("main.cpp"), true, true);
|
||||
snippet.locationFile = std::make_shared<SourceLocationFile>(FilePath(L"main.cpp"), true, true);
|
||||
snippet.locationFile->addSourceLocation(
|
||||
LOCATION_LOCAL_SYMBOL, 0, std::vector<Id>(1, id), 1, 1, 1, snippet.code.size());
|
||||
|
||||
@@ -2182,7 +2182,7 @@ void PersistentStorage::addNodesToGraph(const std::vector<Id>& newNodeIds, Graph
|
||||
Node* node = graph->createNode(
|
||||
storageNode.id,
|
||||
type,
|
||||
NameHierarchy(filePath.fileName(), NAME_DELIMITER_FILE),
|
||||
NameHierarchy(filePath.wFileName(), NAME_DELIMITER_FILE),
|
||||
defined
|
||||
);
|
||||
node->addComponentFilePath(std::make_shared<TokenComponentFilePath>(filePath));
|
||||
@@ -2558,7 +2558,7 @@ void PersistentStorage::buildSearchIndex()
|
||||
const NameHierarchy nameHierarchy = NameHierarchy::deserialize(node.serializedName);
|
||||
|
||||
// we don't use the signature here, so elements with the same signature share the same node.
|
||||
std::string name = nameHierarchy.getQualifiedName();
|
||||
std::string name = utility::encodeToUtf8(nameHierarchy.getQualifiedName());
|
||||
|
||||
// replace template arguments with .. to avoid clutter in search results and have different
|
||||
// template specializations share the same node.
|
||||
|
||||
@@ -129,9 +129,9 @@ public:
|
||||
|
||||
virtual Id addNodeBookmark(const NodeBookmark& bookmark) override;
|
||||
virtual Id addEdgeBookmark(const EdgeBookmark& bookmark) override;
|
||||
virtual Id addBookmarkCategory(const std::string& categoryName) override;
|
||||
virtual Id addBookmarkCategory(const std::wstring& categoryName) override;
|
||||
|
||||
virtual void updateBookmark(const Id bookmarkId, const std::string& name, const std::string& comment, const std::string& categoryName) override;
|
||||
virtual void updateBookmark(const Id bookmarkId, const std::wstring& name, const std::wstring& comment, const std::wstring& categoryName) override;
|
||||
virtual void removeBookmark(const Id id) override;
|
||||
virtual void removeBookmarkCategory(const Id id) override;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "data/storage/migration/SqliteStorageMigrator.h"
|
||||
#include "settings/ProjectSettings.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/utilityString.h"
|
||||
#include "Application.h"
|
||||
|
||||
const size_t SqliteBookmarkStorage::s_storageVersion = 2;
|
||||
@@ -51,7 +52,7 @@ StorageBookmarkCategory SqliteBookmarkStorage::addBookmarkCategory(const Storage
|
||||
"VALUES (NULL, ?);";
|
||||
|
||||
CppSQLite3Statement stmt = m_database.compileStatement(statement.c_str());
|
||||
stmt.bind(1, data.name.c_str());
|
||||
stmt.bind(1, utility::encodeToUtf8(data.name).c_str());
|
||||
|
||||
executeStatement(stmt);
|
||||
return StorageBookmarkCategory(m_database.lastRowId(), data);
|
||||
@@ -65,8 +66,8 @@ StorageBookmark SqliteBookmarkStorage::addBookmark(const StorageBookmarkData& da
|
||||
try
|
||||
{
|
||||
CppSQLite3Statement stmt = m_database.compileStatement(statement.c_str());
|
||||
stmt.bind(1, data.name.c_str());
|
||||
stmt.bind(2, data.comment.c_str());
|
||||
stmt.bind(1, utility::encodeToUtf8(data.name).c_str());
|
||||
stmt.bind(2, utility::encodeToUtf8(data.comment).c_str());
|
||||
stmt.bind(3, data.timestamp.c_str());
|
||||
executeStatement(stmt);
|
||||
|
||||
@@ -87,7 +88,7 @@ StorageBookmarkedNode SqliteBookmarkStorage::addBookmarkedNode(const StorageBook
|
||||
std::string statement = "INSERT INTO bookmarked_node(id, serialized_node_name) "
|
||||
"VALUES (" + std::to_string(id) + ", ?);";
|
||||
CppSQLite3Statement stmt = m_database.compileStatement(statement.c_str());
|
||||
stmt.bind(1, data.serializedNodeName.c_str());
|
||||
stmt.bind(1, utility::encodeToUtf8(data.serializedNodeName).c_str());
|
||||
executeStatement(stmt);
|
||||
|
||||
return StorageBookmarkedNode(id, data);
|
||||
@@ -101,8 +102,8 @@ StorageBookmarkedEdge SqliteBookmarkStorage::addBookmarkedEdge(const StorageBook
|
||||
std::string statement = "INSERT INTO bookmarked_edge(id, serialized_source_node_name, serialized_target_node_name, edge_type, source_node_active) "
|
||||
"VALUES (" + std::to_string(id) + ", ?, ?, " + std::to_string(data.edgeType) + ", " + std::to_string(data.sourceNodeActive) + ");";
|
||||
CppSQLite3Statement stmt = m_database.compileStatement(statement.c_str());
|
||||
stmt.bind(1, data.serializedSourceNodeName.c_str());
|
||||
stmt.bind(2, data.serializedTargetNodeName.c_str());
|
||||
stmt.bind(1, utility::encodeToUtf8(data.serializedSourceNodeName).c_str());
|
||||
stmt.bind(2, utility::encodeToUtf8(data.serializedTargetNodeName).c_str());
|
||||
executeStatement(stmt);
|
||||
|
||||
return StorageBookmarkedEdge(id, data);
|
||||
@@ -130,10 +131,10 @@ std::vector<StorageBookmarkedEdge> SqliteBookmarkStorage::getAllBookmarkedEdges(
|
||||
return doGetAll<StorageBookmarkedEdge>("");
|
||||
}
|
||||
|
||||
void SqliteBookmarkStorage::updateBookmark(const Id bookmarkId, const std::string& name, const std::string& comment, const Id categoryId)
|
||||
void SqliteBookmarkStorage::updateBookmark(const Id bookmarkId, const std::wstring& name, const std::wstring& comment, const Id categoryId)
|
||||
{
|
||||
executeStatement("UPDATE bookmark SET name = '" + name + "' WHERE id == " + std::to_string(bookmarkId) + ";");
|
||||
executeStatement("UPDATE bookmark SET comment = '" + comment + "' WHERE id == " + std::to_string(bookmarkId) + ";");
|
||||
executeStatement("UPDATE bookmark SET name = '" + utility::encodeToUtf8(name) + "' WHERE id == " + std::to_string(bookmarkId) + ";");
|
||||
executeStatement("UPDATE bookmark SET comment = '" + utility::encodeToUtf8(comment) + "' WHERE id == " + std::to_string(bookmarkId) + ";");
|
||||
executeStatement("UPDATE bookmark SET category_id = " + std::to_string(categoryId) + " WHERE id == " + std::to_string(bookmarkId) + ";");
|
||||
}
|
||||
|
||||
@@ -142,9 +143,9 @@ std::vector<StorageBookmarkCategory> SqliteBookmarkStorage::getAllBookmarkCatego
|
||||
return doGetAll<StorageBookmarkCategory>("");
|
||||
}
|
||||
|
||||
StorageBookmarkCategory SqliteBookmarkStorage::getBookmarkCategoryByName(const std::string& name) const
|
||||
StorageBookmarkCategory SqliteBookmarkStorage::getBookmarkCategoryByName(const std::wstring& name) const
|
||||
{
|
||||
return doGetFirst<StorageBookmarkCategory>("WHERE name == '" + name + "'");
|
||||
return doGetFirst<StorageBookmarkCategory>("WHERE name == '" + utility::encodeToUtf8(name) + "'");
|
||||
}
|
||||
|
||||
void SqliteBookmarkStorage::removeBookmarkCategory(Id id)
|
||||
@@ -260,7 +261,7 @@ std::vector<StorageBookmarkCategory> SqliteBookmarkStorage::doGetAll<StorageBook
|
||||
|
||||
if (id != 0 && name != "")
|
||||
{
|
||||
categories.push_back(StorageBookmarkCategory(id, name));
|
||||
categories.push_back(StorageBookmarkCategory(id, utility::decodeFromUtf8(name)));
|
||||
}
|
||||
|
||||
q.nextRow();
|
||||
@@ -286,7 +287,7 @@ std::vector<StorageBookmark> SqliteBookmarkStorage::doGetAll<StorageBookmark>(co
|
||||
|
||||
if (id != 0 && name != "" && timestamp != "")
|
||||
{
|
||||
bookmarks.push_back(StorageBookmark(id, name, comment, timestamp, categoryId));
|
||||
bookmarks.push_back(StorageBookmark(id, utility::decodeFromUtf8(name), utility::decodeFromUtf8(comment), timestamp, categoryId));
|
||||
}
|
||||
|
||||
q.nextRow();
|
||||
@@ -314,7 +315,7 @@ std::vector<StorageBookmarkedNode> SqliteBookmarkStorage::doGetAll<StorageBookma
|
||||
|
||||
if (id != 0 && bookmarkId != 0 && serializedNodeName != "")
|
||||
{
|
||||
bookmarkedNodes.push_back(StorageBookmarkedNode(id, bookmarkId, serializedNodeName));
|
||||
bookmarkedNodes.push_back(StorageBookmarkedNode(id, bookmarkId, utility::decodeFromUtf8(serializedNodeName)));
|
||||
}
|
||||
|
||||
q.nextRow();
|
||||
@@ -345,7 +346,14 @@ std::vector<StorageBookmarkedEdge> SqliteBookmarkStorage::doGetAll<StorageBookma
|
||||
|
||||
if (id != 0 && bookmarkId != 0 && serializedSourceNodeName != "" && serializedTargetNodeName != "" && edgeType != -1 && sourceNodeActive != -1)
|
||||
{
|
||||
bookmarkedEdges.push_back(StorageBookmarkedEdge(id, bookmarkId, serializedSourceNodeName, serializedTargetNodeName, edgeType, sourceNodeActive));
|
||||
bookmarkedEdges.push_back(StorageBookmarkedEdge(
|
||||
id,
|
||||
bookmarkId,
|
||||
utility::decodeFromUtf8(serializedSourceNodeName),
|
||||
utility::decodeFromUtf8(serializedTargetNodeName),
|
||||
edgeType,
|
||||
sourceNodeActive
|
||||
));
|
||||
}
|
||||
|
||||
q.nextRow();
|
||||
|
||||
@@ -31,10 +31,10 @@ public:
|
||||
std::vector<StorageBookmarkedNode> getAllBookmarkedNodes() const;
|
||||
std::vector<StorageBookmarkedEdge> getAllBookmarkedEdges() const;
|
||||
|
||||
void updateBookmark(const Id bookmarkId, const std::string& name, const std::string& comment, const Id categoryId);
|
||||
void updateBookmark(const Id bookmarkId, const std::wstring& name, const std::wstring& comment, const Id categoryId);
|
||||
|
||||
std::vector<StorageBookmarkCategory> getAllBookmarkCategories() const;
|
||||
StorageBookmarkCategory getBookmarkCategoryByName(const std::string& name) const;
|
||||
StorageBookmarkCategory getBookmarkCategoryByName(const std::wstring& name) const;
|
||||
|
||||
private:
|
||||
static const size_t s_storageVersion;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
const size_t SqliteIndexStorage::s_storageVersion = 15;
|
||||
|
||||
@@ -42,7 +43,7 @@ StorageNode SqliteIndexStorage::addNode(const StorageNodeData& data)
|
||||
{
|
||||
m_inserNodeStmt.bind(1, int(id));
|
||||
m_inserNodeStmt.bind(2, data.type);
|
||||
m_inserNodeStmt.bind(3, data.serializedName.c_str());
|
||||
m_inserNodeStmt.bind(3, utility::encodeToUtf8(data.serializedName).c_str());
|
||||
executeStatement(m_inserNodeStmt);
|
||||
m_inserNodeStmt.reset();
|
||||
}
|
||||
@@ -70,7 +71,7 @@ void SqliteIndexStorage::addFile(const StorageFile& data)
|
||||
bool success = false;
|
||||
{
|
||||
m_insertFileStmt.bind(1, int(data.id));
|
||||
m_insertFileStmt.bind(2, data.filePath.c_str());
|
||||
m_insertFileStmt.bind(2, utility::encodeToUtf8(data.filePath).c_str());
|
||||
m_insertFileStmt.bind(3, data.modificationTime.c_str());
|
||||
m_insertFileStmt.bind(4, data.complete);
|
||||
m_insertFileStmt.bind(5, lineCount);
|
||||
@@ -116,7 +117,7 @@ StorageLocalSymbol SqliteIndexStorage::addLocalSymbol(const StorageLocalSymbolDa
|
||||
}
|
||||
{
|
||||
m_inserLocalSymbolStmt.bind(1, int(id));
|
||||
m_inserLocalSymbolStmt.bind(2, data.name.c_str());
|
||||
m_inserLocalSymbolStmt.bind(2, utility::encodeToUtf8(data.name).c_str());
|
||||
executeStatement(m_inserLocalSymbolStmt);
|
||||
m_inserLocalSymbolStmt.reset();
|
||||
}
|
||||
@@ -248,13 +249,13 @@ StorageCommentLocation SqliteIndexStorage::addCommentLocation(const StorageComme
|
||||
|
||||
StorageError SqliteIndexStorage::addError(const StorageErrorData& data)
|
||||
{
|
||||
const std::string sanitizedMessage = utility::replace(data.message, "'", "''");
|
||||
const std::wstring sanitizedMessage = utility::replace(data.message, L"'", L"''");
|
||||
|
||||
Id id = 0;
|
||||
{
|
||||
m_checkErrorExistsStmt.bind(1, sanitizedMessage.c_str());
|
||||
m_checkErrorExistsStmt.bind(1, utility::encodeToUtf8(sanitizedMessage).c_str());
|
||||
m_checkErrorExistsStmt.bind(2, int(data.fatal));
|
||||
m_checkErrorExistsStmt.bind(3, data.filePath.str().c_str());
|
||||
m_checkErrorExistsStmt.bind(3, utility::encodeToUtf8(data.filePath).c_str());
|
||||
m_checkErrorExistsStmt.bind(4, int(data.lineNumber));
|
||||
m_checkErrorExistsStmt.bind(5, int(data.columnNumber));
|
||||
|
||||
@@ -269,10 +270,10 @@ StorageError SqliteIndexStorage::addError(const StorageErrorData& data)
|
||||
|
||||
if (id == 0)
|
||||
{
|
||||
m_insertErrorStmt.bind(1, sanitizedMessage.c_str());
|
||||
m_insertErrorStmt.bind(1, utility::encodeToUtf8(sanitizedMessage).c_str());
|
||||
m_insertErrorStmt.bind(2, data.fatal);
|
||||
m_insertErrorStmt.bind(3, data.indexed);
|
||||
m_insertErrorStmt.bind(4, data.filePath.str().c_str());
|
||||
m_insertErrorStmt.bind(4, utility::encodeToUtf8(data.filePath).c_str());
|
||||
m_insertErrorStmt.bind(5, int(data.lineNumber));
|
||||
m_insertErrorStmt.bind(6, int(data.columnNumber));
|
||||
|
||||
@@ -552,38 +553,38 @@ StorageNode SqliteIndexStorage::getNodeById(Id id) const
|
||||
return StorageNode();
|
||||
}
|
||||
|
||||
StorageNode SqliteIndexStorage::getNodeBySerializedName(const std::string& serializedName) const
|
||||
StorageNode SqliteIndexStorage::getNodeBySerializedName(const std::wstring& serializedName) const
|
||||
{
|
||||
CppSQLite3Statement stmt = m_database.compileStatement(
|
||||
"SELECT id, type, serialized_name FROM node WHERE serialized_name == ? LIMIT 1;"
|
||||
);
|
||||
|
||||
stmt.bind(1, serializedName.c_str());
|
||||
stmt.bind(1, utility::encodeToUtf8(serializedName).c_str());
|
||||
CppSQLite3Query q = executeQuery(stmt);
|
||||
|
||||
if (!q.eof())
|
||||
{
|
||||
const Id id = q.getIntField(0, 0);
|
||||
const int type = q.getIntField(1, -1);
|
||||
const std::string serializedName = q.getStringField(2, "");
|
||||
const std::string name = q.getStringField(2, "");
|
||||
|
||||
if (id != 0 && type != -1)
|
||||
{
|
||||
return StorageNode(id, type, serializedName);
|
||||
return StorageNode(id, type, utility::decodeFromUtf8(name));
|
||||
}
|
||||
}
|
||||
|
||||
return StorageNode();
|
||||
}
|
||||
|
||||
StorageLocalSymbol SqliteIndexStorage::getLocalSymbolByName(const std::string& name) const
|
||||
StorageLocalSymbol SqliteIndexStorage::getLocalSymbolByName(const std::wstring& name) const
|
||||
{
|
||||
return doGetFirst<StorageLocalSymbol>("WHERE name == '" + name + "'");
|
||||
return doGetFirst<StorageLocalSymbol>("WHERE name == '" + utility::encodeToUtf8(name) + "'");
|
||||
}
|
||||
|
||||
StorageFile SqliteIndexStorage::getFileByPath(const std::string& filePath) const
|
||||
StorageFile SqliteIndexStorage::getFileByPath(const std::wstring& filePath) const
|
||||
{
|
||||
return doGetFirst<StorageFile>("WHERE file.path == '" + filePath + "'");
|
||||
return doGetFirst<StorageFile>("WHERE file.path == '" + utility::encodeToUtf8(filePath) + "'");
|
||||
}
|
||||
|
||||
std::vector<StorageFile> SqliteIndexStorage::getFilesByPaths(const std::vector<FilePath>& filePaths) const
|
||||
@@ -604,7 +605,7 @@ std::shared_ptr<TextAccess> SqliteIndexStorage::getFileContentById(Id fileId) co
|
||||
return TextAccess::createFromString("");
|
||||
}
|
||||
|
||||
std::shared_ptr<TextAccess> SqliteIndexStorage::getFileContentByPath(const std::string& filePath) const
|
||||
std::shared_ptr<TextAccess> SqliteIndexStorage::getFileContentByPath(const std::wstring& filePath) const
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -612,7 +613,7 @@ std::shared_ptr<TextAccess> SqliteIndexStorage::getFileContentByPath(const std::
|
||||
"SELECT filecontent.content "
|
||||
"FROM filecontent "
|
||||
"INNER JOIN file ON filecontent.id = file.id "
|
||||
"WHERE file.path = '" + filePath + "';"
|
||||
"WHERE file.path = '" + utility::encodeToUtf8(filePath) + "';"
|
||||
);
|
||||
|
||||
if (!q.eof())
|
||||
@@ -646,7 +647,7 @@ std::shared_ptr<SourceLocationFile> SqliteIndexStorage::getSourceLocationsForFil
|
||||
{
|
||||
std::shared_ptr<SourceLocationFile> ret = std::make_shared<SourceLocationFile>(filePath, true, false);
|
||||
|
||||
const StorageFile file = getFileByPath(filePath.str());
|
||||
const StorageFile file = getFileByPath(filePath.wstr());
|
||||
if (file.id == 0) // early out
|
||||
{
|
||||
return ret;
|
||||
@@ -717,7 +718,7 @@ std::vector<StorageComponentAccess> SqliteIndexStorage::getComponentAccessesByNo
|
||||
|
||||
std::vector<StorageCommentLocation> SqliteIndexStorage::getCommentLocationsInFile(const FilePath& filePath) const
|
||||
{
|
||||
Id fileNodeId = getFileByPath(filePath.str()).id;
|
||||
Id fileNodeId = getFileByPath(filePath.wstr()).id;
|
||||
return doGetAll<StorageCommentLocation>("WHERE file_node_id == " + std::to_string(fileNodeId));
|
||||
}
|
||||
|
||||
@@ -1090,7 +1091,7 @@ std::vector<StorageNode> SqliteIndexStorage::doGetAll<StorageNode>(const std::st
|
||||
|
||||
if (id != 0 && type != -1)
|
||||
{
|
||||
nodes.push_back(StorageNode(id, type, serializedName));
|
||||
nodes.push_back(StorageNode(id, type, utility::decodeFromUtf8(serializedName)));
|
||||
}
|
||||
|
||||
q.nextRow();
|
||||
@@ -1138,7 +1139,7 @@ std::vector<StorageFile> SqliteIndexStorage::doGetAll<StorageFile>(const std::st
|
||||
|
||||
if (id != 0)
|
||||
{
|
||||
files.push_back(StorageFile(id, filePath, modificationTime, complete));
|
||||
files.push_back(StorageFile(id, utility::decodeFromUtf8(filePath), modificationTime, complete));
|
||||
}
|
||||
q.nextRow();
|
||||
}
|
||||
@@ -1162,7 +1163,7 @@ std::vector<StorageLocalSymbol> SqliteIndexStorage::doGetAll<StorageLocalSymbol>
|
||||
|
||||
if (id != 0)
|
||||
{
|
||||
localSymbols.push_back(StorageLocalSymbol(id, name));
|
||||
localSymbols.push_back(StorageLocalSymbol(id, utility::decodeFromUtf8(name)));
|
||||
}
|
||||
|
||||
q.nextRow();
|
||||
@@ -1299,7 +1300,7 @@ std::vector<StorageError> SqliteIndexStorage::doGetAll<StorageError>(const std::
|
||||
if (lineNumber != -1 && columnNumber != -1)
|
||||
{
|
||||
errors.push_back(StorageError(
|
||||
id, message, FilePath(filePath), lineNumber, columnNumber, fatal, indexed)
|
||||
id, utility::decodeFromUtf8(message), utility::decodeFromUtf8(filePath), lineNumber, columnNumber, fatal, indexed)
|
||||
);
|
||||
id++;
|
||||
}
|
||||
|
||||
@@ -75,14 +75,14 @@ public:
|
||||
std::vector<StorageEdge> getEdgesByTargetsType(const std::vector<Id>& targetIds, int type) const;
|
||||
|
||||
StorageNode getNodeById(Id id) const;
|
||||
StorageNode getNodeBySerializedName(const std::string& serializedName) const;
|
||||
StorageNode getNodeBySerializedName(const std::wstring& serializedName) const;
|
||||
|
||||
StorageLocalSymbol getLocalSymbolByName(const std::string& name) const;
|
||||
StorageLocalSymbol getLocalSymbolByName(const std::wstring& name) const;
|
||||
|
||||
StorageFile getFileByPath(const std::string& filePath) const;
|
||||
StorageFile getFileByPath(const std::wstring& filePath) const;
|
||||
|
||||
std::vector<StorageFile> getFilesByPaths(const std::vector<FilePath>& filePaths) const;
|
||||
std::shared_ptr<TextAccess> getFileContentByPath(const std::string& filePath) const;
|
||||
std::shared_ptr<TextAccess> getFileContentByPath(const std::wstring& filePath) const;
|
||||
std::shared_ptr<TextAccess> getFileContentById(Id fileId) const;
|
||||
|
||||
void setFileComplete(bool complete, Id fileId);
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
struct StorageBookmarkData
|
||||
{
|
||||
StorageBookmarkData()
|
||||
: name("")
|
||||
, comment("")
|
||||
: name(L"")
|
||||
, comment(L"")
|
||||
, timestamp("")
|
||||
, categoryId(0)
|
||||
{}
|
||||
|
||||
StorageBookmarkData(
|
||||
const std::string& name,
|
||||
const std::string& comment,
|
||||
const std::wstring& name,
|
||||
const std::wstring& comment,
|
||||
const std::string& timestamp,
|
||||
const Id categoryId
|
||||
)
|
||||
@@ -26,8 +26,8 @@ struct StorageBookmarkData
|
||||
, categoryId(categoryId)
|
||||
{}
|
||||
|
||||
std::string name;
|
||||
std::string comment;
|
||||
std::wstring name;
|
||||
std::wstring comment;
|
||||
std::string timestamp;
|
||||
Id categoryId;
|
||||
};
|
||||
@@ -46,8 +46,8 @@ struct StorageBookmark: public StorageBookmarkData
|
||||
|
||||
StorageBookmark(
|
||||
Id id,
|
||||
const std::string& name,
|
||||
const std::string& comment,
|
||||
const std::wstring& name,
|
||||
const std::wstring& comment,
|
||||
const std::string& timestamp,
|
||||
const Id categoryId
|
||||
)
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
struct StorageBookmarkCategoryData
|
||||
{
|
||||
StorageBookmarkCategoryData()
|
||||
: name("")
|
||||
: name(L"")
|
||||
{}
|
||||
|
||||
StorageBookmarkCategoryData(const std::string& name)
|
||||
StorageBookmarkCategoryData(const std::wstring& name)
|
||||
: name(name)
|
||||
{}
|
||||
|
||||
std::string name;
|
||||
std::wstring name;
|
||||
};
|
||||
|
||||
struct StorageBookmarkCategory: public StorageBookmarkCategoryData
|
||||
@@ -30,7 +30,7 @@ struct StorageBookmarkCategory: public StorageBookmarkCategoryData
|
||||
, id(id)
|
||||
{}
|
||||
|
||||
StorageBookmarkCategory(Id id, const std::string& name)
|
||||
StorageBookmarkCategory(Id id, const std::wstring& name)
|
||||
: StorageBookmarkCategoryData(name)
|
||||
, id(id)
|
||||
{}
|
||||
|
||||
@@ -9,16 +9,16 @@ struct StorageBookmarkedEdgeData
|
||||
{
|
||||
StorageBookmarkedEdgeData()
|
||||
: bookmarkId(0)
|
||||
, serializedSourceNodeName("")
|
||||
, serializedTargetNodeName("")
|
||||
, serializedSourceNodeName(L"")
|
||||
, serializedTargetNodeName(L"")
|
||||
, edgeType(0)
|
||||
, sourceNodeActive(false)
|
||||
{}
|
||||
|
||||
StorageBookmarkedEdgeData(
|
||||
Id bookmarkId,
|
||||
const std::string& serializedSourceNodeName,
|
||||
const std::string& serializedTargetNodeName,
|
||||
const std::wstring& serializedSourceNodeName,
|
||||
const std::wstring& serializedTargetNodeName,
|
||||
int edgeType,
|
||||
bool sourceNodeActive
|
||||
)
|
||||
@@ -30,8 +30,8 @@ struct StorageBookmarkedEdgeData
|
||||
{}
|
||||
|
||||
Id bookmarkId;
|
||||
std::string serializedSourceNodeName;
|
||||
std::string serializedTargetNodeName;
|
||||
std::wstring serializedSourceNodeName;
|
||||
std::wstring serializedTargetNodeName;
|
||||
int edgeType;
|
||||
bool sourceNodeActive;
|
||||
};
|
||||
@@ -51,8 +51,8 @@ struct StorageBookmarkedEdge: public StorageBookmarkedEdgeData
|
||||
StorageBookmarkedEdge(
|
||||
Id id,
|
||||
Id bookmarkId,
|
||||
const std::string& serializedSourceNodeName,
|
||||
const std::string& serializedTargetNodeName,
|
||||
const std::wstring& serializedSourceNodeName,
|
||||
const std::wstring& serializedTargetNodeName,
|
||||
int edgeType,
|
||||
bool sourceNodeActive
|
||||
)
|
||||
|
||||
@@ -9,16 +9,16 @@ struct StorageBookmarkedNodeData
|
||||
{
|
||||
StorageBookmarkedNodeData()
|
||||
: bookmarkId(0)
|
||||
, serializedNodeName("")
|
||||
, serializedNodeName(L"")
|
||||
{}
|
||||
|
||||
StorageBookmarkedNodeData(Id bookmarkId, const std::string& serializedNodeName)
|
||||
StorageBookmarkedNodeData(Id bookmarkId, const std::wstring& serializedNodeName)
|
||||
: bookmarkId(bookmarkId)
|
||||
, serializedNodeName(serializedNodeName)
|
||||
{}
|
||||
|
||||
Id bookmarkId;
|
||||
std::string serializedNodeName;
|
||||
std::wstring serializedNodeName;
|
||||
};
|
||||
|
||||
struct StorageBookmarkedNode: public StorageBookmarkedNodeData
|
||||
@@ -36,7 +36,7 @@ struct StorageBookmarkedNode: public StorageBookmarkedNodeData
|
||||
StorageBookmarkedNode(
|
||||
Id id,
|
||||
Id bookmarkId,
|
||||
const std::string& serializedNodeName
|
||||
const std::wstring& serializedNodeName
|
||||
)
|
||||
: StorageBookmarkedNodeData(bookmarkId, serializedNodeName)
|
||||
, id(id)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -9,12 +9,12 @@ struct StorageFile
|
||||
{
|
||||
StorageFile()
|
||||
: id(0)
|
||||
, filePath("")
|
||||
, filePath(L"")
|
||||
, modificationTime("")
|
||||
, complete(true)
|
||||
{}
|
||||
|
||||
StorageFile(Id id, const std::string& filePath, const std::string& modificationTime, bool complete)
|
||||
StorageFile(Id id, const std::wstring& filePath, const std::string& modificationTime, bool complete)
|
||||
: id(id)
|
||||
, filePath(filePath)
|
||||
, modificationTime(modificationTime)
|
||||
@@ -22,7 +22,7 @@ struct StorageFile
|
||||
{}
|
||||
|
||||
Id id;
|
||||
std::string filePath;
|
||||
std::wstring filePath;
|
||||
std::string modificationTime;
|
||||
bool complete;
|
||||
};
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
struct StorageLocalSymbolData
|
||||
{
|
||||
StorageLocalSymbolData()
|
||||
: name("")
|
||||
: name(L"")
|
||||
{}
|
||||
|
||||
StorageLocalSymbolData(const std::string& name)
|
||||
StorageLocalSymbolData(const std::wstring& name)
|
||||
: name(name)
|
||||
{}
|
||||
|
||||
std::string name;
|
||||
std::wstring name;
|
||||
};
|
||||
|
||||
struct StorageLocalSymbol: public StorageLocalSymbolData
|
||||
@@ -30,7 +30,7 @@ struct StorageLocalSymbol: public StorageLocalSymbolData
|
||||
, id(id)
|
||||
{}
|
||||
|
||||
StorageLocalSymbol(Id id, const std::string& name)
|
||||
StorageLocalSymbol(Id id, const std::wstring& name)
|
||||
: StorageLocalSymbolData(name)
|
||||
, id(id)
|
||||
{}
|
||||
|
||||
@@ -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)
|
||||
{}
|
||||
|
||||
Reference in New Issue
Block a user