ECSTASY
All in the name
Loading...
Searching...
No Matches
UserProfile.cpp
Go to the documentation of this file.
1
11
12#include "UserProfile.hpp"
13
15{
17 {
18 toml::table table;
19
20 table.emplace("id", static_cast<long long int>(_id));
21 table.emplace("bindings", _actionBindings.dump());
22 return table;
23 }
24
25 bool UserProfile::load(const toml::table &infos) noexcept
26 {
28 auto id = infos.get("id");
29 if (id && id->is_integer())
30 _id = static_cast<UserProfile::Id>(id->as_integer()->get());
31
33 auto bindings = infos.get("bindings");
34 if (bindings && bindings->is_table())
35 _actionBindings.load(*bindings->as_table());
36 return true;
37 }
38
39} // namespace ecstasy::integration::user_action
toml::table dump() const noexcept
Dump the bindings as a toml table.
toml::table dump() const noexcept
Dump the user profile informations as a toml table.
bool load(const toml::table &infos) noexcept
Load a given toml table representing a user profile.
std::pair< iterator, bool > emplace(KeyType &&key, ValueArgs &&... args)
User action integration.
Definition Action.hpp:18