Use for range loops in basegfx and basic

Change-Id: I5b2086c245695aeb30630150b3c5ccf61fbd6a56
Reviewed-on: https://gerrit.libreoffice.org/50280
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet
2018-02-24 16:27:42 +01:00
parent 85643ad3b6
commit 3ceb01afc3
11 changed files with 70 additions and 90 deletions

View File

@@ -100,18 +100,18 @@ void CodeCompleteOptions::SetAutoCorrectOn( bool b )
std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache)
{
aStream << "Global variables" << std::endl;
for(CodeCompleteVarTypes::const_iterator aIt = aCache.aGlobalVars.begin(); aIt != aCache.aGlobalVars.end(); ++aIt )
for (auto const& globalVar : aCache.aGlobalVars)
{
aStream << aIt->first << "," << aIt->second << std::endl;
aStream << globalVar.first << "," << globalVar.second << std::endl;
}
aStream << "Local variables" << std::endl;
for( CodeCompleteVarScopes::const_iterator aIt = aCache.aVarScopes.begin(); aIt != aCache.aVarScopes.end(); ++aIt )
for (auto const& varScope : aCache.aVarScopes)
{
aStream << aIt->first << std::endl;
CodeCompleteVarTypes aVarTypes = aIt->second;
for( CodeCompleteVarTypes::const_iterator aOtherIt = aVarTypes.begin(); aOtherIt != aVarTypes.end(); ++aOtherIt )
aStream << varScope.first << std::endl;
CodeCompleteVarTypes aVarTypes = varScope.second;
for (auto const& varType : aVarTypes)
{
aStream << "\t" << aOtherIt->first << "," << aOtherIt->second << std::endl;
aStream << "\t" << varType.first << "," << varType.second << std::endl;
}
}
aStream << "-----------------" << std::endl;
@@ -148,44 +148,44 @@ void CodeCompleteDataCache::InsertLocalVar( const OUString& sProcName, const OUS
OUString CodeCompleteDataCache::GetVarType( const OUString& sVarName ) const
{
for( CodeCompleteVarScopes::const_iterator aIt = aVarScopes.begin(); aIt != aVarScopes.end(); ++aIt )
for (auto const& varScope : aVarScopes)
{
CodeCompleteVarTypes aTypes = aIt->second;
for( CodeCompleteVarTypes::const_iterator aOtherIt = aTypes.begin(); aOtherIt != aTypes.end(); ++aOtherIt )
CodeCompleteVarTypes aTypes = varScope.second;
for (auto const& elem : aTypes)
{
if( aOtherIt->first.equalsIgnoreAsciiCase( sVarName ) )
if( elem.first.equalsIgnoreAsciiCase( sVarName ) )
{
return aOtherIt->second;
return elem.second;
}
}
}
//not a local, search global scope
for( CodeCompleteVarTypes::const_iterator aIt = aGlobalVars.begin(); aIt != aGlobalVars.end(); ++aIt )
for (auto const& globalVar : aGlobalVars)
{
if( aIt->first.equalsIgnoreAsciiCase( sVarName ) )
return aIt->second;
if( globalVar.first.equalsIgnoreAsciiCase( sVarName ) )
return globalVar.second;
}
return OUString(); //not found
}
OUString CodeCompleteDataCache::GetCorrectCaseVarName( const OUString& sVarName, const OUString& sActProcName ) const
{
for( CodeCompleteVarScopes::const_iterator aIt = aVarScopes.begin(); aIt != aVarScopes.end(); ++aIt )
for (auto const& varScope : aVarScopes)
{
CodeCompleteVarTypes aTypes = aIt->second;
for( CodeCompleteVarTypes::const_iterator aOtherIt = aTypes.begin(); aOtherIt != aTypes.end(); ++aOtherIt )
CodeCompleteVarTypes aTypes = varScope.second;
for (auto const& elem : aTypes)
{
if( aOtherIt->first.equalsIgnoreAsciiCase( sVarName ) && aIt->first.equalsIgnoreAsciiCase( sActProcName ) )
if( elem.first.equalsIgnoreAsciiCase( sVarName ) && varScope.first.equalsIgnoreAsciiCase( sActProcName ) )
{
return aOtherIt->first;
return elem.first;
}
}
}
// search global scope
for( CodeCompleteVarTypes::const_iterator aIt = aGlobalVars.begin(); aIt != aGlobalVars.end(); ++aIt )
for (auto const& globalVar : aGlobalVars)
{
if( aIt->first.equalsIgnoreAsciiCase( sVarName ) )
return aIt->first;
if( globalVar.first.equalsIgnoreAsciiCase( sVarName ) )
return globalVar.first;
}
return OUString(); //not found
}