本文整理汇总了C++中reportcontext::Ptr::error方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::error方法的具体用法?C++ Ptr::error怎么用?C++ Ptr::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportcontext::Ptr
的用法示例。
在下文中一共展示了Ptr::error方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parsePattern
QRegExp PatternPlatform::parsePattern(const QString &patternP,
const ReportContext::Ptr &context,
const SourceLocationReflection *const location)
{
if(patternP == QLatin1String("(.)\\3") ||
patternP == QLatin1String("\\3") ||
patternP == QLatin1String("(.)\\2"))
{
context->error(QLatin1String("We don't want to hang infinitely on K2-MatchesFunc-9, "
"10 and 11."),
ReportContext::FOER0000, location);
return QRegExp();
}
QString rewrittenPattern(patternP);
/* We rewrite some well known patterns to QRegExp style here. Note that
* these character classes only works in the ASCII range, and fail for
* others. This support needs to be in QRegExp, since it's about checking
* QChar::category(). */
rewrittenPattern.replace(QLatin1String("[\\i-[:]]"), QLatin1String("[a-zA-Z_]"));
rewrittenPattern.replace(QLatin1String("[\\c-[:]]"), QLatin1String("[a-zA-Z0-9_\\-\\.]"));
QRegExp retval(rewrittenPattern, Qt::CaseSensitive, QRegExp::W3CXmlSchema11);
if(retval.isValid())
return retval;
else
{
context->error(QtXmlPatterns::tr("%1 is an invalid regular expression pattern: %2")
.arg(formatExpression(patternP), retval.errorString()),
ReportContext::FORX0002, location);
return QRegExp();
}
}
示例2: Ptr
AtomicComparator::Ptr ComparisonPlatform<TSubClass, issueError, comparisonType, errorCode>::
fetchComparator(const ItemType::Ptr &t1,
const ItemType::Ptr &t2,
const ReportContext::Ptr &context) const
{
Q_ASSERT(t1);
Q_ASSERT(t2);
if(*BuiltinTypes::xsAnyAtomicType == *t1 ||
*BuiltinTypes::xsAnyAtomicType == *t2 ||
*BuiltinTypes::item == *t1 ||
*BuiltinTypes::item == *t2 ||
*BuiltinTypes::numeric == *t1 ||
*BuiltinTypes::numeric == *t2 ||
*CommonSequenceTypes::Empty == *t1 ||
*CommonSequenceTypes::Empty == *t2)
{
/* The static type of(at least) one of the operands could not
* be narrowed further, so we do the operator
* lookup at runtime.
*/
return AtomicComparator::Ptr();
}
const AtomicComparatorLocator::Ptr locator
(static_cast<const AtomicType *>(t1.data())->comparatorLocator());
if(!locator)
{
if(issueError)
{
context->error(QtXmlPatterns::tr("No comparisons can be done involving the type %1.")
.arg(formatType(context->namePool(), t1)),
errorCode, static_cast<const TSubClass *>(this)->actualReflection());
}
return AtomicComparator::Ptr();
}
const AtomicComparator::Ptr comp(static_cast<const AtomicType *>(t2.data())->accept(locator, operatorID(),
static_cast<const TSubClass *>(this)->actualReflection()));
if(comp)
return comp;
else if(issueError)
{
context->error(QtXmlPatterns::tr("Operator %1 is not available between atomic values of type %2 and %3.")
.arg(formatKeyword(AtomicComparator::displayName(operatorID(),
comparisonType)),
formatType(context->namePool(), t1),
formatType(context->namePool(), t2)),
errorCode, static_cast<const TSubClass *>(this)->actualReflection());
}
return AtomicComparator::Ptr();
}
示例3: formatKeyword
void Template::raiseXTSE0680(const ReportContext::Ptr &context,
const QXmlName &name,
const SourceLocationReflection *const reflection)
{
context->error(QtXmlPatterns::tr("The parameter %1 is passed, but no corresponding %2 exists.")
.arg(formatKeyword(context->namePool(), name),
formatKeyword(QLatin1String("xsl:param"))),
ReportContext::XTSE0680,
reflection);
}
示例4: retrieveUnparsedText
bool AccelTreeResourceLoader::retrieveUnparsedText(const QUrl &uri,
const QString &encoding,
const ReportContext::Ptr &context,
const SourceLocationReflection *const where)
{
const AutoPtr<QNetworkReply> reply(load(uri, m_networkAccessDelegator, context));
if(!reply)
return false;
const QTextCodec * codec;
if(encoding.isEmpty())
{
/* XSL Transformations (XSLT) Version 2.0 16.2 Reading Text Files:
*
* "if the media type of the resource is text/xml or application/xml
* (see [RFC2376]), or if it matches the conventions text/\*+xml or
* application/\*+xml (see [RFC3023] and/or its successors), then the
* encoding is recognized as specified in [XML 1.0]"
*/
codec = QTextCodec::codecForMib(106);
}
else
{
codec = QTextCodec::codecForName(encoding.toLatin1());
if(codec && context)
{
context->error(QtXmlPatterns::tr("%1 is an unsupported encoding.").arg(formatURI(encoding)),
ReportContext::XTDE1190,
where);
}
else
return false;
}
QTextCodec::ConverterState converterState;
const QByteArray inData(reply->readAll());
const QString result(codec->toUnicode(inData.constData(), inData.length(), &converterState));
if(converterState.invalidChars)
{
if(context)
{
context->error(QtXmlPatterns::tr("%1 contains octets which are disallowed in "
"the requested encoding %2.").arg(formatURI(uri),
formatURI(encoding)),
ReportContext::XTDE1190,
where);
}
else
return false;
}
const int len = result.length();
/* This code is a candidate for threading. Divide and conqueror. */
for(int i = 0; i < len; ++i)
{
if(!QXmlUtils::isChar(result.at(i)))
{
if(context)
{
context->error(QtXmlPatterns::tr("The codepoint %1, occurring in %2 using encoding %3, "
"is an invalid XML character.").arg(formatData(result.at(i)),
formatURI(uri),
formatURI(encoding)),
ReportContext::XTDE1190,
where);
}
else
return false;
}
}
m_unparsedTexts.insert(qMakePair(uri, encoding), result);
return true;
}
示例5: streamToReceiver
//.........这里部分代码省略.........
reader.readNext();
switch(reader.tokenType())
{
case QXmlStreamReader::StartElement:
{
/* Send the name. */
receiver->startElement(np->allocateQName(reader.namespaceUri().toString(), reader.name().toString(),
reader.prefix().toString()), reader.lineNumber(), reader.columnNumber());
/* Send namespace declarations. */
const QXmlStreamNamespaceDeclarations &nss = reader.namespaceDeclarations();
/* The far most common case, is for it to be empty. */
if(!nss.isEmpty())
{
const int len = nss.size();
for(int i = 0; i < len; ++i)
{
const QXmlStreamNamespaceDeclaration &ns = nss.at(i);
receiver->namespaceBinding(np->allocateBinding(ns.prefix().toString(), ns.namespaceUri().toString()));
}
}
/* Send attributes. */
const QXmlStreamAttributes &attrs = reader.attributes();
const int len = attrs.size();
for(int i = 0; i < len; ++i)
{
const QXmlStreamAttribute &attr = attrs.at(i);
receiver->attribute(np->allocateQName(attr.namespaceUri().toString(), attr.name().toString(),
attr.prefix().toString()),
attr.value());
}
continue;
}
case QXmlStreamReader::EndElement:
{
receiver->endElement();
continue;
}
case QXmlStreamReader::Characters:
{
if(reader.isWhitespace())
receiver->whitespaceOnly(reader.text());
else
receiver->characters(reader.text());
continue;
}
case QXmlStreamReader::Comment:
{
receiver->comment(reader.text().toString());
continue;
}
case QXmlStreamReader::ProcessingInstruction:
{
receiver->processingInstruction(np->allocateQName(QString(), reader.processingInstructionTarget().toString()),
reader.processingInstructionData().toString());
continue;
}
case QXmlStreamReader::StartDocument:
{
receiver->startDocument();
continue;
}
case QXmlStreamReader::EndDocument:
{
receiver->endDocument();
continue;
}
case QXmlStreamReader::EntityReference:
/* Fallthrough. */
case QXmlStreamReader::DTD:
{
/* We just ignore any DTD and entity references. */
continue;
}
case QXmlStreamReader::Invalid:
{
if(context)
context->error(escape(reader.errorString()), ReportContext::FODC0002, QSourceLocation(uri, reader.lineNumber(), reader.columnNumber()));
return false;
}
case QXmlStreamReader::NoToken:
{
Q_ASSERT_X(false, Q_FUNC_INFO,
"This token is never expected to be received.");
return false;
}
}
}
return true;
}
示例6: Ptr
AtomicMathematician::Ptr
ArithmeticExpression::fetchMathematician(Expression::Ptr &op1,
Expression::Ptr &op2,
const AtomicMathematician::Operator op,
const bool issueError,
const ReportContext::Ptr &context,
const SourceLocationReflection *const reflection,
const ReportContext::ErrorCode code,
const bool isCompat)
{
ItemType::Ptr t1(op1->staticType()->itemType());
ItemType::Ptr t2(op2->staticType()->itemType());
if(BuiltinTypes::xsUntypedAtomic->xdtTypeMatches(t1)
|| (isCompat && (BuiltinTypes::xsString->xdtTypeMatches(t1)
|| BuiltinTypes::xsDecimal->xdtTypeMatches(t1))))
{
op1 = Expression::Ptr(new UntypedAtomicConverter(op1, BuiltinTypes::xsDouble));
/* The types might have changed, reload. */
t1 = op1->staticType()->itemType();
}
if(BuiltinTypes::xsUntypedAtomic->xdtTypeMatches(t2)
|| (isCompat && (BuiltinTypes::xsString->xdtTypeMatches(t1)
|| BuiltinTypes::xsDecimal->xdtTypeMatches(t1))))
{
op2 = Expression::Ptr(new UntypedAtomicConverter(op2, BuiltinTypes::xsDouble));
/* The types might have changed, reload. */
t2 = op2->staticType()->itemType();
}
const AtomicMathematicianLocator::Ptr locator
(static_cast<const AtomicType *>(t1.data())->mathematicianLocator());
if(!locator)
{
if(!issueError)
return AtomicMathematician::Ptr();
context->error(QtXmlPatterns::tr(
"Operator %1 cannot be used on type %2.")
.arg(formatKeyword(AtomicMathematician::displayName(op)))
.arg(formatType(context->namePool(), t1)),
code, reflection);
return AtomicMathematician::Ptr();
}
const AtomicMathematician::Ptr comp
(static_cast<const AtomicType *>(t2.data())->accept(locator, op, reflection));
if(comp)
return comp;
if(!issueError)
return AtomicMathematician::Ptr();
context->error(QtXmlPatterns::tr("Operator %1 cannot be used on "
"atomic values of type %2 and %3.")
.arg(formatKeyword(AtomicMathematician::displayName(op)))
.arg(formatType(context->namePool(), t1))
.arg(formatType(context->namePool(), t2)),
code, reflection);
return AtomicMathematician::Ptr();
}