chore: separate definition from decleration for the fake_parser where possible.

This commit is contained in:
2026-03-15 23:35:21 +04:00
parent c7304aa36e
commit 609a730e8f
2 changed files with 34 additions and 25 deletions

View File

@@ -11,28 +11,13 @@ namespace argument_parser {
class fake_parser : public base_parser { class fake_parser : public base_parser {
public: public:
fake_parser() = default; fake_parser() = default;
fake_parser(std::string program_name, std::vector<std::string> const &arguments);
fake_parser(std::string const &program_name, std::vector<std::string> &&arguments);
fake_parser(std::string const &program_name, std::initializer_list<std::string> const &arguments);
fake_parser(std::string program_name, std::vector<std::string> const& arguments) { void set_program_name(std::string const &program_name);
this->program_name = std::move(program_name); void set_parsed_arguments(std::vector<std::string> const &parsed_arguments);
parsed_arguments = arguments;
}
fake_parser(std::string const& program_name, std::vector<std::string>&& arguments) {
this->program_name = program_name;
parsed_arguments = std::move(arguments);
}
fake_parser(std::string const& program_name, std::initializer_list<std::string> const& arguments) :
fake_parser(program_name, std::vector<std::string>(arguments)) {}
void set_program_name(std::string const& program_name) {
this->program_name = program_name;
}
void set_parsed_arguments(std::vector<std::string> const& parsed_arguments) {
this->parsed_arguments = parsed_arguments;
}
}; };
} } // namespace argument_parser
#endif #endif

View File

@@ -0,0 +1,24 @@
#include "fake_parser.hpp"
namespace argument_parser {
fake_parser::fake_parser(std::string program_name, std::vector<std::string> const &arguments) {
this->program_name = std::move(program_name);
parsed_arguments = arguments;
}
fake_parser::fake_parser(std::string const &program_name, std::vector<std::string> &&arguments) {
this->program_name = program_name;
parsed_arguments = std::move(arguments);
}
fake_parser::fake_parser(std::string const &program_name, std::initializer_list<std::string> const &arguments)
: fake_parser(program_name, std::vector<std::string>(arguments)) {}
void fake_parser::set_program_name(std::string const &program_name) {
this->program_name = program_name;
}
void fake_parser::set_parsed_arguments(std::vector<std::string> const &parsed_arguments) {
this->parsed_arguments = parsed_arguments;
}
} // namespace argument_parser