Kaydet (Commit) 3bf3cae9 authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Noel Grandin

Replace some lists by vectors (vcl)

Change-Id: Id6f61cbbcd91e1a81e5ac23cdf19a6cda07f8659
Reviewed-on: https://gerrit.libreoffice.org/43675Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 61bddaff
...@@ -69,7 +69,7 @@ struct FastPrintFontInfo ...@@ -69,7 +69,7 @@ struct FastPrintFontInfo
// font attributes // font attributes
OUString m_aFamilyName; OUString m_aFamilyName;
OUString m_aStyleName; OUString m_aStyleName;
std::list< OUString > m_aAliases; std::vector< OUString > m_aAliases;
FontFamily m_eFamilyStyle; FontFamily m_eFamilyStyle;
FontItalic m_eItalic; FontItalic m_eItalic;
FontWidth m_eWidth; FontWidth m_eWidth;
...@@ -150,7 +150,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager ...@@ -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; 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 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; bool analyzeSfntFile(PrintFont* pFont) const;
// finds the font id for the nFaceIndex face in this font file // finds the font id for the nFaceIndex face in this font file
// There may be multiple font ids for font collections // There may be multiple font ids for font collections
...@@ -212,7 +212,7 @@ public: ...@@ -212,7 +212,7 @@ public:
void initialize(); void initialize();
// returns the ids of all managed fonts. // 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 // get font info for a specific font
bool getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const; bool getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const;
......
...@@ -497,7 +497,7 @@ namespace ...@@ -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; OUString aFamily;
...@@ -556,10 +556,10 @@ void PrintFontManager::analyzeSfntFamilyName( void* pTTFont, ::std::list< OUStri ...@@ -556,10 +556,10 @@ void PrintFontManager::analyzeSfntFamilyName( void* pTTFont, ::std::list< OUStri
DisposeNameRecords( pNameRecords, nNameRecords ); DisposeNameRecords( pNameRecords, nNameRecords );
if( !aFamily.isEmpty() ) if( !aFamily.isEmpty() )
{ {
rNames.push_front( aFamily ); rNames.emplace_back( aFamily );
for( ::std::set< OUString >::const_iterator it = aSet.begin(); it != aSet.end(); ++it ) for (auto const& elem : aSet)
if( *it != aFamily ) if( elem != aFamily )
rNames.push_back( *it ); rNames.emplace_back(elem);
} }
} }
...@@ -575,7 +575,7 @@ bool PrintFontManager::analyzeSfntFile( PrintFont* pFont ) const ...@@ -575,7 +575,7 @@ bool PrintFontManager::analyzeSfntFile( PrintFont* pFont ) const
TTGlobalFontInfo aInfo; TTGlobalFontInfo aInfo;
GetTTGlobalFontInfo( pTTFont, & aInfo ); GetTTGlobalFontInfo( pTTFont, & aInfo );
::std::list< OUString > aNames; ::std::vector< OUString > aNames;
analyzeSfntFamilyName( pTTFont, aNames ); analyzeSfntFamilyName( pTTFont, aNames );
// set family name from XLFD if possible // set family name from XLFD if possible
...@@ -584,7 +584,7 @@ bool PrintFontManager::analyzeSfntFile( PrintFont* pFont ) const ...@@ -584,7 +584,7 @@ bool PrintFontManager::analyzeSfntFile( PrintFont* pFont ) const
if( !aNames.empty() ) if( !aNames.empty() )
{ {
pFont->m_aFamilyName = aNames.front(); pFont->m_aFamilyName = aNames.front();
aNames.pop_front(); aNames.erase(aNames.begin());
} }
else else
{ {
...@@ -777,13 +777,13 @@ void PrintFontManager::initialize() ...@@ -777,13 +777,13 @@ void PrintFontManager::initialize()
#endif #endif
} }
void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs ) void PrintFontManager::getFontList( ::std::vector< fontID >& rFontIDs )
{ {
rFontIDs.clear(); rFontIDs.clear();
std::unordered_map< fontID, PrintFont* >::const_iterator it; std::unordered_map< fontID, PrintFont* >::const_iterator it;
for( it = m_aFonts.begin(); it != m_aFonts.end(); ++it ) for (auto const& font : m_aFonts)
rFontIDs.push_back( it->first ); rFontIDs.emplace_back(font.first);
} }
void PrintFontManager::fillPrintFontInfo(PrintFont* pFont, FastPrintFontInfo& rInfo) void PrintFontManager::fillPrintFontInfo(PrintFont* pFont, FastPrintFontInfo& rInfo)
...@@ -1185,7 +1185,7 @@ void PrintFontManager::getGlyphWidths( fontID nFont, ...@@ -1185,7 +1185,7 @@ void PrintFontManager::getGlyphWidths( fontID nFont,
extern "C" { extern "C" {
SAL_DLLPUBLIC_EXPORT const char * unit_online_get_fonts(void) SAL_DLLPUBLIC_EXPORT const char * unit_online_get_fonts(void)
{ {
std::list< fontID > aFontIDs; std::vector< fontID > aFontIDs;
PrintFontManager &rMgr = PrintFontManager::get(); PrintFontManager &rMgr = PrintFontManager::get();
rMgr.getFontList(aFontIDs); rMgr.getFontList(aFontIDs);
OStringBuffer aBuf; OStringBuffer aBuf;
......
...@@ -370,13 +370,12 @@ void CairoTextRender::GetDevFontList( PhysicalFontCollection* pFontCollection ) ...@@ -370,13 +370,12 @@ void CairoTextRender::GetDevFontList( PhysicalFontCollection* pFontCollection )
GlyphCache& rGC = getPlatformGlyphCache(); GlyphCache& rGC = getPlatformGlyphCache();
psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
::std::list< psp::fontID > aList; ::std::vector< psp::fontID > aList;
::std::list< psp::fontID >::iterator it;
psp::FastPrintFontInfo aInfo; psp::FastPrintFontInfo aInfo;
rMgr.getFontList( aList ); 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; continue;
// normalize face number to the GlyphCache // normalize face number to the GlyphCache
......
...@@ -722,14 +722,13 @@ bool GenPspGraphics::AddTempDevFontHelper( PhysicalFontCollection* pFontCollecti ...@@ -722,14 +722,13 @@ bool GenPspGraphics::AddTempDevFontHelper( PhysicalFontCollection* pFontCollecti
void GenPspGraphics::GetDevFontList( PhysicalFontCollection *pFontCollection ) void GenPspGraphics::GetDevFontList( PhysicalFontCollection *pFontCollection )
{ {
::std::list< psp::fontID > aList; ::std::vector< psp::fontID > aList;
psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
rMgr.getFontList( aList ); rMgr.getFontList( aList );
::std::list< psp::fontID >::iterator it;
psp::FastPrintFontInfo aInfo; psp::FastPrintFontInfo aInfo;
for (it = aList.begin(); it != aList.end(); ++it) for (auto const& elem : aList)
if (rMgr.getFontFastInfo (*it, aInfo)) if (rMgr.getFontFastInfo (elem, aInfo))
AnnounceFonts( pFontCollection, aInfo ); AnnounceFonts( pFontCollection, aInfo );
// register platform specific font substitutions if available // register platform specific font substitutions if available
...@@ -851,9 +850,8 @@ FontAttributes GenPspGraphics::Info2FontAttributes( const psp::FastPrintFontInfo ...@@ -851,9 +850,8 @@ FontAttributes GenPspGraphics::Info2FontAttributes( const psp::FastPrintFontInfo
aDFA.SetQuality(512); aDFA.SetQuality(512);
// add font family name aliases // add font family name aliases
::std::list< OUString >::const_iterator it = rInfo.m_aAliases.begin(); for (auto const& alias : rInfo.m_aAliases)
for(; it != rInfo.m_aAliases.end(); ++it ) aDFA.AddMapName(alias);
aDFA.AddMapName( *it );
#if OSL_DEBUG_LEVEL > 2 #if OSL_DEBUG_LEVEL > 2
if( aDFA.HasMapNames() ) if( aDFA.HasMapNames() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment