Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.59 KB | None | 0 0
  1. void dispheadDups(linkedList<linkedList<string>> fList) {
  2.  
  3.  
  4.  
  5.     linkedList<string> uniqueHList;
  6.     //This section prepares the unique Header List of names to scan through.
  7.     if (fList.getHead() != NULL) {
  8.         node<linkedList<string>> *currentFile = fList.getHead();
  9.         while (currentFile != NULL) { // if there's at at least 1 file, go through the files.
  10.             node<string> *currentHeader = currentFile->getData().getHead();
  11.             while (currentHeader != NULL) { // loop while there are still headers to check.
  12.                 node<string> *tempUHL = uniqueHList.getHead();
  13.                 bool foundCopy = false;
  14.                 while (tempUHL != NULL) {
  15.                     cout << "comparing " << tempUHL->getData() << " to " << currentHeader->getData() << endl;
  16.                     if (tempUHL->getData().compare(currentHeader->getData()) == 0) {
  17.                         cout << "they're equal!" << endl;
  18.                         foundCopy = true;
  19.                     }
  20.                     tempUHL = tempUHL->getNext();
  21.                 }
  22.                 if (!foundCopy) { //Means I haven't worked on this header name yet.
  23.                     int count = countCopies(currentHeader->getData());
  24.                     if (count > 1) {
  25.                         cout << "about to add " << currentHeader->getData() << " to unique list" << endl;
  26.                         uniqueHList.Append(currentHeader->getData());
  27.                     }
  28.                     dispDirect(currentHeader->getData(), fList);
  29.                 }
  30.                 currentHeader = currentHeader->getNext();
  31.             }
  32.             currentFile = currentFile->getNext();
  33.         }
  34.     }
  35.     ////This section below uses the unique Header List of names to scan for duplicates.
  36.     ////There are two steps to scanning for duplicates.
  37.     ////(1) If a file indirectly includes the header through another file.
  38.     ////(2) If a file directly includes the header.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement