Quick Links: |
#include <bsls_nameof.h>
Public Member Functions | |
NameOf () | |
operator const char * () const | |
const char * | name () const |
Protected Types | |
enum | { k_USELESS_PREAMBLE_LEN = 26 } |
Static Protected Member Functions | |
static const char * | initBuffer (char *buffer, const char *functionName) |
This class
provides a means to display the type name of its template parameter TYPE
. An instance of this class
can be implicitly (or explicitly via the name
accessor) cast to a const char *
which will point to a buffer containing the description of the type. Note that all instances of a given type will refer to the same character buffer containing the name.
bsls::NameOf< TYPE >::NameOf | ( | ) |
Initialize the base class of this object to the name of TYPE
.
References BSLS_ASSERT_SAFE, bsls::BslOnceGuard::enter(), bsls::NameOf_Base::initBuffer(), and bsls::NameOf_Base::k_USELESS_PREAMBLE_LEN.
bsls::NameOf< TYPE >::operator const char * | ( | ) | const [inline] |
Return a pointer to the a string containing the name of TYPE
.
const char * bsls::NameOf< TYPE >::name | ( | ) | const [inline] |
Return a pointer to the a string containing the name of TYPE
, this serves as a convenient way to explicitly cast the return value to a const char *
.
static const char* bsls::NameOf_Base::initBuffer | ( | char * | buffer, | |
const char * | functionName | |||
) | [static, protected, inherited] |
Initialize the specified buffer
with the type name contained in the specified functionName
, where functionName
is the function name of the NameOf
constructor. Return either a pointer to buffer
, or if buffer
couldn't be properly initialized, functionName
.
Referenced by bsls::NameOf< TYPE >::NameOf().