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


C++ StringSet::Contains方法代码示例

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


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

示例1:

TEST(StringSetTest, UnionOfTwoStringSets) {
  // Tests the Unions of two sets, including all strings.
  StringSet first, second;
  first.Add("First string.");
  first.Add("Second string.");
  first.Add("Third string.");
  second.Add("First string.");
  second.Add("Second string.");
  StringSet third = first.Union(second);
  EXPECT_TRUE(third.Contains("First string."));
  EXPECT_TRUE(third.Contains("Second string."));
  EXPECT_TRUE(third.Contains("Third string."));
  EXPECT_EQ(3, third.Count());
}
开发者ID:JarvisPrestidge,项目名称:CPP-Testing-Kata,代码行数:14,代码来源:StringSet_unittest.cpp

示例2: Intersection

// Takes two string sets and returns the intersection set.
StringSet StringSet::Intersection(StringSet in_set) {
  StringSet result;
  for (int i = 0; i < this->Count(); ++i)
    if (in_set.Contains(this->GetString(i)))
      result.Add(this->GetString(i));
  return result;
}
开发者ID:JarvisPrestidge,项目名称:CPP-Testing-Kata,代码行数:8,代码来源:StringSet.cpp

示例3: Union

// Takes two string sets and returns the union set.
StringSet StringSet::Union(StringSet in_set) {
  StringSet result;
  for (int i = 0; i < this->Count(); ++i)
    result.Add(this->GetString(i));
  for (int i = 0; i < in_set.Count(); ++i)
    if (!result.Contains(in_set.GetString(i)))
      result.Add(in_set.GetString(i));
  return result;
}
开发者ID:JarvisPrestidge,项目名称:CPP-Testing-Kata,代码行数:10,代码来源:StringSet.cpp

示例4: loadSymbols

// read symbol table
void Database::loadSymbols(wxInputStream &file)
{
    wxTextInputStream str(file, wxT(" \t"), wxConvAuto(wxFONTENCODING_UTF8));
    int c = 0;
    while(!file.Eof())
    {
        wxString line = str.ReadLine();
        if (line.IsEmpty())
            break;

        std::wistringstream stream(line.c_str().AsWChar());
        Symbol *sym = new Symbol;

        stream >> sym->id;
        ::readQuote(stream, sym->module);
        ::readQuote(stream, sym->procname);
        ::readQuote(stream, sym->sourcefile);
        stream >> sym->sourceline;
        sym->isCollapseFunction = osFunctions.Contains(sym->procname.c_str());
        sym->isCollapseModule = osModules.Contains(sym->module.c_str());
        symbols[sym->id] = sym;
    }
}
开发者ID:CyberShadow,项目名称:verysleepy-1,代码行数:24,代码来源:database.cpp

示例5: showFile

void SourceView::showFile(std::string path, int proclinenum, const LINEINFOMAP *lineinfomap)
{
	currentfile = path;

	SetValue("");//clear text
	SetDefaultStyle(wxTextAttr(*wxBLACK));

	if (path == "[hint KiFastSystemCallRet]")
	{
		AppendText(
			" Hint: KiFastSystemCallRet often means the thread was waiting for something else to finish.\n"
			" \n"
			" Possible causes might be disk I/O, waiting for an event, or maybe just calling Sleep().\n"
			);
		return;
	}

	if (path == "" || path == "[unknown]")
	{
		SetValue("[ No source file available for this location. ]");

		return;
	}


	FILE *file = fopen(path.c_str(),"r");
	if(!file)
	{
		char *crtSub = "\\crt\\src\\";
		char *crt = strstr((char *)path.c_str(),crtSub);
		if(crt) {
			for(size_t i=0;i<msDevPaths.size();i++) {
				std::string newPath(msDevPaths[i]);
				newPath += crt+strlen(crtSub);
				path = newPath;
				file = fopen(path.c_str(),"r");
				if(file)
					break;
			}
		}
	}

	if(!file)
	{
		AppendText(std::string("[ Could not open file '" + path + "'. ]").c_str());
		return;
	}

	Show(false);
	std::string displaytext= "{\\rtf1\\ansi\\fdeff0{\\colortbl;\\red0\\green0\\blue0;\\red255\\green0\\blue0;\\red0\\green128\\blue0;\\red0\\green0\\blue255;}\\cf1";
	int linenum = 1;//1-based counting
	//int showpos = 0;//index of character to make visible in order to scroll to line where proc is defined.
	const int MARGIN_WIDTH = 7;
	char line[1024*10];
	bool block=false;
	char blockType;
	while(fgets(line,sizeof(line),file))
	{
		char outLine[1024*20];
		LINEINFOMAP::const_iterator result = lineinfomap->find(linenum);
		
		if(result != lineinfomap->end()) {
			sprintf(outLine,"{\\b\\cf2 %0.2fs\t}",result->second.count);
		} else {
			strcpy(outLine,"\t");
		}
		char *out = outLine+strlen(outLine);
		char *in = line;
		while(*in) {
			if(!block)
			{
				if(in[0] == '/' && in[1] == '/') {
					block = true;
					blockType = '/';
					strcpy(out,"{\\cf3 ");
					out += strlen(out);
				} else 	if(in[0] == '/' && in[1] == '*') {
					block = true;
					blockType = '*';
					strcpy(out,"{\\cf3 ");
					out += strlen(out);
				} else if(in[0] == '"' && ( in[-1] != '\\' || in[-2] == '\\' )) {
					block = true;
					blockType = '"';
					strcpy(out,"{\\cf3 ");
					out += strlen(out);
				} if(!isCToken(in[-1]) && isCToken(in[0])) {
					char token[1024*10];
					char *tokOut = token;
					while(isCToken(*in)) {
						*(tokOut++) = *(in++);
					}
					*tokOut=0;
					if(keywords.Contains(token)) {
						strcpy(out,"{\\cf4 ");
						out += strlen(out);
						strcpy(out,token);
						out += strlen(out);
						strcpy(out,"}");
						out += strlen(out);
//.........这里部分代码省略.........
开发者ID:mhoffesommer,项目名称:Very-Sleepy,代码行数:101,代码来源:sourceview.cpp

示例6: IsOsModule

bool IsOsModule(wxString mod)
{
    return osModules.Contains(mod);
}
开发者ID:CyberShadow,项目名称:verysleepy-1,代码行数:4,代码来源:database.cpp

示例7: IsOsFunction

bool IsOsFunction(wxString function)
{
    return osFunctions.Contains(function);
}
开发者ID:CyberShadow,项目名称:verysleepy-1,代码行数:4,代码来源:database.cpp


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