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); 28PushDataItem(CborMajorType.Array, null); 37PushDataItem(CborMajorType.Array, arrayLength); 54PopDataItem(expectedType: CborMajorType.Array); 60PopDataItem(expectedType: CborMajorType.Array);
System\Formats\Cbor\Reader\CborReader.cs (10)
16private CborMajorType? _currentMajorType; // major type of the currently written data item. Null iff at the root context 134case CborMajorType.ByteString: 135case CborMajorType.TextString: 152private CborInitialByte PeekInitialByte(CborMajorType expectedType) 174private void PushDataItem(CborMajorType majorType, int? definiteLength) 200private void PopDataItem(CborMajorType expectedType) 224if (_currentMajorType == CborMajorType.Map) 237if (_currentMajorType == CborMajorType.Map) 292CborMajorType? type, 310public 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); 43PushDataItem(CborMajorType.Map, null); 58PushDataItem(CborMajorType.Map, 2 * mapSize); 86PopDataItem(expectedType: CborMajorType.Map); 92PopDataItem(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); 147PushDataItem(CborMajorType.ByteString, definiteLength: null); 158PopDataItem(CborMajorType.ByteString); 174CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 220CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 266CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 301CborInitialByte header = PeekInitialByte(expectedType: CborMajorType.TextString); 314PushDataItem(CborMajorType.TextString, definiteLength: null); 325PopDataItem(CborMajorType.TextString); 332List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.ByteString, out int encodingLength, out int concatenatedBufferSize); 353List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.ByteString, out int encodingLength, out int concatenatedBufferSize); 378List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.TextString, out int encodingLength, out int concatenatedBufferSize); 413List<(int Offset, int Length)> ranges = ReadIndefiniteLengthStringChunkRanges(CborMajorType.TextString, out int encodingLength, out int _); 446private List<(int Offset, int Length)> ReadIndefiniteLengthStringChunkRanges(CborMajorType type, out int encodingLength, out int concatenatedBufferSize) 468static CborInitialByte ReadNextInitialByte(ReadOnlySpan<byte> buffer, CborMajorType expectedType) 483private void SkipString(CborMajorType type) 485Debug.Assert(type == CborMajorType.ByteString || type == CborMajorType.TextString); 494if (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); 53WriteUnsignedInteger(CborMajorType.Array, (ulong)definiteLength); 54PushDataItem(CborMajorType.Array, definiteLength); 65WriteInitialByte(new CborInitialByte(CborMajorType.Array, CborAdditionalInfo.IndefiniteLength)); 66PushDataItem(CborMajorType.Array, definiteLength: null); 70private void PatchIndefiniteLengthCollection(CborMajorType majorType, int count) 72Debug.Assert(majorType == CborMajorType.Array || majorType == CborMajorType.Map);
System\Formats\Cbor\Writer\CborWriter.cs (17)
22private CborMajorType? _currentMajorType; // major type of the current data item context 258private void PushDataItem(CborMajorType newMajorType, int? definiteLength) 288private void PopDataItem(CborMajorType typeToPop) 308throw new InvalidOperationException(SR.Format(SR.Cbor_PopMajorTypeMismatch, (int)CborMajorType.Tag)); 319if (typeToPop == CborMajorType.Map) 345if (_currentMajorType == CborMajorType.Map) 370case CborMajorType.ByteString: 371case CborMajorType.TextString: 388private void CompleteIndefiniteLengthWrite(CborMajorType type) 397case CborMajorType.ByteString: 398case CborMajorType.TextString: 401case CborMajorType.Array: 402PatchIndefiniteLengthCollection(CborMajorType.Array, _itemsWritten); 404case CborMajorType.Map: 406PatchIndefiniteLengthCollection(CborMajorType.Map, _itemsWritten / 2); 424CborMajorType? type, 445public 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); 71WriteUnsignedInteger(CborMajorType.Map, (ulong)definiteLength); 72PushDataItem(CborMajorType.Map, definiteLength: 2 * definiteLength); 84WriteInitialByte(new CborInitialByte(CborMajorType.Map, CborAdditionalInfo.IndefiniteLength)); 85PushDataItem(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)
44WriteUnsignedInteger(CborMajorType.ByteString, (ulong)value.Length); 47if (ConvertIndefiniteLengthEncodings && _currentMajorType == CborMajorType.ByteString) 88WriteInitialByte(new CborInitialByte(CborMajorType.ByteString, CborAdditionalInfo.IndefiniteLength)); 89PushDataItem(CborMajorType.ByteString, definiteLength: null); 96PopDataItem(CborMajorType.ByteString); 141WriteUnsignedInteger(CborMajorType.TextString, (ulong)length); 144if (ConvertIndefiniteLengthEncodings && _currentMajorType == CborMajorType.TextString) 185WriteInitialByte(new CborInitialByte(CborMajorType.TextString, CborAdditionalInfo.IndefiniteLength)); 186PushDataItem(CborMajorType.TextString, definiteLength: null); 193PopDataItem(CborMajorType.TextString); 198private void PatchIndefiniteLengthString(CborMajorType type) 200Debug.Assert(type == CborMajorType.ByteString || type == CborMajorType.TextString);
System\Formats\Cbor\Writer\CborWriter.Tag.cs (1)
27WriteUnsignedInteger(CborMajorType.Tag, (ulong)tag);