bool EdgeArray::hasPrevious(std::vector<EdgeIF*>::const_iterator & iterator, Connectivity const connectivity) { while (hasPrevious(iterator) && (connectivity != Connectivity::BOTH && !current(iterator)->isInState(connectivity))) { previous(iterator); } return hasPrevious(iterator); }
bool VertexList::hasPrevious(std::list<VertexIF*>::const_iterator & iterator, Visibility const visibility) { while (hasPrevious(iterator) && (visibility != Visibility::BOTH && current(iterator)->getVisibility() != visibility)) { previous(iterator); } return hasPrevious(iterator); }
bool EdgeArray::hasPrevious(std::vector<EdgeIF*>::const_iterator & iterator, Visibility const visibility) { while (hasPrevious(iterator) && (visibility != Visibility::BOTH && current(iterator)->getVisibility() != visibility)) { previous(iterator); } return hasPrevious(iterator); }
bool EdgeArray::hasPrevious(std::vector<EdgeIF*>::const_iterator & iterator, Connectivity const connectivity, Visibility const visibility) { while (hasPrevious(iterator) && (((connectivity != Connectivity::BOTH && !current(iterator)->isInState(connectivity))) || (visibility != Visibility::BOTH && current(iterator)->getVisibility() != visibility))) { previous(iterator); } return hasPrevious(iterator); }
bool Playlist::previousVideo() { if (!hasPrevious()) return false; playRow--; emit playVideo(videoPathAt(playRow)); emit nextVideoStatusChange(hasNext()); emit previousVideoStatusChange(hasPrevious()); emit dataChanged(firstIndex, lastIndex); return true; }
/*! * Removes a cell and all its subcells from the tree. * * This should work for all cells. But it will leave an empty * cellgroup if last cell is deleted in cellgroup. * * This does not delete the cell, it just removes the cell from the * celltree. */ void CellCursor::removeCurrentCell() { if(hasPrevious()) //If cursor has previous { // 2006-04-27 AF, cursorIsMoved(); Cell *current = previous(); removeFromCurrentPosition(); if(current->hasPrevious()) current->previous()->setNext(this); else parentCell()->setChild(this); setPrevious(current->previous()); current->setParentCell(0); current->setPrevious(0); current->setNext(0); current->setChild(0); current->setLast(0); current->hide(); parentCell()->addCellWidgets(); } }
/*! Returns current cell. */ Cell *CellCursor::currentCell() { if(!hasPrevious()) //First in group. return parentCell(); //Will always work. else return previous(); }
EdgeIF * EdgeArray::peek(std::vector<EdgeIF*>::const_iterator & iterator, int moveIndex) throw (LogicExceptions::EmptyIteratorException) { EdgeIF* item { }; std::vector<EdgeIF*>::const_iterator tmpIterator = iterator; if (this->numberOfEdges > 0) { if (iterator == this->edgeIteratorEnd) { iterator = std::prev(iterator); } if (moveIndex > 0) { for (; moveIndex > 0; moveIndex -= 1) { if (std::next(iterator) != this->edgeIteratorEnd) { iterator++; } } } else { for (; moveIndex < 0; moveIndex += 1) { if (hasPrevious(iterator)) { --iterator; } } } item = *(iterator); iterator = tmpIterator; return item; } throw LogicExceptions::EmptyIteratorException(); }
VertexIF * VertexList::peek(std::list<VertexIF*>::const_iterator & iterator, int moveIndex) throw (LogicExceptions::EmptyIteratorException) { VertexIF* item { }; std::list<VertexIF*>::const_iterator tmpIterator = iterator; if (this->numberOfVertices > 0) { if (iterator == this->vertexIteratorEnd) { iterator = std::prev(iterator); } if (moveIndex > 0) { for (; moveIndex > 0; moveIndex -= 1) { if (std::next(iterator) != this->vertexIteratorEnd) { iterator++; } } } else { for (; moveIndex < 0; moveIndex += 1) { if (hasPrevious(iterator)) { --iterator; } } } item = *(iterator); iterator = tmpIterator; return item; } throw LogicExceptions::EmptyIteratorException(); }
/*! Moves the iterator back by one position. \sa hasPrevious(), next(), name() */ void QScriptValueIterator::previous() { Q_D(QScriptValueIterator); (void)hasPrevious(); d->index = d->nextIndex; d->nextIndex = -1; }
void QScriptValueIteratorImpl::previous() { (void)hasPrevious(); // sync the previous-element info m_object = m_foundObject; m_member = m_foundMember; m_foundObject = QScriptValueImpl(); m_foundMember.invalidate(); }
std::shared_ptr<const OsmAnd::ResolvedMapStyle> OsmAnd::MapStylesCollection_P::getResolvedStyleByName(const QString& name) const { QMutexLocker scopedLocker(&_resolvedStylesLock); const auto styleName = getFullyQualifiedStyleName(name); // Check if such style was already resolved auto& resolvedStyle = _resolvedStyles[styleName]; if (resolvedStyle) return resolvedStyle; // Get style inheritance chain QList< std::shared_ptr<UnresolvedMapStyle> > stylesChain; { QReadLocker scopedLocker(&_stylesLock); auto style = getEditableStyleByName_noSync(name); while (style) { stylesChain.push_back(style); // In case this is root-style, do nothing if (style->isStandalone()) break; // Otherwise, obtain next parent const auto parentStyle = getEditableStyleByName_noSync(style->parentName); if (!parentStyle) { LogPrintf(LogSeverityLevel::Error, "Failed to resolve style '%s': parent-in-chain '%s' was not found", qPrintable(name), qPrintable(style->parentName)); return nullptr; } style = parentStyle; } } // From top-most parent to style, load it auto itStyle = iteratorOf(stylesChain); itStyle.toBack(); while (itStyle.hasPrevious()) { const auto& style = itStyle.previous(); if (!style->load()) { LogPrintf(LogSeverityLevel::Error, "Failed to resolve style '%s': parent-in-chain '%s' failed to load", qPrintable(name), qPrintable(style->name)); return nullptr; } } return ResolvedMapStyle::resolveMapStylesChain(copyAs< QList< std::shared_ptr<const UnresolvedMapStyle> > >(stylesChain));; }
bool OsmAnd::ResolvedMapStyle_P::collectConstants() { // Process styles chain in reverse order, top-most parent is the last element auto citUnresolvedMapStyle = iteratorOf(owner->unresolvedMapStylesChain); citUnresolvedMapStyle.toBack(); while (citUnresolvedMapStyle.hasPrevious()) { const auto& unresolvedMapStyle = citUnresolvedMapStyle.previous(); for (const auto& constantEntry : rangeOf(constOf(unresolvedMapStyle->constants))) _constants[constantEntry.key()] = constantEntry.value(); } return true; }
// 2006-08-24 AF, changed so the function returns a boolean value, true if // the cursor is moved. bool CellCursor::moveUp() { // 2006-08-24 AF, bool moved( false ); // 2006-04-27 AF, cursorIsMoved(); if( !hasPrevious() ) { if( parentCell()->hasParentCell() ) { moveBefore( parentCell() ); moved = true; } } else { //previous() exists. if(previous()->hasChilds()) { if(!previous()->isClosed()) { moveToLastChild(previous()); moved = true; } else { moveBefore(previous()); moved = true; } } else { moveBefore(previous()); moved = true; } } emit positionChanged(x(), y(), 5,5); // TMP EMIT emit changedPosition(); return moved; }
void CellCursor::removeFromCurrentPosition() { //remove all widgets from parents layout. Cell *par = parentCell(); par->removeCellWidgets(); if(parentCell()->child() == this) parentCell()->setChild(next()); if(parentCell()->last() == this) parentCell()->setLast(previous()); if(hasNext()) next()->setPrevious(previous()); if(hasPrevious()) previous()->setNext(next()); //Insert all widgets again. par->addCellWidgets(); }
bool Playlist::addVideo(const QString &videoPath) { int row = playlistVideos.size(); if (!firstIndex.isValid()) firstIndex = index(0, 0); beginInsertRows(QModelIndex(), row, row); playlistVideos.append(new Video(videoPath)); endInsertRows(); lastIndex = index(rowCount() - 1, 0); if (playRow == -1) { playRow = 0; emit loadVideo(videoPathAt(0)); } emit nextVideoStatusChange(hasNext()); emit previousVideoStatusChange(hasPrevious()); return true; }
/*! \bug Segfault in cellgroups. Probably a parent, child or last. * \bug Deletion of last cell in cellgroup should be taken care of. */ void CellCursor::deleteCurrentCell() { if(hasPrevious()) //If cursor has previous { // 2006-04-27 AF, cursorIsMoved(); //removeCurrentCell(); //OLD CODE //Remove currentCell. Cell *current = previous(); //Save a pointer to the cell being deleted. removeCurrentCell(); // removeFromCurrentPosition(); // if(current->hasPrevious()) // current->previous()->setNext(this); // else // parentCell()->setChild(this); // setPrevious(current->previous()); // current->setParentCell(0); // current->setPrevious(0); // current->setNext(0); // current->setChild(0); // current->setLast(0); //Segfault on delete. delete current; //parentCell()->addCellWidgets(); } // TMP EMIT emit changedPosition(); }
bool EdgeArray::hasPrevious() { return hasPrevious(this->edgeIterator); }
bool VertexList::hasPrevious(IteratorId const iteratorId, Visibility const visibility) { return hasPrevious(iteratorMap.at(iteratorId), visibility); }
bool VertexList::hasPrevious(Visibility const visibility) { return hasPrevious(this->vertexIterator, visibility); }
bool VertexList::hasPrevious(IteratorId const iteratorId) { return hasPrevious(iteratorMap.at(iteratorId)); }
bool VertexList::hasPrevious() { return hasPrevious(this->vertexIterator); }
bool EdgeArray::hasPrevious(IteratorId const iteratorId) { return hasPrevious(iteratorMap.at(iteratorId)); }
bool EdgeArray::hasPrevious(Visibility const visibility) { return hasPrevious(this->edgeIterator, visibility); }
bool EdgeArray::hasPrevious(Connectivity const connectivity, Visibility const visibility) { return hasPrevious(this->edgeIterator, connectivity, visibility); }
bool EdgeArray::hasPrevious(IteratorId const iteratorId, Connectivity const connectivity, Visibility const visibility) { return hasPrevious(iteratorMap.at(iteratorId), connectivity, visibility); }