add some app infrastructure services
This commit is contained in:
@@ -1,6 +1,47 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <libconfig.h++>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct LoggerConfig {
|
||||
std::string id;
|
||||
std::vector<std::string> flagsEnabled;
|
||||
bool showTime = false;
|
||||
bool showSourceTrace = false;
|
||||
bool coutEnabled = false;
|
||||
bool fileEnabled = false;
|
||||
std::string filePath;
|
||||
};
|
||||
|
||||
struct AudioConfig {
|
||||
uint32_t sampleRate;
|
||||
uint32_t channels;
|
||||
uint32_t stereoMode;
|
||||
uint32_t bufferSize;
|
||||
float pitchStandard;
|
||||
int32_t midiHome;
|
||||
int32_t notesPerOctave;
|
||||
};
|
||||
|
||||
class ConfigService {
|
||||
|
||||
public:
|
||||
|
||||
ConfigService(const std::string& filePath);
|
||||
~ConfigService() = default;
|
||||
|
||||
bool loadFromFile(const std::string& filePath);
|
||||
|
||||
bool getLoggerConfig(const std::string& id, LoggerConfig* loggerConfig) const;
|
||||
const std::string& lastError() const;
|
||||
|
||||
private:
|
||||
bool parseLoggerConfig(const libconfig::Setting& loggerSetting, LoggerConfig* loggerConfig) const;
|
||||
|
||||
libconfig::Config config_;
|
||||
std::string lastError_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user