Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Simple functions to represent objects, for debugging and diagnostics.
The helpers provided here are rather commonplace, but written in a way as to incur only modest header inclusion load. It should be OK to use these even on widely used interface headers.
typeid(TY).name()
) into a readable, fully qualified C++ type name. This is only supported for GNU compatible compilers.boost::lexical_cast
behind a custom facade, the way we did it for boost::format
? This would reduce inclusion cost...Definition in file format-obj.hpp.
Classes | |
class | basic_ostream< Char > |
STL class. | |
class | char_traits< C > |
struct | StringConv< bool > |
struct | StringConv< double > |
explicit specialisation to control precision of double values. More... | |
struct | StringConv< float > |
struct | StringConv< SP, show_SmartPointer< SP > > |
struct | StringConv< X, enable_LexicalConversion< X > > |
Typedefs | |
template<typename X > | |
using | enable_LexicalConversion = lib::meta::enable_if< lib::meta::use_LexicalConversion< X > > |
toggle to prefer specialisation with direct lexical conversion | |
using | ostream = basic_ostream< char, char_traits< char > > |
template<typename SP > | |
using | show_SmartPointer = lib::meta::enable_if< lib::meta::is_smart_ptr< typename lib::meta::Strip< SP >::TypeReferred > > |
Functions | |
string | demangleCxx (Literal rawName) |
Fallback type-ID: More... | |
string | humanReadableTypeID (lib::Literal) |
pretty-print an internal C++ type representation More... | |
string | primaryTypeComponent (lib::Literal) |
extract core name component from a raw type spec More... | |
string | sanitisedFullTypeName (lib::Literal) |
build a sanitised ID from full type name | |
ostream & | showAdr (std::ostream &, void const *addr) |
preconfigured format for pretty-printing of addresses More... | |
string | showAdr (void const *addr) noexcept |
pretty-print an address as hex-suffix | |
string | showComplete (double) noexcept |
show enough decimal digits to represent every distinct value | |
string | showComplete (float val) noexcept |
string | showComplete (f128 val) noexcept |
string | showDecimal (double) noexcept |
show maximum reproducible decimal representation | |
string | showDecimal (float val) noexcept |
string | showDecimal (f128 val) noexcept |
string | showDouble (double) noexcept |
pretty-print a double in (rounded) fixed-point format More... | |
string | showFloat (float val) noexcept |
string | showHash (size_t hash, uint showBytes=8) noexcept |
renders the size_t in hex, optionally only trailing bytes | |
std::string | showHashLSB (size_t hash) noexcept |
string | showSize (size_t val) noexcept |
template<typename TY > | |
std::string | toString (TY const &val) noexcept |
get some string representation of any object, reliably. More... | |
template<typename TY > | |
std::string | typedString (TY const &val) noexcept |
indicate type and possibly a (custom) conversion to string More... | |
Namespaces | |
lib | |
Implementation namespace for support and library code. | |
std::string demangleCxx | ( | Literal | rawName | ) |
Fallback type-ID:
reverse the effect of C++ name mangling.
Definition at line 159 of file format-obj.cpp.
References lib::meta::demangleCxx().
Referenced by lib::meta::demangleCxx(), lib::meta::humanReadableTypeID(), and lib::meta::primaryTypeComponent().
std::string humanReadableTypeID | ( | Literal | rawType | ) |
pretty-print an internal C++ type representation
const
, &
or *
, however, the typical usage from within util::typeStr() is arranged in a way to absorb these adornments by the way the template signatures are definedstd::regex_replace
Definition at line 190 of file format-obj.cpp.
References lib::meta::demangleCxx(), and lib::meta::humanReadableTypeID().
Referenced by lib::meta::humanReadableTypeID(), and lib::meta::sanitisedFullTypeName().
std::string primaryTypeComponent | ( | Literal | rawType | ) |
extract core name component from a raw type spec
::
Definition at line 268 of file format-obj.cpp.
References lib::meta::demangleCxx(), lib::meta::primaryTypeComponent(), and lib::meta::typeStr().
Referenced by lib::meta::primaryTypeComponent().
|
noexcept |
pretty-print a double in (rounded) fixed-point format
0.1
(which can not be represented as binary floats) Definition at line 360 of file format-obj.cpp.
References util::showDouble().
Referenced by util::showDouble().
std::ostream & showAdr | ( | ostream & | stream, |
void const * | addr | ||
) |
preconfigured format for pretty-printing of addresses
Definition at line 385 of file format-obj.cpp.
References util::showAdr().
Referenced by util::showAdr().
|
inlinenoexcept |
get some string representation of any object, reliably.
A custom string conversion operator is invoked, if applicable, while all lexically convertible types (numbers etc) are treated by boost::lexical_cast. For double or float values, hard wired rounding to a fixed number of digits will be performed, to yield a predictable display of printed unit-test results.
StringConf<TY>
, yet this solution might be brittle. If you want pointers to be indicated (with address), consider using util::showPtr explicitly. Definition at line 191 of file format-obj.hpp.
References util::toString().
Referenced by FormatHelper_test::check2String(), and util::toString().
|
inlinenoexcept |
indicate type and possibly a (custom) conversion to string
Definition at line 205 of file format-obj.hpp.
References util::typedString().
Referenced by util::typedString().