summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-03-18 12:36:02 +0100
committerJulien Nabet <serval2412@yahoo.fr>2018-03-25 15:14:44 +0200
commitf365b17bf170c8ed1baae299a2d719774fcc4305 (patch)
tree312378ff5e6ef487ab65d7a1d011307486941c56 /l10ntools
parentdd5df4ccb33048fa5fa8f85b2e6e69a6a225be57 (diff)
Use for-range loops in some modules
jvmaccess, jvmfwk, l10ntools, libreofficekit and linguistic Change-Id: I9d290d1098b25ccb3aee19d2df18c18f4aa65105 Reviewed-on: https://gerrit.libreoffice.org/51495 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/helpmerge.cxx22
-rw-r--r--l10ntools/source/idxdict/idxdict.cxx7
-rw-r--r--l10ntools/source/localize.cxx4
-rw-r--r--l10ntools/source/merge.cxx4
-rw-r--r--l10ntools/source/pocheck.cxx18
-rw-r--r--l10ntools/source/xmlparse.cxx15
6 files changed, 31 insertions, 39 deletions
diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index f09fe6af45a0..92f5171e5e67 100644
--- a/l10ntools/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -52,9 +52,9 @@
#if OSL_DEBUG_LEVEL > 2
void HelpParser::Dump(XMLHashMap* rElem_in)
{
- for(XMLHashMap::iterator pos = rElem_in->begin();pos != rElem_in->end(); ++pos)
+ for (auto const& pos : *rElem_in)
{
- Dump(pos->second,pos->first);
+ Dump(pos.second,pos.first);
}
}
@@ -63,10 +63,10 @@ void HelpParser::Dump(LangHashMap* rElem_in,const OString & sKey_in)
OString x;
OString y;
fprintf(stdout,"+------------%s-----------+\n",sKey_in.getStr() );
- for(LangHashMap::iterator posn=rElem_in->begin();posn!=rElem_in->end();++posn)
+ for (auto const& posn : *rElem_in)
{
- x=posn->first;
- y=posn->second->ToOString();
+ x=posn.first;
+ y=posn.second->ToOString();
fprintf(stdout,"key=%s value=%s\n",x.getStr(),y.getStr());
}
fprintf(stdout,"+--------------------------+\n");
@@ -110,12 +110,10 @@ bool HelpParser::CreatePO(
XMLHashMap* aXMLStrHM = file->GetStrings();
std::vector<OString> order = file->getOrder();
- std::vector<OString>::iterator pos;
- XMLHashMap::iterator posm;
- for( pos = order.begin(); pos != order.end() ; ++pos )
+ for (auto const& pos : order)
{
- posm = aXMLStrHM->find( *pos );
+ auto posm = aXMLStrHM->find(pos);
LangHashMap* pElem = posm->second;
XMLElement* pXMLElement = (*pElem)[ "en-US" ];
@@ -173,12 +171,10 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile* pMergeDataFile
s_ResData.sResTyp = "help";
std::vector<OString> order = file->getOrder();
- std::vector<OString>::iterator pos;
- XMLHashMap::iterator posm;
- for( pos = order.begin(); pos != order.end() ; ++pos ) // Merge every l10n related string in the same order as export
+ for (auto const& pos : order) // Merge every l10n related string in the same order as export
{
- posm = aXMLStrHM->find( *pos );
+ auto posm = aXMLStrHM->find(pos);
LangHashMap* aLangHM = posm->second;
#if OSL_DEBUG_LEVEL > 2
printf("*********************DUMPING HASHMAP***************************************");
diff --git a/l10ntools/source/idxdict/idxdict.cxx b/l10ntools/source/idxdict/idxdict.cxx
index e35bceaa0aea..38955a5b8258 100644
--- a/l10ntools/source/idxdict/idxdict.cxx
+++ b/l10ntools/source/idxdict/idxdict.cxx
@@ -84,12 +84,9 @@ int main(int argc, char *argv[])
outputStream << encoding << '\n' << entries.size() << '\n';
- for (multimap<string, size_t>::const_iterator ii(entries.begin());
- ii != entries.end();
- ++ii
- )
+ for (auto const& entry : entries)
{
- outputStream << ii->first << '|' << ii->second << '\n';
+ outputStream << entry.first << '|' << entry.second << '\n';
}
}
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index 9a2cf8ad4b94..98098b775456 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -247,8 +247,8 @@ void handleFilesOfDir(
///Handle files in lexical order
std::sort(aFiles.begin(), aFiles.end());
- for( auto aIt = aFiles.begin(); aIt != aFiles.end(); ++aIt )
- handleFile(rProject, *aIt, rPotDir);
+ for (auto const& elem : aFiles)
+ handleFile(rProject, elem, rPotDir);
}
bool includeProject(const OString& rProject) {
diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx
index b80eaf91b232..66aca214467d 100644
--- a/l10ntools/source/merge.cxx
+++ b/l10ntools/source/merge.cxx
@@ -296,8 +296,8 @@ MergeDataFile::MergeDataFile(
MergeDataFile::~MergeDataFile()
{
- for (MergeDataHashMap::iterator aI = aMap.begin(), aEnd = aMap.end(); aI != aEnd; ++aI)
- delete aI->second;
+ for (auto const& elem : aMap)
+ delete elem.second;
}
std::vector<OString> MergeDataFile::GetLanguages() const
diff --git a/l10ntools/source/pocheck.cxx b/l10ntools/source/pocheck.cxx
index dc56014b083a..241c225e1c35 100644
--- a/l10ntools/source/pocheck.cxx
+++ b/l10ntools/source/pocheck.cxx
@@ -71,21 +71,21 @@ static void checkStyleNames(const OString& aLanguage)
}
aPoInput.close();
- for( std::map<OString,sal_uInt16>::iterator it=aLocalizedStyleNames.begin(); it!=aLocalizedStyleNames.end(); ++it)
+ for (auto const& localizedStyleName : aLocalizedStyleNames)
{
- if( it->second > 1 )
+ if( localizedStyleName.second > 1 )
{
std::cout << "ERROR: Style name translations must be unique in:\n" <<
- aPoPath << "\nLanguage: " << aLanguage << "\nDuplicated translation is: " << it->first <<
+ aPoPath << "\nLanguage: " << aLanguage << "\nDuplicated translation is: " << localizedStyleName.first <<
"\nSee STR_POOLCOLL_*\n\n";
}
}
- for( std::map<OString,sal_uInt16>::iterator it=aLocalizedNumStyleNames.begin(); it!=aLocalizedNumStyleNames.end(); ++it)
+ for (auto const& localizedNumStyleName : aLocalizedNumStyleNames)
{
- if( it->second > 1 )
+ if( localizedNumStyleName.second > 1 )
{
std::cout << "ERROR: Style name translations must be unique in:\n" <<
- aPoPath << "\nLanguage: " << aLanguage << "\nDuplicated translation is: " << it->first <<
+ aPoPath << "\nLanguage: " << aLanguage << "\nDuplicated translation is: " << localizedNumStyleName.first <<
"\nSee STR_POOLNUMRULE_*\n\n";
}
}
@@ -268,14 +268,14 @@ static void checkFunctionNames(const OString& aLanguage)
}
}
aPoInput.close();
- for( std::map<OString,sal_uInt16>::iterator it=aLocalizedFunctionNames.begin(); it!=aLocalizedFunctionNames.end(); ++it)
+ for (auto const& localizedFunctionName : aLocalizedFunctionNames)
{
- if( it->second > 1 )
+ if( localizedFunctionName.second > 1 )
{
std::cout
<< ("ERROR: Spreadsheet function name translations must be"
" unique.\nLanguage: ")
- << aLanguage << "\nDuplicated translation is: " << it->first
+ << aLanguage << "\nDuplicated translation is: " << localizedFunctionName.first
<< "\n\n";
}
}
diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx
index 3ba61be5e1a0..297b736dae22 100644
--- a/l10ntools/source/xmlparse.cxx
+++ b/l10ntools/source/xmlparse.cxx
@@ -301,10 +301,9 @@ XMLFile::~XMLFile()
{
if( m_pXMLStrings )
{
- XMLHashMap::iterator pos = m_pXMLStrings->begin();
- for( ; pos != m_pXMLStrings->end() ; ++pos )
+ for (auto const& pos : *m_pXMLStrings)
{
- delete pos->second; // Check and delete content also ?
+ delete pos.second; // Check and delete content also ?
}
}
}
@@ -404,15 +403,15 @@ XMLFile& XMLFile::operator=(const XMLFile& rObj)
if( rObj.m_pXMLStrings )
{
m_pXMLStrings.reset( new XMLHashMap );
- for( XMLHashMap::iterator pos = rObj.m_pXMLStrings->begin() ; pos != rObj.m_pXMLStrings->end() ; ++pos )
+ for (auto const& pos : *rObj.m_pXMLStrings)
{
- LangHashMap* pElem=pos->second;
+ LangHashMap* pElem=pos.second;
LangHashMap* pNewelem = new LangHashMap;
- for(LangHashMap::iterator pos2=pElem->begin(); pos2!=pElem->end();++pos2)
+ for (auto const& pos2 : *pElem)
{
- (*pNewelem)[ pos2->first ] = new XMLElement( *pos2->second );
+ (*pNewelem)[ pos2.first ] = new XMLElement( *pos2.second );
}
- (*m_pXMLStrings)[ pos->first ] = pNewelem;
+ (*m_pXMLStrings)[ pos.first ] = pNewelem;
}
}
}