MCPcopy Create free account
hub / github.com/ZDoom/Raze / ExpVal

Class ExpVal

source/common/scripting/backend/codegen.h:115–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113//==========================================================================
114
115struct ExpVal
116{
117 PType *Type;
118 union
119 {
120 int Int;
121 double Float;
122 void *pointer;
123 };
124
125 ExpVal()
126 {
127 Type = TypeSInt32;
128 Int = 0;
129 }
130
131 ~ExpVal()
132 {
133 if (Type == TypeString)
134 {
135 ((FString *)&pointer)->~FString();
136 }
137 }
138
139 ExpVal(const FString &str)
140 {
141 Type = TypeString;
142 ::new(&pointer) FString(str);
143 }
144
145 ExpVal(const ExpVal &o)
146 {
147 Type = o.Type;
148 if (o.Type == TypeString)
149 {
150 ::new(&pointer) FString(*(FString *)&o.pointer);
151 }
152 else
153 {
154 memcpy(&Float, &o.Float, 8);
155 }
156 }
157
158 ExpVal &operator=(const ExpVal &o)
159 {
160 if (Type == TypeString)
161 {
162 ((FString *)&pointer)->~FString();
163 }
164 Type = o.Type;
165 if (o.Type == TypeString)
166 {
167 ::new(&pointer) FString(*(FString *)&o.pointer);
168 }
169 else
170 {
171 memcpy(&Float, &o.Float, 8);
172 }

Callers 1

FxConstantMethod · 0.85

Calls 1

~FStringMethod · 0.80

Tested by

no test coverage detected