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


C++ CStringList::join方法代码示例

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


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

示例1: load

bool CWordFilter::load(char *pFile)
{
	for (int i = 0; i < WordList.count(); i++)
		delete (WordMatch *)WordList[i];
	WordList.clear();
	CStringList lines;
	lines.load(pFile);
	if(lines.count() < 1)
		return false;

	for (int i = 0; i < lines.count(); i++)
	{
		CStringList words;
		words.load(lines[i].text(), " ");
		if (words.count() <= 0)
			continue;

		if (words[0] == "WARNMESSAGE")
		{
			words.remove(0);
			warnmessage = words.join(" ");
		}
			else if (words[0] == "SHOWWORDSTORC")
		{
			showtorc = CHECK_BOOL(words[1].text());
		}
			else if (words[0] == "RULE")
		{
			WordMatch *word = new WordMatch();
			memset(word->check, false, sizeof(word->check));
			memset(word->action, false, sizeof(word->action));

			for (i++; i < lines.count() && lines[i] != "RULEEND"; i++)
			{
				words.load(lines[i].text(), " ");
				if (words.count() <= 0)
					continue;

				if (words[0] == "ACTION" && words.count() >= 2)
				{
					for (int ii = 1; ii < words.count(); ii++)
					{
						if (words[ii] == "ban") word->action[FILTERA_BAN] = true;
						else if (words[ii] == "jail") word->action[FILTERA_JAIL] = true;
						else if (words[ii] == "log") word->action[FILTERA_LOG] = true;
						else if (words[ii] == "replace") word->action[FILTERA_REPLACE] = true;
						else if (words[ii] == "tellrc") word->action[FILTERA_TELLRC] = true;
						else if (words[ii] == "warn") word->action[FILTERA_WARN] = true;
					}
				}
					else if (words[0] == "CHECK" && words.count() >= 2)
				{
					for (int ii = 1; ii < words.count(); ii++)
					{
						if (words[ii] == "chat") word->check[FILTERC_CHAT] = true;
						else if (words[ii] == "nick") word->check[FILTERC_NICK] = true;
						else if (words[ii] == "pm") word->check[FILTERC_PM] = true;
						else if (words[ii] == "toall") word->check[FILTERC_TOALL] = true;
					}
				}
					else if (words[0] == "MATCH" && words.count() >= 2)
				{
					words.remove(0);
					word->match = words.join(" ");
				}
					else if (words[0] == "PRECISION" && words.count() == 2)
				{
					word->precision = (words[1].find('%') >= 0 ? word->match.length() * atoi(words[1].text()) / 100 : atoi(words[1].text()));
				}
					else if (words[0] == "WORDPOSITION" && words.count() == 2)
				{
					if (words[1] == "full") word->position = FILTERP_FULL;
					else if (words[1] == "part") word->position = FILTERP_PART;
					else if (words[1] == "start") word->position = FILTERP_START;
				}
					else if (words[0] == "WARNMESSAGE" && words.count() >= 2)
				{
					words.remove(0);
					word->warnmessage = words.join(" ");
				}
			}

			if (word->precision <= 0)
				word->precision = word->match.length();

			WordList.add(word);
		}
	}

	return true;
}
开发者ID:Guthius,项目名称:gs2emu-googlecode,代码行数:91,代码来源:CWordFilter.cpp


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