本文整理汇总了C++中Directory::AddDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ Directory::AddDirectory方法的具体用法?C++ Directory::AddDirectory怎么用?C++ Directory::AddDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Directory
的用法示例。
在下文中一共展示了Directory::AddDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateData
void Directory::CreateData ( const char *dataName, DArray <int> *darray )
{
if ( GetData( dataName ) )
{
AppReleaseAssert(false, "Attempted to create duplicate data %s at location\n%s", dataName, m_name);
}
else
{
Directory *directory = AddDirectory ( dataName );
AppAssert( directory );
directory->CreateData( "tID", "DArray<int>" );
directory->CreateData( "Size", darray->Size() );
for ( int i = 0; i < darray->Size(); ++i )
{
char indexName[16];
sprintf ( indexName, "[i %d]", i );
Directory *thisDir = directory->AddDirectory( indexName );
if ( darray->ValidIndex(i) )
{
thisDir->CreateData( "[Used]", true );
thisDir->CreateData( "[Data]", darray->GetData(i) );
}
else
{
thisDir->CreateData( "[Used]", false );
}
}
}
}
示例2: AppAssert
Directory *Directory::AddDirectory ( const char *dirName )
{
AppAssert( dirName );
char *firstSubDir = GetFirstSubDir ( dirName );
char *otherSubDirs = GetOtherSubDirs ( dirName );
if ( firstSubDir )
{
Directory *subDir = NULL;
//
// Search for that subdirectory
for ( int i = 0; i < m_subDirectories.Size(); ++i )
{
if ( m_subDirectories.ValidIndex(i) )
{
Directory *thisDir = m_subDirectories[i];
AppAssert( thisDir );
if ( strcmp ( thisDir->m_name, firstSubDir ) == 0 )
{
subDir = thisDir;
break;
}
}
}
// If the directory doesn't exist, create it and recurse into it
if ( !subDir )
{
subDir = new Directory();
subDir->SetName( firstSubDir );
m_subDirectories.PutData( subDir );
}
delete[] firstSubDir;
firstSubDir = NULL;
//
// Have we finished building directories?
// Otherwise, recurse in
if ( !otherSubDirs )
{
return subDir;
}
else
{
return subDir->AddDirectory( otherSubDirs );
}
}
else
{
AppReleaseAssert(false, "Failed to get first SubDir from %s", dirName );
return NULL;
}
}