Skip to content

Commit

Permalink
OrcCommand: UtilitiesMain: add OutputOption overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
jgautier-anssi authored and fabienfl-orc committed Nov 9, 2020
1 parent 5bf2f6f commit aec3c11
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/OrcCommand/UtilitiesMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,37 @@ class ORCLIB_API UtilitiesMain
// Option handling
//
bool OutputOption(LPCWSTR szArg, LPCWSTR szOption, OutputSpec::Kind supportedTypes, OutputSpec& anOutput);

template <typename OptionType>
bool
OutputOption(LPCWSTR szArg, LPCWSTR szOption, OutputSpec::Kind supportedTypes, std::optional<OptionType>& parameter)
{
OptionType result;
if (OutputOption(szArg, szOption, supportedTypes, result))
{
parameter.emplace(std::move(result));
return true;
}
return false;
}

bool OutputOption(LPCWSTR szArg, LPCWSTR szOption, OutputSpec& anOutput)
{
return OutputOption(szArg, szOption, anOutput.supportedTypes, anOutput);
};

template <typename OptionType>
bool OutputOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType> parameter)
{
OptionType result;
if (OutputOption(szArg, szOption, result))
{
parameter.emplace(std::move(result));
return true;
}
return false;
}

bool OutputFileOption(LPCWSTR szArg, LPCWSTR szOption, std::wstring& strOutputFile);
template <typename OptionType>
bool OutputFileOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType> parameter)
Expand Down

0 comments on commit aec3c11

Please sign in to comment.