From 32dd9c554b7a98daf0bdf7df2090640d90ce36ca Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 2 Apr 2021 21:12:47 +0300 Subject: LibKeyboard: Mark CharacterMap::get_char as const Also, mark character_map_name method as const and make it to return const String& instead of const String. --- Userland/Libraries/LibKeyboard/CharacterMap.cpp | 4 ++-- Userland/Libraries/LibKeyboard/CharacterMap.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibKeyboard/CharacterMap.cpp b/Userland/Libraries/LibKeyboard/CharacterMap.cpp index cf5771d67f..925a768c8f 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMap.cpp +++ b/Userland/Libraries/LibKeyboard/CharacterMap.cpp @@ -74,7 +74,7 @@ Result CharacterMap::fetch_system_map() #endif -u32 CharacterMap::get_char(KeyEvent event) +u32 CharacterMap::get_char(KeyEvent event) const { auto modifiers = event.modifiers(); auto index = event.scancode & 0xFF; // Index is last byte of scan code. @@ -121,7 +121,7 @@ void CharacterMap::set_character_map_name(const String& character_map_name) m_character_map_name = character_map_name; } -const String CharacterMap::character_map_name() +const String& CharacterMap::character_map_name() const { return m_character_map_name; } diff --git a/Userland/Libraries/LibKeyboard/CharacterMap.h b/Userland/Libraries/LibKeyboard/CharacterMap.h index 5a45c34fdb..6dd701d216 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMap.h +++ b/Userland/Libraries/LibKeyboard/CharacterMap.h @@ -47,12 +47,12 @@ public: static Result fetch_system_map(); #endif - u32 get_char(KeyEvent); + u32 get_char(KeyEvent) const; void set_character_map_data(CharacterMapData character_map_data); void set_character_map_name(const String& character_map_name); const CharacterMapData& character_map_data() const { return m_character_map_data; }; - const String character_map_name(); + const String& character_map_name() const; private: CharacterMapData m_character_map_data; -- cgit v1.2.3