From 9a81c308f2d4217592630ef41a18a8998bd66f5c Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 6 Jan 2017 03:26:03 +0300 Subject: Add operator<<(ostream, exception) --- butl/utility | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'butl/utility') diff --git a/butl/utility b/butl/utility index f668ecc..ac94171 100644 --- a/butl/utility +++ b/butl/utility @@ -6,10 +6,11 @@ #define BUTL_UTILITY #include +#include // ostream #include // size_t #include // move(), forward() #include // strcmp(), strlen() -#include // uncaught_exception(s)() +#include // exception, uncaught_exception(s)() //#include // hash #include @@ -227,6 +228,18 @@ namespace butl #endif } +namespace std +{ + // Sanitize the exception description before printing. This includes: + // + // - stripping leading colons and spaces (see fdstream.cxx) + // - stripping trailing newlines, periods, and spaces + // - lower-case the first letter if the beginning looks like a word + // + LIBBUTL_EXPORT ostream& + operator<< (ostream&, const exception&); +} + #include #endif // BUTL_UTILITY -- cgit v1.1