Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
276 lines (252 sloc) 19.1 KB
/* -----------------------------------------------------------\
| This code was generated by Allen Copeland's Abstraction. |
| Version: 1.0.0.14276 |
|-------------------------------------------------------------|
| To ensure the code works properly, |
| please do not make any changes to the file. |
|-------------------------------------------------------------|
| The specific language is C# (Runtime version: v4.0.30319) |
| Sub-tool Name: Abstraction's Old C♯ Code Translator |
| Sub-tool Version: 1.0.0.14276 |
\----------------------------------------------------------- */
using System;
using System.Collections;
using System.Collections.Generic;
using AllenCopeland.Abstraction.Slf._Internal.Cli.Metadata.Tables;
using AllenCopeland.Abstraction.Slf.Cli.Metadata;
using AllenCopeland.Abstraction.Slf.Cli.Metadata.Tables;
using AllenCopeland.Abstraction.Utilities.Collections;
namespace AllenCopeland.Abstraction.Slf._Internal.Cli.Metadata.Tables
{
// Module: RootModule
internal class CliMetadataModuleLockedTableRow :
ICliMetadataModuleTableRow
{
private uint index;
private ICliMetadataRoot metadataRoot;
/// <summary>
/// Data member for <see cref="Generation"/>.
/// </summary>
private ushort generation;
/// <summary>
/// Data member for <see cref="Name"/>.
/// </summary>
private uint nameIndex;
/// <summary>
/// Data member for <see cref="ModuleVersion"/>.
/// </summary>
private uint moduleVersionIndex;
/// <summary>
/// Data member for <see cref="EncId"/>.
/// </summary>
private uint encIdIndex;
/// <summary>
/// Data member for <see cref="EncBaseId"/>.
/// </summary>
private uint encBaseIdIndex;
/// <summary>
/// Data member which denotes the state of the row, used to calculate the size of the
/// <see cref="AllenCopeland.Abstraction.Slf._Internal.Cli.Metadata.Tables.CliMetadataModuleTableReader"/>
/// </summary>
private byte state;
/// <summary>
/// Data member for <see cref="CustomAttributes"/>.
/// </summary>
private IControlledCollection<ICliMetadataCustomAttributeTableRow> customAttributes;
/// <summary>
/// Returns the index of the row within the <see cref="CliMetadataModuleTableReader"/>
/// since the rows from the containing table are referenced by other tables.
/// </summary>
public uint Index
{
get
{
return this.index;
}
}
/// <summary>
/// Returns the root of the metadata from which the current <see cref="CliMetadataModuleLockedTableRow"/>
/// was derived.
/// </summary>
public ICliMetadataRoot MetadataRoot
{
get
{
return this.metadataRoot;
}
}
/// <summary>
/// Returns the generation associated to the module
/// </summary>
/// <remarks>
/// A two-byte (2-byte) value, reserved, shall be zero.
/// </remarks>
public ushort Generation
{
get
{
return this.generation;
}
}
/// <summary>
/// Returns the name of the module.
/// </summary>
public string Name
{
get
{
return this.metadataRoot.StringsHeap[this.nameIndex];
}
}
/// <summary>
/// Returns the index onto the <see cref="CliMetadataFixedRoot.StringsHeap"/> from which
/// <see cref="Name"/> is derived.
/// </summary>
public uint NameIndex
{
get
{
return this.nameIndex;
}
}
/// <summary>
/// Returns a Guid used to distinguish between two versions of the same
/// module.
/// </summary>
public Guid ModuleVersion
{
get
{
return this.metadataRoot.GuidHeap[this.moduleVersionIndex];
}
}
/// <summary>
/// Returns the index onto the <see cref="CliMetadataFixedRoot.GuidHeap"/> from which
/// <see cref="ModuleVersion"/> is derived.
/// </summary>
public uint ModuleVersionIndex
{
get
{
return this.moduleVersionIndex;
}
}
/// <summary>
/// Returns an index into the Guid heap, reserved, shall be zero.
/// </summary>
public Guid EncId
{
get
{
return this.metadataRoot.GuidHeap[this.encIdIndex];
}
}
/// <summary>
/// Returns the index onto the <see cref="CliMetadataFixedRoot.GuidHeap"/> from which
/// <see cref="EncId"/> is derived.
/// </summary>
public uint EncIdIndex
{
get
{
return this.encIdIndex;
}
}
/// <summary>
/// Returns an index into the Guid heap, reserved, shall be zero.
/// </summary>
public Guid EncBaseId
{
get
{
return this.metadataRoot.GuidHeap[this.encBaseIdIndex];
}
}
/// <summary>
/// Returns the index onto the <see cref="CliMetadataFixedRoot.GuidHeap"/> from which
/// <see cref="EncBaseId"/> is derived.
/// </summary>
public uint EncBaseIdIndex
{
get
{
return this.encBaseIdIndex;
}
}
public int Size
{
get
{
switch (this.state)
{
case 1:
return CliMetadataModuleTableReader.__COR_MODULE_CALC_SIZE_2__;
case 2:
return CliMetadataModuleTableReader.__COR_MODULE_CALC_SIZE_3__;
case 3:
return CliMetadataModuleTableReader.__COR_MODULE_CALC_SIZE_4__;
}
return CliMetadataModuleTableReader.__COR_MODULE_CALC_SIZE_1__;
}
}
/// <summary>
/// Returns the set of custom metadata elements applied to the member.
/// </summary>
/// <remarks>
/// Created through references from the <see cref="ICliMetadataCustomAttributeTable"/>.
/// </remarks>
public IControlledCollection<ICliMetadataCustomAttributeTableRow> CustomAttributes
{
get
{
if (this.customAttributes == null)
{
ICliMetadataCustomAttributeTable customAttributesTable = this.metadataRoot.TableStream.CustomAttributeTable;
if (customAttributesTable != null)
{
List<uint> customAttributes = new List<uint>();
foreach (ICliMetadataCustomAttributeTableRow customAttribute in customAttributesTable.GetTaggedEntries(CliMetadataHasCustomAttributeTag.Module))
{
if (customAttribute.ParentIndex == this.Index)
customAttributes.Add(customAttribute.Index);
else if (customAttribute.ParentIndex > this.Index)
break;
}
this.customAttributes = new CliMetadataLazySet<ICliMetadataCustomAttributeTableRow>(customAttributes.ToArray(), this.metadataRoot.TableStream.CustomAttributeTable);
}
}
return this.customAttributes;
}
}
CliMetadataHasCustomAttributeTag ICliMetadataHasCustomAttributeRow.HasCustomAttributeEncoding
{
get
{
return CliMetadataHasCustomAttributeTag.Module;
}
}
CliMetadataResolutionScopeTag ICliMetadataResolutionScopeRow.ResolutionScopeEncoding
{
get
{
return CliMetadataResolutionScopeTag.Module;
}
}
public override string ToString()
{
return string.Format("Module: Generation = {0}, Name = {1}, ModuleVersion = {2}, EncId = {3}, EncBaseId = {4}", this.Generation, this.Name,
this.ModuleVersion, this.EncId, this.EncBaseId);
}
internal CliMetadataModuleLockedTableRow(uint index, byte state, ICliMetadataRoot metadataRoot, ushort generation, uint nameIndex, uint moduleVersionIndex, uint encIdIndex, uint encBaseIdIndex)
{
this.index = index;
this.metadataRoot = metadataRoot;
this.state = state;
this.generation = generation;
this.nameIndex = nameIndex;
this.moduleVersionIndex = moduleVersionIndex;
this.encIdIndex = encIdIndex;
this.encBaseIdIndex = encBaseIdIndex;
}
}
}