NEFFy
NEFF Calculator and MSA File Converter
Loading...
Searching...
No Matches
flagHandler.h
Go to the documentation of this file.
1
6#ifndef FLAGHANDLER_H
7#define FLAGHANDLER_H
8
9#include <iostream>
10#include <string>
11#include <unordered_map>
12#include <stdexcept>
13#include <vector>
14
16{
18 std::string value;
19};
20
22{
23private:
24 std::unordered_map<std::string, FlagInfo> flags;
25
26public:
27
32 FlagHandler(const std::unordered_map<std::string, FlagInfo>& _flags);
33
39 void processFlags(const std::vector<std::string>& args);
40
47 std::string getFlagValue(const std::string& flagName) const;
48
53 void checkRequiredFlags() const;
54
59 float getFloatValue(const std::string& name) const;
60
65 float getBooleanValue(const std::string& name) const;
66
70 std::vector<std::string> getFileArrayValue(const std::string& name) const;
71
76 std::vector<int> getIntArrayValue(const std::string& name) const;
77
81 int getIntValue(const std::string& name) const;
82
86 int getNonZeroIntValue(const std::string& name) const;
87};
88
89#endif
Definition flagHandler.h:22
float getFloatValue(const std::string &name) const
Get given float option by user.
Definition flagHandler.cpp:109
float getBooleanValue(const std::string &name) const
Get given boolean option by user.
Definition flagHandler.cpp:91
FlagHandler(const std::unordered_map< std::string, FlagInfo > &_flags)
Constructor for FlagHandler.
Definition flagHandler.cpp:17
std::vector< std::string > getFileArrayValue(const std::string &name) const
Get list of files.
Definition flagHandler.cpp:123
std::unordered_map< std::string, FlagInfo > flags
Definition flagHandler.h:24
void checkRequiredFlags() const
Checks if all required flags have values.
Definition flagHandler.cpp:77
int getNonZeroIntValue(const std::string &name) const
Get given non-zero int option by user.
Definition flagHandler.cpp:195
std::string getFlagValue(const std::string &flagName) const
Retrieves the value of a flag.
Definition flagHandler.cpp:63
void processFlags(const std::vector< std::string > &args)
Processes the command-line arguments and updates the flag values.
Definition flagHandler.cpp:20
std::vector< int > getIntArrayValue(const std::string &name) const
Get given int option by user.
Definition flagHandler.cpp:151
int getIntValue(const std::string &name) const
Get given int option by user.
Definition flagHandler.cpp:173
Definition flagHandler.h:16
std::string value
Definition flagHandler.h:18
bool required
Definition flagHandler.h:17
Footer