aboutsummaryrefslogtreecommitdiff
path: root/src/argument_parser.hpp
blob: 25243a3459bcc1c2b99d6299f95c9b57255fc2ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include "DI/auto_wirable.hpp"
#include "interfaces/argument_parser.hpp"
#include "interfaces/randomization.hpp"

#include <getopt.h>
#include <string_view>
#include <vector>

class ArgumentParser
	: public IArgumentParser,
	  public AutoWirable<IArgumentParser, ArgumentParser, IRandomNumberGeneratorFactory>
{
public:
	explicit ArgumentParser(IRandomNumberGeneratorFactory random_number_generator_factory
	) noexcept;

	auto parse(
		const std::vector<option> &options,
		const std::string_view &short_options,
		const int &argc,
		char *const *argv
	) noexcept -> ParsedArguments override; // NOLINT(cppcoreguidelines-avoid-c-arrays,
											// modernize-avoid-c-arrays)

private:
	IRandomNumberGeneratorFactory _random_number_generator_factory;
};