mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 20:11:50 +00:00
numeric setting value display fix
This commit is contained in:
parent
c3b5576c02
commit
788bd6bf0f
8 changed files with 13 additions and 12 deletions
41
src/util/command_line.hpp
Normal file
41
src/util/command_line.hpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef UTIL_COMMAND_LINE_HPP_
|
||||
#define UTIL_COMMAND_LINE_HPP_
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include "../files/engine_paths.h"
|
||||
|
||||
class ArgsReader {
|
||||
int argc;
|
||||
char** argv;
|
||||
int pos = 0;
|
||||
const char* last = "";
|
||||
public:
|
||||
ArgsReader(int argc, char** argv) : argc(argc), argv(argv) {}
|
||||
|
||||
void skip() {
|
||||
pos++;
|
||||
}
|
||||
|
||||
bool hasNext() const {
|
||||
return pos < argc;
|
||||
}
|
||||
|
||||
bool isKeywordArg() const {
|
||||
return last[0] == '-';
|
||||
}
|
||||
|
||||
std::string next() {
|
||||
if (pos >= argc) {
|
||||
throw std::runtime_error("unexpected end");
|
||||
}
|
||||
last = argv[pos];
|
||||
return argv[pos++];
|
||||
}
|
||||
};
|
||||
|
||||
/// @return false if engine start can
|
||||
bool parse_cmdline(int argc, char** argv, EnginePaths& paths);
|
||||
|
||||
#endif // UTIL_COMMAND_LINE_HPP_
|
||||
Loading…
Add table
Add a link
Reference in a new issue