aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2006-11-22 18:00:58 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2006-11-22 18:00:58 +0000
commite7fd39b83dd25fcd779e8d3b1980b3a07fc4274a (patch)
tree0ca1597dcb2cd00b15b6487b85efe2a8654c2ded
parent301254edee94e7125a4c1197030114b380c23022 (diff)
downloadpaludis-e7fd39b83dd25fcd779e8d3b1980b3a07fc4274a.tar.gz
paludis-e7fd39b83dd25fcd779e8d3b1980b3a07fc4274a.tar.xz
Add pretty output for stringify QALevel
-rw-r--r--paludis/qa/message.cc36
-rw-r--r--paludis/qa/message.hh10
2 files changed, 45 insertions, 1 deletions
diff --git a/paludis/qa/message.cc b/paludis/qa/message.cc
index 276eb81..036fb4c 100644
--- a/paludis/qa/message.cc
+++ b/paludis/qa/message.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/qa/message.hh>
+#include <paludis/util/exception.hh>
#include <ostream>
using namespace paludis;
@@ -32,3 +33,38 @@ paludis::qa::operator<< (std::ostream & s, const Message & m)
return s;
}
+std::ostream &
+paludis::qa::operator<< (std::ostream & s, const QALevel & l)
+{
+ switch (l)
+ {
+ case qal_info:
+ s << "info";
+ return s;
+
+ case qal_skip:
+ s << "skip";
+ return s;
+
+ case qal_maybe:
+ s << "maybe";
+ return s;
+
+ case qal_minor:
+ s << "minor";
+ return s;
+
+ case qal_major:
+ s << "major";
+ return s;
+
+ case qal_fatal:
+ s << "fatal";
+ return s;
+
+ case last_qal:
+ ;
+ };
+
+ throw InternalError(PALUDIS_HERE, "Bad QA Level");
+}
diff --git a/paludis/qa/message.hh b/paludis/qa/message.hh
index 4607491..507bbe6 100644
--- a/paludis/qa/message.hh
+++ b/paludis/qa/message.hh
@@ -45,7 +45,8 @@ namespace paludis
qal_maybe,
qal_minor,
qal_major,
- qal_fatal
+ qal_fatal,
+ last_qal ///< Number of items
};
#include <paludis/qa/message-sr.hh>
@@ -56,6 +57,13 @@ namespace paludis
* \ingroup grpqa
*/
std::ostream & operator<< (std::ostream &, const Message &);
+
+ /**
+ * Write a QALevel to a stream.
+ *
+ * \ingroup grpqa
+ */
+ std::ostream & operator<< (std::ostream &, const QALevel &);
}
}