Hello lo-devs,
This patch series replaces some DECLARE_TABLE macros with
the std::map equivalent.
regards
Marcel
---
vcl/source/window/accel.cxx | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index f45b145..e755d48 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -27,18 +27,18 @@
************************************************************************/
-#include <tools/table.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
#include <vcl/svapp.hxx>
#include <accel.h>
#include <vcl/accel.hxx>
+#include <map>
#include <vector>
// =======================================================================
-DECLARE_TABLE( ImplAccelTable, ImplAccelEntry* )
+typedef ::std::map< sal_uLong, ImplAccelEntry* > ImplAccelMap;
typedef ::std::vector< ImplAccelEntry* > ImplAccelList;
#define ACCELENTRY_NOTFOUND ((sal_uInt16)0xFFFF)
@@ -48,8 +48,8 @@ typedef ::std::vector< ImplAccelEntry* > ImplAccelList;
class ImplAccelData
{
public:
- ImplAccelTable maKeyTable; // for keycodes, generated with a code
- ImplAccelList maIdList; // Id-List
+ ImplAccelMap maKeyMap; // for keycodes, generated with a code
+ ImplAccelList maIdList; // Id-List
};
// =======================================================================
@@ -179,7 +179,11 @@ void Accelerator::ImplInit()
ImplAccelEntry* Accelerator::ImplGetAccelData( const KeyCode& rKeyCode ) const
{
- return mpData->maKeyTable.Get( rKeyCode.GetFullKeyCode() );
+ ImplAccelMap::iterator it = mpData->maKeyMap.find( rKeyCode.GetFullKeyCode() );
+ if( it != mpData->maKeyMap.end() )
+ return it->second;
+ else
+ return NULL;
}
// -----------------------------------------------------------------------
@@ -200,7 +204,7 @@ void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
else
pEntry->mpAutoAccel = NULL;
- mpData->maKeyTable.Insert( (sal_uLong)pEntry->maKeyCode.GetFullKeyCode(), pEntry );
+ mpData->maKeyMap.insert( std::make_pair( pEntry->maKeyCode.GetFullKeyCode(), pEntry ) );
mpData->maIdList.push_back( pEntry );
}
}
@@ -267,7 +271,7 @@ void Accelerator::ImplInsertAccel( sal_uInt16 nItemId, const KeyCode& rKeyCode,
OSL_FAIL( "Accelerator::InsertItem(): KeyCode with KeyCode 0 not allowed" );
delete pEntry;
}
- else if ( !mpData->maKeyTable.Insert( nCode, pEntry ) )
+ else if ( mpData->maKeyMap.insert( std::make_pair( nCode, pEntry ) ).second )
{
OSL_TRACE( "Accelerator::InsertItem(): KeyCode (Key: %lx) already exists", nCode );
delete pEntry;
@@ -470,7 +474,7 @@ Accelerator& Accelerator::operator=( const Accelerator& rAccel )
// delete and copy tables
ImplDeleteData();
- mpData->maKeyTable.Clear();
+ mpData->maKeyMap.clear();
ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) );
return *this;
Context
- [Libreoffice] [PATCH 1/4] fdo38832 Replace ImplAccelTable with std::map · Marcel Metz
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.