本文整理汇总了C++中AString::EndsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ AString::EndsWith方法的具体用法?C++ AString::EndsWith怎么用?C++ AString::EndsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AString
的用法示例。
在下文中一共展示了AString::EndsWith方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
// GetTempDir
//------------------------------------------------------------------------------
/*static*/ bool FileIO::GetTempDir( AString & output )
{
#if defined( __WINDOWS__ )
char buffer[ MAX_PATH ];
DWORD len = GetTempPath( MAX_PATH, buffer );
if ( len != 0 )
{
output = buffer;
// Ensure slash terminated
const bool slashTerminated = ( output.EndsWith( '/' ) || output.EndsWith( '\\' ) );
if ( !slashTerminated )
{
output += '\\';
}
return true;
}
#elif defined( __LINUX__ ) || defined( __APPLE__ )
output = "/tmp/";
return true;
#else
#error Unknown platform
#endif
return false;
}
示例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: GetErrorMessage
/*--------------------------------------------------------------------------------*/
AString PostgresDatabase::GetErrorMessage(PGconn *conn, bool full)
{
AString msg;
if (conn) {
msg = AString(PQerrorMessage(conn)).SearchAndReplace("\r", "").SearchAndReplace("\n\n", ", ");
if (msg.EndsWith(", ")) msg = msg.Left(msg.len() - 2);
if (!full) msg = msg.Line(0);
}
else msg = "No connection!";
return msg;
}
示例4:
// FormatName
//------------------------------------------------------------------------------
/*static*/ void DirectoryListNode::FormatName( const AString & path,
const Array< AString > * patterns,
bool recursive,
const Array< AString > & excludePaths,
const Array< AString > & excludeFiles,
AString & result )
{
ASSERT( path.EndsWith( NATIVE_SLASH ) );
AStackString<> patternString;
if ( patterns )
{
const size_t numPatterns = patterns->GetSize();
for ( size_t i=0; i<numPatterns; ++i )
{
if ( i > 0 )
{
patternString += '<';
}
patternString += (*patterns)[ i ];
}
}
result.Format( "%s|%s|%s|", path.Get(),
patternString.Get(),
recursive ? "true" : "false" );
const AString * const end = excludePaths.End();
for ( const AString * it = excludePaths.Begin(); it!=end; ++it )
{
const AString & excludePath = *it;
ASSERT( excludePath.EndsWith( NATIVE_SLASH ) );
result += excludePath;
result += '<';
}
if ( !excludeFiles.IsEmpty() )
{
result += '|';
const AString * const endFiles = excludeFiles.End();
for ( const AString * itFiles = excludeFiles.Begin(); itFiles != endFiles; ++itFiles )
{
const AString & excludedFile = *itFiles;
result += excludedFile;
result += '<';
}
}
}
示例5: Node
// CONSTRUCTOR
//------------------------------------------------------------------------------
DirectoryListNode::DirectoryListNode( const AString & name,
const AString & path,
const Array< AString > * patterns,
bool recursive,
const Array< AString > & excludePaths,
const Array< AString > & filesToExclude )
: Node( name, Node::DIRECTORY_LIST_NODE, Node::FLAG_NONE )
, m_Path( path )
, m_Patterns()
, m_ExcludePaths( excludePaths )
, m_FilesToExclude( filesToExclude )
, m_Recursive( recursive )
, m_Files( 4096, true )
{
if ( patterns )
{
m_Patterns = *patterns;
}
// ensure name is correctly formatted
// path|[patterns]|recursive|[excludePath]
ASSERT( name.BeginsWith( path ) );
ASSERT( name[ path.GetLength() ] == '|' );
ASSERT( m_Patterns.IsEmpty() || ( name.Find( m_Patterns[ 0 ].Get() ) == name.Get() + path.GetLength() + 1 ) );
ASSERT( ( recursive && name.Find( "|true|" ) ) ||
( !recursive && name.Find( "|false|" ) ) );
// paths must have trailing slash
ASSERT( path.EndsWith( NATIVE_SLASH ) );
// make sure exclusion path has trailing slash if provided
#ifdef DEBUG
const AString * const end = excludePaths.End();
for ( const AString * it=excludePaths.Begin(); it != end; ++it )
{
ASSERT( ( *it ).EndsWith( NATIVE_SLASH ) );
}
#endif
}