-
Notifications
You must be signed in to change notification settings - Fork 6
/
project.h
61 lines (46 loc) · 1.39 KB
/
project.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef PROJECT_H_
#define PROJECT_H_
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include "filter-predicate.h"
#include "serializer.h"
#include "task.h"
using std::ifstream;
using std::ofstream;
using std::string;
using std::vector;
class Project : public HierarchicalListDataSource {
public:
explicit Project(string name);
virtual ~Project();
static Project* NewProjectFromFile(string path);
void FilterTasks(FilterPredicate<Task>* filter);
void FilterTasks() { FilterTasks(&base_filter_); }
void RunSearchFilter(const string& find);
string Name() { return name_; }
Task* AddTaskNamed(const string& name);
void Serialize(Serializer* s);
// A count of every item in the tree.
int NumTasks();
void DeleteTask(Task* t);
// Various Common Filters
void ShowAllTasks();
void ShowCompletedLastWeek();
void ArchiveCompletedTasks();
int NumFilteredRoots();
Task* FilteredRoot(int r);
// Functions required by HierarchicalListDataSource:
int NumRoots() { return NumFilteredRoots(); }
ListItem* Root(int i) { return static_cast<ListItem*>(FilteredRoot(i)); }
void RecomputeNodeStatus();
friend ostream& operator<<(ostream& out, Project& project);
private:
TaskStatus ComputeStatusForTask(Task* t);
string name_;
vector<Task*> tasks_;
vector<Task*> filtered_tasks_;
AndFilterPredicate<Task> base_filter_;
};
#endif // PROJECT_H_