aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-27 18:12:47 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-27 18:12:47 +0000
commita269d8e9cae9b99b824b75d9a532c4f7edc730f2 (patch)
tree769cb9676ebf8019e404e00bc499ca11b50df334
parent0be73fb20a514eaa4c0cb74b650bbda6f78b6bda (diff)
downloadpaludis-a269d8e9cae9b99b824b75d9a532c4f7edc730f2.tar.gz
paludis-a269d8e9cae9b99b824b75d9a532c4f7edc730f2.tar.xz
Add should helpers to symbols choice values
-rw-r--r--paludis/elike_choices.cc59
-rw-r--r--paludis/elike_choices.hh4
2 files changed, 63 insertions, 0 deletions
diff --git a/paludis/elike_choices.cc b/paludis/elike_choices.cc
index e012f45..61c9788 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 00cad94..9d8d4de 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));
};
}