Quick Links: |
namespace for type-name functions More...
#include <bdlat_typename.h>
Static Public Member Functions | |
template<class TYPE > | |
static const char * | className (const TYPE &object) |
template<class TYPE > | |
static const char * | name (const TYPE &object) |
template<class TYPE > | |
static const char * | xsdName (const TYPE &object, int format) |
Static template functions for returning a string representation for the name of a type.
static const char* bdlat_TypeName::className | ( | const TYPE & | object | ) | [static] |
Return a null-terminated string containing the exported name for the specified TYPE
, or a 0 pointer if TYPE
does not export a name. A type exports a name by overloading the function bdlat_TypeName_className(const TYPE&)
in TYPE's namespace. The default implementation of bdlat_TypeName_className
will automatically return the CLASS_NAME
value for types that have the bdlat_TypeTraitBasicChoice
, bdlat_TypeTraitBasicSequence
, bdlat_TypeTraitBasicCustomizedType
, or bdlat_TypeTraitBasicEnumeration
trait (i.e., types generated using bas_codegen.pl
).
static const char* bdlat_TypeName::name | ( | const TYPE & | object | ) | [static] |
Return a null-terminated string containing the name of the specified TYPE
. If TYPE
is a fundamental type, string, date, time, or datetime, then return a canonical representation of the type's name. Otherwise, if className
applied to the specified object
returns a non-null value, then return that value. Otherwise, return typeid(TYPE).name()
. Note that the returned name refers to the static TYPE
, not to the dynamic type of object
.
static const char* bdlat_TypeName::xsdName | ( | const TYPE & | object, | |
int | format | |||
) | [static] |
Return a null-terminated text string containing the name of the specified TYPE
with the specified format
as it would appear in an XML Schema (XSD) element declaration. The format
is interpreted as the bit-wise OR of one or more of the values defined in the bdlat_formattingmode
component. Formatting mode bits outside of bdlat_FormattingMode::TYPE_MASK
are ignored. If the specified object
corresponds to one of the XSD built-in types, then return the XSD type's name. Otherwise, if className(object)
returns a non-null value, then return that value. Otherwise, return "anyType". The behavior is undefined unless the format
is valid for the specified TYPE
.