• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ rules函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setActive

/*!
  Sets the client's active state to \a act.

  This function does only change the visual appearance of the client,
  it does not change the focus setting. Use
  Workspace::activateClient() or Workspace::requestFocus() instead.

  If a client receives or looses the focus, it calls setActive() on
  its own.

 */
void Client::setActive(bool act)
{
    if (active == act)
        return;
    active = act;
    const int ruledOpacity = active
                             ? rules()->checkOpacityActive(qRound(opacity() * 100.0))
                             : rules()->checkOpacityInactive(qRound(opacity() * 100.0));
    setOpacity(ruledOpacity / 100.0);
    workspace()->setActiveClient(act ? this : NULL, Allowed);

    if (active)
        Notify::raise(Notify::Activate);

    if (!active)
        cancelAutoRaise();

    if (!active && shade_mode == ShadeActivated)
        setShade(ShadeNormal);

    StackingUpdatesBlocker blocker(workspace());
    workspace()->updateClientLayer(this);   // active windows may get different layer
    ClientList mainclients = mainClients();
    for (ClientList::ConstIterator it = mainclients.constBegin();
            it != mainclients.constEnd();
            ++it)
        if ((*it)->isFullScreen())  // fullscreens go high even if their transient is active
            workspace()->updateClientLayer(*it);
    if (decoration != NULL)
        decoration->activeChange();
    emit activeChanged();
    updateMouseGrab();
    updateUrgency(); // demand attention again if it's still urgent
    workspace()->checkUnredirect();
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:46,代码来源:activation.cpp


示例2: rules

String AbnfRuleList::toString () const
{
	Vector<AbnfRule *>::const_iterator it = rules().cbegin();
	Vector<AbnfRule *>::const_iterator itEnd = rules().cend();

	String r;

	for (; it != itEnd; ++it) {
		r << (*it)->toString();
		if (! r.endsWith(String::EndOfLine))
			r << String::EndOfLine;
		r << String::EndOfLine;
	}

	return r;
}
开发者ID:semenovf,项目名称:cwt-abnf,代码行数:16,代码来源:abnf.cpp


示例3: attachOpaque

//
// Generate and attach an ad-hoc opaque signature
// Use SHA-1 digests because that's what the whitelist is made with
//
static void attachOpaque(SecStaticCodeRef code, SecAssessmentFeedback feedback)
{
	CFTemp<CFDictionaryRef> rules("{"	// same resource rules as used for collection
		"rules={"
			"'^.*' = #T"
			"'^Info\\.plist$' = {omit=#T,weight=10}"
		"},rules2={"
			"'^(Frameworks|SharedFrameworks|Plugins|Plug-ins|XPCServices|Helpers|MacOS)/' = {nested=#T, weight=0}" 
			"'^.*' = #T"
			"'^Info\\.plist$' = {omit=#T,weight=10}"
			"'^[^/]+$' = {top=#T, weight=0}"
		"}"
	"}");

	CFRef<CFDataRef> signature = CFDataCreateMutable(NULL, 0);
	CFTemp<CFDictionaryRef> arguments("{%O=%O, %O=#N, %O=%d, %O=%O}",
		kSecCodeSignerDetached, signature.get(),
		kSecCodeSignerIdentity, /* kCFNull, */
		kSecCodeSignerDigestAlgorithm, kSecCodeSignatureHashSHA1,
		kSecCodeSignerResourceRules, rules.get());
	CFRef<SecCodeSignerRef> signer;
	SecCSFlags creationFlags = kSecCSSignOpaque | kSecCSSignNoV1 | kSecCSSignBundleRoot;
	SecCSFlags operationFlags = 0;

	if (feedback)
		operationFlags |= kSecCSReportProgress;
	MacOSError::check(SecStaticCodeSetCallback(code, kSecCSDefaultFlags, NULL, ^CFTypeRef(SecStaticCodeRef code, CFStringRef stage, CFDictionaryRef info) {
		if (CFEqual(stage, CFSTR("progress"))) {
			bool proceed = feedback(kSecAssessmentFeedbackProgress, info);
			if (!proceed)
				SecStaticCodeCancelValidation(code, kSecCSDefaultFlags);
		}
		return NULL;
	}));
开发者ID:darlinghq,项目名称:darling-security,代码行数:38,代码来源:opaquewhitelist.cpp


示例4: main

void main()
{
	Game Game1;
	STATE current = INIT;
	
	while (true)
	{
		switch (current)
		{
		case INIT:
			splash();
		case MAIN:
			current = MainMenu();
			break;
		case PLAY:
			Game1.newGame();
		case GAME:
			current = Game1.update();
			break;
		case RULES: 
			current = rules();
			break;
		case EXIT:
			exit();
			return;
		}
	}
}
开发者ID:No-Face-the-3rd,项目名称:Hunt-the-Wumpus,代码行数:28,代码来源:main.cpp


示例5: action

void action(int ignored)
{
  signal(SIGALRM,action);
 
  if (rotall || rotcore)
     if (!(rtimer--)) {
	rtimer=rotdelay;
	pmove();
     }
  
  if (!(mtimer--)) {
    mtimer=mesdelay;
    funnymessage();
  }

  if (topgun) {
      if (!(ttimer--)) {
        stop_topgun();
	topgun = 0;
	ttimer=topgundelay;
      }
     topgunships();
     if ((ttimer > 0) && ((ttimer % 120) == 0))  {
	sprintf(buf, ">                -= T O P    G U N =-      (%d min. left) ", (ttimer/60));
	amessage(buf , 0, MALL);
	rules();
      }    
   } else
     if (!(ttimer--)) {
        start_topgun();
	topgun = 1;
	ttimer=topguntime;
     }

}
开发者ID:timothyzillion,项目名称:netrek,代码行数:35,代码来源:fun.c


示例6: main

int main() {
	std::cout << "\033[?25l";
	std::istringstream in("abbbbbd");
	Tape t(&in);

	IMachine* m = new Machine();

	std::istringstream rules("z1,a,b,left,z2\nz3,b,c,right,z3\nz2,-,X,right,z3");
	m->loadRules(&rules);
	m->setTape(&t);

	m->setState("unknown");
	m->step();

	m->setState("z1");
	std::cout << "state: " << m->getState() << std::endl;

	do {
		t.dump(std::cout);
	} while(m->step());

	m->step();

	std::cout << "state: " << m->getState() << std::endl;

	delete m;

	std::cout << "\033[?25h" << std::endl;
}
开发者ID:hoax,项目名称:Turing,代码行数:29,代码来源:MachineTest.cpp


示例7: main

//定义每一个函数//
int main()
{
	begin();
	int i;
	fp=fopen("排行榜","r");
    for(i=0;i<5;i++)
	    fread(&end_score[i],2,1,fp);
	fclose(fp);
	MOUSEMSG m;                           //定义鼠标消息//
    while(true)
	{
	  m=GetMouseMsg();
	  switch(m.uMsg)
	  {
	  case WM_LBUTTONDOWN:
	   if(m.x>=10&&m.y>=130&&m.y<=200&&m.x<=290)
	       design_cp1();
	   if(m.x>=10&&m.y>=230&&m.y<=300&&m.x<=290)
		   rules();
       if(m.x>=10&&m.y>=330&&m.y<=400&&m.x<=290)
		   select();
	   if(m.x>=10&&m.y>=430&&m.y<=500&&m.x<=290)
		   see_rank();
	   if(m.x>=10&&m.y>=530&&m.y<=600&&m.x<=290)
		   exit(0);
	  }
	}
    return 0;
}
开发者ID:lxyeinsty,项目名称:SnakeByC,代码行数:30,代码来源:snake.cpp


示例8: rules

unsigned int
ExpressionBuilder::EBTerm::substitute(const EBSubstitutionRule & rule)
{
  EBSubstitutionRuleList rules(1);
  rules[0] = &rule;
  return substitute(rules);
}
开发者ID:jasonmhite,项目名称:moose,代码行数:7,代码来源:ExpressionBuilder.C


示例9: Registrable

		Edge::Edge(
			Path* parentPath,
			size_t rankInPath,
			Vertex* fromVertex,
			double metricOffset
		):	Registrable(0),
			_fromVertex(fromVertex),
			_parentPath (parentPath),
			_metricOffset(metricOffset),
			_rankInPath (rankInPath),
			_previous(NULL),
			_previousConnectionDeparture(NULL),
			_previousDepartureForFineSteppingOnly(NULL),
			_followingConnectionArrival(NULL),
			_followingArrivalForFineSteppingOnly(NULL),
			_next(NULL),
			_departureIndex(INDICES_NUMBER),
			_arrivalIndex(INDICES_NUMBER),
			_serviceIndexUpdateNeeded (true),
			_RTserviceIndexUpdateNeeded(true)
		{
			// Default accessibility
			RuleUser::Rules rules(RuleUser::GetEmptyRules());
			rules[USER_PEDESTRIAN - USER_CLASS_CODE_OFFSET] = AllowedUseRule::INSTANCE.get();
			rules[USER_BIKE - USER_CLASS_CODE_OFFSET] = AllowedUseRule::INSTANCE.get();
			rules[USER_HANDICAPPED - USER_CLASS_CODE_OFFSET] = AllowedUseRule::INSTANCE.get();
			rules[USER_CAR - USER_CLASS_CODE_OFFSET] = AllowedUseRule::INSTANCE.get();
			setRules(rules);
		}
开发者ID:Tisseo,项目名称:synthese,代码行数:29,代码来源:Edge.cpp


示例10: if

value::Value* Agent::observation(
    const devs::ObservationEvent& event) const
{
    const std::string port = event.getPortName();

    if (port == "KnowledgeBase") {
        std::stringstream out;
        out << *this;
        return new value::String(out.str());
    } else if (port == "Activities") {
        std::stringstream out;
        out << activities();
        return new value::String(out.str());
    } else if ((port.compare(0, 9, "Activity_") == 0) and port.size() > 9) {
        std::string activity(port, 9, std::string::npos);
        const Activity& act(activities().get(activity)->second);
        std::stringstream out;
        out << act.state();
        return new value::String(out.str());
    } else if ((port.compare(0, 6, "Rules_") == 0) and port.size() > 6) {
        std::string rule(port, 6, std::string::npos);
        const Rule& ru(rules().get(rule));
        return new value::Boolean(ru.isAvailable());
    }
    return 0;
}
开发者ID:GG31,项目名称:packages,代码行数:26,代码来源:Agent.cpp


示例11: Search

void FastMKS<KernelType, TreeType>::Search(TreeType* queryTree,
                                           const size_t k,
                                           arma::Mat<size_t>& indices,
                                           arma::mat& kernels)
{
  // If either naive mode or single mode is specified, this must fail.
  if (naive || singleMode)
  {
    throw std::invalid_argument("can't call Search() with a query tree when "
        "single mode or naive search is enabled");
  }

  // No remapping will be necessary because we are using the cover tree.
  indices.set_size(k, queryTree->Dataset().n_cols);
  kernels.set_size(k, queryTree->Dataset().n_cols);
  kernels.fill(-DBL_MAX);

  Timer::Start("computing_products");
  typedef FastMKSRules<KernelType, TreeType> RuleType;
  RuleType rules(referenceSet, queryTree->Dataset(), indices, kernels,
      metric.Kernel());

  typename TreeType::template DualTreeTraverser<RuleType> traverser(rules);

  traverser.Traverse(*queryTree, *referenceTree);

  Log::Info << rules.BaseCases() << " base cases." << std::endl;
  Log::Info << rules.Scores() << " scores." << std::endl;

  Timer::Stop("computing_products");
}
开发者ID:0x0all,项目名称:mlpack,代码行数:31,代码来源:fastmks_impl.hpp


示例12: start

void start()
{
    char a;
    char choice=0;
    int i=0;

    rules();
    printf("Aby rozpoczac losowanie, wpisz 1: ");

    while(a=getchar())
    {
        if(i==0)
        {
            if(a=='1') choice = a;
            else choice = 0;
            i++;
        }
        else
        {
            if(choice&&i==1&&a=='\n')
                deal();
            else if (a=='\n') {
                printf("Niewlasciwa komenda!\n");
                i=0;
            }
            else i++;

        }/*else*/
        if(choice=='1'&&a=='\n'&&i==1) break;
    }

}/*start()*/
开发者ID:qiubix,项目名称:Cyclops,代码行数:32,代码来源:testing2.c


示例13: playGameAgainst

void playGameAgainst(Agent *agent0, Agent *agent1) {
  GameRules rules(4);

  vector<Agent *> players{agent1, agent0};
  unsigned curIndex = 0; // rand()%players.size();

  uptr<State> gameState(GameState::NewEmptyGameState(4, 4));

  while (true) {
    Agent *curPlayer = players[curIndex];

    uptr<Action> action = curPlayer->ChooseAction(gameState.get());
    uptr<State> successor = gameState->SuccessorState(*action);

    bool isWin = rules.IsWin(*successor);
    bool isFinished = rules.IsTerminalState(*successor);

    if (isWin || isFinished) {
      cout << "end of game!" << endl;
      if (isWin) {
        cout << "player" << curIndex << " is the winner" << endl;
      } else {
        cout << "its a draw" << endl;
      }
      successor->Output(cout);

      break;
    }

    gameState = successor->Clone();
    static_cast<GameState *>(gameState.get())->FlipState(); // TODO: this is a bit hacky.
    curIndex = (curIndex + 1) % players.size();
  }
}
开发者ID:Rocky3X,项目名称:mcts,代码行数:34,代码来源:main.cpp


示例14: random

void Rule31Pattern::updateCells() {
    uint8_t nextCell = (currentCell+1) %2;
    for (uint8_t i =0; i<numLeds;i++){
        cells[nextCell][i] =rules(cells[currentCell][i-1],cells[currentCell][i],cells[currentCell][(i+1)%numLeds]);
        cellColors[i] += cells[nextCell][i] ? random(5) :-1*random(5);
    }
    currentCell =nextCell;
}
开发者ID:talolard,项目名称:FLPP,代码行数:8,代码来源:Rule30Pattern.cpp


示例15: NativeCollation_openCollatorFromRules

static jint NativeCollation_openCollatorFromRules(JNIEnv* env, jclass, jstring rules0, jint mode, jint strength) {
    ScopedJavaUnicodeString rules(env, rules0);
    UErrorCode status = U_ZERO_ERROR;
    UCollator* c = ucol_openRules(rules.unicodeString().getBuffer(), rules.unicodeString().length(),
            UColAttributeValue(mode), UCollationStrength(strength), NULL, &status);
    icu4jni_error(env, status);
    return static_cast<jint>(reinterpret_cast<uintptr_t>(c));
}
开发者ID:OMFGB,项目名称:libcore,代码行数:8,代码来源:NativeCollation.cpp


示例16: sendCommand

void Dynamic::start(const QString &name)
{
    if (isRemote()) {
        sendCommand(SetActive, QStringList() << name << "1");
        return;
    }

    if (Utils::findExe("perl").isEmpty()) {
        emit error(i18n("You need to install \"perl\" on your system in order for Cantata's dynamic mode to function."));
        return;
    }

    QString fName(Utils::dataDir(constDir, false)+name+constExtension);

    if (!QFile::exists(fName)) {
        emit error(i18n("Failed to locate rules file - %1", fName));
        return;
    }

    QString rules(Utils::cacheDir(constDir, true)+constActiveRules);

    QFile::remove(rules);
    if (QFile::exists(rules)) {
        emit error(i18n("Failed to remove previous rules file - %1", rules));
        return;
    }

    if (!QFile::link(fName, rules)) {
        emit error(i18n("Failed to install rules file - %1 -> %2", fName, rules));
        return;
    }

    int i=currentEntry.isEmpty() ? -1 : entryList.indexOf(currentEntry);
    QModelIndex idx=index(i, 0, QModelIndex());

    currentEntry=name;

    if (idx.isValid()) {
        emit dataChanged(idx, idx);
    }

    i=entryList.indexOf(currentEntry);
    idx=index(i, 0, QModelIndex());
    if (idx.isValid()) {
        emit dataChanged(idx, idx);
    }

    if (isRunning()) {
        emit clear();
        return;
    }
    if (controlApp(true)) {
        emit running(isRunning());
        emit clear();
        return;
    }
}
开发者ID:ciotog,项目名称:cantata,代码行数:57,代码来源:dynamic.cpp


示例17: initializeIteratorWithRules

static TextBreakIterator* initializeIteratorWithRules(const char* breakRules)
{
    UParseError parseStatus;
    UErrorCode openStatus = U_ZERO_ERROR;
    String rules(breakRules);
    TextBreakIterator* iterator = reinterpret_cast<TextBreakIterator*>(ubrk_openRules(rules.deprecatedCharacters(), rules.length(), 0, 0, &parseStatus, &openStatus));
    ASSERT_WITH_MESSAGE(U_SUCCESS(openStatus), "ICU could not open a break iterator: %s (%d)", u_errorName(openStatus), openStatus);
    return iterator;
}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:9,代码来源:TextBreakIterator.cpp


示例18: rulescode_produce

void
rulescode_produce(T_PTR_tree entry,
		  transition_system_t **system) {
  /* First memory allocation of the transition system */
  (*system) = (transition_system_t *)xmalloc(sizeof(transition_system_t));
  sys = (*system);
  sys->limits.nbr_variables = nbr_var;
  rules(entry);
}
开发者ID:cryptica,项目名称:mist,代码行数:9,代码来源:codegenrules.c


示例19: rules

void AbstractClient::setSkipSwitcher(bool set)
{
    set = rules()->checkSkipSwitcher(set);
    if (set == skipSwitcher())
        return;
    m_skipSwitcher = set;
    updateWindowRules(Rules::SkipSwitcher);
    emit skipSwitcherChanged();
}
开发者ID:8l,项目名称:kwin,代码行数:9,代码来源:abstract_client.cpp


示例20: NativeCollation_openCollatorFromRules

static jlong NativeCollation_openCollatorFromRules(JNIEnv* env, jclass, jstring javaRules, jint mode, jint strength) {
    ScopedStringChars rules(env, javaRules);
    if (rules.get() == NULL) {
        return -1;
    }
    UErrorCode status = U_ZERO_ERROR;
    UCollator* c = ucol_openRules(rules.get(), rules.size(),
            UColAttributeValue(mode), UCollationStrength(strength), NULL, &status);
    maybeThrowIcuException(env, "ucol_openRules", status);
    return static_cast<jlong>(reinterpret_cast<uintptr_t>(c));
}
开发者ID:dicej,项目名称:android-libcore64,代码行数:11,代码来源:libcore_icu_NativeCollation.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rump_schedule函数代码示例发布时间:2022-05-30
下一篇:
C++ rule函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap