本文整理汇总了C++中BDirectory::CountEntries方法的典型用法代码示例。如果您正苦于以下问题:C++ BDirectory::CountEntries方法的具体用法?C++ BDirectory::CountEntries怎么用?C++ BDirectory::CountEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BDirectory
的用法示例。
在下文中一共展示了BDirectory::CountEntries方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: appDir
void
EnsureTemplates(void)
{
// Because creating a new project depends on the existence of the Templates folder,
// make sure that we have some (very) basic templates to work with if the folder
// has been deleted.
DPath templatePath = gAppPath.GetFolder();
templatePath << "Templates";
bool missing = false;
BDirectory tempDir;
if (!BEntry(templatePath.GetFullPath()).Exists())
{
BDirectory appDir(gAppPath.GetFolder());
appDir.CreateDirectory("Templates", &tempDir);
missing = true;
}
else
{
tempDir.SetTo(templatePath.GetFullPath());
if (tempDir.CountEntries() == 0)
missing = true;
}
if (missing)
{
BDirectory dir;
tempDir.CreateDirectory("Empty Application", &dir);
tempDir.CreateDirectory("Kernel Driver", &dir);
tempDir.CreateDirectory("Shared Library or Addon", &dir);
tempDir.CreateDirectory("Static Library", &dir);
DPath filePath;
TextFile file;
filePath = templatePath;
filePath << "Empty Application/TEMPLATEINFO";
file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
file.WriteString("TYPE=Application\nLIB=B_BEOS_LIB_DIRECTORY/libsupc++.so\n");
filePath = templatePath;
filePath << "Kernel Driver/TEMPLATEINFO";
file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
file.WriteString("TYPE=Driver\n");
filePath = templatePath;
filePath << "Shared Library or Addon/TEMPLATEINFO";
file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
file.WriteString("TYPE=Shared\n");
filePath = templatePath;
filePath << "Static Library/TEMPLATEINFO";
file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
file.WriteString("TYPE=Static\n");
file.Unset();
}
}
示例2: GetFolder
void InfoBox::GetFolder(BDirectory dir) {
int32 c=dir.CountEntries();
BEntry entry;
if (c>0)
for (int32 i=0; i<c; i++) {
dir.GetNextEntry(&entry, true);
if (entry.IsDirectory()) {
folders++;
GetFolder(BDirectory(&entry));
}
else
files++;
}
}
示例3: str
status_t
PDirectory::GetProperty(const char *name, PValue *value, const int32 &index) const
{
if (!name || !value)
return B_ERROR;
BString str(name);
PProperty *prop = FindProperty(name,index);
if (!prop)
return B_NAME_NOT_FOUND;
BDirectory *backend = (BDirectory*)fBackend;
if (str.ICompare("IsRoot") == 0)
((BoolProperty*)prop)->SetValue(backend->IsRootDirectory());
else if (str.ICompare("EntryCount") == 0)
((IntProperty*)prop)->SetValue(backend->CountEntries());
else
{
return PNode::GetProperty(name, value, index);
}
return prop->GetValue(value);
}