void BookCollection::addDescription(BookDescriptionPtr description) { if (description.isNull()) { return; } AuthorPtr author = description->author(); const std::string &displayName = author->displayName(); const std::string &sortKey = author->sortKey(); std::map<AuthorPtr,Books>::iterator it = myCollection.begin(); for (; it != myCollection.end(); ++it) { AuthorPtr author1 = (*it).first; if ((author1->sortKey() == sortKey) && (author1->displayName() == displayName)) { break; } } if (it != myCollection.end()) { (*it).second.push_back(description); } else { Books books; books.push_back(description); myCollection.insert(std::pair<AuthorPtr,Books>(author, books)); myAuthors.push_back(author); } }
const std::vector<std::string> &SeriesTitleEntry::values() const { myValues.clear(); std::set<std::string> valuesSet; valuesSet.insert(initialValue()); valuesSet.insert(""); if (!myOriginalAuthor.isNull()) { myInfoDialog.myCollection.collectSeriesNames(myOriginalAuthor, valuesSet); } AuthorPtr currentAuthor = myInfoDialog.myAuthorDisplayNameEntry->myCurrentAuthor; if (!currentAuthor.isNull() && (currentAuthor != myOriginalAuthor)) { myInfoDialog.myCollection.collectSeriesNames(currentAuthor, valuesSet); } for (std::set<std::string>::const_iterator it = valuesSet.begin(); it != valuesSet.end(); ++it) { myValues.push_back(*it); } return myValues; }
const std::string &AuthorSortKeyEntry::initialValue() const { AuthorPtr currentAuthor = myInfoDialog.myAuthorDisplayNameEntry->myCurrentAuthor; return currentAuthor.isNull() ? myInfoDialog.myBookInfo.AuthorSortKeyOption.value() : currentAuthor->sortKey(); }