本文整理汇总了C++中AString::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ AString::Get方法的具体用法?C++ AString::Get怎么用?C++ AString::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AString
的用法示例。
在下文中一共展示了AString::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: WriteHeader
// WriteHeader
//------------------------------------------------------------------------------
void SLNGenerator::WriteHeader( const AString & solutionVisualStudioVersion,
const AString & solutionMinimumVisualStudioVersion )
{
const char * defaultVersion = "14.0.22823.1"; // Visual Studio 2015 RC
const char * defaultMinimumVersion = "10.0.40219.1"; // Visual Studio Express 2010
const char * version = ( solutionVisualStudioVersion.GetLength() > 0 )
? solutionVisualStudioVersion.Get()
: defaultVersion ;
const char * minimumVersion = ( solutionMinimumVisualStudioVersion.GetLength() > 0 )
? solutionMinimumVisualStudioVersion.Get()
: defaultMinimumVersion ;
const char * shortVersionStart = version;
const char * shortVersionEnd = version;
for ( ; *shortVersionEnd && *shortVersionEnd != '.' ; ++shortVersionEnd );
AStackString<> shortVersion( shortVersionStart, shortVersionEnd );
// header
Write( "\r\n" ); // Deliberate blank line
Write( "Microsoft Visual Studio Solution File, Format Version 12.00\r\n" );
Write( "# Visual Studio %s\r\n", shortVersion.Get() );
Write( "VisualStudioVersion = %s\r\n", version );
Write( "MinimumVisualStudioVersion = %s\r\n", minimumVersion );
}
示例3: defined
// DirectoryCreate
//------------------------------------------------------------------------------
/*static*/ bool FileIO::DirectoryCreate( const AString & path )
{
#if defined( __WINDOWS__ )
if ( CreateDirectory( path.Get(), nullptr ) )
{
return true;
}
// it failed - is it because it exists already?
if ( GetLastError() == ERROR_ALREADY_EXISTS )
{
return true;
}
#elif defined( __LINUX__ ) || defined( __APPLE__ )
umask( 0 ); // disable default creation mask
mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO; // TODO:LINUX TODO:MAC Check these permissions
if ( mkdir( path.Get(), mode ) == 0 )
{
return true; // created ok
}
// failed to create - already exists?
if ( errno == EEXIST )
{
return true;
}
#else
#error Unknown platform
#endif
// failed, probably missing intermediate folders or an invalid name
return false;
}
示例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: defined
// CONSTRUCTOR
//------------------------------------------------------------------------------
/*explicit*/ CachePlugin::CachePlugin( const AString & dllName ) :
#if defined( __WINDOWS__ )
m_DLL( nullptr ),
#endif
m_InitFunc( nullptr ),
m_ShutdownFunc( nullptr ),
m_PublishFunc( nullptr ),
m_RetrieveFunc( nullptr ),
m_FreeMemoryFunc( nullptr )
{
#if defined( __WINDOWS__ )
m_DLL = ::LoadLibrary( dllName.Get() );
if ( !m_DLL )
{
FLOG_WARN( "Cache plugin '%s' load failed (0x%x).", dllName.Get(), ::GetLastError() );
return;
}
m_InitFunc = (CacheInitFunc) GetFunction( "CacheInit", "[email protected]@[email protected]" );
m_ShutdownFunc = (CacheShutdownFunc) GetFunction( "CacheShutdown", "[email protected]@YAXXZ" );
m_PublishFunc = (CachePublishFunc) GetFunction( "CachePublish", "[email protected]@[email protected]" );
m_RetrieveFunc = (CacheRetrieveFunc) GetFunction( "CacheRetrieve", "[email protected]@[email protected]" );
m_FreeMemoryFunc= (CacheFreeMemoryFunc) GetFunction( "CacheFreeMemory", "[email protected]@[email protected]" );
#elif defined( __APPLE__ )
ASSERT( false ); // TODO:MAC Implement CachePlugin
#elif defined( __LINUX__ )
ASSERT( false ); // TODO:LINUX Implement CachePlugin
#else
#error Unknown platform
#endif
}
示例6: 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();
}
示例7: FromString
bool ReflectedProperty::FromString( const AString & buffer, int64_t * value )
{
#if defined( __LINUX__ )
return ( sscanf_s( buffer.Get(), "%ld", value ) == 1 );
#else
return ( sscanf_s( buffer.Get(), "%lld", value ) == 1 );
#endif
}
示例8: CompareI
// CompareI
//------------------------------------------------------------------------------
int32_t AString::CompareI( const AString & other ) const
{
#if defined( __WINDOWS__ )
return _stricmp( m_Contents, other.Get() );
#elif defined( __APPLE__ ) || defined( __LINUX__ )
return strcasecmp( m_Contents, other.Get() );
#else
#error Unknown platform
#endif
}
示例9: StoreVariableStruct
// StoreVariableStruct
//------------------------------------------------------------------------------
bool BFFParser::StoreVariableStruct( const AString & name,
const BFFIterator & valueStart, const BFFIterator & valueEnd,
const BFFIterator & operatorIter,
BFFStackFrame * frame )
{
// are we concatenating?
if ( *operatorIter == BFF_VARIABLE_CONCATENATION )
{
// concatenation of structs not supported
Error::Error_1027_CannotModify( operatorIter, name, BFFVariable::VAR_STRUCT, BFFVariable::VAR_ANY );
return false;
}
// create stack frame to capture variables
BFFStackFrame stackFrame;
// parse all the variables in the scope
BFFParser subParser;
BFFIterator subIter( valueStart );
subIter.SetMax( valueEnd.GetCurrent() ); // limit to closing token
if ( subParser.Parse( subIter ) == false )
{
return false; // error will be emitted by Parse
}
// get variables defined in the scope
const Array< const BFFVariable * > & structMembers = stackFrame.GetLocalVariables();
// Register this variable
BFFStackFrame::SetVarStruct( name, structMembers, frame ? frame : stackFrame.GetParent() );
FLOG_INFO( "Registered <struct> variable '%s' with %u members", name.Get(), structMembers.GetSize() );
return true;
}
示例10: while
/*static*/ void FileIO::WorkAroundForWindowsFilePermissionProblem( const AString & fileName )
{
// Sometimes after closing a file, subsequent operations on that file will
// fail. For example, trying to set the file time, or even another process
// opening the file.
//
// This seems to be a known issue in windows, with multiple potential causes
// like Virus scanners and possibly the behaviour of the kernel itself.
//
// A work-around for this problem is to attempt to open a file we just closed.
// This will sometimes fail, but if we retry until it succeeds, we avoid the
// problem on the subsequent operation.
FileStream f;
Timer timer;
while ( f.Open( fileName.Get() ) == false )
{
Thread::Sleep( 1 );
// timeout so we don't get stuck in here forever
if ( timer.GetElapsed() > 1.0f )
{
ASSERT( false && "WorkAroundForWindowsFilePermissionProblem Failed!" );
return;
}
}
f.Close();
}
示例11:
// CreateTempFile
//------------------------------------------------------------------------------
/*static*/ bool WorkerThread::CreateTempFile( const AString & tmpFileName,
FileStream & file )
{
ASSERT( tmpFileName.IsEmpty() == false );
ASSERT( PathUtils::IsFullPath( tmpFileName ) );
return file.Open( tmpFileName.Get(), FileStream::WRITE_ONLY );
}
示例12: FormatError
// Error_1100_AlreadyDefined
//------------------------------------------------------------------------------
/*static*/ void Error::Error_1100_AlreadyDefined( const BFFIterator & iter,
const Function * function,
const AString & name )
{
FormatError( iter, 1100u, function, "Target '%s' already defined.",
name.Get() );
}
示例13: WritePGItem
// WritePGItem
//------------------------------------------------------------------------------
void VSProjectGenerator::WritePGItem( const char * xmlTag, const AString & value )
{
if ( value.IsEmpty() )
{
return;
}
Write( " <%s>%s</%s>\n", xmlTag, value.Get(), xmlTag );
}
示例14:
// Publish
//------------------------------------------------------------------------------
/*virtual*/ bool CachePlugin::Publish( const AString & cacheId, const void * data, size_t dataSize )
{
if ( m_PublishFunc )
{
return (*m_PublishFunc)( cacheId.Get(), data, dataSize );
}
return false;
}
示例15: StoreVariableInt
// StoreVariableInt
//------------------------------------------------------------------------------
bool BFFParser::StoreVariableInt( const AString & name, int value, BFFStackFrame * frame )
{
BFFStackFrame::SetVarInt( name, value, frame );
FLOG_INFO( "Registered <int> variable '%s' with value '%i'", name.Get(), value );
return true;
}