130 references to CborMajorType
System.Formats.Cbor (130)
System\Formats\Cbor\CborInitialByte.cs (3)
45public CborInitialByte(CborMajorType majorType, CborAdditionalInfo additionalInfo) 58public CborMajorType MajorType => (CborMajorType)(InitialByte >> 5);
System\Formats\Cbor\Reader\CborReader.Array.cs (5)
18CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.Array); 29PushDataItem(CborMajorType.Array, null); 38PushDataItem(CborMajorType.Array, arrayLength); 55PopDataItem(expectedType: CborMajorType.Array); 61PopDataItem(expectedType: CborMajorType.Array);
System\Formats\Cbor\Reader\CborReader.cs (10)
18private CborMajorType? _currentMajorType; // major type of the currently written data item. Null iff at the root context 166case CborMajorType.ByteString: 167case CborMajorType.TextString: 184private CborInitialByte PeekInitialByte(CborMajorType expectedType) 214private void PushDataItem(CborMajorType majorType, int? definiteLength) 242private void PopDataItem(CborMajorType expectedType) 266if (_currentMajorType == CborMajorType.Map) 279if (_currentMajorType == CborMajorType.Map) 334CborMajorType? type, 352public CborMajorType? MajorType { get; }
System\Formats\Cbor\Reader\CborReader.Integer.cs (5)
97CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.NegativeInteger); 110case CborMajorType.UnsignedInteger: 114case CborMajorType.NegativeInteger: 129case CborMajorType.UnsignedInteger: 133case CborMajorType.NegativeInteger:
System\Formats\Cbor\Reader\CborReader.Map.cs (5)
33CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.Map); 44PushDataItem(CborMajorType.Map, null); 59PushDataItem(CborMajorType.Map, 2 * mapSize); 87PopDataItem(expectedType: CborMajorType.Map); 93PopDataItem(expectedType: CborMajorType.Map);
System\Formats\Cbor\Reader\CborReader.PeekState.cs (17)
35case CborMajorType.Array: return CborReaderState.EndArray; 36case CborMajorType.Map: return CborReaderState.EndMap; 77case CborMajorType.ByteString: return CborReaderState.EndIndefiniteLengthByteString; 78case CborMajorType.TextString: return CborReaderState.EndIndefiniteLengthTextString; 79case CborMajorType.Array: return CborReaderState.EndArray; 80case CborMajorType.Map when _itemsRead % 2 == 0: return CborReaderState.EndMap; 81case CborMajorType.Map: 99case CborMajorType.ByteString: 100case CborMajorType.TextString: 112case CborMajorType.UnsignedInteger: return CborReaderState.UnsignedInteger; 113case CborMajorType.NegativeInteger: return CborReaderState.NegativeInteger; 114case CborMajorType.ByteString: 119case CborMajorType.TextString: 124case CborMajorType.Array: return CborReaderState.StartArray; 125case CborMajorType.Map: return CborReaderState.StartMap; 126case CborMajorType.Tag: return CborReaderState.Tag; 127case CborMajorType.Simple: return MapSimpleValueDataToReaderState(initialByte.AdditionalInfo);
System\Formats\Cbor\Reader\CborReader.Simple.cs (5)
24CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.Simple); 65CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.Simple); 109CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.Simple); 134CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.Simple); 159CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.Simple);
System\Formats\Cbor\Reader\CborReader.Simple.netcoreapp.cs (1)
24CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.Simple);
System\Formats\Cbor\Reader\CborReader.SkipValue.cs (2)
86SkipString(type: CborMajorType.ByteString); 90SkipString(type: CborMajorType.TextString);
System\Formats\Cbor\Reader\CborReader.String.cs (22)
29CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.ByteString); 64CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.ByteString); 106CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.ByteString); 134CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.ByteString); 148PushDataItem(CborMajorType.ByteString, definiteLength: null); 159PopDataItem(CborMajorType.ByteString); 175CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 221CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 267CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 302CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 316PushDataItem(CborMajorType.TextString, definiteLength: null); 327PopDataItem(CborMajorType.TextString); 334List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.ByteString, out int encodingLength, out int concatenatedBufferSize); 355List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.ByteString, out int encodingLength, out int concatenatedBufferSize); 380List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.TextString, out int encodingLength, out int concatenatedBufferSize); 415List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.TextString, out int encodingLength, out int _); 448private List<(int Offset, int Length)> ReadIndefiniteLengthStringChunkRanges(CborMajorType type, out int encodingLength, out int concatenatedBufferSize) 472static CborInitialByte ReadNextInitialByte(ReadOnlySpan<byte> buffer, CborMajorType expectedType) 487private void SkipString(CborMajorType type) 489Debug.Assert(type == CborMajorType.ByteString || type == CborMajorType.TextString); 498if (type == CborMajorType.TextString && _isConformanceModeCheckEnabled &&
System\Formats\Cbor\Reader\CborReader.Tag.cs (1)
284CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.Tag);
System\Formats\Cbor\Writer\CborWriter.Array.cs (8)
42PopDataItem(CborMajorType.Array); 54WriteUnsignedInteger(CborMajorType.Array, (ulong)definiteLength); 55PushDataItem(CborMajorType.Array, definiteLength); 67WriteInitialByte(new CborInitialByte(CborMajorType.Array, CborAdditionalInfo.IndefiniteLength)); 68PushDataItem(CborMajorType.Array, definiteLength: null); 72private void PatchIndefiniteLengthCollection(CborMajorType majorType, int count) 74Debug.Assert(majorType == CborMajorType.Array || majorType == CborMajorType.Map);
System\Formats\Cbor\Writer\CborWriter.cs (17)
23private CborMajorType? _currentMajorType; // major type of the current data item context 308private void PushDataItem(CborMajorType newMajorType, int? definiteLength) 340private void PopDataItem(CborMajorType typeToPop) 360throw new InvalidOperationException(SR.Format(SR.Cbor_PopMajorTypeMismatch, (int)CborMajorType.Tag)); 371if (typeToPop == CborMajorType.Map) 397if (_currentMajorType == CborMajorType.Map) 422case CborMajorType.ByteString: 423case CborMajorType.TextString: 440private void CompleteIndefiniteLengthWrite(CborMajorType type) 449case CborMajorType.ByteString: 450case CborMajorType.TextString: 453case CborMajorType.Array: 454PatchIndefiniteLengthCollection(CborMajorType.Array, _itemsWritten); 456case CborMajorType.Map: 458PatchIndefiniteLengthCollection(CborMajorType.Map, _itemsWritten / 2); 476CborMajorType? type, 497public CborMajorType? MajorType { get; }
System\Formats\Cbor\Writer\CborWriter.Integer.cs (5)
33WriteUnsignedInteger(CborMajorType.NegativeInteger, unsignedRepresentation); 37WriteUnsignedInteger(CborMajorType.UnsignedInteger, (ulong)value); 63WriteUnsignedInteger(CborMajorType.UnsignedInteger, value); 81WriteUnsignedInteger(CborMajorType.NegativeInteger, value); 85private void WriteUnsignedInteger(CborMajorType type, ulong value)
System\Formats\Cbor\Writer\CborWriter.Map.cs (5)
60PopDataItem(CborMajorType.Map); 72WriteUnsignedInteger(CborMajorType.Map, (ulong)definiteLength); 73PushDataItem(CborMajorType.Map, definiteLength: 2 * definiteLength); 86WriteInitialByte(new CborInitialByte(CborMajorType.Map, CborAdditionalInfo.IndefiniteLength)); 87PushDataItem(CborMajorType.Map, definiteLength: null);
System\Formats\Cbor\Writer\CborWriter.Simple.cs (4)
65WriteInitialByte(new CborInitialByte(CborMajorType.Simple, CborAdditionalInfo.Additional32BitData)); 74WriteInitialByte(new CborInitialByte(CborMajorType.Simple, CborAdditionalInfo.Additional64BitData)); 116WriteInitialByte(new CborInitialByte(CborMajorType.Simple, (CborAdditionalInfo)value)); 126WriteInitialByte(new CborInitialByte(CborMajorType.Simple, CborAdditionalInfo.Additional8BitData));
System\Formats\Cbor\Writer\CborWriter.Simple.netcoreapp.cs (1)
23WriteInitialByte(new CborInitialByte(CborMajorType.Simple, CborAdditionalInfo.Additional16BitData));
System\Formats\Cbor\Writer\CborWriter.String.cs (13)
41WriteUnsignedInteger(CborMajorType.ByteString, (ulong)value.Length); 44if (ConvertIndefiniteLengthEncodings && _currentMajorType == CborMajorType.ByteString) 87WriteInitialByte(new CborInitialByte(CborMajorType.ByteString, CborAdditionalInfo.IndefiniteLength)); 88PushDataItem(CborMajorType.ByteString, definiteLength: null); 95PopDataItem(CborMajorType.ByteString); 137WriteUnsignedInteger(CborMajorType.TextString, (ulong)length); 140if (ConvertIndefiniteLengthEncodings && _currentMajorType == CborMajorType.TextString) 183WriteInitialByte(new CborInitialByte(CborMajorType.TextString, CborAdditionalInfo.IndefiniteLength)); 184PushDataItem(CborMajorType.TextString, definiteLength: null); 191PopDataItem(CborMajorType.TextString); 196private void PatchIndefiniteLengthString(CborMajorType type) 198Debug.Assert(type == CborMajorType.ByteString || type == CborMajorType.TextString);
System\Formats\Cbor\Writer\CborWriter.Tag.cs (1)
27WriteUnsignedInteger(CborMajorType.Tag, (ulong)tag);