117 references to TypeCode
Microsoft.CodeAnalysis.Workspaces (117)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (79)
14
using TypeCode = ObjectWriter.
TypeCode
;
157
var
code = (
TypeCode
)ReadByte();
160
case
TypeCode
.Null: return null;
161
case
TypeCode
.Boolean_True: return true;
162
case
TypeCode
.Boolean_False: return false;
163
case
TypeCode
.Int8: return ReadSByte();
164
case
TypeCode
.UInt8: return ReadByte();
165
case
TypeCode
.Int16: return ReadInt16();
166
case
TypeCode
.UInt16: return ReadUInt16();
167
case
TypeCode
.Int32: return ReadInt32();
168
case
TypeCode
.Int32_1Byte: return (int)ReadByte();
169
case
TypeCode
.Int32_2Bytes: return (int)ReadUInt16();
170
case
TypeCode
.Int32_0:
171
case
TypeCode
.Int32_1:
172
case
TypeCode
.Int32_2:
173
case
TypeCode
.Int32_3:
174
case
TypeCode
.Int32_4:
175
case
TypeCode
.Int32_5:
176
case
TypeCode
.Int32_6:
177
case
TypeCode
.Int32_7:
178
case
TypeCode
.Int32_8:
179
case
TypeCode
.Int32_9:
180
case
TypeCode
.Int32_10:
181
return (int)code - (int)
TypeCode
.Int32_0;
182
case
TypeCode
.UInt32: return ReadUInt32();
183
case
TypeCode
.UInt32_1Byte: return (uint)ReadByte();
184
case
TypeCode
.UInt32_2Bytes: return (uint)ReadUInt16();
185
case
TypeCode
.UInt32_0:
186
case
TypeCode
.UInt32_1:
187
case
TypeCode
.UInt32_2:
188
case
TypeCode
.UInt32_3:
189
case
TypeCode
.UInt32_4:
190
case
TypeCode
.UInt32_5:
191
case
TypeCode
.UInt32_6:
192
case
TypeCode
.UInt32_7:
193
case
TypeCode
.UInt32_8:
194
case
TypeCode
.UInt32_9:
195
case
TypeCode
.UInt32_10:
196
return (uint)((int)code - (int)
TypeCode
.UInt32_0);
197
case
TypeCode
.Int64: return ReadInt64();
198
case
TypeCode
.UInt64: return ReadUInt64();
199
case
TypeCode
.Float4: return ReadSingle();
200
case
TypeCode
.Float8: return ReadDouble();
201
case
TypeCode
.Decimal: return ReadDecimal();
202
case
TypeCode
.Char:
205
case
TypeCode
.StringUtf8:
206
case
TypeCode
.StringUtf16:
207
case
TypeCode
.StringRef_4Bytes:
208
case
TypeCode
.StringRef_1Byte:
209
case
TypeCode
.StringRef_2Bytes:
211
case
TypeCode
.DateTime:
221
var
code = (
TypeCode
)ReadByte();
224
case
TypeCode
.Null:
227
case
TypeCode
.EncodingName:
230
case >=
TypeCode
.FirstWellKnownTextEncoding and <=
TypeCode
.LastWellKnownTextEncoding:
233
case
TypeCode
.EncodingCodePage:
240
static TextEncodingKind ToEncodingKind(
TypeCode
code)
242
Debug.Assert(code is >=
TypeCode
.FirstWellKnownTextEncoding and <=
TypeCode
.LastWellKnownTextEncoding);
243
return Microsoft.CodeAnalysis.EncodingExtensions.FirstTextEncodingKind + (byte)(code -
TypeCode
.FirstWellKnownTextEncoding);
308
var
kind = (
TypeCode
)ReadByte();
309
return kind ==
TypeCode
.Null ? null : ReadStringValue(kind);
312
private string ReadStringValue(
TypeCode
kind)
316
TypeCode
.StringRef_1Byte => _stringReferenceMap.GetValue(ReadByte()),
317
TypeCode
.StringRef_2Bytes => _stringReferenceMap.GetValue(ReadUInt16()),
318
TypeCode
.StringRef_4Bytes => _stringReferenceMap.GetValue(ReadInt32()),
319
TypeCode
.StringUtf16 or
TypeCode
.StringUtf8 => ReadStringLiteral(kind),
324
private unsafe string ReadStringLiteral(
TypeCode
kind)
327
if (kind ==
TypeCode
.StringUtf8)
347
=> (
TypeCode
)ReadByte() switch
349
TypeCode
.Array_0 => 0,
350
TypeCode
.Array_1 => 1,
351
TypeCode
.Array_2 => 2,
352
TypeCode
.Array_3 => 3,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (38)
171
WriteByte((byte)
TypeCode
.Null);
196
WriteByte((byte)
TypeCode
.Float8);
201
WriteByte((byte)((bool)value ?
TypeCode
.Boolean_True :
TypeCode
.Boolean_False));
205
WriteByte((byte)
TypeCode
.Char);
210
WriteByte((byte)
TypeCode
.UInt8);
215
WriteByte((byte)
TypeCode
.Int16);
220
WriteByte((byte)
TypeCode
.Int64);
225
WriteByte((byte)
TypeCode
.Int8);
230
WriteByte((byte)
TypeCode
.Float4);
235
WriteByte((byte)
TypeCode
.UInt16);
244
WriteByte((byte)
TypeCode
.UInt64);
254
WriteByte((byte)
TypeCode
.Decimal);
259
WriteByte((byte)
TypeCode
.DateTime);
328
WriteByte((byte)
TypeCode
.Array_0);
331
WriteByte((byte)
TypeCode
.Array_1);
334
WriteByte((byte)
TypeCode
.Array_2);
337
WriteByte((byte)
TypeCode
.Array_3);
340
WriteByte((byte)
TypeCode
.Array);
366
WriteByte((byte)((int)
TypeCode
.Int32_0 + v));
370
WriteByte((byte)
TypeCode
.Int32_1Byte);
375
WriteByte((byte)
TypeCode
.Int32_2Bytes);
380
WriteByte((byte)
TypeCode
.Int32);
389
WriteByte((byte)((int)
TypeCode
.UInt32_0 + v));
393
WriteByte((byte)
TypeCode
.UInt32_1Byte);
398
WriteByte((byte)
TypeCode
.UInt32_2Bytes);
403
WriteByte((byte)
TypeCode
.UInt32);
446
WriteByte((byte)
TypeCode
.Null);
455
WriteByte((byte)
TypeCode
.StringRef_1Byte);
460
WriteByte((byte)
TypeCode
.StringRef_2Bytes);
465
WriteByte((byte)
TypeCode
.StringRef_4Bytes);
478
WriteByte((byte)
TypeCode
.StringUtf8);
483
WriteByte((byte)
TypeCode
.StringUtf16);
503
WriteByte((byte)
TypeCode
.Null);
511
WriteByte((byte)
TypeCode
.EncodingCodePage);
516
WriteByte((byte)
TypeCode
.EncodingName);
522
static
TypeCode
ToTypeCode(TextEncodingKind kind)
525
return
TypeCode
.FirstWellKnownTextEncoding + (byte)(kind - EncodingExtensions.FirstTextEncodingKind);