bool LoginData::match(const LoginData& b) const { return partialMatch(b.m_realm, b.m_usernameField, b.m_usernameValue, b.m_passwdField) && (m_passwdValue == b.m_passwdValue); }
/* This functions finds a BookData object Checked it. Looks good. */ void BookCollection::lookUpBook() { // To hold the indices of found books std::vector<std::list<BookData>::iterator> found; std::vector<std::list<BookData>::iterator> partialfound; std::string input; // To hold user string input. // Ask the user for the title or ISBN of the book std::cout << "Please enter the title of the " << "book." << std::endl; std::getline(std::cin, input); std::cout << std::endl; // pass the user input to the match and partial match function match(input, found); partialMatch(input, partialfound); if (found.empty()) { // go through the partialfound vector for (unsigned int index = 0; index < partialfound.size(); index++) { // add the position of the book to found found.push_back(partialfound[index]); } // end for } // end if else { // go through the partialfound vector for (unsigned int index = 0; index < partialfound.size(); index++) { // go through the found vector for (unsigned int count = 0; count < found.size(); count++) { // initialze flag bool flag = false; // if the elements are equal if (found[index] == partialfound[count]) { // set flag to true flag = true; } // end if // if it wasn't found in found if (!flag) { // add the position of the book to found found.push_back(partialfound[count]); } // end if } // end for } // end for } // end else // If nothing was found if (found.empty() && partialfound.empty()) { std::cout << "Your query did not match any titles." << std::endl; } // end if // Otherwise else { // display the matches and patial matches std::cout << "Found: " << std::endl; displayBooks(found); //displayBooks(partialfound); } } // end function lookUpBook