本文整理汇总了C++中ActionSet::overrides方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionSet::overrides方法的具体用法?C++ ActionSet::overrides怎么用?C++ ActionSet::overrides使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionSet
的用法示例。
在下文中一共展示了ActionSet::overrides方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xrule_impl
void XRuleTime::xrule_impl(
IronBee::Transaction tx,
ActionSet& actions
)
{
if (actions.overrides(m_action)) {
/* Get tx start time, shifted into the local time zone. */
boost::posix_time::ptime tx_start =
tx.started_time() + m_zone_info->base_utc_offset();
std::ostringstream os;
std::locale loc(
os.getloc(),
new boost::posix_time::time_facet("%H:%M:%S"));
os.imbue(loc);
os << "Checking current time "
<< tx_start
<< " against window "
<< m_start_time
<< "-"
<< m_end_time
<< ".";
ib_log_debug_tx(tx.ib(), "%s", os.str().c_str());
bool in_window = (
m_start_time.time_of_day() <= tx_start.time_of_day() &&
tx_start.time_of_day() < m_end_time.time_of_day()
);
// If any days of the week are specified in our window...
if (m_days.size() > 0) {
// ...get the day of the week...
short dow =
boost::gregorian::gregorian_calendar::day_of_week(
tx_start.date().year_month_day());
// ...and update the in_window boolean.
in_window &= (m_days.find(dow) != m_days.end());
}
// If we are in the window specified (considering the
// m_invert member) then execute the associated action.
if (in_window ^ m_invert) {
ib_log_debug_tx(tx.ib(), "XRuleTime was matched.");
actions.set(m_action);
}
else {
ib_log_debug_tx(tx.ib(), "XRuleTime was not matched.");
}
}
else {
ib_log_debug_tx(
tx.ib(),
"Skipping rule as action does not override tx actions.");
}
}