本文整理汇总了C++中AString::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ AString::Clear方法的具体用法?C++ AString::Clear怎么用?C++ AString::Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AString
的用法示例。
在下文中一共展示了AString::Clear方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: GetRemoteFilePath
// GetRemoteFilePath
//------------------------------------------------------------------------------
void ToolManifest::GetRemoteFilePath( uint32_t fileId, AString & exe, bool fullPath ) const
{
// we'll store in the sub dir
if ( fullPath )
{
GetRemotePath( exe );
}
else
{
exe.Clear();
}
// determine primary root
const File & primaryFile = m_Files[ 0 ];
AStackString<> primaryPath( primaryFile.m_Name.Get(), primaryFile.m_Name.FindLast( NATIVE_SLASH ) + 1 ); // include backslash
const File & f = m_Files[ fileId ];
if ( f.m_Name.BeginsWithI( primaryPath ) )
{
// file is in sub dir on master machine, so store with same relative location
exe += ( f.m_Name.Get() + primaryPath.GetLength() );
}
else
{
// file is in some completely other directory, so put in same place as exe
const char * lastSlash = f.m_Name.FindLast( NATIVE_SLASH );
lastSlash = lastSlash ? lastSlash + 1 : f.m_Name.Get();
exe += AStackString<>( lastSlash, f.m_Name.GetEnd() );
}
}
示例3: substringConstruction
//---------------------------------------------------------------------------------------------------------
//--- Test Substring
//---------------------------------------------------------------------------------------------------------
void substringConstruction( const char* inputString, AString& res, bool trim )
{
Substring subs( inputString );
if (trim)
subs.Trim();
res.Clear()._(subs);
}
示例4: GetStatus
// GetStatus
//------------------------------------------------------------------------------
void WorkerThreadRemote::GetStatus( AString & hostName, AString & status, bool & isIdle ) const
{
isIdle = false;
MutexHolder mh( m_CurrentJobMutex );
if ( m_CurrentJob )
{
Server::GetHostForJob( m_CurrentJob, hostName );
if ( IsEnabled() == false )
{
status = "(Finishing) ";
}
status += m_CurrentJob->GetRemoteName();
}
else
{
hostName.Clear();
if ( IsEnabled() == false )
{
status = "(Disabled)";
}
else
{
status = "Idle";
isIdle = true;
}
}
}
示例5:
// GetHostForJob
//------------------------------------------------------------------------------
/*static*/ void Server::GetHostForJob( const Job * job, AString & hostName )
{
const ClientState * cs = (const ClientState *)job->GetUserData();
if ( cs )
{
hostName = cs->m_HostName;
}
else
{
hostName.Clear();
}
}
示例6:
// Generate
//------------------------------------------------------------------------------
/*static*/ void Args::StripQuotes( const char * start, const char * end, AString & out )
{
ASSERT( start );
ASSERT( end );
// handle empty inputs
if ( start == end )
{
out.Clear();
return;
}
// strip first quote if there is one
const char firstChar = *start;
if ( ( firstChar == '"' ) || ( firstChar == '\'' ) )
{
++start;
}
// strip first quote if there is one
const char lastChar = *( end - 1 );
if ( ( lastChar == '"' ) || ( lastChar == '\'' ) )
{
--end;
}
// handle invalid strings (i.e. just one quote)
if ( end < start )
{
out.Clear();
return;
}
// assign unquoted string (could be empty, and that's ok)
out.Assign( start, end );
}
示例7: GetRemoteFilePath
// GetRemoteFilePath
//------------------------------------------------------------------------------
void ToolManifest::GetRemoteFilePath( uint32_t fileId, AString & exe, bool fullPath ) const
{
// we'll store in the sub dir
if ( fullPath )
{
GetRemotePath( exe );
}
else
{
exe.Clear();
}
// determine primary root
const File & primaryFile = m_Files[ 0 ];
const File & f = m_Files[ fileId ];
GetRelativePath( primaryFile.m_Name, f.m_Name, exe );
}
示例8: tokenizerTest
//---------------------------------------------------------------------------------------------------------
//--- Tokenizer
//---------------------------------------------------------------------------------------------------------
void tokenizerTest( const char* inputString, AString& res, char delim, char newDelim,
Whitespaces trim, int inpStart= -1, int inpEnd= -1 )
{
Substring inp( inputString );
if ( inpStart < 0 ) inpStart= 0;
if ( inpEnd < 0 ) inpEnd= inp.Length() - 1;
inp.Set( inp, inpStart, inpEnd-inpStart +1 );
res.Clear();
Tokenizer tok( inp, delim );
while( tok.HasNext() )
{
res._( tok.Next(trim) );
res._( newDelim );
}
}