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


C++ value::exists方法代码示例

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


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

示例1: resolvealldeps

// ==========================================================================
// METHOD yumsource::resolvedeps
// ==========================================================================
void yumsource::resolvealldeps (value &list)
{
	value depargs;
	string id = "";
	depargs.newval() = "/usr/bin/yum";
	depargs.newval() = "-C";
	depargs.newval() = "deplist";
	
    foreach (update, list)
	{
		depargs.newval() = update.id();
	}

	systemprocess depp (depargs, true);
	depp.run ();
	
	APP->log (log::info, "yum-src", "Resolving dependencies: %S", id.str());
	
	while (! depp.eof())
	{
		string line = depp.gets();
		if (line.strlen())
		{
			if (line.strncmp ("package:", 8) == 0)
			{
				line = line.mid (9);
				line.cropat (' ');
				line.cropatlast ('.'); // remove architecture
				if (list.exists(line))
					id = line;
				else
					id = "";
			}
			
			if (id.strlen() && line.strncmp ("   provider:", 12) == 0)
			{
				line = line.mid (13);
				line.cropat (' ');
				line.cropatlast ('.'); // remove architecture
				if ((id != line.str()) && 
					(list.exists (line.str())))
				{
					if (! list[line.str()]["deps"].exists (id))
					{
						list[line.str()]["deps"][id] = true;
					}
					/*
					if (! list[id]["deps"].exists (line))
					{
						list[id]["deps"][line] = true;
					}*/
				}
			}
		}
	}
	
	depp.serialize();
}
开发者ID:CloudVPS,项目名称:openpanel-swupd,代码行数:61,代码来源:source.cpp

示例2: run

// ==========================================================================
// METHOD IconRequestHandler::run
// ==========================================================================
int IconRequestHandler::run (string &uri, string &postbody, value &inhdr,
							 string &out, value &outhdr, value &env,
							 tcpsocket &s)
{
	bool isdown = (uri.strstr ("/down/") >= 0);
	string uuid = uri.copyafterlast ("/");
	uuid.cropat ('.');
	
	app->log (log::debug, "httpicon", "Request for <%s>" %format (uuid));
	
	if (inhdr.exists ("If-Modified-Since"))
	{
		s.puts ("HTTP/1.1 304 NOT CHANGED\r\n"
				"Connection: %s\r\n"
				"Content-length: 0\r\n\r\n"
				%format (env["keepalive"].bval() ? "keep-alive" : "close"));
		
		env["sentbytes"] = 0;
		return -304;
	}
	
	if (! app->mdb->classExistsUUID (uuid))
	{
		string orgpath;
		
		if (isdown)
		{
			orgpath = "/var/openpanel/http/images/icons/down_%s.png" %format (uuid);
		}
		else
		{
			orgpath = "/var/openpanel/http/images/icons/%s.png" %format (uuid);
		}
		if (fs.exists (orgpath))
		{
			out = fs.load (orgpath);
			outhdr["Content-type"] = "image/png";
			return 200;
		}
		return 404;
	}
	CoreClass &c = app->mdb->getClassUUID (uuid);
	string path;
	if (isdown)
	{
		path = "%s/down_%s" %format (c.module.path, c.icon);
	}
	else
	{
		path = "%s/%s" %format (c.module.path, c.icon);
	}
	
	app->log (log::debug, "httpicon", "Loading %s" %format (path));
	
	if (! fs.exists (path)) return 404;
	
	outhdr["Content-type"] = "image/png";
	out = fs.load (path);
	return 200;
}
开发者ID:CloudVPS,项目名称:openpanel-opencore,代码行数:63,代码来源:rpcrequesthandler.cpp

示例3: resolvedeps

// ==========================================================================
// METHOD rhnsource::resolvedeps
// ==========================================================================
void rhnsource::resolvedeps (const statstring &id, value &list)
{
	value depargs;
	depargs.newval() = "/usr/bin/up2date";
	depargs.newval() = "--dry-run";
	depargs.newval() = "-u";
	depargs.newval() = id;
	int listno = 0;
	bool inlist = false;
	
	systemprocess depp (depargs, true);
	depp.run ();
	
	while (! depp.eof())
	{
		string line = depp.gets();
		if (line.strlen() && (line.strncmp ("------", 6) == 0))
		{
			listno++;
			if (listno == 3) inlist = true;
		}
		
		if (inlist)
		{
			line = line.cutat (' ');

			if ((line.strlen()) &&
			    (id != line.str()) && 
				(list.exists (line.str())))
			{
				if (! list[line.str()]["deps"].exists (id))
				{
					list[line.str()]["deps"][id] = true;
				}/*
				if (! list[id]["deps"].exists (line))
				{
					list[id]["deps"][line] = true;
				}*/
			}
		}
	}
	
	depp.serialize();
}
开发者ID:CloudVPS,项目名称:openpanel-swupd,代码行数:47,代码来源:source.cpp


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