comparison trunk/src/dil/Enums.d @ 786:3b34f6a95a27

Added and revised documenation comments.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 24 Feb 2008 02:41:11 +0100
parents e76c9fdb83a3
children
comparison
equal deleted inserted replaced
785:57ef69eced96 786:3b34f6a95a27
4 +/ 4 +/
5 module dil.Enums; 5 module dil.Enums;
6 6
7 import common; 7 import common;
8 8
9 /// Enumeration of storage classes.
9 enum StorageClass 10 enum StorageClass
10 { 11 {
11 None = 0, 12 None = 0,
12 Abstract = 1, 13 Abstract = 1,
13 Auto = 1<<2, 14 Auto = 1<<2,
25 Ref = 1<<14, 26 Ref = 1<<14,
26 Lazy = 1<<15, 27 Lazy = 1<<15,
27 Variadic = 1<<16, 28 Variadic = 1<<16,
28 } 29 }
29 30
31 /// Enumeration of protection attributes.
30 enum Protection 32 enum Protection
31 { 33 {
32 None, 34 None,
33 Private/+ = 1+/, 35 Private/+ = 1+/,
34 Protected/+ = 1<<1+/, 36 Protected/+ = 1<<1+/,
35 Package/+ = 1<<2+/, 37 Package/+ = 1<<2+/,
36 Public/+ = 1<<3+/, 38 Public/+ = 1<<3+/,
37 Export/+ = 1<<4+/ 39 Export/+ = 1<<4+/
38 } 40 }
39 41
42 /// Enumeration of linkage types.
40 enum LinkageType 43 enum LinkageType
41 { 44 {
42 None, 45 None,
43 C, 46 C,
44 Cpp, 47 Cpp,
46 Windows, 49 Windows,
47 Pascal, 50 Pascal,
48 System 51 System
49 } 52 }
50 53
54 /// Returns the string for prot.
51 string toString(Protection prot) 55 string toString(Protection prot)
52 { 56 {
53 switch (prot) 57 switch (prot)
54 { alias Protection P; 58 { alias Protection P;
55 case P.None: return ""; 59 case P.None: return "";
87 default: 91 default:
88 assert(0); 92 assert(0);
89 } 93 }
90 } 94 }
91 95
92 /// Returns the string . Any number of bits may be set. 96 /// Returns the strings for stc. Any number of bits may be set.
93 string[] toStrings(StorageClass stc) 97 string[] toStrings(StorageClass stc)
94 { 98 {
95 string[] result; 99 string[] result;
96 for (auto i = StorageClass.max; i; i >>= 1) 100 for (auto i = StorageClass.max; i; i >>= 1)
97 if (stc & i) 101 if (stc & i)
98 result ~= toString(i); 102 result ~= toString(i);
99 return result; 103 return result;
100 } 104 }
101 105
106 /// Returns the string for ltype.
102 string toString(LinkageType ltype) 107 string toString(LinkageType ltype)
103 { 108 {
104 switch (ltype) 109 switch (ltype)
105 { alias LinkageType LT; 110 { alias LinkageType LT;
106 case LT.None: return ""; 111 case LT.None: return "";