summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibKeyboard
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-04-02 21:12:47 +0300
committerAndreas Kling <kling@serenityos.org>2021-04-03 11:57:23 +0200
commit32dd9c554b7a98daf0bdf7df2090640d90ce36ca (patch)
treea43da5cd9cb4e36bd2b2ae01b829f206ff5b8638 /Userland/Libraries/LibKeyboard
parent8a12d02b9af587cc8b5353f7c5d0205b924b43aa (diff)
downloadserenity-32dd9c554b7a98daf0bdf7df2090640d90ce36ca.zip
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.
Diffstat (limited to 'Userland/Libraries/LibKeyboard')
-rw-r--r--Userland/Libraries/LibKeyboard/CharacterMap.cpp4
-rw-r--r--Userland/Libraries/LibKeyboard/CharacterMap.h4
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, OSError> 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<CharacterMap, OSError> 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;