Skip to content

Commit 181dfd8

Browse files
committed
OrcCommand: UtilitiesMain: make 'Option' functions static
They should be moved in a dedicated source file.
1 parent 31c8891 commit 181dfd8

File tree

1 file changed

+44
-39
lines changed

1 file changed

+44
-39
lines changed

src/OrcCommand/UtilitiesMain.h

+44-39
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,10 @@ class UtilitiesMain
446446
//
447447
// Option handling
448448
//
449-
bool OutputOption(LPCWSTR szArg, LPCWSTR szOption, OutputSpec::Kind supportedTypes, OutputSpec& anOutput);
449+
static bool OutputOption(LPCWSTR szArg, LPCWSTR szOption, OutputSpec::Kind supportedTypes, OutputSpec& anOutput);
450450

451451
template <typename OptionType>
452-
bool
452+
static bool
453453
OutputOption(LPCWSTR szArg, LPCWSTR szOption, OutputSpec::Kind supportedTypes, std::optional<OptionType>& parameter)
454454
{
455455
OptionType result;
@@ -461,13 +461,13 @@ class UtilitiesMain
461461
return false;
462462
}
463463

464-
bool OutputOption(LPCWSTR szArg, LPCWSTR szOption, OutputSpec& anOutput)
464+
static bool OutputOption(LPCWSTR szArg, LPCWSTR szOption, OutputSpec& anOutput)
465465
{
466466
return OutputOption(szArg, szOption, anOutput.supportedTypes, anOutput);
467467
};
468468

469469
template <typename OptionType>
470-
bool OutputOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType> parameter)
470+
static bool OutputOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType> parameter)
471471
{
472472
OptionType result;
473473
if (OutputOption(szArg, szOption, result))
@@ -478,9 +478,10 @@ class UtilitiesMain
478478
return false;
479479
}
480480

481-
bool OutputFileOption(LPCWSTR szArg, LPCWSTR szOption, std::wstring& strOutputFile);
481+
static bool OutputFileOption(LPCWSTR szArg, LPCWSTR szOption, std::wstring& strOutputFile);
482+
482483
template <typename OptionType>
483-
bool OutputFileOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType> parameter)
484+
static bool OutputFileOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType> parameter)
484485
{
485486
OptionType result;
486487
if (OutputFileOption(szArg, szOption, result))
@@ -491,9 +492,10 @@ class UtilitiesMain
491492
return false;
492493
}
493494

494-
bool OutputDirOption(LPCWSTR szArg, LPCWSTR szOption, std::wstring& strOutputFile);
495+
static bool OutputDirOption(LPCWSTR szArg, LPCWSTR szOption, std::wstring& strOutputFile);
496+
495497
template <typename OptionType>
496-
bool OutputDirOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType>& parameter)
498+
static bool OutputDirOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType>& parameter)
497499
{
498500
OptionType result;
499501
if (OutputDirOption(szArg, szOption, result))
@@ -507,7 +509,7 @@ class UtilitiesMain
507509
bool InputFileOption(LPCWSTR szArg, LPCWSTR szOption, std::wstring& strInputFile);
508510

509511
template <typename OptionType>
510-
bool InputFileOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType>& parameter)
512+
static bool InputFileOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType>& parameter)
511513
{
512514
OptionType result;
513515
if (InputFileOption(szArg, szOption, result))
@@ -518,10 +520,10 @@ class UtilitiesMain
518520
return false;
519521
}
520522

521-
bool InputDirOption(LPCWSTR szArg, LPCWSTR szOption, std::wstring& strInputFile);
523+
static bool InputDirOption(LPCWSTR szArg, LPCWSTR szOption, std::wstring& strInputFile);
522524

523525
template <typename OptionType>
524-
bool InputDirOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType>& parameter)
526+
static bool InputDirOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType>& parameter)
525527
{
526528
OptionType result;
527529
if (InputDirOption(szArg, szOption, result))
@@ -532,16 +534,16 @@ class UtilitiesMain
532534
return false;
533535
}
534536

535-
bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, std::wstring& strParameter);
536-
bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, ULONGLONG& ullParameter);
537-
bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, DWORD& dwParameter);
538-
bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, std::chrono::minutes& dwParameter);
539-
bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, std::chrono::seconds& dwParameter);
540-
bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, std::chrono::milliseconds& dwParameter);
541-
bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, boost::logic::tribool& bParameter);
537+
static bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, std::wstring& strParameter);
538+
static bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, ULONGLONG& ullParameter);
539+
static bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, DWORD& dwParameter);
540+
static bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, std::chrono::minutes& dwParameter);
541+
static bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, std::chrono::seconds& dwParameter);
542+
static bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, std::chrono::milliseconds& dwParameter);
543+
static bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, boost::logic::tribool& bParameter);
542544

543545
template <typename OptionType>
544-
bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType>& parameter)
546+
static bool ParameterOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<OptionType>& parameter)
545547
{
546548
OptionType result;
547549
if (ParameterOption(szArg, szOption, result))
@@ -552,24 +554,25 @@ class UtilitiesMain
552554
return false;
553555
}
554556

555-
bool OptionalParameterOption(
557+
static bool OptionalParameterOption(
556558
LPCWSTR szArg,
557559
LPCWSTR szOption,
558560
std::optional<std::wstring>& strParameter,
559561
const std::optional<std::wstring> defaultValue = std::nullopt);
560-
bool OptionalParameterOption(
562+
563+
static bool OptionalParameterOption(
561564
LPCWSTR szArg,
562565
LPCWSTR szOption,
563566
std::optional<ULONGLONG>& ullParameter,
564567
const std::optional<ULONGLONG> defaultValue = std::nullopt);
565-
bool OptionalParameterOption(
568+
static bool OptionalParameterOption(
566569
LPCWSTR szArg,
567570
LPCWSTR szOption,
568571
std::optional<DWORD>& dwParameter,
569572
const std::optional<DWORD> defaultValue = std::nullopt);
570573

571574
template <class ListContainerT>
572-
void
575+
static void
573576
CSVListToContainer(const std::wstring& strKeywords, ListContainerT& parameterList, const LPCWSTR szSeparator = L",")
574577
{
575578
ListContainerT keys;
@@ -594,7 +597,7 @@ class UtilitiesMain
594597
};
595598

596599
template <class ListContainerT>
597-
bool ParameterListOption(
600+
static bool ParameterListOption(
598601
LPCWSTR szArg,
599602
LPCWSTR szOption,
600603
ListContainerT& parameterList,
@@ -618,18 +621,18 @@ class UtilitiesMain
618621
return false;
619622
}
620623

621-
bool FileSizeOption(LPCWSTR szArg, LPCWSTR szOption, DWORDLONG& dwlFileSize);
624+
static bool FileSizeOption(LPCWSTR szArg, LPCWSTR szOption, DWORDLONG& dwlFileSize);
622625

623-
bool AltitudeOption(LPCWSTR szArg, LPCWSTR szOption, LocationSet::Altitude& altitude);
626+
static bool AltitudeOption(LPCWSTR szArg, LPCWSTR szOption, LocationSet::Altitude& altitude);
624627

625-
bool BooleanOption(LPCWSTR szArg, LPCWSTR szOption, bool& bOption);
626-
bool BooleanOption(LPCWSTR szArg, LPCWSTR szOption, boost::logic::tribool& bOption);
627-
bool BooleanExactOption(LPCWSTR szArg, LPCWSTR szOption, boost::logic::tribool& bPresent);
628+
static bool BooleanOption(LPCWSTR szArg, LPCWSTR szOption, bool& bOption);
629+
static bool BooleanOption(LPCWSTR szArg, LPCWSTR szOption, boost::logic::tribool& bOption);
630+
static bool BooleanExactOption(LPCWSTR szArg, LPCWSTR szOption, boost::logic::tribool& bPresent);
628631

629-
bool ToggleBooleanOption(LPCWSTR szArg, LPCWSTR szOption, bool& bOption);
632+
static bool ToggleBooleanOption(LPCWSTR szArg, LPCWSTR szOption, bool& bOption);
630633

631634
template <typename _EnumT>
632-
bool EnumOption(LPCWSTR szArg, LPCWSTR szOption, _EnumT& eOption, _EnumT eValue)
635+
static bool EnumOption(LPCWSTR szArg, LPCWSTR szOption, _EnumT& eOption, _EnumT eValue)
633636
{
634637
if (_wcsnicmp(szArg, szOption, wcslen(szOption)))
635638
return false;
@@ -638,15 +641,15 @@ class UtilitiesMain
638641
}
639642

640643
template <typename _FlagT, typename = std::enable_if_t<EnumFlagsOperator<_FlagT>::value>>
641-
bool FlagOption(LPCWSTR szArg, LPCWSTR szOption, _FlagT& eOption, _FlagT eValue)
644+
static bool FlagOption(LPCWSTR szArg, LPCWSTR szOption, _FlagT& eOption, _FlagT eValue)
642645
{
643646
if (_wcsnicmp(szArg, szOption, wcslen(szOption)))
644647
return false;
645648
eOption |= eValue;
646649
return true;
647650
}
648651
template <typename _FlagT, typename = std::enable_if_t<EnumFlagsOperator<_FlagT>::value>>
649-
bool FlagOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<_FlagT>& fOption, _FlagT eValue)
652+
static bool FlagOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<_FlagT>& fOption, _FlagT eValue)
650653
{
651654
if (_wcsnicmp(szArg, szOption, wcslen(szOption)))
652655
return false;
@@ -656,19 +659,21 @@ class UtilitiesMain
656659
return true;
657660
}
658661

659-
bool ShadowsOption(
662+
static bool ShadowsOption(
660663
LPCWSTR szArg,
661664
LPCWSTR szOption,
662665
boost::logic::tribool& bAddShadows,
663666
std::optional<LocationSet::ShadowFilters>& filters);
664667

665-
bool LocationExcludeOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<LocationSet::PathExcludes>& excludes);
668+
static bool
669+
LocationExcludeOption(LPCWSTR szArg, LPCWSTR szOption, std::optional<LocationSet::PathExcludes>& excludes);
670+
671+
static bool CryptoHashAlgorithmOption(LPCWSTR szArg, LPCWSTR szOption, CryptoHashStream::Algorithm& algo);
672+
static bool FuzzyHashAlgorithmOption(LPCWSTR szArg, LPCWSTR szOption, FuzzyHashStream::Algorithm& algo);
666673

667-
bool CryptoHashAlgorithmOption(LPCWSTR szArg, LPCWSTR szOption, CryptoHashStream::Algorithm& algo);
668-
bool FuzzyHashAlgorithmOption(LPCWSTR szArg, LPCWSTR szOption, FuzzyHashStream::Algorithm& algo);
674+
static bool ProcessPriorityOption(LPCWSTR szArg, LPCWSTR szOption = L"Low");
675+
static bool EncodingOption(LPCWSTR szArg, OutputSpec::Encoding& anEncoding);
669676

670-
bool ProcessPriorityOption(LPCWSTR szArg, LPCWSTR szOption = L"Low");
671-
bool EncodingOption(LPCWSTR szArg, OutputSpec::Encoding& anEncoding);
672677
bool UsageOption(LPCWSTR szArg);
673678

674679
bool WaitForDebugger(int argc, const WCHAR* argv[]);

0 commit comments

Comments
 (0)