37#ifndef LIB_FORMAT_OBJ_H
38#define LIB_FORMAT_OBJ_H
43#include <boost/lexical_cast.hpp>
51 template<
typename C,
class _TRAITS>
54 using ostream = basic_ostream<char, char_traits<char>>;
79 std::string
showSize (
size_t)
noexcept;
80 std::string
showAdr (
void const* addr)
noexcept;
89 showHashLSB (
size_t hash) noexcept
108 template<
typename SP>
122 try {
return boost::lexical_cast<std::string> (val); }
123 catch(...) {
return FAILURE_INDICATOR; }
126 template<
typename SP>
132 catch(...) {
return FAILURE_INDICATOR; }
189 template<
typename TY>
203 template<
typename TY>
208 return 0 == repr.rfind(
"«", 0)? repr
209 :
"«"+typeStr(val)+
"»|"+repr;
212 {
return FAILURE_INDICATOR; }
Implementation namespace for support and library code.
basic_ostream< char, char_traits< char > > ostream
string showComplete(double val) noexcept
show enough decimal digits to represent every distinct value
string showDouble(double val) noexcept
pretty-print a double in (rounded) fixed-point format
std::string showBool(bool yes) noexcept
human readable display of boolean values
string showHash(size_t hash, uint showBytes) noexcept
renders the size_t in hex, optionally only trailing bytes
std::string typedString(TY const &val) noexcept
indicate type and possibly a (custom) conversion to string
ostream & showAdr(ostream &stream, void const *addr)
preconfigured format for pretty-printing of addresses
string showSize(size_t val) noexcept
string showDecimal(double val) noexcept
show maximum reproducible decimal representation
string showFloat(float val) noexcept
std::string toString(TY const &val) noexcept
get some string representation of any object, reliably.
std::string showSmartPtr(SP const &smPtr, std::string label="smP")
static std::string invoke(SP const &smP) noexcept
static std::string invoke(X const &val) noexcept
static std::string invoke(bool val) noexcept
static std::string invoke(double val) noexcept
static std::string invoke(float val) noexcept
failsafe invocation of custom string conversion.
static std::string invoke(X const &x) noexcept
Marker types to indicate a literal string and a Symbol.
Helpers for type detection, type rewriting and metaprogramming.