![]() |
Leviathan
0.8.0.0
Leviathan game engine
|
Holds key configuration for an application. More...
#include <KeyConfiguration.h>
Public Member Functions | |
DLLEXPORT | KeyConfiguration (const std::string &configfile) |
DLLEXPORT | KeyConfiguration () |
Creates an in-memory only configuration. More... | |
DLLEXPORT | ~KeyConfiguration () |
DLLEXPORT bool | Init (std::function< void(Lock &guard, KeyConfiguration *checkfrom)> functocheck) |
Loads the defined keys from a file. More... | |
DLLEXPORT void | Release () |
Saves all keys if modified. More... | |
DLLEXPORT bool | AddKeyIfMissing (Lock &guard, const std::string &name, const std::vector< std::string > &defaultkeys) |
Adds a key if one with the name isn't defined. More... | |
DLLEXPORT void | MarkAsChanged () |
Marks current keys as changed and that the configuration should be saved to a file. More... | |
DLLEXPORT void | Save (Lock &guard) |
Saves current keys. More... | |
DLLEXPORT std::shared_ptr< std::vector< GKey > > | ResolveControlNameToKey (const std::string &controlkey) |
Resolves a control key string ("WalkForward") to a key. More... | |
DLLEXPORT const std::vector< GKey > & | ResolveControlNameToKeyVector (const std::string &controlkey) |
Resolve variant for getting a reference to the vector of keys. More... | |
DLLEXPORT GKey | ResolveControlNameToFirstKey (const std::string &controlkey) |
Resolve variant for getting the first binding or throwing. More... | |
DLLEXPORT std::string | ResolveKeyToControlName (const GKey &key) |
![]() | |
DLLEXPORT | ThreadSafeGeneric () |
DLLEXPORT | ~ThreadSafeGeneric () |
FORCE_INLINE void | VerifyLock (RecursiveLock &guard) const |
FORCE_INLINE void | VerifyLock (Lock &lockit) const |
Additional Inherited Members | |
![]() | |
MutexType | ObjectsLock |
Holds key configuration for an application.
Definition at line 15 of file KeyConfiguration.h.
DLLEXPORT KeyConfiguration::KeyConfiguration | ( | const std::string & | configfile | ) |
configfile | The file which is used for saving and loading keys |
Definition at line 8 of file KeyConfiguration.cpp.
DLLEXPORT KeyConfiguration::KeyConfiguration | ( | ) |
Creates an in-memory only configuration.
Definition at line 13 of file KeyConfiguration.cpp.
DLLEXPORT KeyConfiguration::~KeyConfiguration | ( | ) |
Definition at line 15 of file KeyConfiguration.cpp.
DLLEXPORT bool KeyConfiguration::AddKeyIfMissing | ( | Lock & | guard, |
const std::string & | name, | ||
const std::vector< std::string > & | defaultkeys | ||
) |
Adds a key if one with the name isn't defined.
Definition at line 73 of file KeyConfiguration.cpp.
DLLEXPORT bool KeyConfiguration::Init | ( | std::function< void(Lock &guard, KeyConfiguration *checkfrom)> | functocheck | ) |
Loads the defined keys from a file.
the function argument is called to verify that all required keys are defined and it can add missing keys
Definition at line 20 of file KeyConfiguration.cpp.
DLLEXPORT void KeyConfiguration::MarkAsChanged | ( | ) |
Marks current keys as changed and that the configuration should be saved to a file.
Useful during initially checking that all keys exist
Definition at line 98 of file KeyConfiguration.cpp.
DLLEXPORT void KeyConfiguration::Release | ( | ) |
Saves all keys if modified.
Definition at line 64 of file KeyConfiguration.cpp.
Resolve variant for getting the first binding or throwing.
InvalidArgument | if controlkey not found |
Definition at line 169 of file KeyConfiguration.cpp.
DLLEXPORT std::shared_ptr< std::vector< GKey > > KeyConfiguration::ResolveControlNameToKey | ( | const std::string & | controlkey | ) |
Resolves a control key string ("WalkForward") to a key.
Definition at line 140 of file KeyConfiguration.cpp.
DLLEXPORT const std::vector< GKey > & KeyConfiguration::ResolveControlNameToKeyVector | ( | const std::string & | controlkey | ) |
Resolve variant for getting a reference to the vector of keys.
InvalidArgument | if controlkey not found |
Definition at line 152 of file KeyConfiguration.cpp.
Checks which configuration key string matches input key
Definition at line 180 of file KeyConfiguration.cpp.
Saves current keys.
Definition at line 103 of file KeyConfiguration.cpp.