Represents a particular type and provides information about it. More...

Classes

struct  BoxedValue
 TypeInfo structure for BoxedValue class. More...
 

Public Types

typedef std::function< ObjectPtr()> DefaultConstructor
 Function pointer to construct type. More...
 

Public Member Functions

ASPOSECPP_SHARED_API TypeInfo ()
 Default constructor (no type is set). More...
 
ASPOSECPP_SHARED_API TypeInfo (std::nullptr_t)
 Null object constructor (no type is set). More...
 
ASPOSECPP_SHARED_API TypeInfo (const char_t *name)
 
ASPOSECPP_SHARED_API TypeInfo (const char_t *name, uint32_t hash)
 
ASPOSECPP_SHARED_API String get_Name () const
 Returns the name of the type represented by the current object. More...
 
ASPOSECPP_SHARED_API String get_Namespace () const
 Gets the namespace of the Type. More...
 
ASPOSECPP_SHARED_API String get_FullName () const
 
ASPOSECPP_SHARED_API System::SharedPtr< System::Reflection::Assemblyget_Assembly () const
 
ASPOSECPP_SHARED_API String get_AssemblyQualifiedName () const
 
ASPOSECPP_SHARED_API bool IsSubclassOf (const TypeInfo &type) const
 
ASPOSECPP_SHARED_API bool IsInstanceOfType (const SharedPtr< Object > &obj) const
 
ASPOSECPP_SHARED_API bool IsAssignableFrom (const TypeInfo &type) const
 
ASPOSECPP_SHARED_API bool get_IsSealed () const
 Gets a value indicating whether the Type is declared sealed. More...
 
ASPOSECPP_SHARED_API bool get_IsInterface () const
 Gets a value indicating whether the Type is an interface; that is, not a class or a value type. More...
 
ASPOSECPP_SHARED_API bool get_IsAbstract () const
 Gets a value indicating whether the Type is abstract and must be overridden. More...
 
ASPOSECPP_SHARED_API bool get_IsEnum () const
 Gets a value indicating whether the current Type represents an enumeration. More...
 
ASPOSECPP_SHARED_API bool get_IsArray () const
 Gets a value that indicates whether the type is an array. More...
 
ASPOSECPP_SHARED_API bool get_IsClass () const
 Gets a value indicating whether the Type is a class or a delegate; that is, not a value type or interface. More...
 
ASPOSECPP_SHARED_API bool get_IsValueType () const
 Gets a value indicating whether the Type is a value type. More...
 
ASPOSECPP_SHARED_API bool get_IsVisible () const
 Gets a value indicating whether the Type can be accessed by code outside the assembly. More...
 
ASPOSECPP_SHARED_API bool get_ContainsGenericParameters () const
 Gets a value indicating whether the current Type object has type parameters that have not been replaced by specific types. More...
 
ASPOSECPP_SHARED_API bool get_IsGenericType () const
 
ASPOSECPP_SHARED_API bool get_IsGenericTypeDefinition () const
 Gets a value indicating whether the current Type represents a generic type definition, from which other generic types can be constructed. More...
 
ASPOSECPP_SHARED_API ArrayPtr< TypeInfoget_GenericTypeArguments () const
 Gets an array of the generic type arguments for this type. More...
 
ASPOSECPP_SHARED_API ArrayPtr< TypeInfoGetInterfaces () const
 Gets all the interfaces implemented or inherited by the current Type. More...
 
ASPOSECPP_SHARED_API ArrayPtr< SharedPtr< System::Reflection::ConstructorInfo > > GetConstructors (System::Reflection::BindingFlags bindingAttr) const
 searches for the constructors defined for the current Type, using the specified BindingFlags. More...
 
ASPOSECPP_SHARED_API ArrayPtr< SharedPtr< System::Reflection::ConstructorInfo > > GetConstructors () const
 Returns all the public constructors defined for the current Type. More...
 
ASPOSECPP_SHARED_API SharedPtr< System::Reflection::ConstructorInfoGetConstructor (ArrayPtr< TypeInfo > types) const
 Searches for a public instance constructor whose parameters match the types in the specified array. More...
 
ASPOSECPP_SHARED_API String ToString () const
 Returns a string containing the name of the type represented by the current object. More...
 
ASPOSECPP_SHARED_API uint32_t Hash () const
 Returns a hash value associated with the type represented by the current object. More...
 
int GetHashCode () const
 Returns a hash code associated with this instance. More...
 
bool operator== (const TypeInfo &info) const
 
bool operator!= (const TypeInfo &info) const
 
bool operator== (std::nullptr_t) const
 
bool operator!= (std::nullptr_t) const
 
ASPOSECPP_SHARED_API void AddAttribute (const ObjectPtr &attribute)
 
ASPOSECPP_SHARED_API void AddMember (SharedPtr< System::Reflection::MemberInfo > member)
 
ASPOSECPP_SHARED_API ArrayPtr< SharedPtr< System::Reflection::MemberInfo > > GetMember (String name) const
 
ASPOSECPP_SHARED_API ArrayPtr< SharedPtr< System::Reflection::MemberInfo > > get_DeclaredMember (String name) const
 
ASPOSECPP_SHARED_API SharedPtr< System::Reflection::MethodInfoGetMethod (String name) const
 
ASPOSECPP_SHARED_API ArrayPtr< SharedPtr< System::Reflection::PropertyInfo > > GetProperties () const
 Returns all the public properties of the current Type. More...
 
ASPOSECPP_SHARED_API ArrayPtr< SharedPtr< System::Reflection::PropertyInfo > > GetProperties (System::Reflection::BindingFlags bindingAttr) const
 Searches for the properties of the current Type, using the specified binding constraints. More...
 
ASPOSECPP_SHARED_API ArrayPtr< SharedPtr< System::Reflection::FieldInfo > > GetFields (System::Reflection::BindingFlags bindingAttr) const
 Searches for the fields defined for the current Type, using the specified binding constraints. More...
 
ASPOSECPP_SHARED_API ObjectPtr GetCustomAttribute (const TypeInfo &attributeType) const
 
ASPOSECPP_SHARED_API ArrayPtr< ObjectPtrGetCustomAttributes () const
 Returns an array containing objects that represent all custom attributes applied to the type. More...
 
ASPOSECPP_SHARED_API ArrayPtr< ObjectPtrGetCustomAttributes (const TypeInfo &attributeType, bool inherit) const
 
ASPOSECPP_SHARED_API TypeInfo get_BaseType () const
 
ASPOSECPP_SHARED_API void SetBaseType (GetTypeInfoFunPtr basetype)
 
ASPOSECPP_SHARED_API void SetTemplParamType (const TypeInfo &templParam)
 
ASPOSECPP_SHARED_API TypeInfo GetTemplParamType () const
 Gets template parameter type descritor. More...
 
ASPOSECPP_SHARED_API void reset ()
 Sets TypeInfo to null. More...
 
template<class T >
void AddDefaultConstructor ()
 Sets default constructor for the type T. More...
 
ASPOSECPP_SHARED_API void AddDefaultConstructor (DefaultConstructor method)
 
ASPOSECPP_SHARED_API void set_IsValueType (bool value)
 Sets a value indicating whether the Type is a value type. More...
 

Static Public Member Functions

static uint32_t StringHash (const char_t *str)
 
template<class T >
static const TypeInfoBoxedValueType ()
 
static const TypeInfoType ()
 Returns a TypeInfo object that represent TypeInfo class. More...
 

Static Public Attributes

static ASPOSECPP_SHARED_API ArrayPtr< TypeInfoEmptyTypes
 Constant representing empty list of TypeInfo. More...
 

Detailed Description

Represents a particular type and provides information about it.

Member Typedef Documentation

◆ DefaultConstructor

Function pointer to construct type.

Constructor & Destructor Documentation

◆ TypeInfo() [1/4]

ASPOSECPP_SHARED_API System::TypeInfo::TypeInfo ( )

Default constructor (no type is set).

◆ TypeInfo() [2/4]

ASPOSECPP_SHARED_API System::TypeInfo::TypeInfo ( std::nullptr_t  )

Null object constructor (no type is set).

◆ TypeInfo() [3/4]

ASPOSECPP_SHARED_API System::TypeInfo::TypeInfo ( const char_t *  name)

Constructor.

Parameters
nameType name.

◆ TypeInfo() [4/4]

ASPOSECPP_SHARED_API System::TypeInfo::TypeInfo ( const char_t *  name,
uint32_t  hash 
)

Constructor.

Parameters
nameType name.
hashType name hash.

Member Function Documentation

◆ AddAttribute()

ASPOSECPP_SHARED_API void System::TypeInfo::AddAttribute ( const ObjectPtr attribute)

Adds the specified attribute to the list of type's attributes.

Parameters
attributeA constant reference to an object that represents an attribute to be added

◆ AddDefaultConstructor() [1/2]

template<class T >
void System::TypeInfo::AddDefaultConstructor ( )
inline

Sets default constructor for the type T.

◆ AddDefaultConstructor() [2/2]

ASPOSECPP_SHARED_API void System::TypeInfo::AddDefaultConstructor ( DefaultConstructor  method)

Sets default constructor by the functor that creates class instanse

Parameters
methodfunctor that creates class instanse

◆ AddMember()

ASPOSECPP_SHARED_API void System::TypeInfo::AddMember ( SharedPtr< System::Reflection::MemberInfo member)

Adds the specified member to the list of type's members.

Parameters
memberMember to add.

◆ BoxedValueType()

template<class T >
static const TypeInfo& System::TypeInfo::BoxedValueType ( )
inlinestatic

Provides unique TypeInfo structure for BoxedValue type to be shared by multiple Boxed* classes.

Template Parameters
TType to hold TypeInfo structure for.
Returns
TypeInfo structure which is unique per class.

◆ get_Assembly()

ASPOSECPP_SHARED_API System::SharedPtr<System::Reflection::Assembly> System::TypeInfo::get_Assembly ( ) const

NOT IMPLEMENTED. Returns a pointer to the assembly in which the type represented by the current object is declared.

◆ get_AssemblyQualifiedName()

ASPOSECPP_SHARED_API String System::TypeInfo::get_AssemblyQualifiedName ( ) const

NOT IMPLEMENTED. Returns the fully qualified name including the assembly name of the type represented by the current object.

◆ get_BaseType()

ASPOSECPP_SHARED_API TypeInfo System::TypeInfo::get_BaseType ( ) const

Returns base type descritor.

Returns
Pointer to base type descriptor or null if not found.

◆ get_ContainsGenericParameters()

ASPOSECPP_SHARED_API bool System::TypeInfo::get_ContainsGenericParameters ( ) const

Gets a value indicating whether the current Type object has type parameters that have not been replaced by specific types.

◆ get_DeclaredMember()

ASPOSECPP_SHARED_API ArrayPtr<SharedPtr<System::Reflection::MemberInfo> > System::TypeInfo::get_DeclaredMember ( String  name) const

Gets list of the members with specified name.

Parameters
nameName of the member to get.
Returns
Array of member descriptors (empty if no member is found).

◆ get_FullName()

ASPOSECPP_SHARED_API String System::TypeInfo::get_FullName ( ) const

Returns the fully qualified name (but without the assembly name) of the type represented by the current object.

◆ get_GenericTypeArguments()

ASPOSECPP_SHARED_API ArrayPtr<TypeInfo> System::TypeInfo::get_GenericTypeArguments ( ) const

Gets an array of the generic type arguments for this type.

◆ get_IsAbstract()

ASPOSECPP_SHARED_API bool System::TypeInfo::get_IsAbstract ( ) const

Gets a value indicating whether the Type is abstract and must be overridden.

◆ get_IsArray()

ASPOSECPP_SHARED_API bool System::TypeInfo::get_IsArray ( ) const

Gets a value that indicates whether the type is an array.

◆ get_IsClass()

ASPOSECPP_SHARED_API bool System::TypeInfo::get_IsClass ( ) const

Gets a value indicating whether the Type is a class or a delegate; that is, not a value type or interface.

◆ get_IsEnum()

ASPOSECPP_SHARED_API bool System::TypeInfo::get_IsEnum ( ) const

Gets a value indicating whether the current Type represents an enumeration.

◆ get_IsGenericType()

ASPOSECPP_SHARED_API bool System::TypeInfo::get_IsGenericType ( ) const

◆ get_IsGenericTypeDefinition()

ASPOSECPP_SHARED_API bool System::TypeInfo::get_IsGenericTypeDefinition ( ) const

Gets a value indicating whether the current Type represents a generic type definition, from which other generic types can be constructed.

◆ get_IsInterface()

ASPOSECPP_SHARED_API bool System::TypeInfo::get_IsInterface ( ) const

Gets a value indicating whether the Type is an interface; that is, not a class or a value type.

◆ get_IsSealed()

ASPOSECPP_SHARED_API bool System::TypeInfo::get_IsSealed ( ) const

Gets a value indicating whether the Type is declared sealed.

◆ get_IsValueType()

ASPOSECPP_SHARED_API bool System::TypeInfo::get_IsValueType ( ) const

Gets a value indicating whether the Type is a value type.

◆ get_IsVisible()

ASPOSECPP_SHARED_API bool System::TypeInfo::get_IsVisible ( ) const

Gets a value indicating whether the Type can be accessed by code outside the assembly.

◆ get_Name()

ASPOSECPP_SHARED_API String System::TypeInfo::get_Name ( ) const

Returns the name of the type represented by the current object.

◆ get_Namespace()

ASPOSECPP_SHARED_API String System::TypeInfo::get_Namespace ( ) const

Gets the namespace of the Type.

◆ GetConstructor()

ASPOSECPP_SHARED_API SharedPtr<System::Reflection::ConstructorInfo> System::TypeInfo::GetConstructor ( ArrayPtr< TypeInfo types) const

Searches for a public instance constructor whose parameters match the types in the specified array.

◆ GetConstructors() [1/2]

ASPOSECPP_SHARED_API ArrayPtr<SharedPtr<System::Reflection::ConstructorInfo> > System::TypeInfo::GetConstructors ( System::Reflection::BindingFlags  bindingAttr) const

searches for the constructors defined for the current Type, using the specified BindingFlags.

◆ GetConstructors() [2/2]

ASPOSECPP_SHARED_API ArrayPtr<SharedPtr<System::Reflection::ConstructorInfo> > System::TypeInfo::GetConstructors ( ) const

Returns all the public constructors defined for the current Type.

◆ GetCustomAttribute()

ASPOSECPP_SHARED_API ObjectPtr System::TypeInfo::GetCustomAttribute ( const TypeInfo attributeType) const

Searches for the custom attribute applied having the specified type and applied to the type reprsented by the current object.

Parameters
attributeTypeThe constant reference to the TypeInfo object representing the type of the attribute to search
Returns
A pointer to an object representing the found attribute, or null-pointer if no attribute was foud matching the search criteria

◆ GetCustomAttributes() [1/2]

ASPOSECPP_SHARED_API ArrayPtr<ObjectPtr> System::TypeInfo::GetCustomAttributes ( ) const

Returns an array containing objects that represent all custom attributes applied to the type.

◆ GetCustomAttributes() [2/2]

ASPOSECPP_SHARED_API ArrayPtr<ObjectPtr> System::TypeInfo::GetCustomAttributes ( const TypeInfo attributeType,
bool  inherit 
) const

Returns an array containing objects that represent specific attributes applied to the type.

Parameters
attributeTypeType of the attribute to look for.
inheritWhether to look for inherited attributes as well.

◆ GetFields()

ASPOSECPP_SHARED_API ArrayPtr<SharedPtr<System::Reflection::FieldInfo> > System::TypeInfo::GetFields ( System::Reflection::BindingFlags  bindingAttr) const

Searches for the fields defined for the current Type, using the specified binding constraints.

◆ GetHashCode()

int System::TypeInfo::GetHashCode ( ) const
inline

Returns a hash code associated with this instance.

◆ GetInterfaces()

ASPOSECPP_SHARED_API ArrayPtr<TypeInfo> System::TypeInfo::GetInterfaces ( ) const

Gets all the interfaces implemented or inherited by the current Type.

◆ GetMember()

ASPOSECPP_SHARED_API ArrayPtr<SharedPtr<System::Reflection::MemberInfo> > System::TypeInfo::GetMember ( String  name) const

Gets list of the members with specified name.

Parameters
nameName of the member to get.
Returns
Array of member descriptors (empty if no member is found).

◆ GetMethod()

ASPOSECPP_SHARED_API SharedPtr<System::Reflection::MethodInfo> System::TypeInfo::GetMethod ( String  name) const

Gets method with specified name.

Parameters
nameName of the method to get.
Returns
Method descriptor (or null if not found).

◆ GetProperties() [1/2]

ASPOSECPP_SHARED_API ArrayPtr<SharedPtr<System::Reflection::PropertyInfo> > System::TypeInfo::GetProperties ( ) const

Returns all the public properties of the current Type.

◆ GetProperties() [2/2]

ASPOSECPP_SHARED_API ArrayPtr<SharedPtr<System::Reflection::PropertyInfo> > System::TypeInfo::GetProperties ( System::Reflection::BindingFlags  bindingAttr) const

Searches for the properties of the current Type, using the specified binding constraints.

◆ GetTemplParamType()

ASPOSECPP_SHARED_API TypeInfo System::TypeInfo::GetTemplParamType ( ) const

Gets template parameter type descritor.

◆ Hash()

ASPOSECPP_SHARED_API uint32_t System::TypeInfo::Hash ( ) const

Returns a hash value associated with the type represented by the current object.

◆ IsAssignableFrom()

ASPOSECPP_SHARED_API bool System::TypeInfo::IsAssignableFrom ( const TypeInfo type) const

Determines whether an instance of a specified type can be assigned to a variable of the current type

Parameters
typethe type to compare with the current type

◆ IsInstanceOfType()

ASPOSECPP_SHARED_API bool System::TypeInfo::IsInstanceOfType ( const SharedPtr< Object > &  obj) const

Determines whether the specified object is an instance of the current type.

Parameters
objThe object to compare with the current type
Returns
true if the current type is in the inheritance hierarchy of the object represented by obj

◆ IsSubclassOf()

ASPOSECPP_SHARED_API bool System::TypeInfo::IsSubclassOf ( const TypeInfo type) const

Determines whether the type represented by the current object is a subclass of the specified class.

Parameters
typethe type to compare with the current type

◆ operator!=() [1/2]

bool System::TypeInfo::operator!= ( const TypeInfo info) const
inline

Determines if the current and the specified TypeInfo objects are not equal.

Parameters
infoThe TypeInfo object to compare with
Returns
True if the objects' hashes are not equal, otherwise - false

◆ operator!=() [2/2]

bool System::TypeInfo::operator!= ( std::nullptr_t  ) const
inline

Determines if the current TypeInfo object is not a null-object, i.e. it represents some type.

Returns
True if the current TypeInfo object is not a null-object, otherwise - false

◆ operator==() [1/2]

bool System::TypeInfo::operator== ( const TypeInfo info) const
inline

Determines if the current and the specified TypeInfo objects are equal.

Parameters
infoThe TypeInfo object to compare with
Returns
True if the objects' hashes are equal, otherwise - false

◆ operator==() [2/2]

bool System::TypeInfo::operator== ( std::nullptr_t  ) const
inline

Determines if the current TypeInfo object is a null-object, i.e. does not represent any type.

Returns
True if the current TypeInfo object is a null-object, otherwise - false

◆ reset()

ASPOSECPP_SHARED_API void System::TypeInfo::reset ( )

Sets TypeInfo to null.

◆ set_IsValueType()

ASPOSECPP_SHARED_API void System::TypeInfo::set_IsValueType ( bool  value)

Sets a value indicating whether the Type is a value type.

◆ SetBaseType()

ASPOSECPP_SHARED_API void System::TypeInfo::SetBaseType ( GetTypeInfoFunPtr  basetype)

Sets base type descritor.

Parameters
basetypePointer to base type descriptor to set.

◆ SetTemplParamType()

ASPOSECPP_SHARED_API void System::TypeInfo::SetTemplParamType ( const TypeInfo templParam)

Sets template parameter type descritor.

Parameters
templParamPointer to template parameter type descriptor to set.

◆ StringHash()

static uint32_t System::TypeInfo::StringHash ( const char_t *  str)
inlinestatic

Calculates hash for specified string.

Parameters
strString to calculate hash for.
Returns
Hash value.

◆ ToString()

ASPOSECPP_SHARED_API String System::TypeInfo::ToString ( ) const

Returns a string containing the name of the type represented by the current object.

◆ Type()

static const TypeInfo& System::TypeInfo::Type ( )
static

Returns a TypeInfo object that represent TypeInfo class.

Member Data Documentation

◆ EmptyTypes

ASPOSECPP_SHARED_API ArrayPtr<TypeInfo> System::TypeInfo::EmptyTypes
static

Constant representing empty list of TypeInfo.