本文整理汇总了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();
}
示例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;
}
示例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();
}