3 * Used to define the class Manager which is used to handle the tasks.
5 * Copyright (C) 2008 Kermit Mei <kermit.mei@gmail.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 3 as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
22 * Written by Kermit Mei <kermit.mei@gmail.com>
24 * Many of the ideas implemented here are from the author's experiment.
25 * But the dictionary's format coincide with the other word recite software
26 * to help the users get more available data. And the review times designed
27 * by means of the theory named Forgetting Curve which dicoveried by the
28 * German psychologist named Hermann Ebbinghaus(1850–1909).
39 #include "ConfigHolder.h"
42 namespace freeRecite
{
45 extern Manager manager
;
53 { /* Do Nothing Here! */ }
55 //Read the information from freeRecite.mgr file.
58 //Save the information to freeRecite.mgr file.
61 //Refresh the Manager information.
64 //Test whether this task ID is available.
65 bool hasTask(time_t taskID
);
67 //Get the task's name.
68 const std::string
&getTaskName(time_t taskID
)const;
70 //Get the next reviewing time which is nearest.
71 time_t getNextTime() const;
73 //Get the conrespond task's next reviewing time.
74 time_t getNextTime(time_t taskID
) const;
76 //Get the step of the task.
77 int getTaskStep(time_t taskID
) const;
79 //Create a new task with the words set.
80 bool createTask(const std::set
<std::string
> &words
,
81 const char *taskName
= 0,
82 unsigned maxLimit
= 100000);
84 //Remove a task which had been created.
85 void removeTask(time_t taskID
);
87 //Get the number of the current reciting words.
90 //Get the number of the tasks that should be reviewed.
91 int getActiveTaskNum() const;
93 //Get the active tasks' ID.
94 const std::vector
<time_t> &getActiveTasks() const;
96 //Get all of the tasks.
97 const std::map
<time_t,Task
> &getAllTasks() const;
100 * This method is used to test whether the mark you got can pass
101 * this test. If you pass it, the task will come to the next step,
105 * -1: If you can't pass it.
106 * 0: If you pass this setp.
107 * 1: If you complish this task.
109 * After calling this method, itr will point to the tested Task
110 * object, see Task::test() for more information.
112 int test(const time_t &taskID
, const int &mark
);
115 * mgrDir is the directory where default freeRecite.mgr
116 * file is saved. This file name is set by default, and
117 * anyone can NOT modify it at Run-time,including that
118 * they can't creat a file with this name under the same
121 time_t firstReviewTime
;
122 std::map
<time_t,Task
> allTasks
;
123 std::vector
<time_t> activeID
;
128 time_t Manager::getNextTime() const {
129 return firstReviewTime
;
132 } //namaspace freeRecite end