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


C++ RuleSet类代码示例

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


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

示例1: renderTarget

		void Builder::build() {

			engine3D->setDisabled(true);


			Rendering::OpenGLRenderer renderTarget(engine3D);
			renderTarget.begin(); // we clear before parsing...

			Preprocessor pp;
			QString out = pp.Process(loadedSystem);
			Tokenizer tokenizer(out);
			EisenParser e(&tokenizer);
			RuleSet* rs = e.parseRuleset();
			rs->resolveNames();
			Model::Builder b(&renderTarget, rs, false);
			b.build();
			if (b.wasCancelled()) throw Exception("User cancelled");

			renderTarget.end();
			engine3D->setRaytracerCommands(b.getRaytracerCommands());
			//INFO(QString("Setting %1 raytracer commands.").arg(raytracerCommands.count()));
			delete(rs);
			rs = 0;

			engine3D->setDisabled(false);
			engine3D->requireRedraw();

		}
开发者ID:heavyimage,项目名称:Structure-Synth,代码行数:28,代码来源:JavaScriptBuilder.cpp

示例2: getEstimateValue

float Value::getEstimateValue(float size, const RuleSet& ruleSet, const boost::shared_ptr<Shape>& shape) const {
	if (type == Value::TYPE_ABSOLUTE) {
		return ruleSet.evalFloat(value, shape);
	} else if (type == Value::TYPE_RELATIVE) {
		return ruleSet.evalFloat(value, shape) * size;
	} else {
		return ruleSet.evalFloat(value, shape);
	}
}
开发者ID:gnishida,项目名称:SketchBasedModelingV2,代码行数:9,代码来源:Rule.cpp

示例3: toString

//---------------------------------------------------------------------------------------------------------------------
    std::string StyleSheet::toString() const
    {
        RuleSet set;
        for (auto const& i : styles_)
        {
            set.rules.push_back(i.getRule());
        }
        return set.toCss();
    }
开发者ID:5cript,项目名称:wretched-css,代码行数:10,代码来源:style_sheet.cpp

示例4: makeRuleSet

 static RuleSet* makeRuleSet(const HeapVector<RuleFeature>& ruleFeatures) {
   if (ruleFeatures.isEmpty())
     return nullptr;
   RuleSet* ruleSet = RuleSet::create();
   for (auto ruleFeature : ruleFeatures)
     ruleSet->addRule(ruleFeature.rule, ruleFeature.selectorIndex,
                      RuleHasNoSpecialState);
   return ruleSet;
 }
开发者ID:ollie314,项目名称:chromium,代码行数:9,代码来源:SharedStyleFinderTest.cpp

示例5: removeRules

int CategoryManager::removeRules(const RuleSet& ruleSet)
{
    int count = 0;
    for (int i = 0; i < ruleSet.maxNumRules(); ++i) {
        const Rule *rule = ruleSet.getRuleById(i);
        if (rule) {
            count += removeRule(*rule);
        }
    }
    return count;
}
开发者ID:AlisdairM,项目名称:bde,代码行数:11,代码来源:ball_categorymanager.cpp

示例6: makeRuleSet

static RuleSet* makeRuleSet(const HeapVector<RuleFeature>& rules) {
  size_t size = rules.size();
  if (!size)
    return nullptr;
  RuleSet* ruleSet = RuleSet::create();
  for (size_t i = 0; i < size; ++i) {
    ruleSet->addRule(rules[i].rule, rules[i].selectorIndex,
                     rules[i].hasDocumentSecurityOrigin
                         ? RuleHasDocumentSecurityOrigin
                         : RuleHasNoSpecialState);
  }
  return ruleSet;
}
开发者ID:mirror,项目名称:chromium,代码行数:13,代码来源:CSSGlobalRuleSet.cpp

示例7: collectRulesFromUserStyleSheets

void DocumentRuleSets::collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet>>& userSheets, RuleSet& userStyle, const MediaQueryEvaluator& medium, StyleResolver& resolver)
{
    for (unsigned i = 0; i < userSheets.size(); ++i) {
        ASSERT(userSheets[i]->contents().isUserStyleSheet());
        userStyle.addRulesFromSheet(userSheets[i]->contents(), medium, &resolver);
    }
}
开发者ID:valbok,项目名称:WebKitForWayland,代码行数:7,代码来源:DocumentRuleSets.cpp

示例8: init_io

bool
Forest::
init_io(RuleSet& ruleSet)
{
	clock_t sec=clock();
	for(int i=0;(size_t)i<_sentence.size();i++)
	{
		Node& node=(*this)[i][i];
		string wrd=_sentence[i];
		pair<RuleSet::RSIter,RuleSet::RSIter> iterPair=ruleSet.query(wrd);
		for(RuleSet::RSIter iter=iterPair.first;iter!=iterPair.second;iter++)
		{
			double ruleScore=iter->second.prob; //when io, we use the original prob, not log
			Label label;
			label.init(iter->second.left,i,i,wrd);
			//label.word()=wrd;
			//jout<<wrd<<endl;
			label.addPreTermScore_io(ruleScore);
			if(node.find(label.nt())==node.end())
				node[label.nt()]=label;
		}
		genUnaryNode_io(ruleSet,(*this)[i][i]);
	}
	initime+=clock()-sec;
	//exit(1);
	return true;
}
开发者ID:lixiangnlp,项目名称:egret,代码行数:27,代码来源:Forest.cpp

示例9: genUnaryNode_io

bool genUnaryNode_io(RuleSet& ruleSet,Node& node)
{
	bool mark=false;
	vector<string> ntPool;
	ntPool.clear();
	node.setUnaryInOrder(ruleSet,ntPool);
	
	for(int i=0;(size_t)i<ntPool.size();i++)
	{
		string rightPart=ntPool[i];
		Label& oldLb=node[rightPart];
		pair<RuleSet::RSIter,RuleSet::RSIter> iterPair=ruleSet.query(rightPart);
		for(RuleSet::RSIter iter=iterPair.first;iter!=iterPair.second;iter++)
		{
			string leftPart=iter->second.left;
			if(node.find(leftPart)==node.end())
			{
				ntPool.push_back(leftPart);
				Label newLabel;
				newLabel.init(leftPart,oldLb.start(),oldLb.stop());
				node[leftPart]=newLabel;
			}
			double ruleScore=iter->second.prob;
			//cerr<<"\n"<<leftPart<<"--->add Child: "<<rightPart<<endl;
			node[leftPart].addChild_io(&oldLb,ruleScore);
			mark=true;
		}
	}
	return mark;
}
开发者ID:lixiangnlp,项目名称:egret,代码行数:30,代码来源:Forest.cpp

示例10: addRules

void TreeBoundaryCrossingRules::addTreeBoundaryCrossingRules(const RuleSet& authorRules, ContainerNode& scopingNode, CSSStyleSheet* parentStyleSheet)
{
    if (authorRules.treeBoundaryCrossingRules().isEmpty() && (scopingNode.isDocumentNode() || authorRules.shadowDistributedRules().isEmpty()))
        return;
    OwnPtrWillBeRawPtr<RuleSet> ruleSetForScope = RuleSet::create();
    addRules(ruleSetForScope.get(), authorRules.treeBoundaryCrossingRules());
    if (!scopingNode.isDocumentNode())
        addRules(ruleSetForScope.get(), authorRules.shadowDistributedRules());

    if (!m_treeBoundaryCrossingRuleSetMap.contains(&scopingNode)) {
        m_treeBoundaryCrossingRuleSetMap.add(&scopingNode, adoptPtrWillBeNoop(new CSSStyleSheetRuleSubSet()));
        m_scopingNodes.add(&scopingNode);
    }
    CSSStyleSheetRuleSubSet* ruleSubSet = m_treeBoundaryCrossingRuleSetMap.get(&scopingNode);
    ruleSubSet->append(std::make_pair(parentStyleSheet, ruleSetForScope.release()));
}
开发者ID:darktears,项目名称:blink-crosswalk,代码行数:16,代码来源:TreeBoundaryCrossingRules.cpp

示例11: apply_and_gather

	void RuleSet:: apply_and_gather (const Nodes_t& n,   RuleSet& use, strings_t& into) {
		for (auto i : n) {
			stringstream ss;
			RedirectStream (cout, ss);
			use.apply_to (*i);
			into .push_back (ss.str());
		}
	}
开发者ID:txjohnson,项目名称:sext,代码行数:8,代码来源:sext.cpp

示例12: fputs

int RuleSet::checkRuleFile(const QString &rulefile) {
  if(rulefile.isEmpty()) {
    fputs(i18n("kppp: no rulefile specified\n").toLocal8Bit(), stderr);
    return 1;
  }

  QFile fl(rulefile);
  if(!fl.exists()) {
    fprintf(stderr, i18n("kppp: rulefile \"%s\" not found\n").toLocal8Bit(), rulefile.toLocal8Bit().data());
    return 1;
  }

  if(rulefile.right(4) != ".rst") {
    fputs(i18n("kppp: rulefiles must have the extension \".rst\"\n").toLocal8Bit(), stderr);
    return 1;
  }

  RuleSet r;
  int err = r.load(rulefile);
  fl.close();

  if(err == -1) {
    fputs(i18n("kppp: error parsing the ruleset\n").toLocal8Bit(), stderr);
    return 1;
  }

  if(err > 0) {
    fprintf(stderr, i18n("kppp: parse error in line %d\n").toLocal8Bit(), err);
    return 1;
  }

  // check for the existence of a default rule
  if((r.default_costs < 0) || (r.default_len < 0)) {
    fputs(i18n("kppp: rulefile does not contain a default rule\n").toLocal8Bit(), stderr);
    return 1;
  }

  if(r.name().length() == 0) {
    fputs(i18n("kppp: rulefile does not contain a \"name=...\" line\n").toLocal8Bit(), stderr);
    return 1;
  }

  fputs(i18n("kppp: rulefile is ok\n").toLocal8Bit(), stderr);
  return 0;
}
开发者ID:KDE,项目名称:kppp,代码行数:45,代码来源:ruleset.cpp

示例13: treeScope

void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRules, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex)
{
    bool isDocumentScope = treeScope().rootNode().isDocumentNode();
    if (authorRules.deepCombinatorOrShadowPseudoRules().isEmpty()
        && (isDocumentScope || (authorRules.contentPseudoElementRules().isEmpty() && authorRules.slottedPseudoElementRules().isEmpty())))
        return;

    if (!authorRules.deepCombinatorOrShadowPseudoRules().isEmpty())
        m_hasDeepOrShadowSelector = true;

    OwnPtrWillBeRawPtr<RuleSet> ruleSetForScope = RuleSet::create();
    addRules(ruleSetForScope.get(), authorRules.deepCombinatorOrShadowPseudoRules());

    if (!isDocumentScope) {
        addRules(ruleSetForScope.get(), authorRules.contentPseudoElementRules());
        addRules(ruleSetForScope.get(), authorRules.slottedPseudoElementRules());
    }

    if (!m_treeBoundaryCrossingRuleSet) {
        m_treeBoundaryCrossingRuleSet = adoptPtrWillBeNoop(new CSSStyleSheetRuleSubSet());
        treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(treeScope().rootNode());
    }

    m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, sheetIndex, ruleSetForScope.release()));
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:25,代码来源:ScopedStyleResolver.cpp

示例14: treeScope

void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRules, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex)
{
    bool isDocumentScope = treeScope().rootNode().isDocumentNode();
    if (authorRules.treeBoundaryCrossingRules().isEmpty() && (isDocumentScope || authorRules.shadowDistributedRules().isEmpty()))
        return;

    OwnPtrWillBeRawPtr<RuleSet> ruleSetForScope = RuleSet::create();
    addRules(ruleSetForScope.get(), authorRules.treeBoundaryCrossingRules());

    if (!isDocumentScope)
        addRules(ruleSetForScope.get(), authorRules.shadowDistributedRules());

    if (!m_treeBoundaryCrossingRuleSet) {
        m_treeBoundaryCrossingRuleSet = adoptPtrWillBeNoop(new CSSStyleSheetRuleSubSet());
        treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(treeScope().rootNode());
    }

    m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, sheetIndex, ruleSetForScope.release()));
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:19,代码来源:ScopedStyleResolver.cpp

示例15: ensureAtHostRuleSetFor

void ScopedStyleResolver::addHostRule(StyleRuleHost* hostRule, bool hasDocumentSecurityOrigin, const ContainerNode* scopingNode)
{
    if (!scopingNode)
        return;

    ShadowRoot* shadowRoot = scopingNode->containingShadowRoot();
    if (!shadowRoot || !shadowRoot->host())
        return;

    RuleSet* rule = ensureAtHostRuleSetFor(shadowRoot);

    const Vector<RefPtr<StyleRuleBase> >& childRules = hostRule->childRules();
    AddRuleFlags addRuleFlags = static_cast<AddRuleFlags>(hasDocumentSecurityOrigin ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState);
    for (unsigned i = 0; i < childRules.size(); ++i) {
        StyleRuleBase* hostStylingRule = childRules[i].get();
        if (hostStylingRule->isStyleRule())
            rule->addStyleRule(static_cast<StyleRule*>(hostStylingRule), addRuleFlags);
    }
}
开发者ID:cvsuser-chromium,项目名称:third_party_WebKit,代码行数:19,代码来源:ScopedStyleResolver.cpp


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