本文整理汇总了C++中ErrorContext::add方法的典型用法代码示例。如果您正苦于以下问题:C++ ErrorContext::add方法的具体用法?C++ ErrorContext::add怎么用?C++ ErrorContext::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorContext
的用法示例。
在下文中一共展示了ErrorContext::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseHash
bool parseHash(const Dictionary& raw, blink::WebCryptoAlgorithm& hash, ErrorContext context, String& errorDetails)
{
Dictionary rawHash;
if (!raw.get("hash", rawHash)) {
errorDetails = context.toString("hash", "Missing or not a dictionary");
return false;
}
context.add("hash");
return parseAlgorithm(rawHash, Digest, hash, context, errorDetails);
}
示例2: parseAlgorithm
bool parseAlgorithm(const Dictionary& raw, AlgorithmOperation op, blink::WebCryptoAlgorithm& algorithm, ErrorContext context, String& errorDetails)
{
context.add("Algorithm");
if (!raw.isObject()) {
errorDetails = context.toString("Not an object");
return false;
}
String algorithmName;
if (!raw.get("name", algorithmName)) {
errorDetails = context.toString("name", "Missing or not a string");
return false;
}
const AlgorithmInfo* info = AlgorithmRegistry::instance().lookupAlgorithmByName(algorithmName);
if (!info) {
errorDetails = context.toString("Unrecognized algorithm name");
return false;
}
context.add(info->algorithmName);
if (info->paramsForOperation[op] == UnsupportedOp) {
errorDetails = context.toString("Unsupported operation");
return false;
}
blink::WebCryptoAlgorithmParamsType paramsType = static_cast<blink::WebCryptoAlgorithmParamsType>(info->paramsForOperation[op]);
OwnPtr<blink::WebCryptoAlgorithmParams> params;
if (!parseAlgorithmParams(raw, paramsType, params, context, errorDetails))
return false;
algorithm = blink::WebCryptoAlgorithm(info->algorithmId, params.release());
return true;
}
示例3: parseAlgorithmParams
bool parseAlgorithmParams(const Dictionary& raw, blink::WebCryptoAlgorithmParamsType type, OwnPtr<blink::WebCryptoAlgorithmParams>& params, ErrorContext& context, String& errorDetails)
{
switch (type) {
case blink::WebCryptoAlgorithmParamsTypeNone:
return true;
case blink::WebCryptoAlgorithmParamsTypeAesCbcParams:
context.add("AesCbcParams");
return parseAesCbcParams(raw, params, context, errorDetails);
case blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams:
context.add("AesKeyGenParams");
return parseAesKeyGenParams(raw, params, context, errorDetails);
case blink::WebCryptoAlgorithmParamsTypeHmacImportParams:
context.add("HmacImportParams");
return parseHmacImportParams(raw, params, context, errorDetails);
case blink::WebCryptoAlgorithmParamsTypeHmacKeyGenParams:
context.add("HmacKeyGenParams");
return parseHmacKeyGenParams(raw, params, context, errorDetails);
case blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams:
context.add("RsaHashedKeyGenParams");
return parseRsaHashedKeyGenParams(raw, params, context, errorDetails);
case blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams:
context.add("RsaHashedImportParams");
return parseRsaHashedImportParams(raw, params, context, errorDetails);
case blink::WebCryptoAlgorithmParamsTypeRsaKeyGenParams:
context.add("RsaKeyGenParams");
return parseRsaKeyGenParams(raw, params, context, errorDetails);
case blink::WebCryptoAlgorithmParamsTypeAesCtrParams:
context.add("AesCtrParams");
return parseAesCtrParams(raw, params, context, errorDetails);
case blink::WebCryptoAlgorithmParamsTypeAesGcmParams:
context.add("AesGcmParams");
return parseAesGcmParams(raw, params, context, errorDetails);
case blink::WebCryptoAlgorithmParamsTypeRsaOaepParams:
// TODO
notImplemented();
break;
}
ASSERT_NOT_REACHED();
return false;
}