Enhancement
- Implemented Record::get_duration as a helper.
This commit is contained in:
@@ -178,6 +178,16 @@ time_t Record::get_date (const std::string& name) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
time_t Record::get_duration (const std::string& name) const
|
||||||
|
{
|
||||||
|
Record::const_iterator i = this->find (name);
|
||||||
|
if (i != this->end ())
|
||||||
|
return (time_t) strtoul (i->second.value ().c_str (), NULL, 10);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Record::set (const std::string& name, const std::string& value)
|
void Record::set (const std::string& name, const std::string& value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public:
|
|||||||
int get_int (const std::string&) const;
|
int get_int (const std::string&) const;
|
||||||
unsigned long get_ulong (const std::string&) const;
|
unsigned long get_ulong (const std::string&) const;
|
||||||
time_t get_date (const std::string&) const;
|
time_t get_date (const std::string&) const;
|
||||||
|
time_t get_duration (const std::string&) const;
|
||||||
void set (const std::string&, const std::string&);
|
void set (const std::string&, const std::string&);
|
||||||
void set (const std::string&, int);
|
void set (const std::string&, int);
|
||||||
void remove (const std::string&);
|
void remove (const std::string&);
|
||||||
|
|||||||
Reference in New Issue
Block a user