本文整理汇总了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()) );
}
}
示例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
}
示例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();
}
示例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;
}
示例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() );
}
}
示例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;
}