132 references to CborMajorType
System.Formats.Cbor (132)
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)
19private CborMajorType? _currentMajorType; // major type of the currently written data item. Null iff at the root context 255case CborMajorType.ByteString: 256case CborMajorType.TextString: 273private CborInitialByte PeekInitialByte(CborMajorType expectedType) 303private void PushDataItem(CborMajorType majorType, int? definiteLength) 331private void PopDataItem(CborMajorType expectedType) 355if (_currentMajorType == CborMajorType.Map) 368if (_currentMajorType == CborMajorType.Map) 434CborMajorType? type, 452public 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); 63PushDataItem(CborMajorType.Map, 2 * mapSize); 91PopDataItem(expectedType: CborMajorType.Map); 97PopDataItem(expectedType: CborMajorType.Map);
System\Formats\Cbor\Reader\CborReader.PeekState.cs (19)
46case CborMajorType.Array: return CborReaderState.EndArray; 47case CborMajorType.Map: return CborReaderState.EndMap; 94case CborMajorType.ByteString: return CborReaderState.EndIndefiniteLengthByteString; 95case CborMajorType.TextString: return CborReaderState.EndIndefiniteLengthTextString; 96case CborMajorType.Array: return CborReaderState.EndArray; 97case CborMajorType.Map when _itemsRead % 2 == 0: return CborReaderState.EndMap; 98case CborMajorType.Map: 116case CborMajorType.ByteString: 117case CborMajorType.TextString: 135case CborMajorType.UnsignedInteger: return CborReaderState.UnsignedInteger; 136case CborMajorType.NegativeInteger: return CborReaderState.NegativeInteger; 137case CborMajorType.ByteString: 142case CborMajorType.TextString: 147case CborMajorType.Array: return CborReaderState.StartArray; 148case CborMajorType.Map: return CborReaderState.StartMap; 149case CborMajorType.Tag: return CborReaderState.Tag; 150case CborMajorType.Simple: return MapSimpleValueDataToReaderState(initialByte.AdditionalInfo); 224case CborMajorType.ByteString: 225case CborMajorType.TextString:
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)
142SkipString(type: CborMajorType.ByteString); 146SkipString(type: CborMajorType.TextString);
System\Formats\Cbor\Reader\CborReader.String.cs (22)
29CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.ByteString); 64CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.ByteString); 110CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.ByteString); 138CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.ByteString); 152PushDataItem(CborMajorType.ByteString, definiteLength: null); 163PopDataItem(CborMajorType.ByteString); 179CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 225CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 275CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 310CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 324PushDataItem(CborMajorType.TextString, definiteLength: null); 335PopDataItem(CborMajorType.TextString); 342List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.ByteString, out int encodingLength, out int concatenatedBufferSize); 363List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.ByteString, out int encodingLength, out int concatenatedBufferSize); 388List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.TextString, out int encodingLength, out int concatenatedBufferSize); 423List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.TextString, out int encodingLength, out int _); 456private List<(int Offset, int Length)> ReadIndefiniteLengthStringChunkRanges(CborMajorType type, out int encodingLength, out int concatenatedBufferSize) 480static CborInitialByte ReadNextInitialByte(ReadOnlySpan<byte> buffer, CborMajorType expectedType) 495private void SkipString(CborMajorType type) 497Debug.Assert(type == CborMajorType.ByteString || type == CborMajorType.TextString); 506if (type == CborMajorType.TextString && _isConformanceModeCheckEnabled &&
System\Formats\Cbor\Reader\CborReader.Tag.cs (1)
300CborInitialByte 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);