当前位置: 首页>>代码示例>>C++>>正文


C++ ActionSet::overrides方法代码示例

本文整理汇总了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.");
    }
}
开发者ID:robguima,项目名称:ironbee,代码行数:57,代码来源:xrules_acls.cpp


注:本文中的ActionSet::overrides方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。