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


C++ QSourceLocation类代码示例

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


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

示例1: handleMessage

void MessageValidator::handleMessage(QtMsgType type,
                                     const QString &description,
                                     const QUrl &identifier,
                                     const QSourceLocation &sourceLocation)
{
    Q_UNUSED(type);
    Q_UNUSED(description);
    Q_UNUSED(sourceLocation);
    Q_UNUSED(identifier);

    QXmlStreamReader reader(description);

    m_received =   QLatin1String("Type:")
                   + QString::number(type)
                   + QLatin1String("\nDescription: ")
                   + description
                   + QLatin1String("\nIdentifier: ")
                   + identifier.toString()
                   + QLatin1String("\nLocation: ")
                   + sourceLocation.uri().toString()
                   + QLatin1String("#")
                   + QString::number(sourceLocation.line())
                   + QLatin1String(",")
                   + QString::number(sourceLocation.column());

    /* We just walk through it, to check that it's valid. */
    while(!reader.atEnd())
        reader.readNext();

    m_success = !reader.hasError();
}
开发者ID:selebro,项目名称:qt,代码行数:31,代码来源:MessageValidator.cpp

示例2: handleMessage

void XSLTMessageHandler::handleMessage(QtMsgType type, const QString& description,
                                       const QUrl&, const QSourceLocation& sourceLocation)
{
    if (!m_document->frame())
        return;

    MessageLevel level;
    switch (type) {
    case QtDebugMsg:
        level = TipMessageLevel;
        break;
    case QtWarningMsg:
        level = WarningMessageLevel;
        break;
    case QtCriticalMsg:
    case QtFatalMsg:
        level = ErrorMessageLevel;
        break;
    default:
        level = LogMessageLevel;
        break;
    }

    Console* console = m_document->frame()->domWindow()->console();
    console->addMessage(XMLMessageSource, LogMessageType, level, description,
                        sourceLocation.line(), sourceLocation.uri().toString());
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:27,代码来源:XSLTProcessorQt.cpp

示例3: handleMessage

void XMessageBoxMessageHandler::handleMessage(QtMsgType type, const QString &description, const QUrl &identifier, const QSourceLocation &sourceLocation)
{
    if (description.isEmpty())
    {
        _message = description;
        return;
    }

    _message = _prefix.arg(sourceLocation.line())
               .arg(sourceLocation.column())
               .arg(description)
               .arg(identifier.toString());
    switch (type)
    {
    case QtDebugMsg:
        QMessageBox::information(0, _title, _message);
        break;
    case QtWarningMsg:
        QMessageBox::warning(0, _title, _message);
        break;
    case QtCriticalMsg:
    case QtFatalMsg:
    default:
        QMessageBox::critical(0, _title, _message);
        break;
    }
}
开发者ID:knowhow,项目名称:xtuple,代码行数:27,代码来源:xmessageboxmessagehandler.cpp

示例4: handleMessage

 virtual void handleMessage(QtMsgType type,
         const QString &description,
         const QUrl &identifier,
         const QSourceLocation &sourceLocation) {
     qDebug() << "Error: " << description << " at line " << sourceLocation.line()
             << " char " << sourceLocation.column() << ".";
 }
开发者ID:FranciscoJavierPRamos,项目名称:wv2qt,代码行数:7,代码来源:fox_base.cpp

示例5: QString

void
MyXmlErrorHandler::handleMessage (QtMsgType type, const QString &description,
                                  const QUrl & /*identifier*/,
                                  const QSourceLocation &sourceLocation)
{
    QString msg = QString("XML message: %1, at uri= %2 "
                          "line %3 column %4")
                .arg(description)
                .arg(sourceLocation.uri ().toString ())
                .arg(sourceLocation.line ())
                .arg(sourceLocation.column ());

    switch (type) {
    case QtDebugMsg:
        Q_DEBUG(msg);
        break;
    case QtWarningMsg:
        Q_WARN(msg);
        break;
    case QtCriticalMsg:
    case QtFatalMsg:
        Q_CRIT(msg);
        break;
    }
}//MyXmlErrorHandler::handleMessage
开发者ID:Damra,项目名称:qgvdial,代码行数:25,代码来源:MyXmlErrorHandler.cpp

示例6: sl

void tst_QSourceLocation::valueConstructor() const
{
    const QSourceLocation sl(QUrl(QLatin1String("http://example.com/")), 5, 4);

    QCOMPARE(sl.uri(), QUrl(QLatin1String("http://example.com/")));
    QCOMPARE(sl.line(), qint64(5));
    QCOMPARE(sl.column(), qint64(4));
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:8,代码来源:tst_qsourcelocation.cpp

示例7: defaultValues

void tst_QSourceLocation::defaultValues() const
{
    QSourceLocation def;

    QCOMPARE(def.line(), qint64(-1));
    QCOMPARE(def.column(), qint64(-1));
    QCOMPARE(def.uri(), QUrl());
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:8,代码来源:tst_qsourcelocation.cpp

示例8: QSourceLocation

void tst_QSourceLocation::equalnessOperator_data() const
{
    QTest::addColumn<QSourceLocation>("v1");
    QTest::addColumn<QSourceLocation>("v2");
    QTest::addColumn<bool>("True");

    {
        QTest::newRow("Default constructed values")
                << QSourceLocation()
                << QSourceLocation()
                << true;
    }

    {
        QSourceLocation modified;
        modified.setColumn(4);

        QTest::newRow("Default constructed, against column-modified")
            << QSourceLocation()
            << modified
            << false;
    }

    {
        QSourceLocation modified;
        modified.setLine(5);

        QTest::newRow("Default constructed, against line-modified")
            << QSourceLocation()
            << modified
            << false;
    }

    {
        QSourceLocation modified;
        modified.setUri(QUrl(QLatin1String("http://example.com/")));

        QTest::newRow("Default constructed, against line-modified")
            << QSourceLocation()
            << modified
            << false;
    }

    {
        QSourceLocation modified;
        modified.setUri(QUrl(QLatin1String("http://example.com/")));
        modified.setLine(5);
        modified.setColumn(4);

        QTest::newRow("Default constructed, against all-modified")
            << QSourceLocation()
            << modified
            << false;
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:55,代码来源:tst_qsourcelocation.cpp

示例9:

QDebug operator<<(QDebug debug, const QSourceLocation &sourceLocation)
{
    debug << "QSourceLocation("
          << sourceLocation.uri()
          << ", line:"
          << sourceLocation.line()
          << ", column:"
          << sourceLocation.column()
          << ')';
    return debug;
}
开发者ID:sicily,项目名称:qt4.8.4,代码行数:11,代码来源:qsourcelocation.cpp

示例10: copy

void tst_QSourceLocation::copyConstructor() const
{
    {
        QSourceLocation def;
        QSourceLocation copy(def);

        QCOMPARE(def.line(), qint64(-1));
        QCOMPARE(def.column(), qint64(-1));
        QCOMPARE(def.uri(), QUrl());
    }

    {
        QSourceLocation val;
        val.setLine(5);
        val.setColumn(600);
        val.setUri(QUrl(QLatin1String("http://example.com/")));

        QSourceLocation copy(val);
        QCOMPARE(copy.line(), qint64(5));
        QCOMPARE(copy.column(), qint64(600));
        QCOMPARE(copy.uri(), QUrl(QLatin1String("http://example.com/")));
    }

    {
        /* Construct from a const object. */
        const QSourceLocation val;
        const QSourceLocation val2(val);
        QCOMPARE(val, val2);
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:30,代码来源:tst_qsourcelocation.cpp

示例11: addLocation

void GenericStaticContext::addLocation(const SourceLocationReflection *const reflection,
                                       const QSourceLocation &location)
{
    Q_ASSERT(!location.isNull());
    Q_ASSERT_X(reflection, Q_FUNC_INFO,
               "The reflection cannot be zero.");
    m_locations.insert(reflection, location);
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:8,代码来源:qgenericstaticcontext.cpp

示例12: constCorrectness

/*!
  Call functions that must be const.
 */
void tst_QSourceLocation::constCorrectness() const
{
    const QSourceLocation def;

    def.line();
    def.column();
    def.uri();
    def.isNull();

    const QSourceLocation def2;

    /* Equalness operator. */
    QVERIFY(def == def2);
    QCOMPARE(def, def2);

    /* Inverse equalness operator. */
    QVERIFY(def != def2);
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:21,代码来源:tst_qsourcelocation.cpp

示例13: handleMessage

void ValidatorMessageHandler::handleMessage(QtMsgType type, const QString& description,
                                            const QUrl& /* identifier */, const QSourceLocation& sourceLocation)
      {
      // convert description from html to text
      QDomDocument desc;
      QString contentError;
      int contentLine;
      int contentColumn;
      if (!desc.setContent(description, false, &contentError, &contentLine,
                           &contentColumn)) {
            qDebug("ValidatorMessageHandler: could not parse validation error line %d column %d: %s",
               contentLine, contentColumn, qPrintable(contentError));
            return;
            }
      QDomElement e = desc.documentElement();
      if (e.tagName() != "html") {
            qDebug("ValidatorMessageHandler: description is not html");
            return;
            }
      QString descText = e.text();

      QString strType;
      switch (type) {
            case 0:  strType = "Debug"; break;
            case 1:  strType = "Warning"; break;
            case 2:  strType = "Critical"; break;
            case 3:  strType = "Fatal"; break;
            default: strType = "Unknown"; break;
            }

      QString errorStr = QString("%1 error: line %2 column %3 %4")
            .arg(strType)
            .arg(sourceLocation.line())
            .arg(sourceLocation.column())
            .arg(descText);

      // append error, separated by newline if necessary
      if (errors != "")
            errors += "\n";
      errors += errorStr;
      }
开发者ID:amitjamadagni,项目名称:MuseScore,代码行数:41,代码来源:musicxmlsupport.cpp

示例14: QVERIFY

void tst_QSourceLocation::isNull() const
{
    {
        QSourceLocation def;
        QVERIFY(def.isNull());

        def.setColumn(4);
        QVERIFY(def.isNull());
    }

    {
        QSourceLocation def2;
        def2.setLine(4);
        QVERIFY(def2.isNull());
    }

    {
        QSourceLocation def3;
        def3.setUri(QUrl(QLatin1String("http://example.com/")));
        QVERIFY(!def3.isNull());
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:22,代码来源:tst_qsourcelocation.cpp

示例15: handleMessage

    void handleMessage(QtMsgType type, const QString &description,
                       const QUrl &, const QSourceLocation &sourceLocation)
    {
        const char* typeName;
        switch(type)
        {
        case QtDebugMsg: typeName = "Debug"; break;
        case QtWarningMsg: typeName = "Warning"; break;
        case QtCriticalMsg: typeName = "Critical"; break;
        case QtFatalMsg:
        default: typeName = "Fatal"; break;
        }

        QXmlStreamReader xml(description);
        QString text;
        while (!xml.atEnd())
            if (xml.readNext() == QXmlStreamReader::Characters)
                text += xml.text();

        std::cerr << typeName << ": " << qPrintable(text);
        if (!sourceLocation.isNull())
            std::cerr << " (line " << sourceLocation.line()
                 << ", col " << sourceLocation.column() << ")" << std::endl;
    }
开发者ID:marwan-abdellah,项目名称:Wisp,代码行数:24,代码来源:parser.cpp


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