Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "library.h"
- List::List()
- {
- Start = nullptr;
- End = nullptr;
- }
- List::~List()
- {
- Function* prom;
- Function* t = Start;
- while (t != 0) {
- prom = t;
- t = t->Next;
- delete prom;
- }
- }
- void List::addFunction(string& name, bool isRecursive)
- {
- Function* Temp = new Function;
- if (!InList(name)) {
- Temp->name = name;
- Temp->isRecursive = isRecursive;
- Temp->Next = nullptr;
- if (Start == nullptr) {
- Start = End = Temp;
- }
- else {
- End->Next = Temp;
- End = Temp;
- }
- }
- }
- void List::PrintR(std::ofstream& file)
- {
- Function* t = Start;
- while (t != 0) {
- if (t->isRecursive) {
- file << t->name << endl;
- }
- t = t->Next;
- }
- }
- void List::PrintNR(std::ofstream& file)
- {
- Function* t = Start;
- while (t != 0) {
- if (!t->isRecursive) {
- file << t->name << endl;
- }
- t = t->Next;
- }
- }
- bool List::InList(string& name)
- {
- Function* t = Start;
- while (t != 0) {
- if (t->name == name) {
- return true;
- }
- t = t->Next;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement