1
0
Fork 0
forked from blue/mlc

reorganized the project, some idea of how to handle settings

This commit is contained in:
Blue 2023-10-06 18:39:07 -03:00
parent e4cc5e8d0e
commit 870842f63d
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
17 changed files with 167 additions and 26 deletions

39
src/settings.h Normal file
View file

@ -0,0 +1,39 @@
#pragma once
#include <string>
#include <string_view>
#include <optional>
#include <vector>
#include <array>
#include <algorithm>
#include "loggable.h"
class Settings {
public:
enum Action {
convert,
help,
printConfig,
_actionsSize
};
Settings(int argc, char **argv);
std::string getInput() const;
std::string getOutput() const;
Loggable::Severity getLogLevel() const;
Action getAction() const;
private:
void parseArguments();
static std::string_view stripFlags(const std::string_view& option);
private:
std::vector<std::string_view> arguments;
std::optional<Action> action;
std::optional<std::string> input;
std::optional<std::string> output;
std::optional<Loggable::Severity> logLevel;
};