diff options
author | 2011-01-27 18:12:47 +0000 | |
---|---|---|
committer | 2011-01-27 18:12:47 +0000 | |
commit | a269d8e9cae9b99b824b75d9a532c4f7edc730f2 (patch) | |
tree | 769cb9676ebf8019e404e00bc499ca11b50df334 | |
parent | 0be73fb20a514eaa4c0cb74b650bbda6f78b6bda (diff) | |
download | paludis-a269d8e9cae9b99b824b75d9a532c4f7edc730f2.tar.gz paludis-a269d8e9cae9b99b824b75d9a532c4f7edc730f2.tar.xz |
Add should helpers to symbols choice values
-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)); }; } |