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


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

本文整理汇总了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()) );
    }
}
开发者ID:dontnod,项目名称:fastbuild,代码行数:34,代码来源:FunctionObjectList.cpp

示例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 );
}
开发者ID:Samana,项目名称:fastbuild,代码行数:29,代码来源:SLNGenerator.cpp

示例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;
}
开发者ID:JeremieA,项目名称:fastbuild,代码行数:35,代码来源:FileIO.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: 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
}
开发者ID:grimtraveller,项目名称:fastbuild,代码行数:33,代码来源:CachePlugin.cpp

示例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();
}
开发者ID:jujis008,项目名称:fastbuild,代码行数:27,代码来源:VSProjectGenerator.cpp

示例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
}
开发者ID:dummyunit,项目名称:fastbuild,代码行数:8,代码来源:ReflectedProperty.cpp

示例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
}
开发者ID:JeremieA,项目名称:fastbuild,代码行数:12,代码来源:AString.cpp

示例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;
}
开发者ID:ClxS,项目名称:fastbuild,代码行数:36,代码来源:BFFParser.cpp

示例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();
    }
开发者ID:JeremieA,项目名称:fastbuild,代码行数:27,代码来源:FileIO.cpp

示例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 );
}
开发者ID:zhangf911,项目名称:fastbuild,代码行数:9,代码来源:WorkerThread.cpp

示例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() );
}
开发者ID:dontnod,项目名称:fastbuild,代码行数:9,代码来源:Error.cpp

示例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 );
}
开发者ID:dontnod,项目名称:fastbuild,代码行数:10,代码来源:VSProjectGenerator.cpp

示例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;
}
开发者ID:grimtraveller,项目名称:fastbuild,代码行数:10,代码来源:CachePlugin.cpp

示例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;
}
开发者ID:ClxS,项目名称:fastbuild,代码行数:10,代码来源:BFFParser.cpp


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