本文整理汇总了C++中Playlist::CountItems方法的典型用法代码示例。如果您正苦于以下问题:C++ Playlist::CountItems方法的具体用法?C++ Playlist::CountItems怎么用?C++ Playlist::CountItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Playlist
的用法示例。
在下文中一共展示了Playlist::CountItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CountItems
void
Playlist::AppendRefs(const BMessage* refsReceivedMessage, int32 appendIndex)
{
// the playlist is replaced by the refs in the message
// or the refs are appended at the appendIndex
// in the existing playlist
if (appendIndex == APPEND_INDEX_APPEND_LAST)
appendIndex = CountItems();
bool add = appendIndex != APPEND_INDEX_REPLACE_PLAYLIST;
if (!add)
MakeEmpty();
bool startPlaying = CountItems() == 0;
Playlist temporaryPlaylist;
Playlist* playlist = add ? &temporaryPlaylist : this;
bool sortPlaylist = true;
entry_ref ref;
int32 subAppendIndex = CountItems();
for (int i = 0; refsReceivedMessage->FindRef("refs", i, &ref) == B_OK;
i++) {
Playlist subPlaylist;
if (_IsPlaylist(_MIMEString(&ref))) {
AppendPlaylistToPlaylist(ref, &subPlaylist);
// Do not sort the whole playlist anymore, as that
// will screw up the ordering in the saved playlist.
sortPlaylist = false;
} else {
AppendToPlaylistRecursive(ref, &subPlaylist);
// At least sort this subsection of the playlist
// if the whole playlist is not sorted anymore.
if (!sortPlaylist)
subPlaylist.Sort();
}
int32 subPlaylistCount = subPlaylist.CountItems();
AdoptPlaylist(subPlaylist, subAppendIndex);
subAppendIndex += subPlaylistCount;
}
if (sortPlaylist)
playlist->Sort();
if (add)
AdoptPlaylist(temporaryPlaylist, appendIndex);
if (startPlaying) {
// open first file
SetCurrentItemIndex(0);
}
}
示例2: ItemAtFast
bool
Playlist::AdoptPlaylist(Playlist& other, int32 index)
{
if (&other == this)
return false;
// NOTE: this is not intended to merge two "equal" playlists
// the given playlist is assumed to be a temporary "dummy"
if (fItems.AddList(&other.fItems, index)) {
// take care of the notifications
int32 count = other.CountItems();
for (int32 i = index; i < index + count; i++) {
PlaylistItem* item = ItemAtFast(i);
_NotifyItemAdded(item, i);
}
if (index <= fCurrentIndex)
SetCurrentItemIndex(fCurrentIndex + count);
// empty the other list, so that the PlaylistItems are now ours
other.fItems.MakeEmpty();
return true;
}
return false;
}