-
Notifications
You must be signed in to change notification settings - Fork 2
TypeDef
A xlang::meta::reader::TypeDef
structure represents a type.
Since it is a row in a database table, 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 TypeDef
that may be empty, as reported by operator bool()
. All method calls are invalid on an empty TypeDef
. (Except for operator bool()
, of course.)
xlang::meta::reader::TypeAttributes Flags() const;
Returns the type's attribute flags. This is column 0 in the database schema.
Complexity: O(1)
Exceptions: Throws std::invalid_argument
if the database is corrupted.
std::string_view TypeName() const;
Returns the name of the type relative to its namespace. 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.
std::string_view TypeNamespace() const;
Returns the name of the namespace in which the type resides. 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.
xlang::meta::reader::coded_index<TypeDefOrRef> Extends() const;
Returns the base class of the type, if any. This is column 3 in the database schema.
In practice, this is almost always a TypeRef
because
- Xlang types always have a base class. (Only
System.Object
has no base class.) This rules out "nothing". - The base class cannot be a parameterized delegate. This rules out
TypeSpec
. -
For system metadata files, the base class is expressed as a
TypeRef
even if defined in the same assembly. However, third-party metadata files are permitted to useTypeDef
.
See enum TypeDefOrRef for further details.
Complexity: O(1)
Exceptions: Throws std::invalid_argument
if the database is corrupted.
std::pair<xlang::meta::reader::Field, xlang::meta::reader::Field>
FieldList() const;
Returns a range (pair of iterators) that represents the fields of this type. If this range is empty, then the type has no fields. You can use the Range collection adapters to perform operations such as iterating over the elements in the range.
This is column 4 in the database schema.
Complexity: O(1)
Exceptions: Throws std::invalid_argument
if the database is corrupted.
std::pair<xlang::meta::reader::MethodDef, xlang::meta::reader::MethodDef>
MethodList() const;
Returns a range (pair of iterators) that represents the methods of this type. If this range is empty, then the type has no methods. You can use the Range collection adapters to perform operations such as iterating over the elements in the range.
This is column 5 in the database schema.
Complexity: O(1)
Exceptions: Throws std::invalid_argument
if the database is corrupted.
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. You can use the Range collection adapters to perform operations such as iterating over the elements in the range.
See also the get_attribute()
helper function.
Complexity: O(log n), where n is the size of the CustomAttributes
table.
Exceptions: Throws std::invalid_argument
if the database is corrupted.
std::pair<xlang::meta::reader::InterfaceImpl, xlang::meta::reader::InterfaceImpl>
InterfaceImpl() const;
Returns a range (pair of iterators) that represents the interfaces implemented by this type. If this range is empty, then the type implements no interfaces. (Is that even legal?) You can use the Range collection adapters to perform operations such as iterating over the elements in the range.
Complexity: O(log n), where n is the size of the InterfaceImpl
table.
Exceptions: Throws std::invalid_argument
if the database is corrupted.
std::pair<xlang::meta::reader::Property, xlang::meta::reader::Property>
PropertyList() const;
Returns a range (pair of iterators) that represents the properties implemented by this type. If this range is empty, then the type implements no properties. You can use the Range collection adapters to perform operations such as iterating over the elements in the range.
Properties appear both in the PropertyList
and in the MethodList
.
Complexity: O(log n), where n is the size of the PropertyMap
table.
Exceptions: Throws std::invalid_argument
if the database is corrupted.
std::pair<xlang::meta::reader::Event, xlang::meta::reader::Event>
EventList() const;
Returns a range (pair of iterators) that represents the events implemented by this type. If this range is empty, then the type implements no events. You can use the Range collection adapters to perform operations such as iterating over the elements in the range.
Events appear both in the EventList
and in the MethodList
.
Complexity: O(log n), where n is the size of the EventMap
table.
Exceptions: Throws std::invalid_argument
if the database is corrupted.
bool is_enum() const;
Returns true
if this type is an enum. An enum extends the System.Enum
type.
Complexity: O(1)
Exceptions: Throws std::invalid_argument
if the database is corrupted.
xlang::meta::Reader::EnumDefinition get_enum_definition() const;
Returns an EnumDefinition that describes the type. It is an error to call this method if is_enum()
is false
.
Complexity: O(1)
Exceptions: Throws std::invalid_argument
if the database is corrupted.