For my current project (in C#) I created an enumerated type that represents the actions you can perform. Then to map a key I simply use a Dictionary with a Keys parameter as the lookup key. When a key is pressed I lookup the KeyAction and fire an appropriate event. In my case I don't handle joysticks/gamepads or remapping of the mouse though.
Currently working on an open world survival RPG - For info check out my Development blog:ByteWrangler