Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
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);
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
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);
}
Ejemplo n.º 5
0
bool Playlist::previousVideo()
{
    if (!hasPrevious())
        return false;

    playRow--;
    emit playVideo(videoPathAt(playRow));
    emit nextVideoStatusChange(hasNext());
    emit previousVideoStatusChange(hasPrevious());
    emit dataChanged(firstIndex, lastIndex);
    return true;
}
Ejemplo n.º 6
0
  /*!
  * 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();
    }
  }
Ejemplo n.º 7
0
 /*! Returns current cell.
 */
 Cell *CellCursor::currentCell()
 {
   if(!hasPrevious()) //First in group.
     return parentCell(); //Will always work.
   else
     return previous();
 }
Ejemplo n.º 8
0
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();
}
Ejemplo n.º 9
0
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();
}
Ejemplo n.º 10
0
/*!
  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));;
}
Ejemplo n.º 13
0
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;
}
Ejemplo n.º 14
0
  // 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;
  }
Ejemplo n.º 15
0
  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();
  }
Ejemplo n.º 16
0
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;
}
Ejemplo n.º 17
0
  /*! \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();
  }
Ejemplo n.º 18
0
bool EdgeArray::hasPrevious() {
	return hasPrevious(this->edgeIterator);
}
Ejemplo n.º 19
0
bool VertexList::hasPrevious(IteratorId const iteratorId,
		Visibility const visibility) {
	return hasPrevious(iteratorMap.at(iteratorId), visibility);
}
Ejemplo n.º 20
0
bool VertexList::hasPrevious(Visibility const visibility) {
	return hasPrevious(this->vertexIterator, visibility);
}
Ejemplo n.º 21
0
bool VertexList::hasPrevious(IteratorId const iteratorId) {
	return hasPrevious(iteratorMap.at(iteratorId));
}
Ejemplo n.º 22
0
bool VertexList::hasPrevious() {
	return hasPrevious(this->vertexIterator);
}
Ejemplo n.º 23
0
bool EdgeArray::hasPrevious(IteratorId const iteratorId) {
	return hasPrevious(iteratorMap.at(iteratorId));
}
Ejemplo n.º 24
0
bool EdgeArray::hasPrevious(Visibility const visibility) {
	return hasPrevious(this->edgeIterator, visibility);
}
Ejemplo n.º 25
0
bool EdgeArray::hasPrevious(Connectivity const connectivity,
		Visibility const visibility) {
	return hasPrevious(this->edgeIterator, connectivity, visibility);
}
Ejemplo n.º 26
0
bool EdgeArray::hasPrevious(IteratorId const iteratorId,
		Connectivity const connectivity, Visibility const visibility) {
	return hasPrevious(iteratorMap.at(iteratorId), connectivity, visibility);
}