--- SiteMapper/Page.cpp 2004/03/25 09:02:24 135 +++ SiteMapper/Page.cpp 2004/03/26 03:21:58 141 @@ -67,7 +67,25 @@ bool Page::operator==(const string& thin return false; } -bool Page::operator==(Page& page) +bool Page::operator==(Matcher& matcher) +{ + if (address == matcher) + { + return true; + } + else if (path == matcher) + { + return true; + } + else if (title == matcher) + { + return true; + } + + return false; +} + +bool Page::operator==(const Page& page) const { if (address == page.address) { @@ -77,32 +95,38 @@ bool Page::operator==(Page& page) return false; } -bool Page::operator<(Page& page) +bool Page::operator<(const Page& page) const { - if (address < page.address) if (path < page.path) return true; + if (address == page.address) + { + return path < page.path; + } - return false; + return address < page.address; } -bool Page::operator>(Page& page) +bool Page::operator>(const Page& page) const { - if (address > page.address) if (path > page.path) return true; + if (address == page.address) + { + return path > page.path; + } - return false; + return address > page.address; } ostream& operator<<(ostream& output, Page& page) { string tab(page.tab, '\t'); - output << tab << "" << page.title << "\n"; if (!page.children.empty()) { output << tab << "\t\n"; - for (int index = 0; index < page.children.size(); index++) + for (unsigned index = 0; index < page.children.size(); index++) { output << page.children[index](page.tab + 1) << '\n'; }