本文整理汇总了C++中DirectoryPrx::list方法的典型用法代码示例。如果您正苦于以下问题:C++ DirectoryPrx::list方法的具体用法?C++ DirectoryPrx::list怎么用?C++ DirectoryPrx::list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DirectoryPrx
的用法示例。
在下文中一共展示了DirectoryPrx::list方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: indent
static void
listRecursive(const DirectoryPrx& dir, int depth = 0)
{
string indent(++depth, '\t');
NodeSeq contents = dir->list();
for(NodeSeq::const_iterator i = contents.begin(); i != contents.end(); ++i)
{
DirectoryPrx dir = DirectoryPrx::checkedCast(*i);
FilePrx file = FilePrx::uncheckedCast(*i);
cout << indent << (*i)->name() << (dir ? " (directory):" : " (file):") << endl;
if(dir)
{
listRecursive(dir, depth);
}
else
{
Lines text = file->read();
for(Lines::const_iterator j = text.begin(); j != text.end(); ++j)
{
cout << indent << "\t" << *j << endl;
}
}
}
}
示例2: catch
void
Parser::destroy(const std::list<string>& names)
{
DirectoryPrx dir = _dirs.front();
for(std::list<string>::const_iterator i = names.begin(); i != names.end(); ++i)
{
if(*i == "*")
{
NodeDescSeq nodes = dir->list();
for(NodeDescSeq::iterator j = nodes.begin(); j != nodes.end(); ++j)
{
try
{
j->proxy->destroy();
}
catch(const PermissionDenied& ex)
{
cout << "cannot remove `" << j->name << "': " << ex.reason << endl;
}
}
return;
}
else
{
NodeDesc d;
try
{
d = dir->find(*i);
}
catch(const NoSuchName&)
{
cout << "`" << *i << "': no such file or directory" << endl;
return;
}
try
{
d.proxy->destroy();
}
catch(const PermissionDenied& ex)
{
cout << "cannot remove `" << *i << "': " << ex.reason << endl;
}
}
}
}
示例3: indent
void
Parser::list(const DirectoryPrx& dir, bool recursive, int depth)
{
string indent(depth++, '\t');
NodeDescSeq contents = dir->list();
for(NodeDescSeq::const_iterator i = contents.begin(); i != contents.end(); ++i)
{
DirectoryPrx d = i->type == DirType ? DirectoryPrx::uncheckedCast(i->proxy) : (DirectoryPrx)0;
cout << indent << i->name << (d ? " (directory)" : " (file)");
if(d && recursive)
{
cout << ":" << endl;
list(d, true, depth);
}
else
{
cout << endl;
}
}
}