本文整理汇总了C++中previous函数的典型用法代码示例。如果您正苦于以下问题:C++ previous函数的具体用法?C++ previous怎么用?C++ previous使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了previous函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
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);
}
示例2: current
void networkDialog::refreshButtonClicked(void) {
QString a=ui->serversComboBox->currentText();
QHostAddress current(a);
QHostAddress previous(gpib->getServerAddress());
gpib->setServerAddress(current);
gpib->serverGetStatus();
gpib->serverGetInterval();
gpib->setServerAddress(previous);
}
示例3: peekNext
T& peekNext(unsigned int jump = 0) {
jump++;
for (unsigned int ij = 1; ij < jump; ij++)
next();
T& t = next();
for (unsigned int ij = 0; ij < jump; ij++)
previous();
return t;
}
示例4: moved
// 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;
}
示例5: add_package
void add_package(package_t* package)
{
variable_t* evar;
variable_t* vvar;
list_node* enode;
list_node* vnode;
list_node* rnode;
group_t* group;
char* name;
int got_one;
char* text;
if (package->requires)
{
DEBUG(stderr, "(pre-using required packages list)\n");
for (rnode=list_tail(package->requires) ; rnode ; rnode=previous(rnode))
{
name = (char*) get_value(rnode);
if (group = get_group(name))
use_group(group);
else
use_package(name);
}
}
for (vnode = head(package->variables) ; vnode ; vnode = next(vnode))
{
vvar = get_value(vnode);
got_one = 0;
for (enode = head(the_environment) ; enode ; enode = next(enode))
{
evar = get_value(enode);
if (!strcmp(vvar->name, evar->name))
{
remove_node(the_environment, enode, 0);
add_to_tail(the_environment, update_var(evar, vvar));
got_one = 1;
break;
}
}
if (!got_one)
{
enode = get_into_env(vvar);
evar = get_value(enode);
set_value(enode, update_var(evar, vvar));
}
}
for (vnode = head(package->scripts) ; vnode ; vnode = next(vnode))
{
text = ((script_t*) get_value(vnode))->text;
add_to_tail(the_scripts, (void*) text);
}
}
示例6: Q_D
//! returns the previous boundary from given index, including the index in the search.
//! If index is a boundary, it is returned and current is decreased by one,
//! otherwise works as previous()
int MIcuBreakIterator::previousInclusive(int index)
{
Q_D(MIcuBreakIterator);
if (isBoundary(index)) {
d->current = index - 1;
return index;
} else {
return previous(index);
}
}
示例7: previous
/**
* Removes the Object last returned by the next() or previous() methods;
* @return the removed Object pointer
**/
void* txListIterator::remove() {
void* obj = 0;
if (currentItem) {
obj = currentItem->objPtr;
txList::ListItem* item = currentItem;
previous(); //-- make previous item the current item
list->remove(item);
delete item;
}
return obj;
} //-- remove
示例8: next
void InterlinearChunkEditor::keyReleaseEvent(QKeyEvent *event)
{
if( event->key() == Qt::Key_PageDown )
{
next();
} else if ( event->key() == Qt::Key_PageUp )
{
previous();
}
QWidget::keyReleaseEvent(event);
}
示例9: QWidget
AddressBook::AddressBook(QWidget *parent)
: QWidget(parent)
{
QLabel *nameLabel = new QLabel(tr("Name:"));
nameLine = new QLineEdit;
nameLine->setReadOnly(true);
QLabel *addressLabel = new QLabel(tr("Address:"));
addressText = new QTextEdit;
addressText->setReadOnly(true);
addButton = new QPushButton(tr("&Add"));
addButton->show();
submitButton = new QPushButton(tr("&Submit"));
submitButton->hide();
cancelButton = new QPushButton(tr("&Cancel"));
cancelButton->hide();
//! [navigation pushbuttons]
nextButton = new QPushButton(tr("&Next"));
nextButton->setEnabled(false);
previousButton = new QPushButton(tr("&Previous"));
previousButton->setEnabled(false);
//! [navigation pushbuttons]
connect(addButton, SIGNAL(clicked()), this, SLOT(addContact()));
connect(submitButton, SIGNAL(clicked()), this, SLOT(submitContact()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
//! [connecting navigation signals]
connect(nextButton, SIGNAL(clicked()), this, SLOT(next()));
connect(previousButton, SIGNAL(clicked()), this, SLOT(previous()));
//! [connecting navigation signals]
QVBoxLayout *buttonLayout1 = new QVBoxLayout;
buttonLayout1->addWidget(addButton, Qt::AlignTop);
buttonLayout1->addWidget(submitButton);
buttonLayout1->addWidget(cancelButton);
buttonLayout1->addStretch();
//! [navigation layout]
QHBoxLayout *buttonLayout2 = new QHBoxLayout;
buttonLayout2->addWidget(previousButton);
buttonLayout2->addWidget(nextButton);
//! [ navigation layout]
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addWidget(nameLabel, 0, 0);
mainLayout->addWidget(nameLine, 0, 1);
mainLayout->addWidget(addressLabel, 1, 0, Qt::AlignTop);
mainLayout->addWidget(addressText, 1, 1);
mainLayout->addLayout(buttonLayout1, 1, 2);
//! [adding navigation layout]
mainLayout->addLayout(buttonLayout2, 3, 1);
//! [adding navigation layout]
setLayout(mainLayout);
setWindowTitle(tr("Simple Address Book"));
}
示例10: previous
void OutfitWindow::wearPreviousOutfit(const bool all)
{
previous();
if (!all && mCurrentOutfit >= 0 && mCurrentOutfit
< static_cast<int>(OUTFITS_COUNT))
{
bool fromStart = false;
while (!mItemsUnequip[mCurrentOutfit])
{
previous();
if (mCurrentOutfit == 0)
{
if (!fromStart)
fromStart = true;
else
return;
}
}
}
wearOutfit(mCurrentOutfit);
}
示例11: current
/**
* Advances the iterator either forward or backward the specified number of steps.
* Negative values move backward, and positive values move forward. This is
* equivalent to repeatedly calling next() or previous().
* @param n The number of steps to move. The sign indicates the direction
* (negative is backwards, and positive is forwards).
* @return The character offset of the boundary position n boundaries away from
* the current one.
*/
int32_t BreakIterator::next(int32_t n) {
int32_t result = current();
while (n > 0) {
result = next();
--n;
}
while (n < 0) {
result = previous();
++n;
}
return result;
}
示例12: parentCell
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();
}
示例13: qDebug
void MusicWidget::setupSensors()
{
QSensorGestureManager manager;
QStringList gestureIds = manager.gestureIds();
qDebug() << gestureIds;
if(gestureIds.contains("QtSensors.shake2"))
{
qDebug() << "setup shake 2 sensor";
m_shakeGesture = new QSensorGesture(
QStringList() << "QtSensors.shake2"
, this);
connect(m_shakeGesture, SIGNAL(shakeUp()),
m_playlist, SLOT(previous()));
connect(m_shakeGesture, SIGNAL(shakeDown()),
m_playlist, SLOT(next()));
connect(m_shakeGesture, SIGNAL(shakeLeft()),
m_playlist, SLOT(previous()));
connect(m_shakeGesture, SIGNAL(shakeRight()),
m_playlist, SLOT(next()));
}
else if(gestureIds.contains("QtSensors.shake"))
{
qDebug() << "setup shake sensor";
m_shakeGesture = new QSensorGesture(
QStringList() << "QtSensors.shake"
, this);
connect(m_shakeGesture, SIGNAL(shake()),
m_playlist, SLOT(next()));
}
if(gestureIds.contains("QtSensors.turnover"))
{
m_turnoverGesture = new QSensorGesture(
QStringList("QtSensors.turnover")
,this
);
connect(m_turnoverGesture, SIGNAL(turnover()),
this, SLOT(onTurnover()));
}
}
示例14: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
m_areaMode( Default ),
m_extractor(new VideoExtractor() ),
m_isHandleActived(true),
m_isPlay(false),
m_subImage(nullptr),
m_subImageSource1(nullptr),
m_subImageSource2(nullptr),
m_subResults(nullptr),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->mdiArea->setMainWindow(this);
connect(ui->actionQuitter, SIGNAL(triggered()), qApp, SLOT( quit() ) );
connect(ui->buttonPrevious, SIGNAL(clicked()), m_extractor, SLOT(previous()));
connect(ui->buttonNext, SIGNAL(clicked()), m_extractor, SLOT(next()));
ui->mdiAreaMode->addItem("Default", Default);
ui->mdiAreaMode->addItem("Tabulation", Tabulation);
ui->mdiAreaMode->addItem("Libre", Free);
int max = 1<<(sizeof(int)*8-2) ;
m_extractor->changeHandleParameters( new ComboBox("Traitement", VirtualHandle::getAllHandleName(),
MainHandle),
ui->parametersArea );
m_extractor->changePeriodeParameters( new Slider("Time", 200000000, 0, max) ,
ui->parametersArea );
/* obligatoire, à n'appeler qu'une unique fois et dans une fonction /!\ */
qRegisterMetaType<ImageDataPtr>("ImageDataPtr");
connect( m_extractor, SIGNAL(imageHandled(ImageDataPtr,ImageDataPtr,ImageDataPtr) ),
this, SLOT(setImage(ImageDataPtr,ImageDataPtr,ImageDataPtr) ) );
connect( m_extractor, SIGNAL(streamFinished()), this, SLOT(playPause()));
VideoReader * cam1 = new VideoReader();
cam1->useCamera(); //or FolderReader * cam1 = new FolderReader("img/");
m_extractor->useSource(cam1, 0);
m_extractor->showParameters( ui->parametersArea );
ui->mdiAreaMode->setCurrentIndex( ui->mdiAreaMode->findData(m_areaMode) );
VirtualHandle::setView(ui->mdiArea);
ui->sliderCurseur->setTracking(true);
m_extractor->start();
updateSeek();
}
示例15: Q_UNUSED
void EPGRuler::paintEvent( QPaintEvent *event )
{
Q_UNUSED( event );
const QSize margin( 0, contentsMargins().top() );
const QSize header( 0, maximumHeight() - contentsMargins().top() );
const int spacing = m_scale * 3600;
QPainter p( this );
QDateTime localStartTime;
localStartTime = m_startTime.addSecs( m_offset / m_scale );
QDateTime diff( localStartTime );
diff.setTime( QTime( localStartTime.time().hour(), 0, 0, 0 ) );
int secondsToHour = localStartTime.secsTo( diff );
/* draw hour blocks, with right bound being hourmark */
QPoint here( secondsToHour * m_scale, margin.height() );
QPoint previous( -1, 0 );
QDateTime current( localStartTime.addSecs( secondsToHour ) );
current = current.addSecs( -3600 );
QColor fillColor;
while ( here.rx() < width() + spacing )
{
QRect area( QPoint( previous.x() + 1, margin.height() ), here );
area.adjust( 0, 0, 0, header.height() );
QString timeString = current.toString( "hh'h'" );
/* Show Day */
if ( current.time().hour() == 0 )
timeString += current.date().toString( " ddd dd" );
if ( m_startTime.date().daysTo( current.date() ) % 2 == 0 )
fillColor = palette().color( QPalette::Window );
else
fillColor = palette().color( QPalette::Dark );
p.fillRect( area, fillColor );
p.drawLine( area.topRight(), area.bottomRight() );
p.drawText( area, Qt::AlignLeft, timeString );
previous = here;
here.rx() += spacing;
current = current.addSecs( 3600 );
}
/* draw current time line */
here.rx() = localStartTime.secsTo( QDateTime::currentDateTime() ) * m_scale;
if ( here.x() <= width() && here.x() >= 0 )
{
p.setPen( QPen( QColor( 255, 0 , 0, 128 ) ) );
p.drawLine( here, QPoint( here.x(), here.y() + header.height() ) );
}
}