From b699bfc80e3b242795c9e7cbb0d1ac8b48750959 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 2 Jan 2014 12:45:19 +1100 Subject: Use a std::map for KeyMap to avoid custom iteration in favour of standard provided functionality. --- src/KeyMap.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/KeyMap.h') diff --git a/src/KeyMap.h b/src/KeyMap.h index 2f14e2488..b102b356f 100644 --- a/src/KeyMap.h +++ b/src/KeyMap.h @@ -20,6 +20,22 @@ namespace Scintilla { #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT) #define SCI_ASHIFT (SCI_ALT | SCI_SHIFT) +/** + */ +class KeyModifiers { +public: + int key; + int modifiers; + KeyModifiers(int key_, int modifiers_) : key(key_), modifiers(modifiers_) { + } + bool operator<(const KeyModifiers &other) const { + if (key == other.key) + return modifiers < other.modifiers; + else + return key < other.key; + } +}; + /** */ class KeyToCommand { @@ -32,7 +48,7 @@ public: /** */ class KeyMap { - std::vector kmap; + std::map kmap; static const KeyToCommand MapDefault[]; public: -- cgit v1.2.3