本文整理汇总了C++中std::ios_base::failure::what方法的典型用法代码示例。如果您正苦于以下问题:C++ failure::what方法的具体用法?C++ failure::what怎么用?C++ failure::what使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::ios_base::failure
的用法示例。
在下文中一共展示了failure::what方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isCanonicalException
static bool isCanonicalException(const std::ios_base::failure& ex)
{
std::string strExplanatoryString("non-canonical ReadCompactSize()");
return strExplanatoryString == ex.what() ||
// OSX Apple LLVM version 5.0 (OSX 10.9)
strExplanatoryString + ": unspecified iostream_category error" == ex.what();
}
示例2: isCanonicalException
static bool isCanonicalException(const std::ios_base::failure &ex) {
std::ios_base::failure expectedException("non-canonical ReadCompactSize()");
// The string returned by what() can be different for different platforms.
// Instead of directly comparing the ex.what() with an expected string,
// create an instance of exception to see if ex.what() matches the expected
// explanatory string returned by the exception instance.
return strcmp(expectedException.what(), ex.what()) == 0;
}
示例3: ios_base_failure_translator
void ios_base_failure_translator(const std::ios_base::failure &exc)
{
PyErr_SetString(PyExc_IOError, exc.what());
}
示例4: isCanonicalException
static bool isCanonicalException(const std::ios_base::failure& ex)
{
return std::string("non-canonical ReadCompactSize()") == ex.what();
}