void CPlayCenter::Play() { if(m_spPlayList.size()<=0) return ; auto it = m_spPlayList.begin(); if(m_iCurPlayingListIndex<=0) m_iCurPlayingListIndex = it->second.GetLocalId(); it = m_spPlayList.find(m_iCurPlayingListIndex); if(it==m_spPlayList.end()) return ; auto itSong = m_spSongListMap.find(it->second.GetLocalId()); if(itSong==m_spSongListMap.end()) return ; if(itSong->second.size()<=0) return ; if(m_iCurPlayingSongIndex<=0) { auto itSongIndex = itSong->second.begin(); m_iCurPlayingSongIndex = itSongIndex->GetLocalId(); } CString path = GetPathBySongLocalId(itSong->second,m_iCurPlayingSongIndex); if (!path.IsEmpty()) { this->PlayThis(path); spSongInfoT song = GetCurrentPlayingSong(); song->SetPlayCount(song->GetPlayCount()+1); theDbMgr->GetUserDB()->UpdatePlayListSongInfo(song,GetListIndex()); } }
void* CTilePool<_TLock, _TAllocator>::Alloc(unsigned long uSize) { #ifndef USE_TILE_MANAGE return malloc(uSize); #endif unsigned long uIdx = GetListIndex(uSize); if(0xFFFFFFFF == uIdx) RETURN_THROW(NULL); tagTileManageInfo &TileManageInfo = m_arrMemList[uIdx]; if(0 == TileManageInfo.FreeList.GetNodeNum()) { if(!AddNewTile(TileManageInfo, GetDefaultAddCount(uIdx))) RETURN_THROW(NULL); } CListNode<unsigned char> *pFreeNode = TileManageInfo.FreeList.PopNode(); MM_ASSERY(NULL != pFreeNode); //! 已使用块数 TileManageInfo.InfoLock.Lock(); ++TileManageInfo.uUseCount; TileManageInfo.InfoLock.UnLock(); unsigned char cInfo = (unsigned char)TileManageInfo.uIndex; pFreeNode->SetInfo(cInfo); return pFreeNode->GetReBuf(); }
Object* ObjectListInterface::GetListFirst(const Object *startFrom, const std::type_info *elementType) { ListOfObjects::iterator it = m_list.begin(); std::advance(it, GetListIndex(startFrom)); it = std::find_if(it, m_list.end(), ObjectComparison( elementType ) ); return (it == m_list.end()) ? NULL : *it; }
Object* ObjectListInterface::GetListFirstBackward(Object *startFrom, const std::type_info *elementType) { ListOfObjects::iterator it = m_list.begin(); std::advance(it, GetListIndex(startFrom)); ListOfObjects::reverse_iterator rit(it); rit = std::find_if(rit, m_list.rend(), ObjectComparison( elementType ) ); return (rit == m_list.rend()) ? NULL : *rit; }
int sList::InsertString(char * string){ int id=GetListIndex(); SendMessage(hCombo, LB_DELETESTRING , id, (long) string); SendMessage(hCombo, LB_INSERTSTRING , id, (long) string); return 0; }
bool CTilePool<_TLock, _TAllocator>::InitForSize(unsigned long uSize, unsigned long uProvideCount) { unsigned long uIdx = GetListIndex(uSize); if(0xFFFFFFFF == uIdx || 0 == uProvideCount) RETURN_THROW(false); tagTileManageInfo &TileManageInfo = m_arrMemList[uIdx]; //! 一次分配的块数不能超过0xFFFF uProvideCount = (0xFFFF < uProvideCount) ? 0xFFFF : uProvideCount; //! 数量对齐 uProvideCount = SNAP_TO_GRID(uProvideCount, GetDefaultAddCount(uIdx)); AddNewTile(TileManageInfo, uProvideCount); return true; }