Merge pull request #3796 from ntherning/windows-backend-for-MemoryMappedFile
[mono.git] / mono / metadata / class-inlines.h
1 /*
2  * Copyright 2016 Microsoft
3  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
4  */
5 #ifndef __MONO_METADATA_CLASS_INLINES_H__
6 #define __MONO_METADATA_CLASS_INLINES_H__
7
8 #include <mono/metadata/class-internals.h>
9 #include <mono/metadata/tabledefs.h>
10
11 static inline gboolean
12 mono_class_is_def (MonoClass *klass)
13 {
14         return klass->class_kind == MONO_CLASS_DEF;
15 }
16
17 static inline gboolean
18 mono_class_is_gtd (MonoClass *klass)
19 {
20         return klass->class_kind == MONO_CLASS_GTD;
21 }
22
23 static inline gboolean
24 mono_class_is_ginst (MonoClass *klass)
25 {
26         return klass->class_kind == MONO_CLASS_GINST;
27 }
28
29 static inline gboolean
30 mono_class_is_gparam (MonoClass *klass)
31 {
32         return klass->class_kind == MONO_CLASS_GPARAM;
33 }
34
35 static inline gboolean
36 mono_class_is_array (MonoClass *klass)
37 {
38         return klass->class_kind == MONO_CLASS_ARRAY;
39 }
40
41 static inline gboolean
42 mono_class_is_pointer (MonoClass *klass)
43 {
44         return klass->class_kind == MONO_CLASS_POINTER;
45 }
46
47 static inline gboolean
48 mono_class_is_abstract (MonoClass *klass)
49 {
50         return mono_class_get_flags (klass) & TYPE_ATTRIBUTE_ABSTRACT;
51 }
52
53 static inline gboolean
54 mono_class_is_interface (MonoClass *klass)
55 {
56         return mono_class_get_flags (klass) & TYPE_ATTRIBUTE_INTERFACE;
57 }
58
59 static inline gboolean
60 mono_class_is_sealed (MonoClass *klass)
61 {
62         return mono_class_get_flags (klass) & TYPE_ATTRIBUTE_SEALED;
63 }
64
65 static inline gboolean
66 mono_class_is_before_field_init (MonoClass *klass)
67 {
68         return mono_class_get_flags (klass) & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT;
69 }
70
71 static inline gboolean
72 mono_class_is_auto_layout (MonoClass *klass)
73 {
74         return (mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_AUTO_LAYOUT;
75 }
76
77 static inline gboolean
78 mono_class_is_explicit_layout (MonoClass *klass)
79 {
80         return (mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_EXPLICIT_LAYOUT;
81 }
82
83 static inline gboolean
84 mono_class_is_public (MonoClass *klass)
85 {
86         return mono_class_get_flags (klass) & TYPE_ATTRIBUTE_PUBLIC;
87 }
88
89 #endif