Kaydet (Commit) f9de7c85 authored tarafından Noel Grandin's avatar Noel Grandin

HandlerCFGAccess::read should take references

Change-Id: Icecb26e15d97fcf9c6694053fafc99b62385ffb5
Reviewed-on: https://gerrit.libreoffice.org/65395
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ec928ac5
...@@ -137,8 +137,7 @@ class FWI_DLLPUBLIC HandlerCFGAccess : public ::utl::ConfigItem ...@@ -137,8 +137,7 @@ class FWI_DLLPUBLIC HandlerCFGAccess : public ::utl::ConfigItem
/* interface */ /* interface */
public: public:
HandlerCFGAccess( const OUString& sPackage ); HandlerCFGAccess( const OUString& sPackage );
void read ( std::unique_ptr<HandlerHash>& ppHandler , void read ( HandlerHash& rHandlerHash, PatternHash& rPatternHash );
std::unique_ptr<PatternHash>& ppPattern );
void setCache(HandlerCache* pCache) {m_pCache = pCache;}; void setCache(HandlerCache* pCache) {m_pCache = pCache;};
virtual void Notify(const css::uno::Sequence< OUString >& lPropertyNames) override; virtual void Notify(const css::uno::Sequence< OUString >& lPropertyNames) override;
......
...@@ -94,7 +94,7 @@ HandlerCache::HandlerCache() ...@@ -94,7 +94,7 @@ HandlerCache::HandlerCache()
m_pHandler.reset(new HandlerHash); m_pHandler.reset(new HandlerHash);
m_pPattern.reset(new PatternHash); m_pPattern.reset(new PatternHash);
m_pConfig.reset(new HandlerCFGAccess(PACKAGENAME_PROTOCOLHANDLER)); m_pConfig.reset(new HandlerCFGAccess(PACKAGENAME_PROTOCOLHANDLER));
m_pConfig->read(m_pHandler,m_pPattern); m_pConfig->read(*m_pHandler, *m_pPattern);
m_pConfig->setCache(this); m_pConfig->setCache(this);
} }
...@@ -183,14 +183,13 @@ HandlerCFGAccess::HandlerCFGAccess( const OUString& sPackage ) ...@@ -183,14 +183,13 @@ HandlerCFGAccess::HandlerCFGAccess( const OUString& sPackage )
@descr User use us as a wrapper between configuration api and his internal structures. @descr User use us as a wrapper between configuration api and his internal structures.
He give us some pointer to his member and we fill it. He give us some pointer to his member and we fill it.
@param pHandler @param rHandlerHash
pointer to a list of protocol handler infos list of protocol handler infos
@param pPattern @param rPatternHash
reverse map of handler pattern to her uno names reverse map of handler pattern to her uno names
*/ */
void HandlerCFGAccess::read( std::unique_ptr<HandlerHash>& ppHandler , void HandlerCFGAccess::read( HandlerHash& rHandlerHash, PatternHash& rPatternHash )
std::unique_ptr<PatternHash>& ppPattern )
{ {
// list of all uno implementation names without encoding // list of all uno implementation names without encoding
css::uno::Sequence< OUString > lNames = GetNodeNames( SETNAME_HANDLER, ::utl::ConfigNameFormat::LocalPath ); css::uno::Sequence< OUString > lNames = GetNodeNames( SETNAME_HANDLER, ::utl::ConfigNameFormat::LocalPath );
...@@ -234,11 +233,11 @@ void HandlerCFGAccess::read( std::unique_ptr<HandlerHash>& ppHandler , ...@@ -234,11 +233,11 @@ void HandlerCFGAccess::read( std::unique_ptr<HandlerHash>& ppHandler ,
// register his pattern into the performance search hash // register his pattern into the performance search hash
for (auto const& item : aHandler.m_lProtocols) for (auto const& item : aHandler.m_lProtocols)
{ {
(*ppPattern)[item] = lNames[nSource]; rPatternHash[item] = lNames[nSource];
} }
// insert the handler info into the normal handler cache // insert the handler info into the normal handler cache
(*ppHandler)[lNames[nSource]] = aHandler; rHandlerHash[lNames[nSource]] = aHandler;
++nSource; ++nSource;
} }
} }
...@@ -248,7 +247,7 @@ void HandlerCFGAccess::Notify(const css::uno::Sequence< OUString >& /*lPropertyN ...@@ -248,7 +247,7 @@ void HandlerCFGAccess::Notify(const css::uno::Sequence< OUString >& /*lPropertyN
std::unique_ptr<HandlerHash> pHandler(new HandlerHash); std::unique_ptr<HandlerHash> pHandler(new HandlerHash);
std::unique_ptr<PatternHash> pPattern(new PatternHash); std::unique_ptr<PatternHash> pPattern(new PatternHash);
read(pHandler, pPattern); read(*pHandler, *pPattern);
if (m_pCache) if (m_pCache)
m_pCache->takeOver(std::move(pHandler), std::move(pPattern)); m_pCache->takeOver(std::move(pHandler), std::move(pPattern));
} }
......
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