languages

A collection of programs made with different programming languages.
git clone git://evanalba.com/languages
Log | Files | Refs

todo_item.h (1629B)


      1 /*
      2  * Name        : todo_item.h
      3  * Author      : Evan Alba
      4  * Description : Header File for class TodoItem.
      5  */
      6 
      7 #ifndef TODO_ITEM
      8 #define TODO_ITEM
      9 #include <algorithm>
     10 #include <iostream>
     11 #include <string>
     12 
     13 class TodoItem {
     14  public:
     15     /* Create Item on the Todo list. */
     16     TodoItem(std::string info, int rank = 1, bool done = false) {
     17       description_ = info;
     18       priority_ = rank;
     19       completed_ = done;
     20     }
     21 
     22     /* Get the Description. */
     23     std::string description() const {
     24       return description_;
     25     }
     26 
     27     /* Get the Priority ranking of item on the Todo List. */
     28     int priority() const {
     29       return priority_;
     30     }
     31 
     32     /* Get back if the item on the Todo List has been completed. */
     33     bool completed() const {
     34       return completed_;
     35     }
     36 
     37     /* PUBLIC Setters Prototypes for Todo Item Class */
     38     /* Set the description of the item. */
     39     void set_description(std::string text);
     40 
     41     /* Check if priority number of item given is a number of 1 - 5.
     42     If TRUE, set priority number. 
     43     If the priority number invalid, set to 5. */
     44     void set_priority(int rank);
     45 
     46     /* State if the item on the Todo List has been completed. */
     47     void set_completed(bool state);
     48 
     49     /* Returns a string containing the description, 
     50     priority, and completed status, separated by the @ symbol. */
     51     std::string ToFile();
     52 
     53  private:
     54     /* PRIVATE Data for Todo Item Class */
     55     std::string description_;
     56     int priority_;
     57     bool completed_;
     58 
     59     /* PRIVATE Prototype for Scrub Function */
     60     /* Replace @ in the description with ` symbol. */
     61     std::string scrub(std::string edit);
     62 };
     63 #endif