mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Code Cleanup
- Removed unused util.cpp compressIds function.
This commit is contained in:
parent
dd6399aba7
commit
4f54578241
2 changed files with 0 additions and 56 deletions
55
src/util.cpp
55
src/util.cpp
|
@ -267,61 +267,6 @@ int flock (int fd, int operation)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// The vector must be sorted first. This is a modified version of the run-
|
|
||||||
// length encoding algorithm.
|
|
||||||
//
|
|
||||||
// This function converts the vector:
|
|
||||||
//
|
|
||||||
// [1, 3, 4, 6, 7, 8, 9, 11]
|
|
||||||
//
|
|
||||||
// to ths string:
|
|
||||||
//
|
|
||||||
// 1,3-4,6-9,11
|
|
||||||
//
|
|
||||||
std::string compressIds (const std::vector <int>& ids)
|
|
||||||
{
|
|
||||||
std::stringstream result;
|
|
||||||
|
|
||||||
int range_start = 0;
|
|
||||||
int range_end = 0;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < ids.size (); ++i)
|
|
||||||
{
|
|
||||||
if (i + 1 == ids.size ())
|
|
||||||
{
|
|
||||||
if (result.str ().length ())
|
|
||||||
result << ",";
|
|
||||||
|
|
||||||
if (range_start < range_end)
|
|
||||||
result << ids[range_start] << "-" << ids[range_end];
|
|
||||||
else
|
|
||||||
result << ids[range_start];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ids[range_end] + 1 == ids[i + 1])
|
|
||||||
{
|
|
||||||
++range_end;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (result.str ().length ())
|
|
||||||
result << ",";
|
|
||||||
|
|
||||||
if (range_start < range_end)
|
|
||||||
result << ids[range_start] << "-" << ids[range_end];
|
|
||||||
else
|
|
||||||
result << ids[range_start];
|
|
||||||
|
|
||||||
range_start = range_end = i + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.str ();
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void combine (std::vector <int>& dest, const std::vector <int>& source)
|
void combine (std::vector <int>& dest, const std::vector <int>& source)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,6 @@ int execute (const std::string&, const std::vector <std::string>&, const std::st
|
||||||
int flock (int, int);
|
int flock (int, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string compressIds (const std::vector <int>&);
|
|
||||||
void combine (std::vector <int>&, const std::vector <int>&);
|
void combine (std::vector <int>&, const std::vector <int>&);
|
||||||
|
|
||||||
unsigned burndown_size (unsigned ntasks);
|
unsigned burndown_size (unsigned ntasks);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue