本文整理汇总了C++中ParseContext::handleError方法的典型用法代码示例。如果您正苦于以下问题:C++ ParseContext::handleError方法的具体用法?C++ ParseContext::handleError怎么用?C++ ParseContext::handleError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParseContext
的用法示例。
在下文中一共展示了ParseContext::handleError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse
DeckRecord ParserRecord::parse(const ParseContext& parseContext , MessageContainer& msgContainer, RawRecord& rawRecord ) const {
std::vector< DeckItem > items;
items.reserve( this->size() + 20 );
for( const auto& parserItem : *this )
items.emplace_back( parserItem->scan( rawRecord ) );
if (rawRecord.size() > 0) {
std::string msg = "The RawRecord for keyword \"" + rawRecord.getKeywordName() + "\" in file\"" + rawRecord.getFileName() + "\" contained " +
std::to_string(rawRecord.size()) +
" too many items according to the spec. RawRecord was: " + rawRecord.getRecordString();
parseContext.handleError(ParseContext::PARSE_EXTRA_DATA , msgContainer, msg);
}
return { std::move( items ) };
}
示例2: parse
DeckRecord ParserRecord::parse(const ParseContext& parseContext , MessageContainer& msgContainer, RawRecord& rawRecord ) const {
DeckRecord deckRecord( size() + 20 );
for (size_t i = 0; i < size(); i++) {
auto parserItem = get(i);
deckRecord.addItem( parserItem->scan( rawRecord ) );
}
if (rawRecord.size() > 0) {
std::string msg = "The RawRecord for keyword \"" + rawRecord.getKeywordName() + "\" in file\"" + rawRecord.getFileName() + "\" contained " +
std::to_string(rawRecord.size()) +
" too many items according to the spec. RawRecord was: " + rawRecord.getRecordString();
parseContext.handleError(ParseContext::PARSE_EXTRA_DATA , msgContainer, msg);
}
return deckRecord;
}
示例3: checkOptions
void checkOptions(const DeckKeyword& keyword, std::multimap<std::string , PartiallySupported<T> >& map, const ParseContext& parseContext, ErrorGuard& errorGuard)
{
// check for partially supported keywords.
typename std::multimap<std::string, PartiallySupported<T> >::iterator it, itlow, itup;
itlow = map.lower_bound(keyword.name());
itup = map.upper_bound(keyword.name());
for (it = itlow; it != itup; ++it) {
const auto& record = keyword.getRecord(0);
if (record.getItem(it->second.item).template get<T>(0) != it->second.item_value) {
std::string msg = "For keyword '" + it->first + "' only value " + boost::lexical_cast<std::string>(it->second.item_value)
+ " in item " + it->second.item + " is supported by flow.\n"
+ "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n";
parseContext.handleError(ParseContext::SIMULATOR_KEYWORD_ITEM_NOT_SUPPORTED, msg, errorGuard);
}
}
}
示例4: checkKeywords
//.........这里部分代码省略.........
"NEXTSTEP",
"NOCASC",
"NODEPROP",
"NOGGF",
"NOINSPEC",
"NOMONITO",
"NONNC",
"NORSSPEC",
"NOWARN",
"NSTACK",
"NUMRES",
"NUPCOL",
"OILVISCT",
"OLDTRAN",
"OPERATER",
"OPTIONS",
"PARALLEL",
"PBVD",
"PCG",
"PERMR",
"PERMTHT",
"PERMXY",
"PERMYZ",
"PERMZX",
"PIMULTAB",
"PLYADSS",
"PLYDHFLF",
"PPCWMAX",
"REFINE",
"RADFIN4",
"RHO",
"RKTRMDIR",
"ROCKCOMP",
"ROCKOPTS",
"ROCKTAB",
"RPTGRID",
"RPTONLY",
"RPTONLYO",
"RPTPROS",
"PRTRST",
"RPTRUNSP",
"RPTSMRY",
"RPTSOL",
"RSCONST",
"RSCONSTT",
"RTEMP",
"RTEMPA",
"RTEMPVD",
"RUNSUM",
"SATOPTS",
"SAVE",
"SEPARATE",
"SKIP",
"SKIP100",
"SKIP300",
"SKIPREST",
"SPECGRID",
"SUMTHIN",
"TEMP",
"THCONR",
"TRACER",
"TRACERS",
"VAPPARS",
"VISCREF",
"WARN",
"WATVISCT",
"WELPI",
"WELSPECL",
"WGASPROD",
"WINJMULT",
"WLIMTOL",
"WORKTHP",
"WPAVE",
"WPITAB",
"WTEMP",
"WTRACER",
"ZIPPY2" };
std::multimap<std::string, PartiallySupported<std::string> > string_options;
std::multimap<std::string, PartiallySupported<int> > int_options;
addSupported<ParserKeywords::COMPORD, ParserKeywords::COMPORD::ORDER_TYPE, std::string>(string_options , "DEPTH");
addSupported<ParserKeywords::ENDSCALE, ParserKeywords::ENDSCALE::DIRECT, std::string>(string_options, "NODIR");
addSupported<ParserKeywords::ENDSCALE, ParserKeywords::ENDSCALE::IRREVERS, std::string>(string_options, "REVER");
addSupported<ParserKeywords::PINCH, ParserKeywords::PINCH::CONTROL_OPTION, std::string>(string_options, "GAP");
addSupported<ParserKeywords::PINCH, ParserKeywords::PINCH::PINCHOUT_OPTION, std::string>(string_options, "TOPBOT");
addSupported<ParserKeywords::EHYSTR, ParserKeywords::EHYSTR::relative_perm_hyst, int>(int_options , 0);
// check deck and keyword for flow and parser.
for (size_t idx = 0; idx < deck.size(); ++idx) {
const auto& keyword = deck.getKeyword(idx);
std::unordered_set<std::string>::const_iterator it;
it = unsupported_keywords.find(keyword.name());
if (it != unsupported_keywords.end()) {
std::string msg = "Keyword '" + keyword.name() + "' is not supported by flow.\n"
+ "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n";
parseContext.handleError(ParseContext::SIMULATOR_KEYWORD_NOT_SUPPORTED, msg, errorGuard);
}
checkOptions<std::string>(keyword, string_options, parseContext, errorGuard);
checkOptions<int>(keyword, int_options, parseContext, errorGuard);
}
}