mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-26 06:37:20 +02:00
Duration
- Implemented Duration::get_units to return the list of supported duration units (wk, week, weekly ...).
This commit is contained in:
parent
f174caccbc
commit
f502ee0c52
2 changed files with 14 additions and 0 deletions
|
@ -452,3 +452,14 @@ void Duration::parse (const std::string& input)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
const std::vector <std::string> Duration::get_units ()
|
||||||
|
{
|
||||||
|
std::vector <std::string> units;
|
||||||
|
for (unsigned int i = 0; i < NUM_DURATIONS; ++i)
|
||||||
|
if (strcmp (durations[i], "-"))
|
||||||
|
units.push_back (durations[i]);
|
||||||
|
|
||||||
|
return units;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#define INCLUDED_DURATION
|
#define INCLUDED_DURATION
|
||||||
#define L10N // Localization complete.
|
#define L10N // Localization complete.
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
@ -59,6 +60,8 @@ public:
|
||||||
static bool valid (const std::string&);
|
static bool valid (const std::string&);
|
||||||
void parse (const std::string&);
|
void parse (const std::string&);
|
||||||
|
|
||||||
|
static const std::vector <std::string> get_units ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
time_t mSecs;
|
time_t mSecs;
|
||||||
bool mNegative;
|
bool mNegative;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue