// file: libmformat/format.cxx -*- C++ -*- module format; import std.core; // transform() import std.io; // to{upper,lower}() using namespace std; namespace format { string message (const string& g, const string& n, volume v) { string r (g); auto tr = [&r] (char (*t) (char)) { transform (r.begin (), r.end (), r.begin (), t); }; switch (v) { case volume::quiet: tr ([](char c) -> char {return tolower (c);}); break; case volume::normal: break; case volume::loud: tr ([](char c) -> char {return toupper (c);}); break; } return r += ", " + n + '!'; } }