Skip to content

Commit

Permalink
DELTA
Browse files Browse the repository at this point in the history
  • Loading branch information
Necryotiks committed Apr 6, 2017
1 parent 976f43d commit 77be3c9
Show file tree
Hide file tree
Showing 29 changed files with 212 additions and 101 deletions.
Binary file modified Attendence Tracker/.vs/Attendence Tracker/v14/.suo
Binary file not shown.
Binary file modified Attendence Tracker/Attendence Tracker.VC.db
Binary file not shown.
129 changes: 114 additions & 15 deletions Attendence Tracker/Attendence Tracker/List.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@ void List::EditList()
}

void List::UpdateList(fstream & updatefile)
{//only stores first node
{
string temp;
auto i = 0;
string token = "Dubs Check 'Em";
assert(updatefile.is_open());
getline(updatefile, temp);
while (!updatefile.eof())
{
try
Expand All @@ -76,6 +75,10 @@ void List::UpdateList(fstream & updatefile)
{
while (temp[k] != ',')
{
if (temp[k] == '"')
{
break;
}
k++;
}
if (temp[k] == ',')
Expand All @@ -92,7 +95,10 @@ void List::UpdateList(fstream & updatefile)
try
{
getline(temp_s, token, ',');

if (token == "")
{
break;
}
i++;
switch (i)
{
Expand Down Expand Up @@ -166,7 +172,7 @@ void List::EditList(std::shared_ptr<Listnode>& headNode)
x = regex_match(input1, match_str, rgx_top);
if (match_str[0] == "1")
{
cout << " Do you wish to add empty node? Y/N" << endl;
cout << "Do you wish to add empty node? Y/N" << endl;
cin >> input1;
if (input1 == "Y" || input1 == "y")
{
Expand Down Expand Up @@ -285,6 +291,7 @@ void List::EditList(std::shared_ptr<Listnode>& headNode)
{
string temp;
cout << "Enter a name." << endl;
cin.ignore();
getline(cin, temp);
Node->setName(temp);
cout << "Name added" << endl;
Expand Down Expand Up @@ -356,7 +363,7 @@ void List::EditList(std::shared_ptr<Listnode>& headNode)
system("pause");
v = false;
}

v = false;
}
else
Expand Down Expand Up @@ -468,13 +475,13 @@ void List::EditList(std::shared_ptr<Listnode>& headNode)
string tempx = match_str3[0];
editNode(tempx);
b = false;
if(tempx == "0")
if (tempx == "0")
{
b = true;
}
}
}
else if(match_str[0] == "4")
else if (match_str[0] == "4")
{
x = true;
}
Expand All @@ -499,13 +506,14 @@ void List::DeleteNode(string &temp2) const
}

}
void List::editNode(string & temp3)
void List::editNode(string & temp3)const
{
string regex_key = "[0-9]";
std::regex rgx_top(regex_key, std::regex_constants::ECMAScript);
auto pCur = headNode;
auto v = false;
auto z = 0;
auto i = 0;
while (pCur != nullptr)
{
if (temp3 == pCur->getRecord())
Expand All @@ -526,14 +534,24 @@ void List::editNode(string & temp3)
cout << "7. Level" << endl;
cout << "8. Number of absences" << endl;
cout << "9. Absences dates" << endl;
cout << "Current profile:" << *pCur << endl;
cout << "Current profile:" << *pCur;
while (!pCur->getAbsDate(i).empty())//maybe
{

cout << pCur->getAbsDate(i) << ",";
if (pCur->getAbsDate(i).empty())
{
break;
}
i++;
}
cin >> input2;
v = regex_match(input2, match_str2, rgx_top);
if (match_str2[0] == "0")
{

break;

}
if (match_str2[0] == "1")
{
Expand Down Expand Up @@ -565,6 +583,7 @@ void List::editNode(string & temp3)
{
string temp;
cout << "Enter a name." << endl;
cin.ignore();
getline(cin, temp);
pCur->setName(temp);
cout << "Name added" << endl;
Expand Down Expand Up @@ -631,14 +650,14 @@ void List::editNode(string & temp3)
system("pause");
v = false;
}
else if(choice == "2")
else if (choice == "2")
{
string ccc;
string rmv = "-2";
auto bbb= 0;
auto bbb = 0;
auto g = 1;
cout << "Select entry number: " << endl;
while(!pCur->getAbsDate().empty())
while (!pCur->getAbsDate().empty())
{
cout << g << "." << pCur->getAbsDate() << "," << endl;
}
Expand All @@ -654,7 +673,7 @@ void List::editNode(string & temp3)
string tstr;
auto temp = currentTime();
cout << "Is student absent: " << endl;
cout << "Y/N";
cout << "Y/N" << endl;
cin >> tstr;
if (tstr == "Y" || tstr == "y")
{
Expand All @@ -675,6 +694,86 @@ void List::editNode(string & temp3)
pCur = pCur->getNextPtr();
}
}
void List::outputNode(fstream & infile)const
{
auto pCur = headNode;//fix
while (pCur != nullptr)
{
auto i = 0;
infile << *pCur;
while (!pCur->getAbsDate(i).empty())//maybe
{

infile << pCur->getAbsDate(i) << ",";
if (pCur->getAbsDate(i).empty())//
{
break;
}
i++;
}
pCur = pCur->getNextPtr();
infile << endl;
}
}
void List::genReport()const
{
auto pCur = headNode;
system("cls");
while (pCur != nullptr)
{
cout << *pCur << pCur->peekMostRecentDate();
pCur = pCur->getNextPtr();
cout << endl;
}
}
void List::genAbsReport(string i) const
{
auto pCur = headNode;
system("cls");
while (pCur != nullptr)
{
if (pCur->getNumAbs() == i)
{
cout << *pCur;
cout << pCur->peekMostRecentDate();
cout << endl;
}
pCur = pCur->getNextPtr();
}
}
void List::ABSloop()const
{
string inputsz;
std::smatch res5;
string regkey = "[YNyn]{1,1}";
std::regex regky(regkey, std::regex_constants::ECMAScript);
auto pCur = headNode;
auto k = false;

while (pCur != nullptr)
{
while (k != true)
{
system("cls");
cout << *pCur << pCur->peekMostRecentDate() << endl;
cout << "Is this student absent? Y/N" << endl;
cin >> inputsz;
k = regex_search(inputsz, res5, regky);
}
if (res5[0] == "Y" || res5[0] == "y")
{
auto temp = currentTime();
pCur->setAbsDate(temp);
k = false;
}
else
{
k = false;
}
pCur = pCur->getNextPtr();
cout << endl;
}
}
std::shared_ptr<Listnode>& List::getHead()
{
return headNode;
Expand Down
6 changes: 5 additions & 1 deletion Attendence Tracker/Attendence Tracker/List.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ class List
void EditList();
void DeleteList();
void DeleteNode(string &temp2) const;
void editNode(string &temp3);
void editNode(string &temp3)const;
void outputNode(fstream & infile) const;
void genReport()const;
void genAbsReport(string i)const;
void ABSloop()const;
std::shared_ptr<Listnode> &getHead();
friend std::ostream &operator<<(std::ostream& lhs, Listnode &rhs);
private:
Expand Down
6 changes: 6 additions & 0 deletions Attendence Tracker/Attendence Tracker/Listnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,9 @@ void Listnode::removeDate(int i)
{
absences.erase(absences.begin()+i);
}

string Listnode::peekMostRecentDate()
{
auto temp = absences.back();
return temp;
}
4 changes: 2 additions & 2 deletions Attendence Tracker/Attendence Tracker/Listnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Listnode
{
public:
explicit Listnode(string Record = "NULL",string idNum = "",string name = "",string email = "",string credits = "",string numAbs = "",string program = "",string level = "");
explicit Listnode(string Record = "NULL",string idNum = "NULL",string name = "NULL",string email = "NULL",string credits = "NULL",string numAbs = "NULL",string program = "NULL",string level = "NULL");
~Listnode();

std::shared_ptr<Listnode> &getNextPtr(); //list was the reason list wasnt linking and should not have been static.
Expand Down Expand Up @@ -36,7 +36,7 @@ class Listnode
string getAbsDate() const;
string getAbsDate(int i) const;
void removeDate(int i);

string peekMostRecentDate();
private:
std::shared_ptr<Listnode> nextptr;
string Record;
Expand Down
2 changes: 0 additions & 2 deletions Attendence Tracker/Attendence Tracker/Master.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ void run_exe()
}
string currentTime()
{


auto t = system_clock::now();
auto time = system_clock::to_time_t(t);
return ctime(&time);
Expand Down
Loading

0 comments on commit 77be3c9

Please sign in to comment.