lintel 0.2.0
Loading...
Searching...
No Matches
Argument.h
Go to the documentation of this file.
1#ifndef LINTEL_ARGUMENT_H
2#define LINTEL_ARGUMENT_H
3
4#include <cstdint>
5#include <iostream>
6#include <optional>
7#include <string>
8#include <variant>
9#include <vector>
10
11namespace lintel {
14{
15private:
16 std::string m_flag;
17 std::string m_shortFlag;
18 std::string m_description;
19
20public:
21 typedef std::variant<int32_t *,
22 uint32_t *,
23 double *,
24 float *,
25 bool *,
26 std::string *,
27 std::optional<int32_t> *,
28 std::optional<uint32_t> *,
29 std::optional<double> *,
30 std::optional<float> *,
31 std::optional<bool> *,
32 std::optional<std::string> *>
34
40 Argument(std::string flag, std::string shortFlag, std::string description, const Value &value);
41
44 void printHelp(std::ostream &os = std::cout) const;
45
48 void parse(const std::string &arguments);
49
52 [[nodiscard]] const std::string &getFlag() const;
53
56 [[nodiscard]] const std::string &getShortFlag() const;
57
58private:
59 void resetOptionals();
60
61 void parseOptionalFromStream(const std::string &argument);
62
63 Value m_value;
64};
65
68{
69private:
70 std::vector<Argument> m_arguments;
71
72public:
75 explicit ArgumentProvider(std::vector<Argument> arguments);
76
79 [[nodiscard]] const std::vector<Argument> &provide() const;
80};
81
82}// namespace lintel
83#endif// LINTEL_ARGUMENT_H
Definition Argument.h:68
ArgumentProvider(std::vector< Argument > arguments)
const std::vector< Argument > & provide() const
Definition Argument.h:14
Argument(std::string flag, std::string shortFlag, std::string description, const Value &value)
const std::string & getFlag() const
const std::string & getShortFlag() const
void printHelp(std::ostream &os=std::cout) const
void parse(const std::string &arguments)
std::variant< int32_t *, uint32_t *, double *, float *, bool *, std::string *, std::optional< int32_t > *, std::optional< uint32_t > *, std::optional< double > *, std::optional< float > *, std::optional< bool > *, std::optional< std::string > * > Value
Definition Argument.h:33
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9