summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/task.cc89
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*/