// todoList.h ////////////////////////////////////////////////////////////////////////// // todoList provides support for maintaining a simple list of tasks that // must be carried out. Each task is represented by a single string, // which can contain as much or as little text as desired. Tasks may // only be accessed in FIFO order. The first task todo may be examined, // or removed from the list. Newly added tasks are appended to the list. // // The items in the todo list may be saved to file; the file will consist // of entries of the form ":\t" followed by the text string for a // task. The saved tasks are numbered, starting at zero. // // The todo list may be initialized task by task, or loaded at once // from a file (formatted as described above). // #ifndef TODOLIST_H #define TODOLIST_H #include #include class todoList { friend class Javert; public: todoList(unsigned int Sz = 10); // set up empty task list todoList(std::string fName); // create list from file bool addTask(const std::string& Task); // add a task to the list std::string getNextTask() const; // see what the next task is bool delTask(); // remove the next task void Display(std::ostream& Out) const; // see the whole list void Save(std::string fName) const; // save the list to file void Clear(); // remove all the tasks todoList(const todoList& Source); // deep copy support todoList& operator=(const todoList& RHS); ~todoList(); // deallocate task list private: unsigned int putNext; // index where next task will go unsigned int doNext; // index of next task to do unsigned int Capacity; // capacity of list unsigned int nTasks; // number of tasks in the list std::string* List; // list of tasks }; #endif