HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Group_arch_Strings

Files

file  demangle.h
 
file  vsnprintf.h
 

Functions

ARCH_API bool ArchDemangle (std::string *typeName)
 
ARCH_API std::string ArchGetDemangled (const std::string &typeName)
 
ARCH_API std::string ArchGetDemangled (const char *typeName)
 
std::string ArchGetDemangled (const std::type_info &typeInfo)
 
std::string ArchGetDemangled (const std::type_index &typeIndex)
 
template<typename T >
std::string ArchGetDemangled ()
 
ARCH_API int ArchVsnprintf (char *str, size_t size, const char *format, va_list ap)
 
ARCH_API std::string ArchStringPrintf (const char *fmt,...)
 
ARCH_API std::string ArchVStringPrintf (const char *fmt, va_list ap)
 

Detailed Description

Function Documentation

ARCH_API bool ArchDemangle ( std::string typeName)

Demangle RTTI-generated type name.

Given a variable v, the construct typeid(v).name() returns the type-name of v; unfortunately, the returned type-name is sometimes extremely encoded (otherwise known as "mangled"). ArchDemangle parses the passed in type-name typeName into a readable form, and overwrites typeName. If typeName cannot be unmangled, the function returns false without altering typeName. Otherwise true is returned.

ARCH_API std::string ArchGetDemangled ( const std::string typeName)

Return demangled RTTI-generated type name.

If typeName can be demangled, the function returns the demangled string; otherwise, the function returns the empty string.

See Also
ArchDemangle()
ARCH_API std::string ArchGetDemangled ( const char *  typeName)

Return demangled RTTI-generated type name.

See Also
ArchDemangle() This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
std::string ArchGetDemangled ( const std::type_info &  typeInfo)
inline

Return demangled RTTI-generated type name.

Returns the demangled name associated with typeInfo (i.e. typeInfo.name()).

See Also
ArchDemangle() This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 80 of file demangle.h.

std::string ArchGetDemangled ( const std::type_index &  typeIndex)
inline

Return demangled RTTI-generated type name.

Returns the demangled name associated with typeIndex (i.e. typeIndex.name()).

See Also
ArchDemangle() This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 91 of file demangle.h.

template<typename T >
std::string ArchGetDemangled ( )
inline

Return demangled RTTI generated-type name.

Returns the demangled name of type T.

See Also
ArchDemangle() This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 103 of file demangle.h.

ARCH_API std::string ArchStringPrintf ( const char *  fmt,
  ... 
)

Returns a string formed by a printf()-like specification.

ArchStringPrintf() is a memory-safe architecture-independent way of forming a string using printf()-like formatting. For example,

string formatMsg(const string& caller, int i, double val[])
{
return ArchStringPrintf("%s: val[%d] = %g\n", caller.c_str(), i, val[i]);
}

The function is safe only to the extent that the arguments match the formatting string. In particular, be careful to pass strings themselve into ArchStringPrintf() as in the above example (i.e. caller.c_str() as opposed to just passing caller).

ARCH_API int ArchVsnprintf ( char *  str,
size_t  size,
const char *  format,
va_list  ap 
)

Return the number of characters (not including the null character) necessary for a particular sprintf into a string.

ArchVsnprintf guarantees the C99 behavior of vsnprintf on all systems: it returns the number of bytes (not including the terminating null character) needed to actually print the requested string. If size indicates that str has enough capacity to hold the result, then the function actually prints into str.

You probably want to use the functionality of this call via TfStringPrintf().

ARCH_API std::string ArchVStringPrintf ( const char *  fmt,
va_list  ap 
)

Returns a string formed by a printf()-like specification.

ArchVStringPrintf() is equivalent to ArchStringPrintf() except that it is called with a va_list instead of a variable number of arguments. ArchVStringPrintf() does not call the va_end macro. Consequently, the value of ap is undefined after the call. A functions that calls ArchVStringPrintf() should call va_end(ap) itself afterwards.