7 /// Default constructor.
8 CTodoEntry::CTodoEntry (id_t id
)
15 m_Priority (priority_Medium
),
17 m_bHasSublist (false),
20 const time_t now (time (NULL
));
21 m_Created
= uint32_t(now
);
25 /// Reads the object from stream \p is.
26 void CTodoEntry::read (istream
& is
)
28 is
>> m_Epoch
>> m_Created
>> m_Done
29 >> m_Id
>> m_Priority
>> m_Progress
>> m_bHasSublist
>> m_Refs
30 >> m_Text
>> m_Comment
>> ios::align(4);
33 /// Writes the object to stream \p os.
34 void CTodoEntry::write (ostream
& os
) const
36 os
<< m_Epoch
<< m_Created
<< m_Done
37 << m_Id
<< m_Priority
<< m_Progress
<< m_bHasSublist
<< m_Refs
38 << m_Text
<< m_Comment
<< ios::align(4);
41 /// Returns the size of the written object.
42 size_t CTodoEntry::stream_size (void) const
44 return (Align (stream_size_of (m_Epoch
) +
45 stream_size_of (m_Created
) +
46 stream_size_of (m_Done
) +
47 stream_size_of (m_Id
) +
48 stream_size_of (m_Priority
) +
49 stream_size_of (m_Progress
) +
50 stream_size_of (m_bHasSublist
) +
51 stream_size_of (m_Refs
) +
52 stream_size_of (m_Text
) +
53 stream_size_of (m_Comment
), 4));
56 /// Marks the item's \p progress and sets the done time if appropriate.
57 void CTodoEntry::MarkComplete (uint8_t progress
)
59 assert (progress
<= 100 && "Progress field is a percentage");
60 m_Progress
= progress
;
61 if (m_Progress
== 100)
65 /// Returns text string containing the combined date.
66 const char* CTodoEntry::TimeTText (uint32_t v
) const
68 time_t t (MakeTimeT (v
));