Skip to content

Commit

Permalink
Edited docs to add search and delete feature 📖, currentlty adding tag…
Browse files Browse the repository at this point in the history
… del
  • Loading branch information
adiultra committed May 31, 2016
1 parent 80ce84d commit 7e78619
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 7 deletions.
Binary file modified data.tdx
Binary file not shown.
2 changes: 2 additions & 0 deletions docs/basic-commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ There are various Basic commands in the app. These commands are entered with the
open
view
append
search
delete
21 changes: 21 additions & 0 deletions docs/delete.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
======
Delete
======

Command
-------

``delete`` or ``del``


Function
--------

This deletes

Explanation
-----------

It shows the currently available lists, that can be opened. Enter the Number/Index in the prompt to open that list.

After Opening other commands like ``append`` and ``view`` can be used on the opened list.
19 changes: 19 additions & 0 deletions docs/search.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
======
Search
======

Command
-------

``search`` or ``grep``


Function
--------

This Searches the database for the string in Title, Tags and Todos

Explanation
-----------

It searches and displays the Lists which have the given search term in thier **Title**, **tag** or **ToDo**.
26 changes: 24 additions & 2 deletions fabric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ class List {

void todoView(int); // View the todo of index passed

void tagIndexView(); // View the Title and Tags with the index

void append(); // append a new ToDo in the #list

void remove(int); // delete the list at index passed
void removeTodo(int); // delete the list at index passed

void removeTag(int); // delete the tag at index passed

void changeStatus(int index, char status){
// Changes Status of the Item of #index to #status
Expand Down Expand Up @@ -164,6 +168,16 @@ void List::todoView(int index) {
cout << list[index].content << endl;
}

void List::tagIndexView() {
cout << title << endl;
cout << "============" << endl;

cout << "Tags : ";
for (int i = 0; i < _tagIndex; i++) {
cout << i << ". " << tags[i] << endl;
}
}

void List::append(){
char Content[200];
cout << "Enter the content of ToDo" << endl << green << " +> " << normal;
Expand All @@ -176,13 +190,21 @@ void List::append(){
_listIndex++;
}

void List::remove(int index) {
void List::removeTodo(int index) {
for (int i = index; i < _listIndex; i++) {
list[i] = list[i + 1];
}
_listIndex--;
}

void List::removeTag(int index) {
for (int i = index; i < _listIndex; i++) {
list[i] = list[i + 1];
}
_listIndex--;
}


// int main() {
// // NOTE
// // This main function is just for testing the stuff
Expand Down
30 changes: 28 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,33 @@ int parse(char command[80]){
currentL.todoView(index);

if ( confirm() ) {
currentL.remove(index);
currentL.removeTodo(index);
}

arrayL[_currentLindex] = currentL; // To Help Improving Finalization
}

else {
cout << "No List is opened, Open a list first" << endl;
}
}

else if (!(strcmp(choice, "tag") * strcmp(choice, "tags") * strcmp(choice, "Tag"))) {

if (isOpenL) {
int index;

cout << "Enter the Index of Tag to Delete " << endl;
currentL.indexView();

cout << Bblue << " #> " << normal;
cin >> index;
cin.ignore();
cout << "Are you sure, This cannot be undone, This will delete ->" << endl;
currentL.todoView(index);

if ( confirm() ) {
currentL.removeTodo(index);
}

arrayL[_currentLindex] = currentL; // To Help Improving Finalization
Expand Down Expand Up @@ -254,7 +280,7 @@ int parse(char command[80]){
currentL.todoView(index);

if ( confirm() ) {
currentL.remove(index);
currentL.removeTodo(index);
}

arrayL[_currentLindex] = currentL;
Expand Down
6 changes: 3 additions & 3 deletions search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void search(char term[], List arrayL[20]){
}

if (found) {
cout << "Found, Index => " << i << endl << arrayL[i].title << endl;
cout << "Found in title, Index => " << i << endl << arrayL[i].title << endl;
}
}

Expand Down Expand Up @@ -67,7 +67,7 @@ void search(char term[], List arrayL[20]){
}

if (found) {
cout << "Found, Index => " << i << endl;
cout << "Found in tag, Index => " << i << endl;
arrayL[i].tagView();

break;
Expand Down Expand Up @@ -104,7 +104,7 @@ void search(char term[], List arrayL[20]){
}

if (found) {
cout << "Found, Index =>" << i << endl;
cout << "Found in ToDo, List Index => " << i << endl;

arrayL[i].view();

Expand Down

0 comments on commit 7e78619

Please sign in to comment.