本文整理汇总了C++中Error::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Error::clear方法的具体用法?C++ Error::clear怎么用?C++ Error::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
bool Compiler::load(const char* buffer, Error& error)
{
error.clear();
m_loadBuffer += buffer;
error.state = Error::SUCCESS;
return true;
}
示例2: main
int main(){
Error T("Testing Error Message");
Error e;
cout << T << endl << e << endl << "isClear(): " << (e.isClear() ? "Passed!" : "failed!") << endl;
for (int i = 0; i < 1000000; i++){
e = "Some error message that is really long long long long long long long long"
" long long long long long long long long long long long long long";
}
cout << e << endl << "isClear(): " << (e.isClear() ? "Failed!" : "Passed!") << endl;
e.message("Short Message");
cout << e << endl << e.message() << endl << "isClear(): " << (e.isClear() ? "Failed!" : "Passed!") << endl;
e.clear();
cout << e << endl << "isClear(): " << (e.isClear() ? "Passed!" : "Failed!") << endl;
return 0;
}
示例3: compile
bool Compiler::compile(Error& error)
{
error.clear();
error.step = Error::COMPILATION;
error.state = Error::ERROR;
m_tokenList = MUON_NEW(std::vector<parser::Token>);
m_nodeRoot = MUON_NEW(parser::ASTNode);
// avoid a macro, and avoid duplicating code
auto clearVariable = [&]()
{
m_loadBuffer.clear();
MUON_DELETE(m_tokenList);
MUON_DELETE(m_nodeRoot);
};
if (!lexical(error))
{
clearVariable();
return false;
}
if (!syntaxic(error))
{
clearVariable();
return false;
}
if (!semantic(error))
{
clearVariable();
return false;
}
clearVariable();
error.state = Error::SUCCESS;
return true;
}