diff options
author | Jonas Suhr Christensen <jsc@umbraculum.org> | 2012-03-30 12:06:26 +0200 |
---|---|---|
committer | Jonas Suhr Christensen <jsc@umbraculum.org> | 2012-03-30 12:06:26 +0200 |
commit | 9e59f28af85f8111bdff5058bbf0d2007f075033 (patch) | |
tree | 7bf1b39c24c9cb39af093078349edf0ff0f2eb58 | |
parent | d05300e1367f1e6503f1fe3753aaa92efe3944f9 (diff) |
deleted
-rw-r--r-- | src/task.cc | 89 |
1 files changed, 16 insertions, 73 deletions
diff --git a/src/task.cc b/src/task.cc index 03c1e56..3054e48 100644 --- a/src/task.cc +++ b/src/task.cc @@ -3,9 +3,9 @@ /*************************************************************************** * task.cc * - * Fri Feb 24 08:16:30 CET 2012 - * Copyright 2012 Bent Bisballe Nyeng - * deva@aasimon.org + * Tue Mar 27 11:41:34 CEST 2012 + * Copyright 2012 Jonas Suhr Christensen + * jsc@umbraculum.org ****************************************************************************/ /* @@ -27,77 +27,20 @@ */ #include "task.h" -#include <stdio.h> +#ifdef TEST_TASK +//Additional dependency files +//deps: +//Required cflags (autoconf vars may be used) +//cflags: +//Required link options (autoconf vars may be used) +//libs: +#include "test.h" -#include "xml_encode_decode.h" +TEST_BEGIN; +// TODO: Put some testcode here (see test.h for usable macros). +TEST_TRUE(false, "No tests yet!"); -TaskList tasklist; +TEST_END; -static int id_count = 0; - -int current_id_count() { - return id_count; -} - -task_t create_task(std::string title, std::string desc, - /*int x, int y,*/ int parent_id) { - - task_t t; - t.parent_id = parent_id; -// t.x = x; -// t.y = y; - t.title = title; - t.desc = desc; - t.id = id_count; id_count++; - - return t; -} - -TaskList load_tasklist_from_file(std::string file) { - TaskList list; - - // create MuniaDb class which handles tasks, db-flush and db-init. - - return list; -} - -bool save_tasklist_to_file(TaskList list, std::string file) { - - FILE* fp; - - if(! (fp = fopen(file.c_str(), "w"))) { - return false; - } - - if(!fprintf(fp, "<tasklist>\n")) { - fclose(fp); - return false; - } - - TaskList::iterator it; - for(it = tasklist.begin(); it != tasklist.end(); it++) { - task_t t = *it; - int r = 1; - -// printf("Flushing task %d\n", t.id); - - r |= fprintf(fp, " <task id=\"%d\" parent_id=\"%d\">\n", t.id, t.parent_id); - r |= fprintf(fp, " <title>%s</title>\n", xml_encode(t.title).c_str()); - r |= fprintf(fp, " <desc>%s</desc>\n", xml_encode(t.desc).c_str()); - r |= fprintf(fp, " </task>)\n"); - - if(!r) { - fclose(fp); - return false; - } - } - - if(!fprintf(fp, "</tasklist>\n")) { - fclose(fp); - return false; - } - - fclose(fp); - return true; -} +#endif/*TEST_TASK*/ |