Kaydet (Commit) 690f7ff8 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Store the handler as a const pointer.

Handlers are conceptually stateless; we can keep them as const objects.

Change-Id: I3d35ab0695037632e82f67f901c9795adf9bdd8d
üst dbf84a35
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
protected: protected:
/** Retrieves a PropertyHandler from the internal cache */ /** Retrieves a PropertyHandler from the internal cache */
XMLPropertyHandler* GetHdlCache( sal_Int32 nType ) const; const XMLPropertyHandler* GetHdlCache( sal_Int32 nType ) const;
/** Puts a PropertyHandler into the internal cache */ /** Puts a PropertyHandler into the internal cache */
void PutHdlCache( sal_Int32 nType, const XMLPropertyHandler* pHdl ) const; void PutHdlCache( sal_Int32 nType, const XMLPropertyHandler* pHdl ) const;
...@@ -94,7 +94,7 @@ private: ...@@ -94,7 +94,7 @@ private:
SAL_DLLPRIVATE const XMLPropertyHandler* GetBasicHandler( sal_Int32 nType ) SAL_DLLPRIVATE const XMLPropertyHandler* GetBasicHandler( sal_Int32 nType )
const; const;
typedef ::std::map< sal_Int32, XMLPropertyHandler* > CacheMap; typedef ::std::map<sal_Int32, const XMLPropertyHandler*> CacheMap;
mutable CacheMap maHandlerCache; mutable CacheMap maHandlerCache;
}; };
......
...@@ -110,9 +110,9 @@ const XMLPropertyHandler* XMLPropertyHandlerFactory::GetPropertyHandler( sal_Int ...@@ -110,9 +110,9 @@ const XMLPropertyHandler* XMLPropertyHandlerFactory::GetPropertyHandler( sal_Int
} }
// Helper-methods to create and cache PropertyHandler // Helper-methods to create and cache PropertyHandler
XMLPropertyHandler* XMLPropertyHandlerFactory::GetHdlCache( sal_Int32 nType ) const const XMLPropertyHandler* XMLPropertyHandlerFactory::GetHdlCache( sal_Int32 nType ) const
{ {
XMLPropertyHandler* pRet = NULL; const XMLPropertyHandler* pRet = NULL;
if( maHandlerCache.find( nType ) != maHandlerCache.end() ) if( maHandlerCache.find( nType ) != maHandlerCache.end() )
pRet = maHandlerCache.find( nType )->second; pRet = maHandlerCache.find( nType )->second;
...@@ -122,7 +122,7 @@ XMLPropertyHandler* XMLPropertyHandlerFactory::GetHdlCache( sal_Int32 nType ) co ...@@ -122,7 +122,7 @@ XMLPropertyHandler* XMLPropertyHandlerFactory::GetHdlCache( sal_Int32 nType ) co
void XMLPropertyHandlerFactory::PutHdlCache( sal_Int32 nType, const XMLPropertyHandler* pHdl ) const void XMLPropertyHandlerFactory::PutHdlCache( sal_Int32 nType, const XMLPropertyHandler* pHdl ) const
{ {
maHandlerCache[nType] = (XMLPropertyHandler*)pHdl; maHandlerCache[nType] = pHdl;
} }
const XMLPropertyHandler* XMLPropertyHandlerFactory::GetBasicHandler( sal_Int32 nType ) const const XMLPropertyHandler* XMLPropertyHandlerFactory::GetBasicHandler( sal_Int32 nType ) const
......
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