Skip to content

Commit 795d5de

Browse files
committed
iox-#846 Remove OPTIONAL from windows platform correction
1 parent 72e942e commit 795d5de

File tree

8 files changed

+18
-19
lines changed

8 files changed

+18
-19
lines changed

iceoryx_hoofs/cli/include/iox/cli/option.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ struct OptionWithDetails : public Option // can this be melt together
9090
struct
9191
{
9292
OptionDescription_t description;
93-
OptionType type = OptionType::SWITCH;
93+
OptionType type = OptionType::Switch;
9494
TypeName_t typeName;
9595
} details;
9696
};

iceoryx_hoofs/cli/include/iox/cli/option_manager.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ inline bool OptionManager::extractOptionArgumentValue(const Arguments& arguments
4040
const OptionName_t& name,
4141
const OptionType optionType)
4242
{
43-
if (optionType == OptionType::SWITCH)
43+
if (optionType == OptionType::Switch)
4444
{
4545
return arguments.isSwitchSet(getLookupName(shortName, name));
4646
}

iceoryx_hoofs/cli/include/iox/cli/types.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ namespace cli
3030
enum class OptionType : uint8_t
3131
{
3232
/// @brief option when provided is true
33-
SWITCH,
33+
Switch,
3434
/// @brief option with value which has to be provided
35-
REQUIRED,
35+
Required,
3636
/// @brief option with value which can be provided
37-
OPTIONAL
37+
Optional
3838
};
3939

4040
static constexpr uint64_t MAX_OPTION_NAME_LENGTH = 32;

iceoryx_hoofs/cli/include/iox/cli_definition.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
/// @param[in] description a description of the optional value
4747
#define IOX_CLI_OPTIONAL(type, memberName, defaultValue, shortName, longName, description) \
4848
IOX_INTERNAL_CMD_LINE_VALUE( \
49-
type, memberName, defaultValue, shortName, longName, description, iox::cli::OptionType::OPTIONAL)
49+
type, memberName, defaultValue, shortName, longName, description, iox::cli::OptionType::Optional)
5050

5151
/// @brief Adds a required value to the command line, if it is not provided the program will print the help and
5252
/// terminate
@@ -57,15 +57,15 @@
5757
/// @param[in] description a description of the required value
5858
#define IOX_CLI_REQUIRED(type, memberName, shortName, longName, description) \
5959
IOX_INTERNAL_CMD_LINE_VALUE( \
60-
type, memberName, type(), shortName, longName, description, iox::cli::OptionType::REQUIRED)
60+
type, memberName, type(), shortName, longName, description, iox::cli::OptionType::Required)
6161

6262
/// @brief Adds a switch to the command line
6363
/// @param[in] memberName the name under which the switch is accessible
6464
/// @param[in] shortName a single character for the short option like '-s' for instance
6565
/// @param[in] longName a long option name under which this can be accessed like '--some-name' for instance
6666
/// @param[in] description a description of the switch
6767
#define IOX_CLI_SWITCH(memberName, shortName, longName, description) \
68-
IOX_INTERNAL_CMD_LINE_VALUE(bool, memberName, false, shortName, longName, description, iox::cli::OptionType::SWITCH)
68+
IOX_INTERNAL_CMD_LINE_VALUE(bool, memberName, false, shortName, longName, description, iox::cli::OptionType::Switch)
6969

7070
/// @brief Helper macro to create a struct with full command line parsing from argc, argv.
7171
/// @param[in] Name the name of the class/struct

iceoryx_hoofs/cli/source/command_line_parser.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ CommandLineParser::parse(const OptionDefinition& optionSet, int argc, char** arg
217217
return m_optionValue;
218218
}
219219

220-
if (optionEntry->details.type == OptionType::SWITCH)
220+
if (optionEntry->details.type == OptionType::Switch)
221221
{
222222
m_optionValue.m_arguments.emplace_back(*optionEntry);
223223
m_optionValue.m_arguments.back().value.clear();
@@ -271,7 +271,7 @@ void CommandLineParser::setDefaultValuesToUnsetOptions() noexcept // rename
271271
{
272272
for (const auto& availableOption : m_optionSet->m_availableOptions)
273273
{
274-
if (availableOption.details.type != OptionType::OPTIONAL)
274+
if (availableOption.details.type != OptionType::Optional)
275275
{
276276
continue;
277277
}
@@ -298,7 +298,7 @@ bool CommandLineParser::areAllRequiredValuesPresent() const noexcept
298298
bool areAllRequiredValuesPresent = true;
299299
for (const auto& availableOption : m_optionSet->m_availableOptions)
300300
{
301-
if (availableOption.details.type == OptionType::REQUIRED)
301+
if (availableOption.details.type == OptionType::Required)
302302
{
303303
bool isValuePresent = false;
304304
for (const auto& option : m_optionValue.m_arguments)
@@ -359,7 +359,7 @@ void CommandLineParser::printHelpAndExit() const noexcept
359359
outLength += 2 + option.longOption.size();
360360
}
361361

362-
if (option.details.type == OptionType::REQUIRED || option.details.type == OptionType::OPTIONAL)
362+
if (option.details.type == OptionType::Required || option.details.type == OptionType::Optional)
363363
{
364364
std::cout << " [" << option.details.typeName << "]";
365365
outLength += 3 + option.details.typeName.size();
@@ -373,7 +373,7 @@ void CommandLineParser::printHelpAndExit() const noexcept
373373
}
374374
std::cout << option.details.description << std::endl;
375375

376-
if (option.details.type == OptionType::OPTIONAL)
376+
if (option.details.type == OptionType::Optional)
377377
{
378378
for (uint64_t i = 0; i < OPTION_OUTPUT_WIDTH; ++i)
379379
{

iceoryx_hoofs/cli/source/option_definition.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ OptionDefinition::OptionDefinition(const OptionDescription_t& programDescription
2727
, m_onFailureCallback{onFailureCallback}
2828
{
2929
constexpr bool IS_SWITCH = true;
30-
std::move(*this).addOption({{'h', IS_SWITCH, {"help"}, {""}}, {"Display help."}, OptionType::SWITCH, {""}});
30+
std::move(*this).addOption({{'h', IS_SWITCH, {"help"}, {""}}, {"Display help."}, OptionType::Switch, {""}});
3131
}
3232

3333
optional<OptionWithDetails> OptionDefinition::getOption(const OptionName_t& name) const noexcept
@@ -100,7 +100,7 @@ OptionDefinition& OptionDefinition::addSwitch(const char shortOption,
100100
const OptionDescription_t& description) noexcept
101101
{
102102
constexpr bool IS_SWITCH = true;
103-
return addOption({{shortOption, IS_SWITCH, longOption, {""}}, description, OptionType::SWITCH, {""}});
103+
return addOption({{shortOption, IS_SWITCH, longOption, {""}}, description, OptionType::Switch, {""}});
104104
}
105105

106106
// NOLINTJUSTIFICATION this is not a user facing API but hidden in a macro
@@ -113,15 +113,15 @@ OptionDefinition& OptionDefinition::addOptional(const char shortOption,
113113
{
114114
constexpr bool IS_NO_SWITCH = false;
115115
return addOption(
116-
{{shortOption, IS_NO_SWITCH, longOption, defaultValue}, description, OptionType::OPTIONAL, typeName});
116+
{{shortOption, IS_NO_SWITCH, longOption, defaultValue}, description, OptionType::Optional, typeName});
117117
}
118118
OptionDefinition& OptionDefinition::addRequired(const char shortOption,
119119
const OptionName_t& longOption,
120120
const OptionDescription_t& description,
121121
const TypeName_t& typeName) noexcept
122122
{
123123
constexpr bool IS_NO_SWITCH = false;
124-
return addOption({{shortOption, IS_NO_SWITCH, longOption, {""}}, description, OptionType::REQUIRED, typeName});
124+
return addOption({{shortOption, IS_NO_SWITCH, longOption, {""}}, description, OptionType::Required, typeName});
125125
}
126126

127127
std::ostream& operator<<(std::ostream& stream, const OptionWithDetails& option) noexcept

iceoryx_hoofs/test/moduletests/test_cli_option.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct OptionWithDetailsFactory
4747
using Type_t = OptionWithDetails;
4848
static Type_t createEmpty()
4949
{
50-
return Type_t{{}, "", iox::cli::OptionType::SWITCH, ""};
50+
return Type_t{{}, "", iox::cli::OptionType::Switch, ""};
5151
}
5252
};
5353

iceoryx_platform/win/include/iceoryx_platform/platform_correction.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,3 @@
3939
#undef min
4040
#undef interface
4141
#undef OPEN_EXISTING
42-
#undef OPTIONAL

0 commit comments

Comments
 (0)