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


C++ PolicyRule::setAbsRuleNumber方法代码示例

本文整理汇总了C++中PolicyRule::setAbsRuleNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ PolicyRule::setAbsRuleNumber方法的具体用法?C++ PolicyRule::setAbsRuleNumber怎么用?C++ PolicyRule::setAbsRuleNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PolicyRule的用法示例。


在下文中一共展示了PolicyRule::setAbsRuleNumber方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: prolog

int PolicyCompiler::prolog()
{
    Compiler::prolog();

    Policy *policy = Policy::cast(fw->getFirstByType(Policy::TYPENAME));
    assert(policy);

    if (source_ruleset == NULL) source_ruleset = policy;

    source_ruleset->renumberRules();

    temp_ruleset = new Policy();   // working copy of the policy
    fw->add( temp_ruleset );

    temp_ruleset->setName(source_ruleset->getName());

    int global_num = 0;

    string label_prefix = "";
    if (source_ruleset->getName() != "Policy") label_prefix = source_ruleset->getName();

    int rule_counter = 0;
    for (FWObject::iterator i=source_ruleset->begin(); i!=source_ruleset->end(); i++)
    {
	PolicyRule *r = PolicyRule::cast(*i);
        if (r == NULL) continue; // skip RuleSetOptions object

        /*
         * do not remove disabled rules just yet because some
         * compilers might use RuleSet::insertRuleAtTop() and other
         * similar methods from prolog() or
         * addPredefinedPolicyRules()() and these methods renumber
         * rules (labels stop matching rule positions when this is
         * done because labels are configured in prolog() method of
         * the base class. See fwbuilder ticket 1173)
         */
	//if (r->isDisabled()) continue;

        if (r->getLabel().empty())
        {
            RuleElementItf *itfre = r->getItf();
            assert(itfre);

            if (itfre->isAny())
            {
                r->setLabel( createRuleLabel(label_prefix, 
                                             "global", r->getPosition()) );
            } else
            {
                string interfaces = "";
                for (FWObject::iterator i=itfre->begin(); i!=itfre->end(); ++i)
                {
                    FWObject *o = FWReference::getObject(*i);
                    if (interfaces!="") interfaces += ",";
                    interfaces += o->getName();
                }
                r->setLabel( createRuleLabel(label_prefix, 
                                             interfaces, r->getPosition()) );
            }
        }

	r->setAbsRuleNumber(global_num);
        global_num++;
        rule_counter++;
    }

    initialized = true;

    return rule_counter;
}
开发者ID:BrendanThompson,项目名称:fwbuilder,代码行数:70,代码来源:PolicyCompiler.cpp


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