mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-29 17:07:19 +02:00
Sorting
- Sorting implemented using a non-relocatable task list, a stable sort, and type-specific comparisons.
This commit is contained in:
parent
9268e552d8
commit
4584da8895
8 changed files with 176 additions and 174 deletions
|
@ -819,6 +819,31 @@ void Context::parse (
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Context::decomposeSortField (
|
||||
const std::string& field,
|
||||
std::string& key,
|
||||
bool& ascending)
|
||||
{
|
||||
int length = field.length ();
|
||||
|
||||
if (field[length - 1] == '+')
|
||||
{
|
||||
ascending = true;
|
||||
key = field.substr (0, length - 1);
|
||||
}
|
||||
else if (field[length - 1] == '-')
|
||||
{
|
||||
ascending = false;
|
||||
key = field.substr (0, length - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ascending = true;
|
||||
key = field;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Note: The reason some of these are commented out is because the ::clear
|
||||
// method is not really "clear" but "clear_some". Some members do not need to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue