本文整理汇总了C++中Book::getNPages方法的典型用法代码示例。如果您正苦于以下问题:C++ Book::getNPages方法的具体用法?C++ Book::getNPages怎么用?C++ Book::getNPages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Book
的用法示例。
在下文中一共展示了Book::getNPages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateItemInfo
void SELMainLibraryWidget::updateItemInfo(EntertainmentItem & item,
unsigned long long type)
{
Book * bookItem = 0;
Movie * movieItem = 0;
MusicAlbum * musicItem = 0;
Videogame * videogameItem = 0;
int currentIndex = 4;
unsigned size;
/// Update title
replaceLabelText(item.getTitle().c_str(), 0);
/// Update genre
replaceLabelText(item.getGenre().c_str(), 1);
/// Update publisher
replaceLabelText(item.getPublisher().c_str(), 2);
/// Update year
replaceLabelText(QString::number(item.getYear()), 3);
/// Check type to write extra data.
switch (type) {
case 1:
bookItem = dynamic_cast<Book *>(&item);
if (bookItem != 0) {
/// Write book data
replaceLabelText("ISBN:", currentIndex++);
replaceLabelText(bookItem->getIsbn().c_str(), currentIndex++);
replaceLabelText("Authors:", currentIndex++);
size = bookItem->getAuthors().size();
for (unsigned i = 0; i < size; i++) {
replaceLabelText(bookItem->getAuthors()[i].c_str(), currentIndex++);
}
replaceLabelText("Num pages", currentIndex++);
replaceLabelText(QString::number(bookItem->getNPages()), currentIndex++);
}
break;
case 2:
movieItem = dynamic_cast<Movie *>(&item);
if (movieItem != 0) {
/// Write movie data
replaceLabelText("Director:", currentIndex++);
replaceLabelText(movieItem->getDirector().c_str(), currentIndex++);
replaceLabelText("Actors:", currentIndex++);
size = movieItem->getMainActors().size();
for (unsigned i = 0; i < size; i++) {
replaceLabelText(movieItem->getMainActors()[i].c_str(), currentIndex++);
}
replaceLabelText("Rating:", currentIndex++);
replaceLabelText(Movie::getRatingString(movieItem->getRating()).c_str(), currentIndex++);
}
break;
case 3:
musicItem = dynamic_cast<MusicAlbum *>(&item);
if (musicItem != 0) {
/// Write music data
replaceLabelText("Artist:", currentIndex++);
replaceLabelText(musicItem->getArtist().c_str(), currentIndex++);
replaceLabelText("Num tracks:", currentIndex++);
replaceLabelText(QString::number(musicItem->getNTracks()), currentIndex++);
replaceLabelText("Total duration:", currentIndex++);
replaceLabelText(musicItem->getDuration().toString("hh:mm:ss"), currentIndex++);
}
break;
case 4:
videogameItem = dynamic_cast<Videogame *>(&item);
if (videogameItem != 0) {
replaceLabelText("Rating:", currentIndex++);
replaceLabelText(Videogame::getRatingString(videogameItem->getEsrbRating()).c_str(), currentIndex++);
replaceLabelText("Platform:", currentIndex++);
replaceLabelText(Videogame::getPlatformString(videogameItem->getPlatform()).c_str(), currentIndex++);
}
break;
default:
Error::raiseError(Error::ERROR_UNKNOWN_ITEM_TYPE);
break;
}
size = itemInfo.size();
while (currentIndex < (int)size) {
itemInfo[currentIndex++]->setText("");
}
}