std::istream& do_manip(std::istream& is) { auto attempt = [this] { return infinite() || retries_ > 0; }; while (attempt()) { if (!infinite()) retries_ -= 1; prompter_(out_); if (reader_(is, value_)) { if (!run_validators(out_)) is.setstate(is.rdstate() | std::ios::failbit); else break; } else { out_.get() << format_error_ << "\n"; } if (attempt()) { if (is.eof()) break; is.clear(); if (flush_on_error_) is.ignore(1024, '\n'); } } return is; }
void infinite( int z, int y, int x = 0 ) { if ( 1 ) { infinite( 5, y - 1, x + 1 ) ; } else infinite( 5, y + 1, x - 1 ) ; }
void iicall( int z, int y, int x = 0 ) { sqlt_fnc_entry( SQLT_CFG, SQLT_cfgReadDcsDirectory ) ; #if 0 mm_sqlt_fnc_entry( SQLT_CFG, SQLT_cfgReadDcsDirectory ) ; if ( 1 ) { infinite( 5, y - 1, x + 1 ) ; } else infinite( 5, y + 1, x - 1 ) ; #endif }
inline void test_adct(double x, double y, double z, double d[3], double& r) { adct::Ad<double,3> a(x,0),b(y,1),c(z,2); auto expr = f(a,b,c); auto derivatives = expr.infinite(); d[0] = derivatives[0];d[1] = derivatives[1];d[2] = derivatives[2]; r = expr.value(); }
void QmitkIGTLoggerWidget::UpdateRecordingTime() { // milliseconds selected in the combobox if (m_Controls->m_cbRecordingType->currentIndex()==0) { m_MilliSeconds = m_Controls->m_leRecordingValue->text(); if(m_MilliSeconds.compare("infinite")==0) { this->SetDefaultRecordingSettings(); } bool success = false; m_MilliSeconds.toInt(&success); if (!success) { QMessageBox::warning(NULL, "Warning", QString("Please enter a number!")); this->SetDefaultRecordingSettings(); return; } } else if(m_Controls->m_cbRecordingType->currentIndex()==1) // #samples selected in the combobox { m_Samples = m_Controls->m_leRecordingValue->text(); if(m_Samples.compare("infinite")==0) { this->SetDefaultRecordingSettings(); } bool success = false; m_Samples.toInt(&success); if (!success) { QMessageBox::warning(NULL, "Warning", QString("Please enter a number!")); this->SetDefaultRecordingSettings(); return; } } else if (m_Controls->m_cbRecordingType->currentIndex()==2)// infinite selected in the combobox { // U+221E unicode symbole for infinite QString infinite("infinite"); m_Controls->m_leRecordingValue->setText(infinite); } // m_Controls->m_leSamples->setText(QString::number(samples)); }
void TemporalConstraintView::paint( QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) { qreal min_w = minWidth(); qreal max_w = maxWidth(); qreal def_w = defaultWidth(); qreal play_w = playWidth(); // Draw the stuff present if there is a rack *in the model* ? if(presenter().rack()) { // Background auto rect = boundingRect(); rect.adjust(0,15,0,-10); rect.setWidth(this->defaultWidth()); painter->fillRect(rect, m_bgColor); // Fake timenode continuation auto color = ScenarioStyle::instance().RackSideBorder; QPen pen{color, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin}; painter->setPen(pen); painter->drawLine(rect.topLeft(), rect.bottomLeft()); painter->drawLine(rect.topRight(), rect.bottomRight()); } QPainterPath solidPath, dashedPath, leftBrace, rightBrace; // Paths if(infinite()) { if(min_w != 0.) { solidPath.lineTo(min_w, 0); leftBrace.moveTo(min_w, -10); leftBrace.arcTo(min_w - 10, -10, 20, 20, 90, 180); } // TODO end state should be hidden dashedPath.moveTo(min_w, 0); dashedPath.lineTo(def_w, 0); } else if(min_w == max_w) // TODO rigid() { solidPath.lineTo(def_w, 0); } else { if(min_w != 0.) solidPath.lineTo(min_w, 0); dashedPath.moveTo(min_w, 0); dashedPath.lineTo(max_w, 0); leftBrace.moveTo(min_w + 10, -10); leftBrace.arcTo(min_w, -10, 20, 20, 90, 180); leftBrace.closeSubpath(); rightBrace.moveTo(max_w, 10); rightBrace.arcTo(max_w - 10, -10, 20, 20, 270, 180); rightBrace.closeSubpath(); rightBrace.translate(-10, 0); // TODO bleh. } QPainterPath playedPath; if(play_w != 0.) { playedPath.lineTo(play_w, 0); } // Colors QColor constraintColor; // TODO make a switch instead if(isSelected()) { constraintColor = ScenarioStyle::instance().ConstraintSelected; } else if(warning()) { constraintColor = ScenarioStyle::instance().ConstraintWarning; } else { constraintColor = ScenarioStyle::instance().ConstraintBase; } if(! isValid()) { constraintColor = ScenarioStyle::instance().ConstraintInvalid; this->setZValue(this->zValue()+ 1); } else { this->setZValue(parentObject()->zValue() + 3); } m_solidPen.setColor(constraintColor); m_dashPen.setColor(constraintColor); // Drawing painter->setPen(m_solidPen); if(!solidPath.isEmpty()) painter->drawPath(solidPath); if(!leftBrace.isEmpty()) painter->drawPath(leftBrace); if(!rightBrace.isEmpty()) painter->drawPath(rightBrace); painter->setPen(m_dashPen); if(!dashedPath.isEmpty()) painter->drawPath(dashedPath); leftBrace.closeSubpath(); rightBrace.closeSubpath(); QPen anotherPen(Qt::transparent, 4); painter->setPen(anotherPen); QColor blueish = m_solidPen.color().lighter(); blueish.setAlphaF(0.3); painter->setBrush(blueish); painter->drawPath(leftBrace); painter->drawPath(rightBrace); static const QPen playedPen{ QBrush{ScenarioStyle::instance().ConstraintPlayFill}, 4, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin }; painter->setPen(playedPen); if(!playedPath.isEmpty()) painter->drawPath(playedPath); static const int fontSize = 12; QRectF labelRect{0,0, defaultWidth(), (-fontSize - 2.)}; auto f = ProcessFonts::Sans(); f.setPointSize(fontSize); painter->setFont(f); painter->setPen(m_labelColor); painter->drawText(labelRect, Qt::AlignCenter, m_label); #if defined(ISCORE_SCENARIO_DEBUG_RECTS) painter->setPen(Qt::darkRed); painter->setBrush(Qt::NoBrush); painter->drawRect(boundingRect()); #endif }
void TemporalConstraintView::paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { // Draw the rack bg if(auto rack = presenter().rack()) { auto rackRect = rack->view().boundingRect(); painter->fillRect(rackRect, QColor::fromRgba(qRgba(0, 127, 229, 76))); auto color = qApp->palette("ScenarioPalette").base().color(); QPen pen{color, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin}; painter->setPen(pen); painter->drawLine(rackRect.topLeft(), rackRect.bottomLeft()); painter->drawLine(rackRect.topRight(), rackRect.bottomRight()); } QPainterPath solidPath, dashedPath, leftBrace, rightBrace; // m_endState->setPos(defaultWidth(), 0); // Paths if(infinite()) { if(minWidth() != 0) { solidPath.lineTo(minWidth(), 0); leftBrace.moveTo(minWidth(), -10); leftBrace.arcTo(minWidth() - 10, -10, 20, 20, 90, 180); } // TODO end state should be hidden dashedPath.moveTo(minWidth(), 0); dashedPath.lineTo(defaultWidth(), 0); } else if(minWidth() == maxWidth()) // TODO rigid() { solidPath.lineTo(defaultWidth(), 0); } else { if(minWidth() != 0) solidPath.lineTo(minWidth(), 0); dashedPath.moveTo(minWidth(), 0); dashedPath.lineTo(maxWidth(), 0); leftBrace.moveTo(minWidth(), -10); leftBrace.arcTo(minWidth() - 10, -10, 20, 20, 90, 180); rightBrace.moveTo(maxWidth(), 10); rightBrace.arcTo(maxWidth() - 10, -10, 20, 20, 270, 180); } QPainterPath playedPath; if(playWidth() != 0) { playedPath.lineTo(playWidth(), 0); } // Colors QColor constraintColor; if(isSelected()) { constraintColor = QColor::fromRgbF(0.188235, 0.54902, 0.776471); } else { constraintColor = qApp->palette("ScenarioPalette").base().color(); } if(warning()) { constraintColor = QColor{200,150,0}; } if(! isValid()) { constraintColor = Qt::red; } m_solidPen.setColor(constraintColor); m_dashPen.setColor(constraintColor); // Drawing painter->setPen(m_solidPen); if(!solidPath.isEmpty()) painter->drawPath(solidPath); if(!leftBrace.isEmpty()) painter->drawPath(leftBrace); if(!rightBrace.isEmpty()) painter->drawPath(rightBrace); painter->setPen(m_dashPen); if(!dashedPath.isEmpty()) painter->drawPath(dashedPath); leftBrace.closeSubpath(); rightBrace.closeSubpath(); QPen anotherPen(Qt::transparent, 4); painter->setPen(anotherPen); QColor blueish = m_solidPen.color().lighter(); blueish.setAlphaF(0.3); painter->setBrush(blueish); painter->drawPath(leftBrace); painter->drawPath(rightBrace); static const QPen playedPen{ QBrush{Qt::green}, 4, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin }; static const QPen dashedPlayedPen{ QBrush{Qt::green}, 4, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin }; painter->setPen(playedPen); if(!playedPath.isEmpty()) painter->drawPath(playedPath); int fontSize = 12; QRectF labelRect{0,0, defaultWidth(), (-fontSize - 2.)}; QFont f("Ubuntu"); f.setPixelSize(fontSize); painter->setFont(f); painter->setPen(m_labelColor); painter->drawText(labelRect, Qt::AlignCenter, m_label); /* painter->setPen(Qt::darkRed); painter->setBrush(Qt::NoBrush); painter->drawRect(boundingRect()); */ }
void TemporalConstraintView::paint( QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*) { auto& skin = ScenarioStyle::instance(); qreal min_w = minWidth(); qreal max_w = maxWidth(); qreal def_w = defaultWidth(); qreal play_w = playWidth(); m_labelItem->setPos(def_w / 2. - m_labelItem->boundingRect().width() / 2., -17); m_counterItem->setPos(def_w - m_counterItem->boundingRect().width() - 5, 5); m_leftBrace->setX(min_w); m_rightBrace->setX(max_w); // Draw the stuff present if there is a rack *in the model* ? if(presenter().rack()) { // Background auto rect = boundingRect(); rect.adjust(0,4,0,-10); rect.setWidth(this->defaultWidth()); QColor bgColor = m_bgColor.getColor(); bgColor.setAlpha(m_hasFocus ? 84 : 76); painter->fillRect(rect, bgColor); // Fake timenode continuation auto color = skin.RackSideBorder.getColor(); QPen pen{color, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin}; painter->setPen(pen); painter->drawLine(rect.topLeft(), rect.bottomLeft()); painter->drawLine(rect.topRight(), rect.bottomRight()); } QPainterPath solidPath, dashedPath, leftBrace, rightBrace; // Paths if(infinite()) { if(min_w != 0.) { solidPath.lineTo(min_w, 0); m_leftBrace->show(); } m_rightBrace->hide(); // TODO end state should be hidden dashedPath.moveTo(min_w, 0); dashedPath.lineTo(def_w, 0); } else if(min_w == max_w) // TODO rigid() { solidPath.lineTo(def_w, 0); m_leftBrace->hide(); m_rightBrace->hide(); } else { if(min_w != 0.) solidPath.lineTo(min_w, 0); dashedPath.moveTo(min_w, 0); dashedPath.lineTo(max_w, 0); m_leftBrace->show(); m_rightBrace->show(); } QPainterPath playedPath; if(play_w != 0.) { playedPath.lineTo(std::min(play_w, std::max(def_w, max_w)), 0); } // Colors QColor constraintColor; // TODO make a switch instead if(isSelected()) { constraintColor = skin.ConstraintSelected.getColor(); } else if(warning()) { constraintColor = skin.ConstraintWarning.getColor(); } else { constraintColor = skin.ConstraintBase.getColor(); } if(! isValid() || m_state == ConstraintExecutionState::Disabled) { constraintColor = skin.ConstraintInvalid.getColor(); } m_solidPen.setColor(constraintColor); m_dashPen.setColor(constraintColor); // Drawing painter->setPen(m_solidPen); if(!solidPath.isEmpty()) painter->drawPath(solidPath); painter->setPen(m_dashPen); if(!dashedPath.isEmpty()) painter->drawPath(dashedPath); leftBrace.closeSubpath(); rightBrace.closeSubpath(); QPen anotherPen(Qt::transparent, 4); painter->setPen(anotherPen); QColor blueish = m_solidPen.color().lighter(); blueish.setAlphaF(0.3); painter->setBrush(blueish); const QPen playedPen{ skin.ConstraintPlayFill.getColor(), 4, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin }; painter->setPen(playedPen); if(!playedPath.isEmpty()) painter->drawPath(playedPath); { auto& dur = presenter().model().duration; auto progress = dur.defaultDuration() * dur.playPercentage(); if(!progress.isZero()) { QString percent = progress.toString(); m_counterItem->setText(percent); } } #if defined(ISCORE_SCENARIO_DEBUG_RECTS) painter->setPen(Qt::darkRed); painter->setBrush(Qt::NoBrush); painter->drawRect(boundingRect()); #endif }
int main (void) { unsigned int i; infinite(); return 0; }
Amount::operator std::string() const { return infinite() ? "unlimited" : std::to_string(value_); }
bool Amount::finite() const { return !infinite(); }
infinite(){ return infinite(); }