summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-10-21 20:30:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-10-22 12:21:20 +0200
commit3bf3cae9b7b4d38e0427d71a2b34629fd5988af7 (patch)
tree1c582289baf6aabb814ea6263ab27d7afa3384f9 /vcl
parent61bddaff3380f7700f58a41adedf8befd34d4d91 (diff)
Replace some lists by vectors (vcl)
Change-Id: Id6f61cbbcd91e1a81e5ac23cdf19a6cda07f8659 Reviewed-on: https://gerrit.libreoffice.org/43675 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/unx/fontmanager.hxx6
-rw-r--r--vcl/unx/generic/fontmanager/fontmanager.cxx22
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx7
-rw-r--r--vcl/unx/generic/print/genpspgraphics.cxx12
4 files changed, 22 insertions, 25 deletions
diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index 16e819bace48..43170bb7108d 100644
--- a/vcl/inc/unx/fontmanager.hxx
+++ b/vcl/inc/unx/fontmanager.hxx
@@ -69,7 +69,7 @@ struct FastPrintFontInfo
// font attributes
OUString m_aFamilyName;
OUString m_aStyleName;
- std::list< OUString > m_aAliases;
+ std::vector< OUString > m_aAliases;
FontFamily m_eFamilyStyle;
FontItalic m_eItalic;
FontWidth m_eWidth;
@@ -150,7 +150,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
std::vector<std::unique_ptr<PrintFont>> analyzeFontFile(int nDirID, const OString& rFileName, const char *pFormat=nullptr) const;
static OUString convertSfntName( void* pNameRecord ); // actually a NameRecord* format font subsetting code
- static void analyzeSfntFamilyName( void* pTTFont, std::list< OUString >& rnames ); // actually a TrueTypeFont* from font subsetting code
+ static void analyzeSfntFamilyName( void* pTTFont, std::vector< OUString >& rnames ); // actually a TrueTypeFont* from font subsetting code
bool analyzeSfntFile(PrintFont* pFont) const;
// finds the font id for the nFaceIndex face in this font file
// There may be multiple font ids for font collections
@@ -212,7 +212,7 @@ public:
void initialize();
// returns the ids of all managed fonts.
- void getFontList( std::list< fontID >& rFontIDs );
+ void getFontList( std::vector< fontID >& rFontIDs );
// get font info for a specific font
bool getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const;
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx
index 8336c1738b26..2c298340e3c9 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -497,7 +497,7 @@ namespace
}
}
-void PrintFontManager::analyzeSfntFamilyName( void* pTTFont, ::std::list< OUString >& rNames )
+void PrintFontManager::analyzeSfntFamilyName( void* pTTFont, ::std::vector< OUString >& rNames )
{
OUString aFamily;
@@ -556,10 +556,10 @@ void PrintFontManager::analyzeSfntFamilyName( void* pTTFont, ::std::list< OUStri
DisposeNameRecords( pNameRecords, nNameRecords );
if( !aFamily.isEmpty() )
{
- rNames.push_front( aFamily );
- for( ::std::set< OUString >::const_iterator it = aSet.begin(); it != aSet.end(); ++it )
- if( *it != aFamily )
- rNames.push_back( *it );
+ rNames.emplace_back( aFamily );
+ for (auto const& elem : aSet)
+ if( elem != aFamily )
+ rNames.emplace_back(elem);
}
}
@@ -575,7 +575,7 @@ bool PrintFontManager::analyzeSfntFile( PrintFont* pFont ) const
TTGlobalFontInfo aInfo;
GetTTGlobalFontInfo( pTTFont, & aInfo );
- ::std::list< OUString > aNames;
+ ::std::vector< OUString > aNames;
analyzeSfntFamilyName( pTTFont, aNames );
// set family name from XLFD if possible
@@ -584,7 +584,7 @@ bool PrintFontManager::analyzeSfntFile( PrintFont* pFont ) const
if( !aNames.empty() )
{
pFont->m_aFamilyName = aNames.front();
- aNames.pop_front();
+ aNames.erase(aNames.begin());
}
else
{
@@ -777,13 +777,13 @@ void PrintFontManager::initialize()
#endif
}
-void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs )
+void PrintFontManager::getFontList( ::std::vector< fontID >& rFontIDs )
{
rFontIDs.clear();
std::unordered_map< fontID, PrintFont* >::const_iterator it;
- for( it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
- rFontIDs.push_back( it->first );
+ for (auto const& font : m_aFonts)
+ rFontIDs.emplace_back(font.first);
}
void PrintFontManager::fillPrintFontInfo(PrintFont* pFont, FastPrintFontInfo& rInfo)
@@ -1185,7 +1185,7 @@ void PrintFontManager::getGlyphWidths( fontID nFont,
extern "C" {
SAL_DLLPUBLIC_EXPORT const char * unit_online_get_fonts(void)
{
- std::list< fontID > aFontIDs;
+ std::vector< fontID > aFontIDs;
PrintFontManager &rMgr = PrintFontManager::get();
rMgr.getFontList(aFontIDs);
OStringBuffer aBuf;
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index bb3ffa456377..c3d0ecc42e75 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -370,13 +370,12 @@ void CairoTextRender::GetDevFontList( PhysicalFontCollection* pFontCollection )
GlyphCache& rGC = getPlatformGlyphCache();
psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
- ::std::list< psp::fontID > aList;
- ::std::list< psp::fontID >::iterator it;
+ ::std::vector< psp::fontID > aList;
psp::FastPrintFontInfo aInfo;
rMgr.getFontList( aList );
- for( it = aList.begin(); it != aList.end(); ++it )
+ for (auto const& elem : aList)
{
- if( !rMgr.getFontFastInfo( *it, aInfo ) )
+ if( !rMgr.getFontFastInfo( elem, aInfo ) )
continue;
// normalize face number to the GlyphCache
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 8cae10af2997..6f458df680eb 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -722,14 +722,13 @@ bool GenPspGraphics::AddTempDevFontHelper( PhysicalFontCollection* pFontCollecti
void GenPspGraphics::GetDevFontList( PhysicalFontCollection *pFontCollection )
{
- ::std::list< psp::fontID > aList;
+ ::std::vector< psp::fontID > aList;
psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
rMgr.getFontList( aList );
- ::std::list< psp::fontID >::iterator it;
psp::FastPrintFontInfo aInfo;
- for (it = aList.begin(); it != aList.end(); ++it)
- if (rMgr.getFontFastInfo (*it, aInfo))
+ for (auto const& elem : aList)
+ if (rMgr.getFontFastInfo (elem, aInfo))
AnnounceFonts( pFontCollection, aInfo );
// register platform specific font substitutions if available
@@ -851,9 +850,8 @@ FontAttributes GenPspGraphics::Info2FontAttributes( const psp::FastPrintFontInfo
aDFA.SetQuality(512);
// add font family name aliases
- ::std::list< OUString >::const_iterator it = rInfo.m_aAliases.begin();
- for(; it != rInfo.m_aAliases.end(); ++it )
- aDFA.AddMapName( *it );
+ for (auto const& alias : rInfo.m_aAliases)
+ aDFA.AddMapName(alias);
#if OSL_DEBUG_LEVEL > 2
if( aDFA.HasMapNames() )