Skip to content

Commit

Permalink
command_line/arguments: Defined constructors, assignment operators an…
Browse files Browse the repository at this point in the history
…d a destructor for arguments_t so the compiler doesn't try to auto-gen them and fail
  • Loading branch information
dragonmux committed Aug 19, 2023
1 parent 807f088 commit d8bea38
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions impl/command_line/arguments.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ namespace substrate::commandLine
// Implementation of the innards of arguments_t as otherwise we get compile errors
// NOLINTNEXTLINE(modernize-use-equals-default)
arguments_t::arguments_t() noexcept : _arguments{} { }
arguments_t::arguments_t(const arguments_t &arguments) noexcept : _arguments{arguments._arguments} { }
arguments_t::arguments_t(arguments_t &&arguments) noexcept : _arguments{std::move(arguments._arguments)} { }
// NOLINTNEXTLINE(modernize-use-equals-default)
arguments_t::~arguments_t() noexcept { }
size_t arguments_t::count() const noexcept
{ return _arguments.size(); }
size_t arguments_t::countMatching(const std::string_view &option) const noexcept
Expand All @@ -400,6 +404,18 @@ namespace substrate::commandLine
arguments_t::iterator_t arguments_t::find(const std::string_view &option) const noexcept
{ return _arguments.find(option); }

arguments_t &arguments_t::operator =(const arguments_t &arguments) noexcept

Check warning on line 407 in impl/command_line/arguments.cxx

View check run for this annotation

Codecov / codecov/patch

impl/command_line/arguments.cxx#L407

Added line #L407 was not covered by tests
{
_arguments = arguments._arguments;
return *this;

Check warning on line 410 in impl/command_line/arguments.cxx

View check run for this annotation

Codecov / codecov/patch

impl/command_line/arguments.cxx#L410

Added line #L410 was not covered by tests
}

arguments_t &arguments_t::operator =(arguments_t &&arguments) noexcept

Check warning on line 413 in impl/command_line/arguments.cxx

View check run for this annotation

Codecov / codecov/patch

impl/command_line/arguments.cxx#L413

Added line #L413 was not covered by tests
{
_arguments = std::move(arguments._arguments);
return *this;

Check warning on line 416 in impl/command_line/arguments.cxx

View check run for this annotation

Codecov / codecov/patch

impl/command_line/arguments.cxx#L415-L416

Added lines #L415 - L416 were not covered by tests
}

// NOLINTNEXTLINE(readability-convert-member-functions-to-static)
std::vector<const item_t *> arguments_t::findAll(const std::string_view &option) const noexcept
{
Expand Down
5 changes: 5 additions & 0 deletions substrate/command_line/arguments
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ namespace substrate::commandLine

public:
arguments_t() noexcept;
arguments_t(const arguments_t &arguments) noexcept;
arguments_t(arguments_t &&arguments) noexcept;
~arguments_t() noexcept;
arguments_t &operator =(const arguments_t &arguments) noexcept;
arguments_t &operator =(arguments_t &&arguments) noexcept;

[[nodiscard]] bool parseFrom(internal::tokeniser_t &lexer, const options_t &options);
[[nodiscard]] bool add(item_t argument) noexcept;
Expand Down

0 comments on commit d8bea38

Please sign in to comment.