Debian Codegraph @

external/cecil-legacy/Mono.Cecil.Metadata/TableHeap.cs

raw symbols SCIP
1 //
2 // TableHeap.cs
3 //
4 // Author:
5 // Jb Evain ([email protected])
6 //
7 // Copyright (c) 2008 - 2011 Jb Evain
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using System;
30 using Mono.Cecil.PE;
31
32 namespace Mono.Cecil.Metadata {
33
34 enum Table : byte {
35 Module = 0x00,
36 TypeRef = 0x01,
37 TypeDef = 0x02,
38 FieldPtr = 0x03,
39 Field = 0x04,
40 MethodPtr = 0x05,
41 Method = 0x06,
42 ParamPtr = 0x07,
43 Param = 0x08,
44 InterfaceImpl = 0x09,
45 MemberRef = 0x0a,
46 Constant = 0x0b,
47 CustomAttribute = 0x0c,
48 FieldMarshal = 0x0d,
49 DeclSecurity = 0x0e,
50 ClassLayout = 0x0f,
51 FieldLayout = 0x10,
52 StandAloneSig = 0x11,
53 EventMap = 0x12,
54 EventPtr = 0x13,
55 Event = 0x14,
56 PropertyMap = 0x15,
57 PropertyPtr = 0x16,
58 Property = 0x17,
59 MethodSemantics = 0x18,
60 MethodImpl = 0x19,
61 ModuleRef = 0x1a,
62 TypeSpec = 0x1b,
63 ImplMap = 0x1c,
64 FieldRVA = 0x1d,
65 EncLog = 0x1e,
66 EncMap = 0x1f,
67 Assembly = 0x20,
68 AssemblyProcessor = 0x21,
69 AssemblyOS = 0x22,
70 AssemblyRef = 0x23,
71 AssemblyRefProcessor = 0x24,
72 AssemblyRefOS = 0x25,
73 File = 0x26,
74 ExportedType = 0x27,
75 ManifestResource = 0x28,
76 NestedClass = 0x29,
77 GenericParam = 0x2a,
78 MethodSpec = 0x2b,
79 GenericParamConstraint = 0x2c,
80 }
81
82 struct TableInformation {
83 public uint Offset;
84 public uint Length;
85 public uint RowSize;
86 }
87
88 sealed class TableHeap : Heap {
89
90 public long Valid;
91 public long Sorted;
92
93 public const int TableCount = 45;
94
95 public readonly TableInformation [] Tables = new TableInformation [TableCount];
96
97 public TableInformation this [Table table] {
98 get { return Tables [(int) table]; }
99 }
100
101 public TableHeap (Section section, uint start, uint size)
102 : base (section, start, size)
103 {
104 }
105
106 public bool HasTable (Table table)
107 {
108 return (Valid & (1L << (int) table)) != 0;
109 }
110 }
111 }