From d11ed7b8bf7c91cba97bd1648f367f37ef735ccb Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 24 Apr 2006 16:08:04 +0000 Subject: [PATCH] split out DumpList --- stepmania/src/smpackage/LanguagesDlg.cpp | 52 ++++++++++++++---------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/stepmania/src/smpackage/LanguagesDlg.cpp b/stepmania/src/smpackage/LanguagesDlg.cpp index d7f699d966..61e1482a57 100644 --- a/stepmania/src/smpackage/LanguagesDlg.cpp +++ b/stepmania/src/smpackage/LanguagesDlg.cpp @@ -442,6 +442,28 @@ void GetAllMatches( const RString &sRegex, const RString &sString, vector &asList, RageFile &file ) +{ + RString sLine; + FOREACH_CONST( RString, asList, s ) + { + if( sLine.size() + s->size() > 100 ) + { + file.PutLine( sLine ); + sLine = ""; + } + + if( sLine.size() ) + sLine += ", "; + else + sLine += " "; + + sLine += *s; + } + + file.PutLine( sLine ); +} + void LanguagesDlg::OnBnClickedCheckLanguage() { RString sTheme = GetCurrentString( m_listThemes ); @@ -521,37 +543,23 @@ void LanguagesDlg::OnBnClickedCheckLanguage() { FOREACH_CONST_Child( &ini1, key ) { - bool bFirst = true; - RString sLastSection; - RString sLine; + vector asList; + const RString &sSection = key->m_sName; FOREACH_CONST_Attr( key, value ) { - const RString &sSection = key->m_sName; const RString &sID = value->first; RString sCurrentLanguage; ini2.GetValue( sSection, sID, sCurrentLanguage ); if( !sCurrentLanguage.empty() ) continue; - if( bFirst ) - { - bFirst = false; - file.PutLine( ssprintf("Not translated in section [%s]:", sSection.c_str()) ); - } - if( sLine.size() + sID.size() > 100 ) - { - file.PutLine( sLine ); - sLine = ""; - } - if( sLine.size() ) - sLine += ", "; - else - sLine += " "; - - sLine += sID; + asList.push_back( sID ); + } + if( !asList.empty() ) + { + file.PutLine( ssprintf("Not translated in section [%s]:", sSection.c_str()) ); + DumpList( asList, file ); } - if( sLine.size() ) - file.PutLine( sLine ); } }