PageRenderTime 20ms CodeModel.GetById 11ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/Mono.Cecil/MarshalInfo.cs

http://github.com/jbevain/cecil
C# | 153 lines | 111 code | 33 blank | 9 comment | 0 complexity | 9487172973dbbd2c658085f23e8d4706 MD5 | raw file
  1//
  2// Author:
  3//   Jb Evain (jbevain@gmail.com)
  4//
  5// Copyright (c) 2008 - 2015 Jb Evain
  6// Copyright (c) 2008 - 2011 Novell, Inc.
  7//
  8// Licensed under the MIT/X11 license.
  9//
 10
 11using System;
 12
 13namespace Mono.Cecil {
 14
 15	public class MarshalInfo {
 16
 17		internal NativeType native;
 18
 19		public NativeType NativeType {
 20			get { return native; }
 21			set { native = value; }
 22		}
 23
 24		public MarshalInfo (NativeType native)
 25		{
 26			this.native = native;
 27		}
 28	}
 29
 30	public sealed class ArrayMarshalInfo : MarshalInfo {
 31
 32		internal NativeType element_type;
 33		internal int size_parameter_index;
 34		internal int size;
 35		internal int size_parameter_multiplier;
 36
 37		public NativeType ElementType {
 38			get { return element_type; }
 39			set { element_type = value; }
 40		}
 41
 42		public int SizeParameterIndex {
 43			get { return size_parameter_index; }
 44			set { size_parameter_index = value; }
 45		}
 46
 47		public int Size {
 48			get { return size; }
 49			set { size = value; }
 50		}
 51
 52		public int SizeParameterMultiplier {
 53			get { return size_parameter_multiplier; }
 54			set { size_parameter_multiplier = value; }
 55		}
 56
 57		public ArrayMarshalInfo ()
 58			: base (NativeType.Array)
 59		{
 60			element_type = NativeType.None;
 61			size_parameter_index = -1;
 62			size = -1;
 63			size_parameter_multiplier = -1;
 64		}
 65	}
 66
 67	public sealed class CustomMarshalInfo : MarshalInfo {
 68
 69		internal Guid guid;
 70		internal string unmanaged_type;
 71		internal TypeReference managed_type;
 72		internal string cookie;
 73
 74		public Guid Guid {
 75			get { return guid; }
 76			set { guid = value; }
 77		}
 78
 79		public string UnmanagedType {
 80			get { return unmanaged_type; }
 81			set { unmanaged_type = value; }
 82		}
 83
 84		public TypeReference ManagedType {
 85			get { return managed_type; }
 86			set { managed_type = value; }
 87		}
 88
 89		public string Cookie {
 90			get { return cookie; }
 91			set { cookie = value; }
 92		}
 93
 94		public CustomMarshalInfo ()
 95			: base (NativeType.CustomMarshaler)
 96		{
 97		}
 98	}
 99
100	public sealed class SafeArrayMarshalInfo : MarshalInfo {
101
102		internal VariantType element_type;
103
104		public VariantType ElementType {
105			get { return element_type; }
106			set { element_type = value; }
107		}
108
109		public SafeArrayMarshalInfo ()
110			: base (NativeType.SafeArray)
111		{
112			element_type = VariantType.None;
113		}
114	}
115
116	public sealed class FixedArrayMarshalInfo : MarshalInfo {
117
118		internal NativeType element_type;
119		internal int size;
120
121		public NativeType ElementType {
122			get { return element_type; }
123			set { element_type = value; }
124		}
125
126		public int Size {
127			get { return size; }
128			set { size = value; }
129		}
130
131		public FixedArrayMarshalInfo ()
132			: base (NativeType.FixedArray)
133		{
134			element_type = NativeType.None;
135		}
136	}
137
138	public sealed class FixedSysStringMarshalInfo : MarshalInfo {
139
140		internal int size;
141
142		public int Size {
143			get { return size; }
144			set { size = value; }
145		}
146
147		public FixedSysStringMarshalInfo ()
148			: base (NativeType.FixedSysString)
149		{
150			size = -1;
151		}
152	}
153}