1 /*
2 * Copyright 2011, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
5
6
7 #include "TypeLookupConstraints.h"
8
9
TypeLookupConstraints()10 TypeLookupConstraints::TypeLookupConstraints()
11 :
12 fTypeKindGiven(false),
13 fSubtypeKindGiven(false)
14 {
15 }
16
17
TypeLookupConstraints(type_kind typeKind)18 TypeLookupConstraints::TypeLookupConstraints(type_kind typeKind)
19 :
20 fTypeKind(typeKind),
21 fTypeKindGiven(true),
22 fSubtypeKindGiven(false)
23 {
24 }
25
26
TypeLookupConstraints(type_kind typeKind,int32 subTypeKind)27 TypeLookupConstraints::TypeLookupConstraints(type_kind typeKind,
28 int32 subTypeKind)
29 :
30 fTypeKind(typeKind),
31 fSubtypeKind(subTypeKind),
32 fTypeKindGiven(true),
33 fSubtypeKindGiven(true),
34 fBaseTypeName()
35 {
36 }
37
38
39 bool
HasTypeKind() const40 TypeLookupConstraints::HasTypeKind() const
41 {
42 return fTypeKindGiven;
43 }
44
45
46 bool
HasSubtypeKind() const47 TypeLookupConstraints::HasSubtypeKind() const
48 {
49 return fSubtypeKindGiven;
50 }
51
52
53 bool
HasBaseTypeName() const54 TypeLookupConstraints::HasBaseTypeName() const
55 {
56 return fBaseTypeName.Length() > 0;
57 }
58
59
60 type_kind
TypeKind() const61 TypeLookupConstraints::TypeKind() const
62 {
63 return fTypeKind;
64 }
65
66
67 int32
SubtypeKind() const68 TypeLookupConstraints::SubtypeKind() const
69 {
70 return fSubtypeKind;
71 }
72
73
74 const BString&
BaseTypeName() const75 TypeLookupConstraints::BaseTypeName() const
76 {
77 return fBaseTypeName;
78 }
79
80
81 void
SetTypeKind(type_kind typeKind)82 TypeLookupConstraints::SetTypeKind(type_kind typeKind)
83 {
84 fTypeKind = typeKind;
85 fTypeKindGiven = true;
86 }
87
88
89 void
SetSubtypeKind(int32 subtypeKind)90 TypeLookupConstraints::SetSubtypeKind(int32 subtypeKind)
91 {
92 fSubtypeKind = subtypeKind;
93 fSubtypeKindGiven = true;
94 }
95
96
97 void
SetBaseTypeName(const BString & name)98 TypeLookupConstraints::SetBaseTypeName(const BString& name)
99 {
100 fBaseTypeName = name;
101 }
102