本文整理汇总了C++中Directory::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Directory::begin方法的具体用法?C++ Directory::begin怎么用?C++ Directory::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Directory
的用法示例。
在下文中一共展示了Directory::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
std::vector<std::string>
System::opendir_recursive(const std::string& pathname)
{
std::vector<std::string> lst;
try
{
Directory dir = opendir(pathname);
for(auto it = dir.begin(); it != dir.end(); ++it)
{
if (it->type == DE_DIRECTORY)
{
std::vector<std::string> subdir = opendir_recursive(Pathname::join(pathname, it->name));
lst.insert(lst.end(), subdir.begin(), subdir.end());
}
else if (it->type == DE_FILE)
{
lst.push_back(Pathname::join(pathname, it->name));
}
}
}
catch(const std::exception& err)
{
log_warn("%1%", err.what());
}
return lst;
}
示例2: ExceptionMessage
Directory * StaticAPI::allocate(Directory & container, const Token & token, const char * id, bool regist)
{
static unsigned int assignment_count = 0;
Directory * node;
if(!(token == Token::IDENTIFIER || token == Token::INTEGER))
ExceptionMessage("Given token(%) is not suitable for an object identifier.","オブジェクトの識別名として利用できない字句(%)が指定されました") << token << throwException;
if(regist && (token == Token::INTEGER && token.value <= 0))
ExceptionMessage("Cannot assign an ID number less or equal to 0.","0以下のID番号を設定することはできません").throwException();
node = container.findChild(id);
if(node != 0)
{
Directory::iterator scope;
scope = node->begin();
while(scope != node->end())
{
if((*scope).first.compare(token) == 0)
ExceptionMessage("Identifier % is already used.","識別名%はすでに利用されています") << token << throwException;
++ scope;
}
}else
node = container.addChild(id);
node = node->addChild(token);
(*node)["#order"] = assignment_count++;
if(token == Token::IDENTIFIER)
{
if(regist)
{
Directory * scope = container.openChild("/","identifier",token.c_str(),NULL);
if(*scope == Directory::INTEGER)
*node = scope->toInteger();
}
}else
*node = token.value;
last = node;
return node;
}
示例3: if
std::vector<std::string>
System::opendir_recursive(const std::string& pathname)
{
std::vector<std::string> lst;
Directory dir = opendir(pathname);
for(auto it = dir.begin(); it != dir.end(); ++it)
{
if (it->type == DE_DIRECTORY)
{
std::vector<std::string> subdir = opendir_recursive(pathname + "/" + it->name);
lst.insert(lst.end(), subdir.begin(), subdir.end());
}
else if (it->type == DE_FILE)
{
lst.push_back(pathname + "/" + it->name);
}
}
return lst;
}
示例4:
DirectoryIterator::DirectoryIterator(const Directory& dir)
{
cur = dir.begin();
end = dir.end();
eof = (cur == end);
}