ui: snippet sizes
* added SnippetMerger class that conducts the merging and snapping of TokenLocations to create snippets. * added parameters for snippet snapping and merging to ApplicationSettings. * added forEachStartTokenLocation() and forEachEndTokenLocation() to TokenLocationLine and TokenLocationFile. * added < and > operators to TokenLocation that compare the location part (not the id).
This commit is contained in:
@@ -39,6 +39,26 @@ TokenLocation::~TokenLocation()
|
||||
{
|
||||
}
|
||||
|
||||
bool TokenLocation::operator<(const TokenLocation& rhs) const
|
||||
{
|
||||
return (
|
||||
getLineNumber() < rhs.getLineNumber() || (
|
||||
getLineNumber() == rhs.getLineNumber() &&
|
||||
getColumnNumber() < rhs.getColumnNumber()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
bool TokenLocation::operator>(const TokenLocation& rhs) const
|
||||
{
|
||||
return (
|
||||
getLineNumber() > rhs.getLineNumber() || (
|
||||
getLineNumber() == rhs.getLineNumber() &&
|
||||
getColumnNumber() > rhs.getColumnNumber()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Id TokenLocation::getId() const
|
||||
{
|
||||
return m_id;
|
||||
@@ -123,6 +143,30 @@ TokenLocation* TokenLocation::getEndTokenLocation()
|
||||
}
|
||||
}
|
||||
|
||||
const TokenLocation* TokenLocation::getStartTokenLocation() const
|
||||
{
|
||||
if (m_isStart)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_other;
|
||||
}
|
||||
}
|
||||
|
||||
const TokenLocation* TokenLocation::getEndTokenLocation() const
|
||||
{
|
||||
if (!m_isStart)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_other;
|
||||
}
|
||||
}
|
||||
|
||||
bool TokenLocation::isStartTokenLocation() const
|
||||
{
|
||||
return m_isStart;
|
||||
|
||||
Reference in New Issue
Block a user