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


C++ CStringArray::erase方法代码示例

本文整理汇总了C++中CStringArray::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ CStringArray::erase方法的具体用法?C++ CStringArray::erase怎么用?C++ CStringArray::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CStringArray的用法示例。


在下文中一共展示了CStringArray::erase方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetAnnouncerNames

void AnnouncerManager::GetAnnouncerNames( CStringArray& AddTo )
{
	GetDirListing( ANNOUNCERS_DIR+"*", AddTo, true );
	
	// strip out the folder called "CVS" and EMPTY_ANNOUNCER_NAME
	for( int i=AddTo.size()-1; i>=0; i-- )
		if( !stricmp( AddTo[i], "cvs" ) )
			AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );

	for( int i=AddTo.size()-1; i>=0; i-- )
		if( !stricmp( AddTo[i], EMPTY_ANNOUNCER_NAME ) )
			AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );
}
开发者ID:Prcuvu,项目名称:StepMania-3.95,代码行数:13,代码来源:AnnouncerManager.cpp

示例2: GetDirListing

void RageFileManager::GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bReturnPathToo )
{
	LockMut( *g_Mutex );

	NormalizePath( sPath );
	
	for( unsigned i = 0; i < g_Drivers.size(); ++i )
	{
		LoadedDriver &ld = g_Drivers[i];
		const CString p = ld.GetPath( sPath );
		if( p.size() == 0 )
			continue;

		const unsigned OldStart = AddTo.size();
		
		g_Drivers[i].driver->GetDirListing( p, AddTo, bOnlyDirs, bReturnPathToo );

		/* If returning the path, prepend the mountpoint name to the files this driver returned. */
		if( bReturnPathToo )
			for( unsigned j = OldStart; j < AddTo.size(); ++j )
				AddTo[j] = ld.MountPoint + AddTo[j];
	}

	/* More than one driver might return the same file.  Remove duplicates (case-
	 * insensitively). */
	sort( AddTo.begin(), AddTo.end(), ilt );
	CStringArray::iterator it = unique( AddTo.begin(), AddTo.end(), ieq );
	AddTo.erase(it, AddTo.end());
}
开发者ID:johntalbain28,项目名称:Stepmania-AMX,代码行数:29,代码来源:RageFileManager.cpp

示例3: LoadTags

void KSFLoader::LoadTags( const CString &str, Song &out )
{
    /* str is either a #TITLE or a directory component.  Fill in missing information.
     * str is either "title", "artist - title", or "artist - title - difficulty". */
    CStringArray asBits;
    split( str, " - ", asBits, false );
    /* Ignore the difficulty, since we get that elsewhere. */
    if( asBits.size() == 3 &&
            (!stricmp(asBits[2], "double") ||
             !stricmp(asBits[2], "easy") ||
             !stricmp(asBits[2], "normal") ||
             !stricmp(asBits[2], "hard") ||
             !stricmp(asBits[2], "crazy")) )
    {
        asBits.erase(asBits.begin()+2, asBits.begin()+3);
    }

    CString title, artist;
    if( asBits.size() == 2 )
    {
        artist = asBits[0];
        title = asBits[1];
    }
    else
    {
        title = asBits[0];
    }

    /* Convert, if possible.  Most KSFs are in Korean encodings (CP942/EUC-KR). */
    if( !ConvertString( title, "korean" ) )
        title = "";
    if( !ConvertString( artist, "korean" ) )
        artist = "";

    if( out.m_sMainTitle == "" )
        out.m_sMainTitle = title;
    if( out.m_sArtist == "" )
        out.m_sArtist = artist;
}
开发者ID:augustg,项目名称:stepmania-3.9,代码行数:39,代码来源:NotesLoaderKSF.cpp

示例4: SetContent


//.........这里部分代码省略.........

		case COURSE_MACHINE_RANK:
			{
			const vector<Course*> best = SONGMAN->GetBestCourses( PROFILE_SLOT_MACHINE );
			val = (float) FindIndex( best.begin(), best.end(), pCourse );
			val += 1;
			}
			break;

		case COURSE_PROFILE_HIGH_SCORE:
			val = 100.0f * PROFILEMAN->GetProfile(m_PlayerNumber)->GetCourseHighScoreList(pCourse,pTrail).GetTopScore().fPercentDP;
			break;
		case COURSE_PROFILE_NUM_PLAYS:
			val = (float) PROFILEMAN->GetProfile(m_PlayerNumber)->GetCourseNumTimesPlayed( pCourse );
			break;

		case COURSE_PROFILE_RANK:
			const vector<Course*> best = SONGMAN->GetBestCourses( PlayerMemCard(m_PlayerNumber) );
			val = (float) FindIndex( best.begin(), best.end(), pCourse );
			val += 1;
			break;
		};

		if( val == RADAR_VAL_UNKNOWN )
			goto done;

		/* Scale, round, clamp, etc. for floats: */
		switch( c )
		{
		case SONG_DIFFICULTY_RADAR_STREAM:
		case SONG_DIFFICULTY_RADAR_VOLTAGE:
		case SONG_DIFFICULTY_RADAR_AIR:
		case SONG_DIFFICULTY_RADAR_FREEZE:
		case SONG_DIFFICULTY_RADAR_CHAOS:
			val = roundf( SCALE( val, 0, 1, 0, 10 ) );
			val = clamp( val, 0, 10 );
			str = ssprintf( "%.0f", val );
			break;
		}

		switch( c )
		{
		case SONG_MACHINE_HIGH_NAME:
			str = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps).GetTopScore().sName;
			break;
		case COURSE_MACHINE_HIGH_NAME:

			str = PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse,pTrail).GetTopScore().sName;
			break;

		case SONG_MACHINE_HIGH_SCORE:
		case COURSE_MACHINE_HIGH_SCORE:
		case SONG_PROFILE_HIGH_SCORE:
		case COURSE_PROFILE_HIGH_SCORE:
			str = ssprintf( "%.2f%%", val );
			break;
		case SONG_NUM_STEPS:
		case SONG_JUMPS:
		case SONG_HOLDS:
		case SONG_MINES:
		case SONG_HANDS:
		case COURSE_NUM_STEPS:
		case COURSE_JUMPS:
		case COURSE_HOLDS:
		case COURSE_MINES:
		case COURSE_HANDS:
		case SONG_MACHINE_NUM_PLAYS:
		case COURSE_MACHINE_NUM_PLAYS:
		case SONG_PROFILE_NUM_PLAYS:
		case COURSE_PROFILE_NUM_PLAYS:
		case SONG_MACHINE_RANK:
		case COURSE_MACHINE_RANK:
		case SONG_PROFILE_RANK:
		case COURSE_PROFILE_RANK:
			str = ssprintf( "%.0f", val );
		}
	}


done:
	m_textContents[c].SetText( str );

	const int num = NUM_ITEM_COLORS( g_Contents[c].name );
	for( int p = 0; p < num; ++p )
	{
		const CString metric = ITEM_COLOR(g_Contents[c].name, p);
		CStringArray spec;
		split( metric, ";", spec );
		if( spec.size() < 2 )
			RageException::Throw( "Metric '%s' malformed", metric.c_str() );

		const float n = strtof( spec[0], NULL );
		if( val >= n )
			continue;
		spec.erase( spec.begin(), spec.begin()+1 );

		m_textContents[c].Command( join(";", spec) );
		break;
	}
}
开发者ID:augustg,项目名称:stepmania-3.9,代码行数:101,代码来源:PaneDisplay.cpp


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