mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Interval: Added ::serialize
This commit is contained in:
parent
e1f9b57d82
commit
171dae6ad2
2 changed files with 17 additions and 0 deletions
|
@ -77,6 +77,22 @@ void Interval::tag (const std::string& tag)
|
|||
_tags.insert (tag);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Interval::serialize () const
|
||||
{
|
||||
std::stringstream out;
|
||||
out << "inc "
|
||||
<< (_start.toEpoch () ? _start.toISO () : "")
|
||||
<< " - "
|
||||
<< (_end.toEpoch () ? _end.toISO () : "")
|
||||
<< " #";
|
||||
|
||||
for (auto& tag : _tags)
|
||||
out << " " << tag;
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Interval::dump () const
|
||||
{
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
std::set <std::string> tags () const;
|
||||
void tag (const std::string&);
|
||||
|
||||
std::string serialize () const;
|
||||
std::string dump () const;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue