本文整理汇总了C++中Answer::addReason方法的典型用法代码示例。如果您正苦于以下问题:C++ Answer::addReason方法的具体用法?C++ Answer::addReason怎么用?C++ Answer::addReason使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Answer
的用法示例。
在下文中一共展示了Answer::addReason方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validate
/**
* Applies validation on block
* @param block
* @return Answer containing found error if any
*/
Answer validate(const interface::EmptyBlock &block) const {
Answer answer;
ReasonsGroupType reason;
reason.first = "EmptyBlock";
field_validator_.validateCreatedTime(reason, block.createdTime());
field_validator_.validateHeight(reason, block.height());
if (not reason.second.empty()) {
answer.addReason(std::move(reason));
}
return answer;
}
示例2: validate
/**
* Applies validation to given query
* @param qry - query to validate
* @return Answer containing found error if any
*/
Answer validate(const interface::Query &qry) const {
Answer answer;
std::string qry_reason_name = "Query";
ReasonsGroupType qry_reason(qry_reason_name, GroupedReasons());
field_validator_.validateCreatorAccountId(qry_reason,
qry.creatorAccountId());
field_validator_.validateCreatedTime(qry_reason, qry.createdTime());
field_validator_.validateCounter(qry_reason, qry.queryCounter());
if (not qry_reason.second.empty()) {
answer.addReason(std::move(qry_reason));
}
auto reason = boost::apply_visitor(query_field_validator_, qry.get());
if (not reason.second.empty()) {
answer.addReason(std::move(reason));
}
return answer;
}
示例3: validate
/**
* Applies validation to given query
* @param qry - query to validate
* @return Answer containing found error if any
*/
Answer validate(const interface::BlocksQuery &qry) const {
Answer answer;
std::string qry_reason_name = "Blocks query";
ReasonsGroupType qry_reason(qry_reason_name, GroupedReasons());
field_validator_.validateCreatorAccountId(qry_reason,
qry.creatorAccountId());
field_validator_.validateCreatedTime(qry_reason, qry.createdTime());
field_validator_.validateCounter(qry_reason, qry.queryCounter());
if (not qry_reason.second.empty()) {
answer.addReason(std::move(qry_reason));
}
return answer;
}