PageRenderTime 17ms CodeModel.GetById 2ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/Mono.Cecil/IMemberDefinition.cs

http://github.com/jbevain/cecil
C# | 82 lines | 55 code | 18 blank | 9 comment | 8 complexity | ca47041871947737fed78b0b2d627c4e 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
11namespace Mono.Cecil {
12
13	public interface IMemberDefinition : ICustomAttributeProvider {
14
15		string Name { get; set; }
16		string FullName { get; }
17
18		bool IsSpecialName { get; set; }
19		bool IsRuntimeSpecialName { get; set; }
20
21		TypeDefinition DeclaringType { get; set; }
22	}
23
24	static partial class Mixin {
25
26		public static bool GetAttributes (this uint self, uint attributes)
27		{
28			return (self & attributes) != 0;
29		}
30
31		public static uint SetAttributes (this uint self, uint attributes, bool value)
32		{
33			if (value)
34				return self | attributes;
35
36			return self & ~attributes;
37		}
38
39		public static bool GetMaskedAttributes (this uint self, uint mask, uint attributes)
40		{
41			return (self & mask) == attributes;
42		}
43
44		public static uint SetMaskedAttributes (this uint self, uint mask, uint attributes, bool value)
45		{
46			if (value) {
47				self &= ~mask;
48				return self | attributes;
49			}
50
51			return self & ~(mask & attributes);
52		}
53
54		public static bool GetAttributes (this ushort self, ushort attributes)
55		{
56			return (self & attributes) != 0;
57		}
58
59		public static ushort SetAttributes (this ushort self, ushort attributes, bool value)
60		{
61			if (value)
62				return (ushort) (self | attributes);
63
64			return (ushort) (self & ~attributes);
65		}
66
67		public static bool GetMaskedAttributes (this ushort self, ushort mask, uint attributes)
68		{
69			return (self & mask) == attributes;
70		}
71
72		public static ushort SetMaskedAttributes (this ushort self, ushort mask, uint attributes, bool value)
73		{
74			if (value) {
75				self = (ushort) (self & ~mask);
76				return (ushort) (self | attributes);
77			}
78
79			return (ushort) (self & ~(mask & attributes));
80		}
81	}
82}