summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-03-08 13:36:58 +0200
committerTor Lillqvist <tlillqvist@suse.com>2012-03-08 13:54:39 +0200
commite36a9a64f14581b2c7d567d17a72be6d3ea8dccc (patch)
tree7f74a33b0d16087c95d0101b96d6eae4fe8a37ab /tools
parent14ca52086ba3cdba0f767f69f9de9fa5fb9e5668 (diff)
Convert tools/table.hxx to std::map
Convert usage of tools/table.hxx to std::map in aPTable field of SvPersistStream class.
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/tools/pstm.hxx7
-rw-r--r--tools/source/ref/pstm.cxx19
2 files changed, 16 insertions, 10 deletions
diff --git a/tools/inc/tools/pstm.hxx b/tools/inc/tools/pstm.hxx
index 6f1e8e9e98d9..c9899773833c 100644
--- a/tools/inc/tools/pstm.hxx
+++ b/tools/inc/tools/pstm.hxx
@@ -31,12 +31,11 @@
#include <boost/unordered_map.hpp>
#include "tools/toolsdllapi.h"
-#include <tools/table.hxx>
-
#include <tools/unqidx.hxx>
#include <tools/ref.hxx>
#include <tools/rtti.hxx>
#include <tools/stream.hxx>
+#include <map>
#define ERRCODE_IO_NOFACTORY ERRCODE_IO_WRONGFORMAT
@@ -150,6 +149,8 @@ SV_IMPL_PERSIST_LIST(ClassName,EntryName)
DECLARE_UNIQUEINDEX( SvPersistUIdx,SvPersistBase *)
+typedef std::map<SvPersistBase*, sal_uIntPtr> PersistBaseMap;
+
//=========================================================================
class SvStream;
class TOOLS_DLLPUBLIC SvPersistStream : public SvStream
@@ -191,7 +192,7 @@ class TOOLS_DLLPUBLIC SvPersistStream : public SvStream
{
SvClassManager & rClassMgr;
SvStream * pStm;
- Table aPTable; // Pointer und Key gedreht
+ PersistBaseMap aPTable; // Pointer und Key gedreht
SvPersistUIdx aPUIdx;
sal_uIntPtr nStartIdx;
const SvPersistStream * pRefStm;
diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx
index 4c95a6fa6445..cba50700c7be 100644
--- a/tools/source/ref/pstm.cxx
+++ b/tools/source/ref/pstm.cxx
@@ -315,10 +315,15 @@ void SvPersistStream::FlushData()
*************************************************************************/
sal_uIntPtr SvPersistStream::GetIndex( SvPersistBase * pObj ) const
{
- sal_uIntPtr nId = (sal_uIntPtr)aPTable.Get( (sal_uIntPtr)pObj );
- if( !nId && pRefStm )
- return pRefStm->GetIndex( pObj );
- return nId;
+ PersistBaseMap::const_iterator it = aPTable.find( pObj );
+ if( it == aPTable.end() )
+ {
+ if ( pRefStm )
+ return pRefStm->GetIndex( pObj );
+ else
+ return 0;
+ }
+ return it->second;
}
/*************************************************************************
@@ -653,7 +658,7 @@ SvPersistStream& SvPersistStream::WritePointer
else
{
nId = aPUIdx.Insert( pObj );
- aPTable.Insert( (sal_uIntPtr)pObj, (void *)nId );
+ aPTable[ pObj ] = nId;
nP |= P_OBJ;
}
WriteId( *this, nP, nId, pObj->GetClassId() );
@@ -722,7 +727,7 @@ sal_uInt32 SvPersistStream::ReadObj
// unbedingt erst in Tabelle eintragen
sal_uIntPtr nNewId = aPUIdx.Insert( rpObj );
// um den gleichen Zustand, wie nach dem Speichern herzustellen
- aPTable.Insert( (sal_uIntPtr)rpObj, (void *)nNewId );
+ aPTable[ rpObj ] = nNewId;
DBG_ASSERT( !(nHdr & P_DBGUTIL) || nId == nNewId,
"read write id conflict: not the same" );
}
@@ -835,7 +840,7 @@ SvStream& operator >>
// Die Id eines Objektes wird nie modifiziert
rThis.aPUIdx.Insert( nId, pEle );
- rThis.aPTable.Insert( (sal_uIntPtr)pEle, (void *)nId );
+ rThis.aPTable[ pEle ] = nId;
}
}
else