diff options
-rw-r--r-- | paludis/elike_choices.cc | 59 | ||||
-rw-r--r-- | paludis/elike_choices.hh | 4 |
2 files changed, 63 insertions, 0 deletions
diff --git a/paludis/elike_choices.cc b/paludis/elike_choices.cc index e012f4585..61c978862 100644 --- a/paludis/elike_choices.cc +++ b/paludis/elike_choices.cc @@ -806,3 +806,62 @@ ELikeSymbolsChoiceValue::canonical_name_with_prefix() return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" + stringify(canonical_unprefixed_name())); } +bool +ELikeSymbolsChoiceValue::should_split(const std::string & v) +{ + switch (destringify<ELikeSymbolsChoiceValueParameter>(v)) + { + case escvp_split: + case escvp_compress: + return true; + + case escvp_preserve: + case escvp_strip: + return false; + + case last_escvp: + break; + } + + throw InternalError(PALUDIS_HERE, "Unhandled ELikeSymbolsChoiceValueParameter"); +} + +bool +ELikeSymbolsChoiceValue::should_strip(const std::string & v) +{ + switch (destringify<ELikeSymbolsChoiceValueParameter>(v)) + { + case escvp_split: + case escvp_compress: + case escvp_strip: + return true; + + case escvp_preserve: + return false; + + case last_escvp: + break; + } + + throw InternalError(PALUDIS_HERE, "Unhandled ELikeSymbolsChoiceValueParameter"); +} + +bool +ELikeSymbolsChoiceValue::should_compress(const std::string & v) +{ + switch (destringify<ELikeSymbolsChoiceValueParameter>(v)) + { + case escvp_compress: + return true; + + case escvp_split: + case escvp_preserve: + case escvp_strip: + return false; + + case last_escvp: + break; + } + + throw InternalError(PALUDIS_HERE, "Unhandled ELikeSymbolsChoiceValueParameter"); +} diff --git a/paludis/elike_choices.hh b/paludis/elike_choices.hh index 00cad9422..9d8d4de01 100644 --- a/paludis/elike_choices.hh +++ b/paludis/elike_choices.hh @@ -270,6 +270,10 @@ namespace paludis static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result)); static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result)); + + static bool should_split(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result)); + static bool should_strip(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result)); + static bool should_compress(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result)); }; } |