"Fossies" - the Fresh Open Source Software Archive

Member "devtodo-0.1.20/src/support.h" (9 May 2006, 1721 Bytes) of package /linux/privat/old/devtodo-0.1.20.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "support.h" see the Fossies "Dox" file reference documentation.

    1 #ifndef SUPPORT_H__
    2 #define SUPPORT_H__
    3 
    4 #include <fstream>
    5 #include <set>
    6 #include <ctime>
    7 #include <map>
    8 #include "TodoDB.h"
    9 
   10 using namespace std;
   11 
   12 /* Options that can be set per run. */
   13 struct Options {
   14     Options();
   15 
   16     enum Dir { Negative = -1, Equal = 0, Positive = +1 };
   17 
   18     int verbose, purgeage;
   19     bool mono, paranoid, global, summary, timeout, comment;
   20     string text, database, globaldatabase, filename,
   21         dateformat;
   22     map<string, string> format;
   23 
   24     struct Filter {
   25         Filter();
   26 
   27         Dir prioritydir;
   28         Todo::Priority priority;
   29         Dir childrendir;
   30         bool children;
   31         Dir donedir;
   32         bool done;
   33         map<string, Dir> item;
   34         Dir show;
   35         Regex search;
   36     } filter;
   37 
   38     struct Sort {
   39         Dir dir;
   40         enum Key { None, Created, Completed, Text, Priority, Duration, Done } key;
   41     };
   42     vector<Sort> sort;
   43 
   44     vector<string> index, loaders;
   45     map<string, vector<string> > event;
   46     Todo::Priority priority;
   47     TodoDB::Mode mode;
   48     typedef map<string, bool (*)(multiset<Todo> &out, string const &title)> Loader;
   49     int backups, timeoutseconds, columns;
   50 };
   51 
   52 extern Options options;
   53 
   54 // Turn a numeric priority into a symbolic one
   55 string symbolisePriority(string sym);
   56 string symbolisePriority(Todo::Priority sym);
   57 Todo::Priority desymbolisePriority(string sym);
   58 
   59 // text input
   60 string readText(string const &prompt, string existing = "", bool nuke = false);
   61 void addHistory(string text);
   62 
   63 // Parse command line arguments
   64 void parseArgs(TodoDB &todo, int argc, char const **argv);
   65 vector<string> parseRC();
   66 
   67 // Date stuff
   68 time_t getCurrentDate();
   69 string dateToHuman(time_t time);
   70 string elapsedToHuman(time_t start, time_t end);
   71 
   72 // Misc
   73 /// Expand any $<identifier> type environment variables found in a string
   74 string expandEnvars(string const &str);
   75 #endif