QList<QUrl> KURLListRequester::urlList() { QList<QUrl> urls; QString text = urlLineEdit->text().simplified(); if (!text.isEmpty()) { QString error; emit checkValidity(text, error); if (error.isNull()) urls.append(QUrl::fromUserInput(text, QString(), QUrl::AssumeLocalFile)); } for (int i = 0; i != urlListBox->count(); i++) { QListWidgetItem *item = urlListBox->item(i); QString text = item->text().simplified(); QString error; emit checkValidity(text, error); if (error.isNull()) urls.append(QUrl::fromUserInput(text, QString(), QUrl::AssumeLocalFile)); } return urls; }
PrintDialog::PrintDialog(QWidget *parent, capture_file *cf) : QDialog(parent), pd_ui_(new Ui::PrintDialog), cur_printer_(NULL), cur_painter_(NULL), preview_(new QPrintPreviewWidget(&printer_)), print_bt_(new QPushButton(tr("&Print..."))), cap_file_(cf) { if (!cf) done(QDialog::Rejected); // ...or assert? pd_ui_->setupUi(this); pd_ui_->previewLayout->insertWidget(0, preview_, Qt::AlignTop); preview_->setMinimumWidth(preview_->height() / 2); preview_->setToolTip(pd_ui_->zoomLabel->toolTip()); // XXX Make these configurable header_font_.setFamily("Times"); header_font_.setPointSizeF(header_font_.pointSizeF() * 0.8); packet_font_ = wsApp->monospaceFont(); packet_font_.setPointSizeF(packet_font_.pointSizeF() * 0.8); memset(&print_args_, 0, sizeof(print_args_)); memset(&stream_ops_, 0, sizeof(stream_ops_)); /* Init the export range */ packet_range_init(&print_args_.range, cap_file_); /* Default to displayed packets */ print_args_.range.process_filtered = TRUE; stream_ops_.print_preamble = print_preamble_pd; stream_ops_.print_line = print_line_pd; stream_ops_.new_page = new_page_pd; stream_.data = this; stream_.ops = &stream_ops_; print_args_.stream = &stream_; gchar *display_basename = g_filename_display_basename(cap_file_->filename); printer_.setDocName(display_basename); g_free(display_basename); pd_ui_->rangeGroupBox->initRange(&print_args_.range); pd_ui_->buttonBox->addButton(print_bt_, QDialogButtonBox::ActionRole); pd_ui_->buttonBox->addButton(tr("Page &Setup..."), QDialogButtonBox::ResetRole); print_bt_->setDefault(true); connect(preview_, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paintPreview(QPrinter*))); connect(pd_ui_->rangeGroupBox, SIGNAL(rangeChanged()), this, SLOT(checkValidity())); connect(pd_ui_->formatGroupBox, SIGNAL(formatChanged()), this, SLOT(checkValidity())); connect(pd_ui_->formFeedCheckBox, SIGNAL(toggled(bool)), preview_, SLOT(updatePreview())); checkValidity(); }
LuaObjectBase* LuaObjectBase::getFromObject(lua_State* state, int object, bool error) { #ifdef FULL_USER_DATA // Make sure it's some user data! LUA->ReferencePush(object); int type = LUA->GetType(-1); if(type != GarrysMod::Lua::Type::USERDATA && type <= GarrysMod::Lua::Type::COUNT) { if (error) { LUA->ThrowError( "Invalid object! (not userdata)\n" ); } return 0; } // Check the object GarrysMod::Lua::UserData* a = (GarrysMod::Lua::UserData*)LUA->GetUserdata(-1); LuaObjectBase* data = (LuaObjectBase*)(a->data); if (!checkValidity(state, type, data, error)) return 0; // Just a simple cast required return reinterpret_cast<LuaObjectBase*>(a); #else void* userData = object->GetMemberUserDataLite("_this"); if (!checkValidity(luaInterface, 0, (LuaObjectBase*)userData, error)) return 0; LuaObjectBase* baseObject = reinterpret_cast<LuaObjectBase*>(userData); baseObject->luaRef(object); return baseObject; #endif }
void OfonoModemInterface::updateValidity() { if (isValid() != checkValidity()) { m_isValid = checkValidity(); emit validityChanged(isValid()); } }
void eLSystem::evaluate() { #if defined(eEDITOR) // check lsystem for regularity if( (!checkValidity(this->axiom)) || (!checkValidity(this->grammar))) return; #endif this->evaluate(*this->getDefaultState(1.0f)); }
EnergyCut::EnergyCut( const double lowerValue, const double upperValue ) : type_(Range), lowerValue_(lowerValue), upperValue_(upperValue) { checkValidity(); }
bool LuaObjectBase::checkValidity(lua_State* state, int position, bool error) { #ifdef FULL_USER_DATA // Make sure it's some user data! int type = LUA->GetType(position); if(type != GarrysMod::Lua::Type::USERDATA && type <= GarrysMod::Lua::Type::COUNT) { if (error) { LUA->ThrowError( "Invalid object! (not userdata)\n" ); } return 0; } // Acually do the check GarrysMod::Lua::UserData* obj = (GarrysMod::Lua::UserData*)LUA->GetUserdata(position); LuaObjectBase* object = (LuaObjectBase*)(obj->data); #else ILuaObject* table = luaInterface->GetObject(position); if (!table) return 0; LuaObjectBase* object = reinterpret_cast<LuaObjectBase*>( table->GetMemberUserDataLite("_this") ); int type = 0; table->UnReference(); #endif return checkValidity(state, type, object, error); }
Launcher::SongIterator Launcher::SongIterator::operator++(){ do{ iter++; }while(iter != boost::filesystem::directory_iterator() && !checkValidity()); return *this; }
ompl::base::PlannerStatus ompl::geometric::CForest::solve(const base::PlannerTerminationCondition &ptc) { using solveFunctionType = void (ompl::geometric::CForest::*)(base::Planner *, const base::PlannerTerminationCondition &); checkValidity(); time::point start = time::now(); std::vector<std::thread*> threads(planners_.size()); const base::ReportIntermediateSolutionFn prevSolutionCallback = getProblemDefinition()->getIntermediateSolutionCallback(); if (prevSolutionCallback) OMPL_WARN("Cannot use previously set intermediate solution callback with %s", getName().c_str()); pdef_->setIntermediateSolutionCallback(std::bind(&CForest::newSolutionFound, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); bestCost_ = opt_->infiniteCost(); // run each planner in its own thread, with the same ptc. for (std::size_t i = 0 ; i < threads.size() ; ++i) threads[i] = new std::thread(std::bind((solveFunctionType)&CForest::solve, this, planners_[i].get(), ptc)); for (auto & thread : threads) { thread->join(); delete thread; } // restore callback getProblemDefinition()->setIntermediateSolutionCallback(prevSolutionCallback); OMPL_INFORM("Solution found in %f seconds", time::seconds(time::now() - start)); return base::PlannerStatus(pdef_->hasSolution(), pdef_->hasApproximateSolution()); }
BasicArrayFS<T, ARRAY_TYPE>::BasicArrayFS(lowlevel::TyFS anFS, uima::CAS & rFSSystem, bool bDoChecks) : FeatureStructure(anFS, rFSSystem) { if (bDoChecks) { checkValidity(UIMA_MSG_ID_EXCON_CREATING_ARRAYFS); checkArray(ARRAY_TYPE, iv_tyFS, iv_cas->getHeap(), UIMA_MSG_ID_EXCON_CREATING_ARRAYFS); } }
bool SpArcSParameters::isValid() { if (isValid_ == 0) { return false; } else if (isValid_ == 1) { return true; } else // isValid_ == -1 { init(); if (checkValidity()) { isValid_ = 1; return true; } else { isValid_ = 0; return false; } } }
void BasicArrayFS<T, ARRAY_TYPE>::copyToArray( size_t uiStart, size_t uiEnd, T* destArray, size_t uiDestOffset) const { checkValidity(UIMA_MSG_ID_EXCON_GETTING_FS_FROM_ARRAY); checkArraySize(iv_tyFS, iv_cas->getHeap(), uiEnd - uiStart - 1 , UIMA_MSG_ID_EXCON_GETTING_FS_FROM_ARRAY); uima::lowlevel::TyFSType typecode = iv_cas->getHeap()->getType(iv_tyFS); size_t srcOffset = uiStart; size_t numelements = uiEnd-uiStart; size_t destOffset = uiDestOffset; if (typecode== uima::internal::gs_tyIntArrayType || typecode== uima::internal::gs_tyFloatArrayType ) { iv_cas->getHeap()->copyToArray( srcOffset,iv_tyFS,(uima::lowlevel::TyHeapCell*) destArray,destOffset,numelements); } else if(typecode== uima::internal::gs_tyByteArrayType || typecode== uima::internal::gs_tyBooleanArrayType) { iv_cas->getHeap()->copyToArray( srcOffset,iv_tyFS,(char*) destArray,destOffset,numelements); } else if(typecode== uima::internal::gs_tyShortArrayType ) { iv_cas->getHeap()->copyToArray( srcOffset,iv_tyFS,(short*) destArray,destOffset,numelements); } else if(typecode== uima::internal::gs_tyLongArrayType || typecode== uima::internal::gs_tyDoubleArrayType) { iv_cas->getHeap()->copyToArray( srcOffset,iv_tyFS,(INT64*) destArray,destOffset,numelements); } else { assertWithMsg(false, "Not yet implemented"); UIMA_EXC_THROW_NEW(NotYetImplementedException, UIMA_ERR_NOT_YET_IMPLEMENTED, UIMA_MSG_ID_EXC_NOT_YET_IMPLEMENTED, ErrorMessage(UIMA_MSG_ID_EXCON_UNKNOWN_CONTEXT), ErrorInfo::unrecoverable ); } }
void MySQLPreparedStatement::setInt64(const uint8 index, const int64 value) { checkValidity(index); paramsSet[index - 1] = true; MYSQL_BIND * param = &bind[index-1]; param->buffer_type = MYSQL_TYPE_LONGLONG; setValue(param,&value,8); }
void MySQLPreparedStatement::setDouble(const uint8 index, const double value) { checkValidity(index); paramsSet[index - 1] = true; MYSQL_BIND * param = &bind[index-1]; param->buffer_type = MYSQL_TYPE_DOUBLE; setValue(param,&value,8); }
bool KML::isValid() { checkValidity(); if( validity == KML_VALIDITY_VALID ) CPLDebug("KML", "Valid: %d Version: %s", validity == KML_VALIDITY_VALID, sVersion_.c_str()); return validity == KML_VALIDITY_VALID; }
IO::Flow ScanPhotoDirectory::onBeginFolder( const String& completePath, const String&, const String& /*name*/) { // I can't directly rule out the entire folder by a flowSkip, as this // invalid folder may include perfectly valid subfolders... pIsValidFolder = checkValidity(completePath); return IO::flowContinue; }
bool isValid() const { if (checkValidity()) try { return access(id_).isValid(); } catch (error::Invalid&) {} return false; }
OfonoModemInterface::OfonoModemInterface(OfonoModem::SelectionSetting modemSetting, const QString& modemPath, const QString& ifname, OfonoGetPropertySetting propertySetting, QObject *parent) : QObject(parent) { m_m = new OfonoModem(modemSetting, modemPath, this); connect(m_m, SIGNAL(validityChanged(bool)), this, SLOT(modemValidityChanged(bool))); connect(m_m, SIGNAL(interfacesChanged(QStringList)), this, SLOT(interfacesChanged(QStringList))); m_if = new OfonoInterface(m_m->path(), ifname, propertySetting, this); connect(m_m, SIGNAL(pathChanged(QString)), m_if, SLOT(setPath(const QString&))); m_isValid = checkValidity(); }
void ExportDissectionDialog::exportTypeChanged(QString name_filter) { export_type_ = export_type_map_.value(name_filter); if (export_type_ == export_type_text) { packet_format_group_box_.setEnabled(true); print_args_.format = PR_FMT_TEXT; } else { packet_format_group_box_.setEnabled(false); } checkValidity(); }
/** Checks whether the signature appears valid */ NotTEC preflight2 (PreflightContext const& ctx) { auto const sigValid = checkValidity(ctx.app.getHashRouter(), ctx.tx, ctx.rules, ctx.app.config()); if (sigValid.first == Validity::SigBad) { JLOG(ctx.j.debug()) << "preflight2: bad signature. " << sigValid.second; return temINVALID; } return tesSUCCESS; }
/** Constructor, sets the vertex attributes in a specific order */ VertexAttributes::VertexAttributes(const VertexAttribute* attributes, int attributesLength) { if (attributesLength < 1) throw GdxRuntimeException("attributes must be >= 1"); m_attributesLength = attributesLength; m_attributes = new VertexAttribute[attributesLength]; for (int i = 0; i < attributesLength; i++) m_attributes[i] = attributes[i]; checkValidity(); m_vertexSize = calculateOffsets(); }
void add(QWidget *w, QValidator *v) { Q_ASSERT(hasParent(v, w)); auto prop = w->metaObject()->userProperty(); auto propChanged = prop.notifySignal(); static auto check = metaObject()->method(metaObject()->indexOfSlot("checkWidget()")); Q_ASSERT(check.isValid()); if (!prop.isValid() || !propChanged.isValid()) return qWarning("DialogValidator::add: The target widget has no user property with a notifier."); if (connect(w, propChanged, this, check)) { m_needsValid++; checkValidity(w); } }
void TextureCube::update(GLuint _textureUnit) { checkValidity(); if (m_glHandle != 0 || m_faces.size() == 0) { return; } generate(_textureUnit); for (int i = 0; i < 6; ++i) { Face& f = m_faces[i]; glTexImage2D(CubeMapFace[i], 0, m_options.m_internalFormat, m_width, m_height, 0, m_options.m_format, GL_UNSIGNED_BYTE, f.m_data.data()); } }
void ShaderProgram::use() { checkValidity(); if (m_needsBuild) { build(); } if (m_glProgram != 0 && m_glProgram != s_activeGlProgram) { glUseProgram(m_glProgram); s_activeGlProgram = m_glProgram; } }
void SpawnParticlesAction::apply(Particle& particle) const { if (!checkValidity()) return; const Ref<Emitter>& emitter = getNextAvailableEmitter(); emitter->setTank(baseEmitter->getMinTank(),baseEmitter->getMaxTank()); const Ref<Zone>& zone = emitter->getZone(); zone->getTransform().setPosition(particle.position()); zone->updateTransform(); targetGroup->addParticles(SPK_RANDOM(minNb,maxNb + 1),emitter); }
JumpToDialog::JumpToDialog(void) { int i = 0; setupUi(this); GlFuncValidator *v = new GlFuncValidator(cbFunctions); cbFunctions->setValidator(v); while (glFunctions[i].fname != NULL) { cbFunctions->addItem(glFunctions[i].fname); i++; } connect(cbFunctions, SIGNAL(editTextChanged(QString)), this, SLOT(checkValidity())); }
void Launcher::LauncherWindow::play() { if(!checkValidity()) return; // order: param[i] = {song fret1 fret2 fret3 fret4 fret5 pick quit width height fullscreen difficulty} std::ostringstream param[12]; std::istringstream res(resolution->currentText().toStdString()); int width, height; res >> width; res.ignore(); res >> height; param[0] << songList->currentItem()->text().toStdString(); for(int i=0; i<7; i++) { param[i+1] << gameButtons[i]->currentIndex(); } param[8] << width; param[9] << height; param[10] << (fullscreen->checkState() == Qt::Unchecked ? false : true); param[11] << difficulty->currentText().toStdString(); for(int i=0; i<12; i++) std::cout<<param[i].str().c_str()<<"\n"; // execute silkystring and exit launcher execl("quitargame", "quitargame", param[0].str().c_str(), param[1].str().c_str(), param[2].str().c_str(), param[3].str().c_str(), param[4].str().c_str(), param[5].str().c_str(), param[6].str().c_str(), param[7].str().c_str(), param[8].str().c_str(), param[9].str().c_str(), param[10].str().c_str(), param[11].str().c_str(), 0); // if execution fails QMessageBox errorMsg(QMessageBox::Critical, "SilkyStrings launcher", "Couldn't launch SilkyStrings", QMessageBox::Ok); errorMsg.exec(); }
void QValidatedLineEdit::setEnabled(bool enabled) { if (!enabled) { // A disabled QValidatedLineEdit should be marked valid setValid(true); } else { // Recheck validity when QValidatedLineEdit gets enabled checkValidity(); } QLineEdit::setEnabled(enabled); }
void JoinGroupchatWidget::SetIdentifyingData (const QVariantMap& data) { const QString& nick = data ["Nick"].toString (); const QString& room = data ["Room"].toString (); const QString& server = data ["Server"].toString (); if (!nick.isEmpty ()) Ui_.Nickname_->setText (nick); if (!room.isEmpty ()) Ui_.Room_->setText (room); if (!server.isEmpty ()) Ui_.Server_->setText (server); checkValidity (); }
void KURLListRequester::slotAdd() { QString text = urlLineEdit->text().simplified(); if (text.length()) { QString error; emit checkValidity(text, error); if (!error.isNull()) KMessageBox::error(this, error); else { urlListBox->addItem(text); urlLineEdit->clear(); emit changed(); } } }