Duration
- Implemented Duration::get_units to return the list of supported duration units (wk, week, weekly ...).
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user