当前位置: 首页>>代码示例>>C++>>正文


C++ ErrorList类代码示例

本文整理汇总了C++中ErrorList的典型用法代码示例。如果您正苦于以下问题:C++ ErrorList类的具体用法?C++ ErrorList怎么用?C++ ErrorList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ErrorList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tr

void checkDock::runTests( ValidateType type )
{
  for ( int i = 0; i < mTestTable->rowCount(); ++i )
  {
    QString testName = mTestTable->item( i, 0 )->text();
    QString layer1Str = mTestTable->item( i, 3 )->text();
    QString layer2Str = mTestTable->item( i, 4 )->text();

    // test if layer1 is in the registry
    if ( !( ( QgsVectorLayer * )QgsProject::instance()->mapLayers().contains( layer1Str ) ) )
    {
      QgsMessageLog::logMessage( tr( "Layer %1 not found in registry." ).arg( layer1Str ), tr( "Topology plugin" ) );
      return;
    }

    QgsVectorLayer *layer1 = ( QgsVectorLayer * )QgsProject::instance()->mapLayer( layer1Str );
    QgsVectorLayer *layer2 = nullptr;

    if ( ( QgsVectorLayer * )QgsProject::instance()->mapLayers().contains( layer2Str ) )
      layer2 = ( QgsVectorLayer * )QgsProject::instance()->mapLayer( layer2Str );

    QProgressDialog progress( testName, tr( "Abort" ), 0, layer1->featureCount(), this );
    progress.setWindowModality( Qt::WindowModal );

    connect( &progress, &QProgressDialog::canceled, mTest, &topolTest::setTestCanceled );
    connect( mTest, &topolTest::progress, &progress, &QProgressDialog::setValue );
    // run the test

    ErrorList errors = mTest->runTest( testName, layer1, layer2, type );

    QList<TopolError *>::Iterator it;

    QgsRubberBand *rb = nullptr;
    for ( it = errors.begin(); it != errors.end(); ++it )
    {
      TopolError *te = *it;
      te->conflict();

      QgsSettings settings;
      if ( te->conflict().type() == QgsWkbTypes::PolygonGeometry )
      {
        rb = new QgsRubberBand( qgsInterface->mapCanvas(), QgsWkbTypes::PolygonGeometry );
      }
      else
      {
        rb = new QgsRubberBand( qgsInterface->mapCanvas(), te->conflict().type() );
      }
      rb->setColor( "red" );
      rb->setWidth( 4 );
      rb->setToGeometry( te->conflict(), layer1 );
      rb->show();
      mRbErrorMarkers << rb;
    }
    disconnect( &progress, &QProgressDialog::canceled, mTest, &topolTest::setTestCanceled );
    disconnect( mTest, &topolTest::progress, &progress, &QProgressDialog::setValue );
    mErrorList << errors;
  }
  mToggleRubberband->setChecked( true );
  mErrorListModel->resetModel();
}
开发者ID:alexbruy,项目名称:QGIS,代码行数:60,代码来源:checkDock.cpp

示例2: showErrorList

//---------------------------------------------------------------------------
void TMultDispFrame::showErrorList( ErrorList &errs )
{
   ErrList->Clear();
   for ( ErrorIterator i = errs.begin(); i != errs.end(); i++ )
   {
      ErrList->Items->Add( ( *i ) ->errStr.c_str() );
   }
   ErrList->ItemIndex = 0;
}
开发者ID:BackupTheBerlios,项目名称:minos-svn,代码行数:10,代码来源:MultDisp.cpp

示例3: validateItem

void AbstractResourceItem::validateItem()
{
    if (_state == ResourceState::FILE_ERROR || _state == ResourceState::NOT_LOADED) {
        return;
    }

    ErrorList err;

    // check dependencies
    bool dependenciesOk = true;
    for (auto& dep : _dependencies) {
        AbstractResourceItem* dItem = _project->findResourceItem(dep.type, dep.name);

        if (dItem == nullptr) {
            if (auto* rl = _project->findResourceList(dep.type)) {
                QString rtn = rl->resourceTypeNameSingle();
                err.addError("Dependency Error: Missing " + rtn.toStdString() + u8" · " + dep.name.toStdString());
            }
            else {
                err.addError("Dependency Error: Missing " + dep.name.toStdString());
            }
            dependenciesOk = false;
        }
        else if (dItem->state() != ResourceState::VALID) {
            QString rtn = dItem->resourceList()->resourceTypeNameSingle();
            err.addError("Dependency Error: " + rtn.toStdString() + u8" · " + dep.name.toStdString());

            dependenciesOk = false;
        }
    }

    if (dependenciesOk) {
        try {
            bool s = compileResource(err);
            setState(s ? ResourceState::VALID : ResourceState::ERROR);
        }
        catch (const std::exception& ex) {
            err.addError(std::string("EXCEPTION: ") + ex.what());
            setState(ResourceState::ERROR);
        }

        _errorList = std::move(err);
        emit errorListChanged();

        emit resourceComplied();
    }
    else {
        _errorList = std::move(err);
        emit errorListChanged();

        setState(ResourceState::DEPENDENCY_ERROR);
    }
}
开发者ID:undisbeliever,项目名称:untech-editor,代码行数:53,代码来源:abstractresourceitem.cpp

示例4: convertAnimationFrames

std::unique_ptr<AnimatedTilesetData>
convertAnimationFrames(const AnimationFramesInput& input, const PaletteInput& paletteInput,
                       ErrorList& err)
{
    bool valid = input.validate(err);
    if (!valid) {
        return nullptr;
    }

    const unsigned initialErrorCount = err.errorCount();

    const auto& firstImageFilename = input.frameImageFilenames.front();
    const auto& imgSize = ImageCache::loadPngImage(firstImageFilename)->size();

    auto ret = std::make_unique<AnimatedTilesetData>(input.bitDepth);
    ret->animationDelay = input.animationDelay;

    const usize mapSize(imgSize.width / 8, imgSize.height / 8);

    const auto palette = extractFirstPalette(paletteInput, input.bitDepth, err);
    if (palette.empty()) {
        return nullptr;
    }

    auto invalidImagesError = std::make_unique<InvalidImageError>();

    const auto frameTiles = tilesFromFrameImages(input, palette, err);
    if (initialErrorCount != err.errorCount()) {
        return nullptr;
    }
    const auto tilesetIntermediate = combineFrameTiles(frameTiles, mapSize.width, err);

    if (input.addTransparentTile) {
        ret->staticTiles.addTile();
    }

    buildTilesetAndTilemap(*ret, mapSize, tilesetIntermediate);

    if (initialErrorCount != err.errorCount()) {
        return nullptr;
    }

    valid = ret->validate(err);
    if (!valid) {
        return nullptr;
    }

    return ret;
}
开发者ID:undisbeliever,项目名称:untech-editor,代码行数:49,代码来源:animation-frames-input.cpp

示例5: generateActionPointMapping

ActionPointMapping MetaSprite::generateActionPointMapping(const NamedList<ActionPointFunction>& apFunctions, ErrorList& err)
{
    bool valid = true;
    auto addError = [&](const std::string msg) {
        err.addError(std::move(msg));
        valid = false;
    };
    auto addApfError = [&](const ActionPointFunction& apf, const std::string msg) {
        err.addError(std::make_unique<ListItemError>(&apf, std::move(msg)));
        valid = false;
    };

    ActionPointMapping ret;

    if (apFunctions.empty()) {
        addError("Expected at least one action point function");
        return ret;
    }

    if (apFunctions.size() > MAX_ACTION_POINT_FUNCTIONS) {
        addError("Too many action point functions (max " + std::to_string(MAX_ACTION_POINT_FUNCTIONS) + ")");
        return ret;
    }

    ret.reserve(apFunctions.size());

    for (unsigned i = 0; i < apFunctions.size(); i++) {
        const unsigned romValue = (i + 1) * 2;
        assert(romValue <= 255 - 2);

        const ActionPointFunction& apf = apFunctions.at(i);

        if (not apf.name.isValid()) {
            addApfError(apf, "Missing action point function name");
        }

        auto success = ret.emplace(apf.name, romValue);

        if (success.second == false) {
            addApfError(apf, "Action point function name already exists: " + apf.name);
        }
    }

    if (not valid) {
        ret.clear();
    }

    return ret;
}
开发者ID:undisbeliever,项目名称:untech-editor,代码行数:49,代码来源:common.cpp

示例6: validate

bool AnimationFramesInput::validate(ErrorList& err) const
{
    bool valid = true;

    if (bitDepth != 2 && bitDepth != 4 && bitDepth != 8) {
        err.addError("Invalid bit-depth, expected 2, 4 or 8");
        valid = false;
    }

    if (frameImageFilenames.empty()) {
        err.addError("Missing frame image");
        valid = false;
    }

    std::vector<usize> imageSizes(frameImageFilenames.size());

    for (unsigned i = 0; i < frameImageFilenames.size(); i++) {
        const auto& imageFilename = frameImageFilenames.at(i);
        const auto& image = ImageCache::loadPngImage(imageFilename);
        imageSizes.at(i) = image->size();

        if (image->empty()) {
            err.addError("Missing frame image: " + image->errorString());
            valid = false;
            break;
        }

        if (image->size().width % 8 != 0 || image->size().height % 8 != 0) {
            err.addError("image size invalid (height and width must be a multiple of 8): " + imageFilename);
            valid = false;
        }
    }

    if (valid) {
        for (const usize& imgSize : imageSizes) {
            if (imgSize != imageSizes.front()) {
                err.addError("All frame images must be the same size");
                valid = false;
                break;
            }
        }
    }

    return valid;
}
开发者ID:undisbeliever,项目名称:untech-editor,代码行数:45,代码来源:animation-frames-input.cpp

示例7:

void
ErrorWindow::AppendToList(ErrorList& list)
{
	list.Rewind();

	error_msg* message = list.GetNextItem();
	int32 counter = 0;
	while (message != NULL) {
		error_msg* newmessage = new error_msg;
		*newmessage = *message;
		fErrors.msglist.AddItem(newmessage);
		ErrMsgToItem(newmessage);
		if (counter % 5 == 0)
			UpdateIfNeeded();

		counter++;
		message = list.GetNextItem();
	}
}
开发者ID:HaikuArchives,项目名称:Paladin,代码行数:19,代码来源:ErrorWindow.cpp

示例8: Q_ASSERT

void AbstractResourceItem::loadResource()
{
    Q_ASSERT(_undoStack->count() == 0);

    ErrorList err;

    try {
        bool s = loadResourceData(err);
        setState(s ? ResourceState::UNCHECKED : ResourceState::FILE_ERROR);
    }
    catch (const std::exception& ex) {
        err.addError(std::string("EXCEPTION: ") + ex.what());
        setState(ResourceState::FILE_ERROR);
    }

    _errorList = std::move(err);

    emit resourceLoaded();
    emit errorListChanged();
}
开发者ID:undisbeliever,项目名称:untech-editor,代码行数:20,代码来源:abstractresourceitem.cpp

示例9: _testFrameSet

static bool _testFrameSet(const FrameSetExportOrder& eo, const FrameSetT& frameSet,
                          ErrorList& errorList)
{
    bool valid = true;

    for (auto& en : eo.stillFrames) {
        if (en.frameExists(frameSet.frames) == false) {
            errorList.addError("Cannot find frame " + en.name);
            valid = false;
        }
    }

    for (auto& en : eo.animations) {
        if (en.animationExists(frameSet.animations) == false) {
            errorList.addError("Cannot find animation " + en.name);
            valid = false;
        }
    }

    return valid;
}
开发者ID:undisbeliever,项目名称:untech-editor,代码行数:21,代码来源:frameset-exportorder.cpp

示例10: _validate

bool Animation::_validate(const FrameSetT& frameSet, ErrorList& err) const
{
    const unsigned oldErrorCount = err.errorCount();

    if (oneShot == false && nextAnimation.isValid()) {
        if (!frameSet.animations.find(nextAnimation)) {
            err.addError(animationError(*this, "Cannot find animation " + nextAnimation));
        }
    }

    if (frames.size() == 0) {
        err.addError(animationError(*this, "Expected at least one animation frame"));
    }

    for (unsigned i = 0; i < frames.size(); i++) {
        const AnimationFrame& aFrame = frames.at(i);

        if (aFrame.testFrameValid(frameSet) == false) {
            err.addError(animationFrameError(*this, i, "Cannot find frame " + aFrame.frame.name));
        }
    }

    return err.errorCount() == oldErrorCount;
}
开发者ID:undisbeliever,项目名称:untech-editor,代码行数:24,代码来源:animation.cpp

示例11: _ReportError

void
TfDiagnosticMgr::_SpliceErrors(ErrorList &src)
{
    if (!HasActiveErrorMark()) {
        for (ErrorList::const_iterator
                 i = src.begin(), end = src.end(); i != end; ++i) {
            _ReportError(*i);
        }
    } else {
        // Reassign new serial numbers to the errors.
        size_t serial = _nextSerial.fetch_and_add(src.size());
        for (auto& error : src) {
            error._data->_serial = serial++;
        }
        // Now splice them into the main list.
        ErrorList &errorList = _errorList.local();
        // We store the begin iterator from the new list.  This iterator remains
        // valid *after the splice*, and iterates the spliced elements from src
        // in errorList.
        ErrorList::iterator newErrorsBegin = src.begin();
        errorList.splice(errorList.end(), src);
        _AppendErrorsToLogText(newErrorsBegin);
    }
}
开发者ID:MWDD,项目名称:USD,代码行数:24,代码来源:diagnosticMgr.cpp

示例12: load

    /**
     * @brief Database::load
     * @param errorList
     */
    void Database::load(ErrorList &errorList)
    {
        QFile f(makeFullPath());
        if (f.open(QIODevice::ReadOnly)) {
            QJsonParseError errorMessage;
            QJsonDocument jdoc(QJsonDocument::fromJson(f.readAll(), &errorMessage));

            if (errorMessage.error == QJsonParseError::NoError) {
                fromJson(jdoc.object(), errorList);
            } else {
                errorList << errorMessage.errorString();
            }
        } else {
            errorList << QObject::tr("Can't load database: %1.").arg(f.fileName());
        }

        m_Valid = errorList.isEmpty();
    }
开发者ID:LETARTARE,项目名称:uml-tool,代码行数:22,代码来源:database.cpp

示例13: tilesFromFrameImages

static std::vector<std::vector<FrameTile>> tilesFromFrameImages(const AnimationFramesInput input,
                                                                const std::vector<Snes::SnesColor>& palettes,
                                                                ErrorList& err)
{
    const unsigned colorsPerPalette = 1 << input.bitDepth;

    std::vector<std::vector<FrameTile>> frameTiles;
    frameTiles.reserve(input.frameImageFilenames.size());

    const unsigned nFrames = input.frameImageFilenames.size();
    for (unsigned frameId = 0; frameId < nFrames; frameId++) {
        auto imageErr = std::make_unique<InvalidImageError>(frameId);

        const auto& image = ImageCache::loadPngImage(input.frameImageFilenames.at(frameId));
        frameTiles.emplace_back(
            tilesFromFrameImage(*image, palettes, colorsPerPalette, *imageErr));

        if (imageErr->hasError()) {
            err.addError(std::move(imageErr));
        }
    }

    return frameTiles;
}
开发者ID:undisbeliever,项目名称:untech-editor,代码行数:24,代码来源:animation-frames-input.cpp

示例14: verify_column_selections

/* Test for the required minimum number of columns selected and
 * the selection is consistent.
 * @param An ErrorList object to which all found issues are added.
 */
void GncTxImport::verify_column_selections (ErrorList& error_msg)
{

    /* Verify if a date column is selected and it's parsable.
     */
    if (!check_for_column_type(GncTransPropType::DATE))
        error_msg.add_error( _("Please select a date column."));

    /* Verify if an account is selected either in the base account selector
     * or via a column in the import data.
     */
    if (!check_for_column_type(GncTransPropType::ACCOUNT))
    {
        if (m_settings.m_multi_split)
            error_msg.add_error( _("Please select an account column."));
        else if (!m_settings.m_base_account)
            error_msg.add_error( _("Please select an account column or set a base account in the Account field."));
    }

    /* Verify a description column is selected.
     */
    if (!check_for_column_type(GncTransPropType::DESCRIPTION))
        error_msg.add_error( _("Please select a description column."));

    /* Verify at least one amount column (deposit or withdrawal) column is selected.
     */
    if (!check_for_column_type(GncTransPropType::DEPOSIT) &&
        !check_for_column_type(GncTransPropType::WITHDRAWAL))
        error_msg.add_error( _("Please select a deposit or withdrawal column."));

    /* Verify a transfer account is selected if any of the other transfer properties
     * are selected.
     */
    if ((check_for_column_type(GncTransPropType::TACTION) ||
         check_for_column_type(GncTransPropType::TMEMO) ||
         check_for_column_type(GncTransPropType::TREC_STATE) ||
         check_for_column_type(GncTransPropType::TREC_DATE)) &&
        !check_for_column_type(GncTransPropType::TACCOUNT))
        error_msg.add_error( _("Please select a transfer account column or remove the other transfer related columns."));
}
开发者ID:Gnucash,项目名称:gnucash,代码行数:44,代码来源:gnc-import-tx.cpp

示例15: p

MemCheckIterTools::ErrorListIterator::ErrorListIterator(ErrorList & l, const IterTool & iterTool)
    : p(l.begin()), m_end(l.end()), m_iterTool(iterTool)
{
    while (p != m_end && m_iterTool.omitSuppressed && p->suppressed)
        ++p;
}
开发者ID:05storm26,项目名称:codelite,代码行数:6,代码来源:memcheckerror.cpp


注:本文中的ErrorList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。