void removeItemAt(int idx) { if((idx < 0) || (idx >= dequeueSize())) return; item* pItem = getItemAt(idx); item* pBefore = NULL; if(pItem != first) pBefore = getPrevItem(pItem); item* pAfter = NULL; if(pItem != last) pAfter = getNextItem(pItem); if((pBefore != NULL) || (pAfter != NULL)){ pBefore->next = pAfter; pAfter->prev = pBefore; }else if(pBefore == NULL){ first = getNextItem(first); first->prev = NULL; }else if(pAfter == NULL){ last = getPrevItem(last); last->next = NULL; } free(pItem); pItem = NULL; };
void TSeq::next(TBaseTiming *ended_element) { childEnded(ended_element); if (!shuffle) { if (canGetNextItem()) // cause .end() pointing to the imaginary item after the last item in the list { active_element = getNextItem(); reactByTag(); } else // end check if repeat value is indefined or Limnit not reached handlePossibleRepeat(); } else { if (MyShuffle->canGetNextItem()) { active_element = MyShuffle->getNextItem(); reactByTag(); } else handlePossibleRepeat(); } return; }
//called to get first/next item during slow sync. SyncItem* WebOsCalendarSyncSource::getFirstItem() { LOG.info("=========== GET FIRST ITEM CALLED =================="); return getNextItem(); // //Get some items form JS. // getMoreItems(); // if(mEvents.empty()) // { // //no Items received => there are no items!? // LOG.info("No items."); // return NULL; // } // else // { // //take first event and convert into item of correct type. // std::pair<std::string,std::string>& e = mEvents.front(); // SyncItem* item = new SyncItem(); // item->setDataType(this->getConfig().getType()); // item->setData(e.second.c_str(),e.second.length()); // item->setKey(e.first.c_str()); // mEvents.pop_front(); // return item; // } // return NULL; }
void Playtree::delSelected() { for( Iterator it = m_children.begin(); it != m_children.end(); ) { if( it->isSelected() && !it->isReadonly() ) { playlist_Lock( m_pPlaylist ); playlist_item_t *pItem = playlist_ItemGetById( m_pPlaylist, it->getId() ); if( pItem ) { if( pItem->i_children == -1 ) { playlist_DeleteFromInput( m_pPlaylist, pItem->p_input, pl_Locked ); } else { playlist_NodeDelete( m_pPlaylist, pItem, true, false ); } } playlist_Unlock( m_pPlaylist ); it = it->getNextSiblingOrUncle(); } else { it = getNextItem( it ); } } }
VarTree::Iterator VarTree::getNextLeaf( Iterator it ) { do { it = getNextItem( it ); } while( it != root()->m_children.end() && it->size() ); return it; }
void Showplan::updateNextTrack() { mLock.lock(); if (getSize() == 0) { conf->setParam("next_on_showplan",""); mLock.unlock(); return; } DpsShowItem x; if ( ! mIsItemActive ) { x = getFirstItem(); } else { try { x = getNextItem(getItemByHash(mActive)); } catch (DpsShowPlan::Error&) { mLock.unlock(); return; } } try { while (1) { if ( x.hasAudio() ) { conf->setParam("next_on_showplan", x.getAudioItem()["md5"]); break; } if (x == getLastItem()) { break; } x = getNextItem(x); } } catch (DpsShowPlan::Error&) { } mLock.unlock(); }
void initGame(Uint32 speed){ setSpeed(speed); gameStatus = GAME_Start; score = 0; clearedLines = 0; srand(time(NULL)); fallItem = getLegalItem(); getNextItem(); memset(map, 0, sizeof(map)); memset(mapColor, 0, sizeof(mapColor)); }
void TSeq::play() { if (dom_list.size() > 0) { if (!shuffle) { iterator = dom_list.begin(); active_element = getNextItem(); } else { active_element = MyShuffle->getNextItem(); } reactByTag(); } status = _playing; return; }
// find an object in the list HTREEITEM SimTreeView::findItem( SimObject * obj ) { // get the root HTREEITEM hRoot = TreeView_GetRoot( treeList.getHandle() ); if( !hRoot ) return( NULL ); while( hRoot ) { // do check SimObject * pObj = getObject( hRoot ); if( pObj == obj ) return( hRoot ); hRoot = getNextItem( hRoot ); } return( NULL ); }
void Playtree::onUpdateCurrent( bool b_active ) { if( b_active ) { playlist_Lock( m_pPlaylist ); playlist_item_t* current = playlist_CurrentPlayingItem( m_pPlaylist ); if( !current ) { playlist_Unlock( m_pPlaylist ); return; } Iterator it = findById( current->i_id ); if( it != m_children.end() ) { it->setPlaying( true ); tree_update descr( tree_update::ItemUpdated, IteratorVisible( it, this ) ); notify( &descr ); } playlist_Unlock( m_pPlaylist ); } else { for( Iterator it = m_children.begin(); it != m_children.end(); it = getNextItem( it ) ) { if( it->isPlaying() ) { it->setPlaying( false ); tree_update descr( tree_update::ItemUpdated, IteratorVisible( it, this ) ); notify( &descr ); break; } } } }
void CLBuiltInType::analysisFromStatement(string & v_statement) { string type; getNextItem(v_statement,type,true); while((type.find("const",0)!=string::npos)||(type.find("static",0)!=string::npos)||(type.find("*",0)!=string::npos)||(type.find("unsigned",0)!=string::npos)||(type.find("signed",0)!=string::npos)) { getNextItem(v_statement,type,false); } if(type == "int"||type == "float"||type == "uin32_t") { this->m_type_len = 4; } else if(type == "short"||type == "uint16_t") { this->m_type_len = 2; } else if(type == "char"||type == "uint8_t") { this->m_type_len = 1; } else if(type == "long"||type == "double") { this->m_type_len = 8; } else { throw std::runtime_error("CLBasic:bad type"); } getNextItem(v_statement,type,false); if(type == "*") { this->m_isPtr = true; getNextItem(v_statement,type,false); } this->m_var_name = type; getNextItem(v_statement,type,false); if(type.find("[")!=string::npos) { this->m_isArray = true; getNextItem(v_statement,type,false); this->m_arraySize = atoi(type.c_str()); } }
void Showplan::onMessage() { const char* routine = "Showplan::onMessage"; L_INFO(LOG_DB,"Showplan received message"); mLock.lock(); if (conf->getParam("next_on_showplan") == "" && getSize() > 0 && getLastItem().getHash() != mActive) { L_INFO(LOG_DB,"Processing track load event"); if (!mIsItemActive) { mActive = getFirstItem().getHash(); } else { getItemByHash(mActive).setState(DpsShowItem::Finished); try { mActive = getNextItem(getItemByHash(mActive)).getHash(); } catch (int e) { cout << "Caught exception - no next item." << endl; } // while we have a script selected... // while (activePoint->getType() == 1 // && activePoint != lstShowPlan->lastItem()) { // activePoint = (ShowPlanItem*)activePoint->nextSibling(); // } } getItemByHash(mActive).setState(DpsShowItem::Loaded); mIsItemActive = true; //?? lstShowPlan->ensureItemVisible(lstShowPlan->selectedItem()); //if (lstShowPlan->selectedItem()) { // selectionChanged(lstShowPlan->selectedItem()); //} mLock.unlock(); showplanUpdated(); } else { mLock.unlock(); } L_INFO(LOG_DB,"Finished Showplan onMessage"); }
item* getItemAt(int idx) { int size = dequeueSize(); if((idx >= size) || (idx < 0)) return NULL; item* pItem = NULL; if(idx+1 <= size/2){ pItem = first; int cnt = 0; for(cnt = 0; (cnt != idx) && (cnt < size); ++cnt) pItem = getNextItem(pItem); }else{ pItem = last; int cnt = size-1; for(cnt = size-1; (cnt != idx) && (cnt >= 0); --cnt){ pItem = getPrevItem(pItem); } } return pItem; };
/** * Return the first SyncItem of all. * It is used in case of slow sync and retrieve the entire * data source content. */ SyncItem* CacheSyncSource::getFirstItem() { allKeys = getAllItemList(); return getNextItem(); };
SyncItem* LOSyncSource::getFirstItem() { return getNextItem(); }
PlayItem * playlist_next(fsl_player_handle handle, options* opt) { fsl_player* pplayer = NULL; pplayer = (fsl_player*)handle; fsl_player_drm_format drm_format; PlayItem * current = opt->current; PlayItem * next = getNextItem(current); switch( opt->repeat ) { case FSL_PLAYER_REPEAT_NONE: { if( next ) { opt->current = next; printf("%s\n", opt->current->name); pplayer->klass->stop(pplayer); pplayer->klass->set_media_location(pplayer, opt->current->name, &drm_format); pplayer->klass->play(pplayer); } else { //gcore_register_callback(gcore, NULL, NULL,0); // if not repeated mode or no next item, exit. //printf("%s(): No more multimedia files, exit.\n", __FUNCTION__); //player_exit(pplayer); } break; } case FSL_PLAYER_REPEAT_PLAYLIST: { if( next ) { opt->current = next; printf("%s\n", opt->current->name); pplayer->klass->stop(pplayer); pplayer->klass->set_media_location(pplayer, opt->current->name, &drm_format); pplayer->klass->play(pplayer); } else { if (opt->play_times>0){ opt->play_times--; if (opt->play_times==0) break; } next = getFirstItem(opt->pl); opt->current = next; pplayer->klass->stop(pplayer); pplayer->klass->set_media_location(pplayer, opt->current->name, &drm_format); pplayer->klass->play(pplayer); } break; } case FSL_PLAYER_REPEAT_CURRENT: { next = opt->current; pplayer->klass->stop(pplayer); pplayer->klass->set_media_location(pplayer, opt->current->name, &drm_format); pplayer->klass->play(pplayer); break; } default: { break; } } return next; }
void nextToFall(){ do{ fallItem = getLegalItem(); }while (fallItem.id != nextItem.id); getNextItem(); }