Skip to content

Commit

Permalink
Added make file and diffenerntiated header 😄 👍 checked
Browse files Browse the repository at this point in the history
  • Loading branch information
adiultra committed Jun 2, 2016
1 parent 7bcdd81 commit dec9bd6
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 144 deletions.
4 changes: 4 additions & 0 deletions export.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include <fstream>
#include <iostream>
#include <cstring>
#include "fabric.h"

using namespace std;

void Export(List Array[20], int _arrayLindex){
char fname[40];

Expand Down
148 changes: 148 additions & 0 deletions fabric.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#include "fabric.h"

#include <iostream>
#include <cstring>

using namespace std;

List::List(){
_listIndex = 0;
_tagIndex = 0;
}

List::List(char Title[100]) {
_listIndex = 0;
_tagIndex = 0;

strcpy(title, Title);
}

void List::enter(){
cout << "Enter title for your list" << endl << green << " +> " << normal;
cin.getline(title, sizeof(title));

char choice[10];
cout << "Do you want some tags? (yes/no)" << endl << Bred << " ?> " << normal;
cin.getline(choice, sizeof(choice));

if (!(strcmp(choice, "yes")*strcmp(choice, "y"))) {
char tagTemp[220];

cout << "Enter the tag one at a time" << endl << "\'d\' when done " << endl;
cout << green << " +> " << normal;

while (1) {
cin.getline(tagTemp, 20);

if (strcmp(tagTemp, "d") != 0) {
addTag(tagTemp);
cout << green << " +> " << normal;
}

else {
break;
}
}
}

}


void List::addTag(char Tag[20]) {
strcpy(tags[_tagIndex++], Tag);
}

void List::setTitle(char Title[100]) {
strcpy(title, Title);
}


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

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

cout << endl << endl;

for (int i = 0; i < _listIndex; i++) {
cout << " [" << list[i].status << "] ";
cout << list[i].content << endl;
}
}

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

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

cout << endl << endl;

for (int i = 0; i < _listIndex; i++) {
cout << " " << i << ". [" << list[i].status << "] ";
cout << list[i].content << endl;
}
}

void List::tagView() {
cout << title << endl;

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

cout << endl;
}

void List::todoView(int index) {
cout << index << ". [" << list[index].status << "] ";
cout << list[index].content << endl;
}

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

cout << "Tags :" << endl;
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;
cin.getline(Content, 200);

strcpy(list[_listIndex].content, Content);

list[_listIndex].status = ' ';
list[_listIndex]._index = _listIndex;
_listIndex++;
}

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 < _tagIndex; i++) {
strcpy(tags[i], tags[i + 1]);
}
_tagIndex--;
}

void List::changeStatus(int index, char status){
list[index].status = status;
}
149 changes: 5 additions & 144 deletions fabric.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#ifndef INC_FABRIC_H
#define INC_FABRIC_H

#include <iostream>
#include <cstring>

using namespace std;

// Color variables using ANSI sequences

Expand Down Expand Up @@ -38,22 +34,18 @@ class List {
char title[100];
char tags[10][20];

int _listIndex; // Variable to count the filling of list
int _tagIndex; // Variable to count the filling of tags
int _listIndex; // Variable to count the filling of list
int _tagIndex; // Variable to count the filling of tags

List(); // Asks for #title(required) and #tags(can be skipped).

List(char Title[100]); // Initialize the #list with #title

void enter(); // Enter the info given by user

void addTag(char Tag[20]) {
strcpy(tags[_tagIndex++], Tag);
}
void addTag(char Tag[20]); // Add the tag to Tags

void setTitle(char Title[100]) {
strcpy(title, Title);
}
void setTitle(char Title[100]); // Set the Title given

void view(); // View the list's #title #tags and #content

Expand All @@ -71,142 +63,11 @@ class List {

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

void changeStatus(int index, char status){
// Changes Status of the Item of #index to #status
list[index].status = status;
}
void changeStatus(int index, char status); // Changes Status of the Item of #index to #status

~List() {}
};

List::List(){
_listIndex = 0;
_tagIndex = 0;
}

List::List(char Title[100]) {
_listIndex = 0;
_tagIndex = 0;

strcpy(title, Title);
}

void List::enter(){
cout << "Enter title for your list" << endl << green << " +> " << normal;
cin.getline(title, sizeof(title));

char choice[10];
cout << "Do you want some tags? (yes/no)" << endl << Bred << " ?> " << normal;
cin.getline(choice, sizeof(choice));

if (!(strcmp(choice, "yes")*strcmp(choice, "y"))) {
char tagTemp[220];

cout << "Enter the tag one at a time" << endl << "\'d\' when done " << endl;
cout << green << " +> " << normal;

while (1) {
cin.getline(tagTemp, 20);

if (strcmp(tagTemp, "d") != 0) {
addTag(tagTemp);
cout << green << " +> " << normal;
}

else {
break;
}
}
}

}

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

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

cout << endl << endl;

for (int i = 0; i < _listIndex; i++) {
cout << " [" << list[i].status << "] ";
cout << list[i].content << endl;
}
}

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

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

cout << endl << endl;

for (int i = 0; i < _listIndex; i++) {
cout << " " << i << ". [" << list[i].status << "] ";
cout << list[i].content << endl;
}
}

void List::tagView() {
cout << title << endl;

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

cout << endl;
}

void List::todoView(int index) {
cout << index << ". [" << list[index].status << "] ";
cout << list[index].content << endl;
}

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

cout << "Tags :" << endl;
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;
cin.getline(Content, 200);

strcpy(list[_listIndex].content, Content);

list[_listIndex].status = ' ';
list[_listIndex]._index = _listIndex;
_listIndex++;
}

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 < _tagIndex; i++) {
strcpy(tags[i], tags[i + 1]);
}
_tagIndex--;
}


// int main() {
// // NOTE
Expand Down
1 change: 1 addition & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <fstream>
#include <iostream>
#include <cstring>

// some local files
#include "fabric.h"
Expand Down
16 changes: 16 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
all: todx.out

todx.out: fabric.o main.o
g++ -o todx.out main.o fabric.o

main.o: main.cpp
g++ -c -Wall main.cpp

fabric.o: fabric.h fabric.cpp
g++ -c -Wall fabric.cpp

run: todx.out
./todx.out

clean:
rm -f *.o *.out *.h.gch
5 changes: 5 additions & 0 deletions search.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include "fabric.h"

#include <iostream>
#include <cstring>

using namespace std;

// TODO
// [*] -> The Loop should repeat at every charecter <- hell wit the spelling

Expand Down

0 comments on commit dec9bd6

Please sign in to comment.