tango.core.RuntimeTraits

Provides runtime traits, which provide much of the functionality of tango.core.Traits and is-expressions, as well as some functionality that is only available at runtime, using runtime type information.

Members

Classes

A
class A
Undocumented in source.
B
class B
Undocumented in source.
C
class C
Undocumented in source.
D
class D
Undocumented in source.

Functions

asClass
const(ClassInfo) asClass(const(TypeInfo) type)

If the given type represents a class, return its ClassInfo; else return null;

baseClasses
const(ClassInfo)[] baseClasses(const(ClassInfo) type)
baseInterfaces
const(ClassInfo)[] baseInterfaces(const(ClassInfo) type)

Returns a list of all interfaces that this type implements, directly * or indirectly. This includes base interfaces of types the class implements, * and interfaces that base classes implement, and base interfaces of interfaces * that base classes implement. This is an expensive operation.

baseTypes
const(ClassInfo)[] baseTypes(const(ClassInfo) type)
derivedTypes
const(ClassInfo)[] derivedTypes(const(ClassInfo) type)

Returns a list of all types that are derived from the given type. This does not * count interfaces; that is, if type is an interface, you will only get derived * interfaces back. It is an expensive operations.

directInterfaces
const(ClassInfo)[] directInterfaces(const(ClassInfo) type)

Returns a list of interfaces that this class directly implements.

implements
bool implements(const(ClassInfo) implementor, const(ClassInfo) iface)

Returns true iff implementor implements the interface described by iface. This is an expensive operation (linear in the number of interfaces and base classes).

interfaceGraph
const(ClassInfo)[] interfaceGraph(const(ClassInfo) type)

Returns all the interfaces that this type directly implements, including inherited interfaces. This is an expensive operation.

isArray
bool isArray(const(TypeInfo) type)

Returns true iff the given type is a dynamic or static array (false for associative * arrays and non-arrays).

isAssociativeArray
bool isAssociativeArray(const(TypeInfo) type)
isBool
bool isBool(const(TypeInfo) type)
isCharacter
bool isCharacter(const(TypeInfo) type)
isClass
bool isClass(const(TypeInfo) type)

Returns true iff the type represents a class (false for interfaces).

isDerived
bool isDerived(const(ClassInfo) derived, const(ClassInfo) base)

Returns true iff one type is an ancestor of the other, or if the types are the same. * If either is null, returns false.

isDynamicArray
bool isDynamicArray(const(TypeInfo) type)
isFloat
bool isFloat(const(TypeInfo) type)
isFunction
bool isFunction(const(TypeInfo) type)
isImplicitly
bool isImplicitly(const(ClassInfo) test, const(ClassInfo) target)

Returns true iff an instance of class test is implicitly castable to target. * This is an expensive operation (isDerived + implements).

isImplicitly
bool isImplicitly(const(TypeInfo) test, const(TypeInfo) target)

Returns true iff an instance of type test is implicitly castable to target. * If the types describe classes or interfaces, this is an expensive operation.

isInteger
bool isInteger(const(TypeInfo) type)
isInterface
bool isInterface(const(TypeInfo) type)

Returns true iff the given type represents an interface.

isPointer
bool isPointer(const(TypeInfo) type)
isPrimitive
bool isPrimitive(const(TypeInfo) type)
isReferenceType
bool isReferenceType(const(TypeInfo) type)

Returns true iff the given type is a reference type.

isSignedInteger
bool isSignedInteger(const(TypeInfo) type)
isStaticArray
bool isStaticArray(const(TypeInfo) type)
isString
bool isString(const(TypeInfo) type)
isStruct
bool isStruct(const(TypeInfo) type)
isUnsignedInteger
bool isUnsignedInteger(const(TypeInfo) type)
isUserDefined
bool isUserDefined(const(TypeInfo) type)

Returns true iff the given type represents a user-defined type. * This does not include functions, delegates, aliases, or typedefs.

isValueType
bool isValueType(const(TypeInfo) type)

Returns true for all value types, false for all reference types. * For functions and delegates, returns false (is this the way it should be?).

keyType
const(TypeInfo) keyType(const(TypeInfo) type)

The key type of the given type. For an array, size_t; for an associative * array TU, U.

moduleOf
ModuleInfo* moduleOf(const(ClassInfo) type)
realType
const(TypeInfo) realType(const(TypeInfo) type)

If the given type represents a typedef, return the actual type. Typedefs have been removed from the language and are no longer supported.

returnType
const(TypeInfo) returnType(const(TypeInfo) type)

If the given type represents a delegate or function, the return type * of that function. Otherwise, null.

valueType
const(TypeInfo) valueType(const(TypeInfo) type)

The value type of the given type -- given T[] or Tn, T; given TU, * T; given T*, T; anything else, null.

Interfaces

I1
interface I1
Undocumented in source.
I2
interface I2
Undocumented in source.
I3
interface I3
Undocumented in source.
I4
interface I4
Undocumented in source.

Structs

S1
struct S1
Undocumented in source.
applyInterfaces
struct applyInterfaces

Iterate through all interfaces that type implements, directly or indirectly, including base interfaces.

Meta

Authors

Chris Wright (dhasenan) $(EMAIL dhasenan@gmail.com)

License

Tango License, Apache 2.0