Skip to content

TypeRef

Raymond Chen edited this page May 14, 2019 · 3 revisions

A xlang::meta::reader::TypeRef structure introduces a level of indirection to a TypeDef.

Since it is a row in a database table, TypeRef derives from xlang::meta::reader::row_base<TypeRef>, and all row operations are available, although in practice you won't use them directly, preferring to use the accessors defined here.

Some methods return a TypeRef that may be empty, as reported by operator bool(). All method calls are invalid on an empty TypeRef. (Except for operator bool(), of course.)

Methods

ResolutionScope

xlang::meta::reader::coded_index<ResolutionScope> ResolutionScope() const;

Returns a coded_index<ResolutionScope> that identifies a row in the Module, ModuleRef, AssemblyRef or TypeRef table. This is column 0 in the database schema.

Complexity: O(1)

Exceptions: Throws std::invalid_argument if the database is corrupted.

TypeName

std::string_view TypeName() const;

Returns the name of the type being referred to. This is column 1 in the database schema.

The underlying data for the std::string_view is the enclosing database. Therefore, the returned TypeName() is valid for as long as the database remains alive.

Complexity: O(n) in the size of the returned string view.

Exceptions: Throws std::invalid_argument if the database is corrupted.

TypeNamespace

std::string_view TypeNamespace() const;

Returns the namespace of the type being referred to. This is column 2 in the database schema.

The underlying data for the std::string_view is the enclosing database. Therefore, the returned TypeNamespace() is valid for as long as the database remains alive.

Complexity: O(n) in the size of the returned string view.

Exceptions: Throws std::invalid_argument if the database is corrupted.

CustomAttribute

std::pair<xlang::meta::reader::CustomAttribute, xlang::meta::reader::CustomAttribute>
CustomAttribute() const;

Returns a range (pair of iterators) that represents the custom attributes associated with this type. If this range is empty, then the type has no custom attributes.

See also the get_attribute() helper function.

Although TypeRefs can in theory possess attributes, in practice they do not. The attributes reside on the corresponding TypeDef.

Complexity: O(log n), where n is the size of the CustomAttributes table.

Exceptions: Throws std::invalid_argument if the database is corrupted.

Clone this wiki locally