26 lines
580 B
C++
26 lines
580 B
C++
#pragma once
|
|
#include <map>
|
|
#include <string>
|
|
|
|
class command_line {
|
|
public:
|
|
static command_line &instance() {
|
|
static command_line instance;
|
|
return instance;
|
|
}
|
|
|
|
void init(int argc, char **argv);
|
|
|
|
void get_arg(const std::string &key, std::string &out) const;
|
|
|
|
void get_arg(const std::string &key, int &out) const;
|
|
|
|
void get_arg(const std::string &key, float &out) const;
|
|
|
|
void get_arg(const std::string &key, bool &out) const;
|
|
|
|
private:
|
|
std::map<std::string, std::string> args_; // key-value pairs
|
|
command_line() = default;
|
|
};
|