logiops/src/logid/Configuration.h
Fabio Streun 97b174f6df Fix DeviceConfig default initialization
Initialize smartshift to nullptr.
Otherwise, the device configuration contains a SmartshiftStatus, even though, none was declared in the configuration file.
This causes later an error if the device does not support SmartShift.
2020-05-14 12:43:25 +02:00

44 lines
1.1 KiB
C++

#ifndef LOGID_CONFIGURATION_H
#define LOGID_CONFIGURATION_H
#include <map>
#include <libconfig.h++>
#include <hidpp20/ISmartShift.h>
#include "Actions.h"
namespace logid
{
class DeviceConfig;
class ButtonAction;
enum class Action;
class DeviceConfig
{
public:
DeviceConfig();
~DeviceConfig();
DeviceConfig(DeviceConfig* dc, Device* dev);
DeviceConfig(const libconfig::Setting& root);
const int* dpi = nullptr;
HIDPP20::ISmartShift::SmartshiftStatus* smartshift = nullptr;
const uint8_t* hiresscroll = nullptr;
std::map<uint16_t, ButtonAction*> actions;
const bool baseConfig = true;
};
class Configuration
{
public:
Configuration(const char* config_file);
Configuration() {}
std::map<std::string, DeviceConfig*> devices;
private:
libconfig::Config cfg;
};
ButtonAction* parse_action(Action action, const libconfig::Setting* action_config, bool is_gesture=false);
extern Configuration* global_config;
}
#endif //LOGID_CONFIGURATION_H