~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ikvm/reflect/Emit/EnumBuilder.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (C) 2010 Jeroen Frijters
 
3
 
 
4
  This software is provided 'as-is', without any express or implied
 
5
  warranty.  In no event will the authors be held liable for any damages
 
6
  arising from the use of this software.
 
7
 
 
8
  Permission is granted to anyone to use this software for any purpose,
 
9
  including commercial applications, and to alter it and redistribute it
 
10
  freely, subject to the following restrictions:
 
11
 
 
12
  1. The origin of this software must not be misrepresented; you must not
 
13
     claim that you wrote the original software. If you use this software
 
14
     in a product, an acknowledgment in the product documentation would be
 
15
     appreciated but is not required.
 
16
  2. Altered source versions must be plainly marked as such, and must not be
 
17
     misrepresented as being the original software.
 
18
  3. This notice may not be removed or altered from any source distribution.
 
19
 
 
20
  Jeroen Frijters
 
21
  jeroen@frijters.net
 
22
  
 
23
*/
 
24
using System;
 
25
using System.Collections.Generic;
 
26
using System.Text;
 
27
 
 
28
namespace IKVM.Reflection.Emit
 
29
{
 
30
        public sealed class EnumBuilder : TypeInfo
 
31
        {
 
32
                private readonly TypeBuilder typeBuilder;
 
33
                private readonly FieldBuilder fieldBuilder;
 
34
 
 
35
                internal EnumBuilder(TypeBuilder typeBuilder, FieldBuilder fieldBuilder)
 
36
                        : base(typeBuilder)
 
37
                {
 
38
                        this.typeBuilder = typeBuilder;
 
39
                        this.fieldBuilder = fieldBuilder;
 
40
                }
 
41
 
 
42
                public override string __Name
 
43
                {
 
44
                        get { return typeBuilder.__Name; }
 
45
                }
 
46
 
 
47
                public override string __Namespace
 
48
                {
 
49
                        get { return typeBuilder.__Namespace; }
 
50
                }
 
51
 
 
52
                public override string Name
 
53
                {
 
54
                        get { return typeBuilder.Name; }
 
55
                }
 
56
 
 
57
                public override string FullName
 
58
                {
 
59
                        get { return typeBuilder.FullName; }
 
60
                }
 
61
 
 
62
                public override Type BaseType
 
63
                {
 
64
                        get { return typeBuilder.BaseType; }
 
65
                }
 
66
 
 
67
                public override TypeAttributes Attributes
 
68
                {
 
69
                        get { return typeBuilder.Attributes; }
 
70
                }
 
71
 
 
72
                public override Module Module
 
73
                {
 
74
                        get { return typeBuilder.Module; }
 
75
                }
 
76
 
 
77
                public FieldBuilder DefineLiteral(string literalName, object literalValue)
 
78
                {
 
79
                        FieldBuilder fb = typeBuilder.DefineField(literalName, typeBuilder, FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
 
80
                        fb.SetConstant(literalValue);
 
81
                        return fb;
 
82
                }
 
83
 
 
84
                public Type CreateType()
 
85
                {
 
86
                        return typeBuilder.CreateType();
 
87
                }
 
88
 
 
89
                public TypeInfo CreateTypeInfo()
 
90
                {
 
91
                        return typeBuilder.CreateTypeInfo();
 
92
                }
 
93
 
 
94
                public TypeToken TypeToken
 
95
                {
 
96
                        get { return typeBuilder.TypeToken; }
 
97
                }
 
98
 
 
99
                public FieldBuilder UnderlyingField
 
100
                {
 
101
                        get { return fieldBuilder; }
 
102
                }
 
103
 
 
104
                public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
 
105
                {
 
106
                        typeBuilder.SetCustomAttribute(con, binaryAttribute);
 
107
                }
 
108
 
 
109
                public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
 
110
                {
 
111
                        typeBuilder.SetCustomAttribute(customBuilder);
 
112
                }
 
113
 
 
114
                public override Type GetEnumUnderlyingType()
 
115
                {
 
116
                        return fieldBuilder.FieldType;
 
117
                }
 
118
 
 
119
                internal override bool IsBaked
 
120
                {
 
121
                        get { return typeBuilder.IsBaked; }
 
122
                }
 
123
        }
 
124
}