aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-04-02 02:22:15 +0200
committerache <ache@ache.one>2018-04-02 02:22:15 +0200
commit27689233b88511327f2581bab367d64eeab9fe41 (patch)
tree2261761355ce16a7fca9de9b3164849a40b06396
parent9f5df28d7aeb97f97d0bb95cfa82a8e24e22cfb0 (diff)
addTodo to add a todo object
-rwxr-xr-xtodo.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/todo.cpp b/todo.cpp
index f3685ef..5b6d2c4 100755
--- a/todo.cpp
+++ b/todo.cpp
@@ -129,7 +129,15 @@ void modifyTODO( vector<todo>& listTodo, int argc, char* argv[], Functor modif
}
}
}
-
+void addTODO( vector<todo>& listTodo, todo& td) {
+ for ( int i = listTodo.size()-1; i >= 0 ; --i)
+ if( listTodo.at(i).str == td.str ) {
+ cerr << "Erreur doublon" << endl;
+ exit(-1);
+ break;
+ }
+ listTodo.push_back(td);
+}
int main(int argc, char *argv[]) {
color = false;
@@ -225,13 +233,7 @@ int main(int argc, char *argv[]) {
break;
} else {
todo tmpTodo = todoFromCmd(sargv);
- for ( int i = listTodo.size()-1; i >= 0 ; --i)
- if( listTodo.at(i).str == tmpTodo.str ) {
- cerr << "Erreur doublon" << endl;
- exit(-1);
- break;
- }
- listTodo.push_back(tmpTodo);
+ addTODO(listTodo, tmpTodo);
}
break;