当前位置: 首页>>代码示例>>C++>>正文


C++ Directory::AddDirectory方法代码示例

本文整理汇总了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 );
            }
        }
    }
}
开发者ID:gene9,项目名称:Darwinia-and-Multiwinia-Source-Code,代码行数:31,代码来源:directory.cpp

示例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;
    }    
}
开发者ID:gene9,项目名称:Darwinia-and-Multiwinia-Source-Code,代码行数:60,代码来源:directory.cpp


注:本文中的Directory::AddDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。