1 // Copyright (c) 2006 by Mike Sharov <msharov@users.sourceforge.net>
6 #ifndef TDDOC_H_31474BC008E2711A4DD60C960CFF3439
7 #define TDDOC_H_31474BC008E2711A4DD60C960CFF3439
11 /// \class CTodoDocument tddoc.h tddoc.h
13 /// Contains the list of todo entries and the table of dependencies between
14 /// them. Provides accessors for modification of the list and the table.
16 class CTodoDocument
: public CDocument
{
18 typedef set
<CTodoItem
> todoset_t
;
19 typedef const CTodoItem
& rcitem_t
;
20 typedef todoset_t::iterator iitem_t
;
21 typedef todoset_t::const_iterator icitem_t
;
22 typedef tddepmap_t::iterator idep_t
;
23 typedef tddepmap_t::const_iterator icdep_t
;
24 typedef CTodoItem::id_t itemid_t
;
25 typedef const string
& rcfname_t
;
28 virtual void read (istream
& is
);
29 virtual void write (ostream
& os
) const;
30 virtual size_t stream_size (void) const;
31 virtual void Open (rcfname_t filename
);
32 virtual void Save (void);
33 icitem_t
FindItem (itemid_t id
) const;
34 inline iitem_t
FindItem (itemid_t id
) { return (const_cast<iitem_t
>(const_cast<const CTodoDocument
*>(this)->FindItem(id
))); }
35 void ItemDeps (itemid_t id
, tddepmap_t
& m
) const;
36 itemid_t
CreateItem (void);
37 void LinkItem (itemid_t id
, itemid_t parent
);
38 void UpdateItem (rcitem_t v
);
39 void UnlinkItem (icdep_t id
);
41 inline itemid_t
GetNextItemId (void) const;
42 void VerifyData (void);
43 bool VisibleOrderLess (const CTodoDep
& d1
, const CTodoDep
& d2
) const;
44 void ResortItemDeps (idep_t first
, idep_t last
) const;
45 void UpdateItemProgress (idep_t first
, idep_t last
);
46 void UpdateCompleteStatus (itemid_t dep
);
48 todoset_t m_Todos
; ///< List of all entries.
49 tddepmap_t m_Deps
; ///< List of dependencies between todos.