- Implemented Duration::get_units to return the list of supported
  duration units (wk, week, weekly ...).
This commit is contained in:
Paul Beckingham 2011-07-24 13:15:27 -04:00
parent f174caccbc
commit f502ee0c52
2 changed files with 14 additions and 0 deletions

View file

@ -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;
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -28,6 +28,7 @@
#define INCLUDED_DURATION
#define L10N // Localization complete.
#include <vector>
#include <string>
#include <time.h>
@ -59,6 +60,8 @@ public:
static bool valid (const std::string&);
void parse (const std::string&);
static const std::vector <std::string> get_units ();
protected:
time_t mSecs;
bool mNegative;