logic: code controller
- Renamed MessageActivateTokenLocation to MessageActivateToken, since it uses the Token id (not the TokenLocation id). - Implemented CodeController to add one snippet for each location where the activated token occurred. - Added Semaphore to QtThreadedFunctor to prevent an evil race-condition. - CodeView dispatches message when a token is clicked.
This commit is contained in:
@@ -103,6 +103,22 @@ void TokenLocationCollection::forEachTokenLocationFile(std::function<void(TokenL
|
||||
}
|
||||
}
|
||||
|
||||
void TokenLocationCollection::forEachTokenLocationLine(std::function<void(TokenLocationLine*)> func) const
|
||||
{
|
||||
for (const TokenLocationFilePairType& file : m_files)
|
||||
{
|
||||
file.second->forEachTokenLocationLine(func);
|
||||
}
|
||||
}
|
||||
|
||||
void TokenLocationCollection::forEachTokenLocation(std::function<void(TokenLocation*)> func) const
|
||||
{
|
||||
for (const TokenLocationFilePairType& file : m_files)
|
||||
{
|
||||
file.second->forEachTokenLocation(func);
|
||||
}
|
||||
}
|
||||
|
||||
TokenLocation* TokenLocationCollection::addTokenLocationAsPlainCopy(const TokenLocation* location)
|
||||
{
|
||||
const std::string& filePath = location->getTokenLocationLine()->getTokenLocationFile()->getFilePath();
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
class TokenLocation;
|
||||
class TokenLocationFile;
|
||||
class TokenLocationLine;
|
||||
|
||||
class TokenLocationCollection
|
||||
{
|
||||
@@ -37,6 +38,8 @@ public:
|
||||
TokenLocationFile* findTokenLocationFileByPath(const std::string& filePath) const;
|
||||
|
||||
void forEachTokenLocationFile(std::function<void(TokenLocationFile*)> func) const;
|
||||
void forEachTokenLocationLine(std::function<void(TokenLocationLine*)> func) const;
|
||||
void forEachTokenLocation(std::function<void(TokenLocation*)> func) const;
|
||||
|
||||
TokenLocation* addTokenLocationAsPlainCopy(const TokenLocation* location);
|
||||
|
||||
|
||||
@@ -66,6 +66,11 @@ void TokenLocationFile::removeTokenLocation(TokenLocation* location)
|
||||
}
|
||||
}
|
||||
|
||||
TokenLocationLine* TokenLocationFile::findTokenLocationLineByNumber(unsigned int lineNumber) const
|
||||
{
|
||||
return findTokenLocationLine(lineNumber);
|
||||
}
|
||||
|
||||
void TokenLocationFile::forEachTokenLocationLine(std::function<void(TokenLocationLine*)> func) const
|
||||
{
|
||||
for (const TokenLocationLinePairType& line : m_lines)
|
||||
@@ -74,6 +79,14 @@ void TokenLocationFile::forEachTokenLocationLine(std::function<void(TokenLocatio
|
||||
}
|
||||
}
|
||||
|
||||
void TokenLocationFile::forEachTokenLocation(std::function<void(TokenLocation*)> func) const
|
||||
{
|
||||
for (const TokenLocationLinePairType& line : m_lines)
|
||||
{
|
||||
line.second->forEachTokenLocation(func);
|
||||
}
|
||||
}
|
||||
|
||||
TokenLocation* TokenLocationFile::addTokenLocationAsPlainCopy(const TokenLocation* location)
|
||||
{
|
||||
unsigned int lineNumber = location->getTokenLocationLine()->getLineNumber();
|
||||
|
||||
@@ -32,7 +32,10 @@ public:
|
||||
unsigned int endLineNumber, unsigned int endColumnNumber);
|
||||
void removeTokenLocation(TokenLocation* location);
|
||||
|
||||
TokenLocationLine* findTokenLocationLineByNumber(unsigned int lineNumber) const;
|
||||
|
||||
void forEachTokenLocationLine(std::function<void(TokenLocationLine*)> func) const;
|
||||
void forEachTokenLocation(std::function<void(TokenLocation*)> func) const;
|
||||
|
||||
TokenLocation* addTokenLocationAsPlainCopy(const TokenLocation* location);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user