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


C++ AString::FindLast方法代码示例

本文整理汇总了C++中AString::FindLast方法的典型用法代码示例。如果您正苦于以下问题:C++ AString::FindLast方法的具体用法?C++ AString::FindLast怎么用?C++ AString::FindLast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AString的用法示例。


在下文中一共展示了AString::FindLast方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetExtraOutputPath

// GetExtraOutputPath
//------------------------------------------------------------------------------
void FunctionObjectList::GetExtraOutputPath( const AString * it, const AString * end, const char * option, AString & path ) const
{
    const char * bodyStart = it->Get() + strlen( option ) + 1; // +1 for - or /
    const char * bodyEnd = it->GetEnd();

    // if token is exactly matched then value is next token
    if ( bodyStart == bodyEnd )
    {
        ++it;
        // handle missing next value
        if ( it == end )
        {
            return; // we just pretend it doesn't exist and let the compiler complain
        }

        bodyStart = it->Get();
        bodyEnd = it->GetEnd();
    }

    // Strip quotes
    Args::StripQuotes( bodyStart, bodyEnd, path );

    // If it's not already a path (i.e. includes filename.ext) then
    // truncate to just the path
    const char * lastSlash = path.FindLast( '\\' );
    lastSlash = lastSlash ? lastSlash : path.FindLast( '/' );
    lastSlash  = lastSlash ? lastSlash : path.Get(); // no slash, means it's just a filename
    if ( lastSlash != ( path.GetEnd() - 1 ) )
    {
        path.SetLength( uint32_t(lastSlash - path.Get()) );
    }
}
开发者ID:dontnod,项目名称:fastbuild,代码行数:34,代码来源:FunctionObjectList.cpp

示例2: Node

// CONSTRUCTOR
//------------------------------------------------------------------------------
FileNode::FileNode( const AString & fileName, uint32_t controlFlags )
: Node( fileName, Node::FILE_NODE, controlFlags )
{
	ASSERT( fileName.EndsWith( "\\" ) == false );
	ASSERT( ( fileName.FindLast( ':' ) == nullptr ) ||
			( fileName.FindLast( ':' ) == ( fileName.Get() + 1 ) ) );

	m_LastBuildTimeMs = 1; // very little work required
}
开发者ID:ClxS,项目名称:fastbuild,代码行数:11,代码来源:FileNode.cpp

示例3: GetFolderPath

// GetFolderPath
//------------------------------------------------------------------------------
void VSProjectGenerator::GetFolderPath( const AString & fileName, AString & folder ) const
{
	const AString * const bEnd = m_BasePaths.End();
	for ( const AString * bIt = m_BasePaths.Begin(); bIt != bEnd; ++bIt )
	{
		const AString & basePath = *bIt;
		const char * begin = fileName.Get();
		const char * end = fileName.GetEnd();

		if ( fileName.BeginsWithI( basePath ) )
		{
			begin = fileName.Get() + basePath.GetLength();
			const char * lastSlash = fileName.FindLast( BACK_SLASH );
			end = ( lastSlash ) ? lastSlash : end;
			if ( begin < end )
			{
				folder.Assign( begin, end );
				return;
			}
		}
	}

	// no matching base path (use root)
	folder.Clear();
}
开发者ID:jujis008,项目名称:fastbuild,代码行数:27,代码来源:VSProjectGenerator.cpp

示例4: GetFolderIndexFor

// GetFolderIndexFor
//------------------------------------------------------------------------------
uint32_t ProjectGeneratorBase::GetFolderIndexFor( const AString & path )
{
    // Get the path exluding the file file or dir
    const char * lastSlash = path.FindLast( NATIVE_SLASH );
    if ( ( lastSlash == nullptr ) || ( lastSlash == path.Get() ) )
    {
        return 0; // no sub-path: put it in the root
    }

    // Search for existing folder
    AStackString<> folderPath( path.Get(), lastSlash );
    for ( const Folder& folder : m_Folders )
    {
        if ( folder.m_Path == folderPath )
        {
            return (uint32_t)( &folder - m_Folders.Begin() ); // Found existing
        }
    }

    // Add new folder(s) recursively
    const uint32_t parentFolderIndex = GetFolderIndexFor( folderPath );

    // Create new folder
    Folder f;
    f.m_Path = folderPath;
    m_Folders.Append( f );
    const uint32_t folderIndex = (uint32_t)( m_Folders.GetSize() - 1 );

    // Add to parent folder
    m_Folders[ parentFolderIndex ].m_Folders.Append( folderIndex );

    return folderIndex;
}
开发者ID:liamkf,项目名称:fastbuild,代码行数:35,代码来源:ProjectGeneratorBase.cpp

示例5: primaryPath

// GetRelativePath
//------------------------------------------------------------------------------
/*static*/ void ToolManifest::GetRelativePath( const AString & mainExe, const AString & otherFile, AString & otherFileRelativePath )
{
	// determine primary root
	AStackString<> primaryPath( mainExe.Get(), mainExe.FindLast( NATIVE_SLASH ) + 1 ); // include backslash

	if ( otherFile.BeginsWithI( primaryPath ) )
	{
		// file is in sub dir on master machine, so store with same relative location
		otherFileRelativePath += ( otherFile.Get() + primaryPath.GetLength() );
	}
	else
	{
		// file is in some completely other directory, so put in same place as exe
		const char * lastSlash = otherFile.FindLast( NATIVE_SLASH );
		otherFileRelativePath += ( lastSlash ? lastSlash + 1 : otherFile.Get() );
	}
}
开发者ID:ClxS,项目名称:fastbuild,代码行数:19,代码来源:ToolManifest.cpp

示例6: pathOnly

// EnsurePathExistsForFile
//------------------------------------------------------------------------------
/*static*/ bool Node::EnsurePathExistsForFile( const AString & name )
{
	const char * lastSlash = name.FindLast( NATIVE_SLASH );
	ASSERT( PathUtils::IsFullPath( name ) ); // should be guaranteed to be a full path
	AStackString<> pathOnly( name.Get(), lastSlash );
	if ( FileIO::EnsurePathExists( pathOnly ) == false )
	{
		FLOG_ERROR( "Failed to create path '%s'", pathOnly.Get() );
		return false;
	}
	return true;
}
开发者ID:scott-nelson,项目名称:fastbuild,代码行数:14,代码来源:Node.cpp


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