35 instantiations of Rune
GenerateDocumentationAndConfigFiles (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (2)
167
result.Add(VirtualChar.Create(new
Rune
('"'), new TextSpan(offset + index, 2)));
176
result.Add(VirtualChar.Create(new
Rune
(tokenText[index]), span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
113
: VirtualChar.Create(new
Rune
(ch), span);
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (1)
EmbeddedLanguages\RegularExpressions\CSharpRegexParserTests.cs (1)
379
Assert.True(RegexLexer.IsEscapeCategoryChar(VirtualChar.Create(new
Rune
(ch), new TextSpan(0, 1))));
Microsoft.CodeAnalysis.Features (8)
EmbeddedLanguages\RegularExpressions\RegexHelpers.cs (8)
43
'a' => VirtualChar.Create(new
Rune
('\u0007'), ch.Span), // bell
44
'b' => VirtualChar.Create(new
Rune
('\b'), ch.Span), // backspace
45
'e' => VirtualChar.Create(new
Rune
('\u001B'), ch.Span), // escape
46
'f' => VirtualChar.Create(new
Rune
('\f'), ch.Span), // form feed
47
'n' => VirtualChar.Create(new
Rune
('\n'), ch.Span), // new line
48
'r' => VirtualChar.Create(new
Rune
('\r'), ch.Span), // carriage return
49
't' => VirtualChar.Create(new
Rune
('\t'), ch.Span), // tab
50
'v' => VirtualChar.Create(new
Rune
('\u000B'), ch.Span), // vertical tab
Microsoft.CodeAnalysis.Workspaces (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (2)
167
result.Add(VirtualChar.Create(new
Rune
('"'), new TextSpan(offset + index, 2)));
176
result.Add(VirtualChar.Create(new
Rune
(tokenText[index]), span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
113
: VirtualChar.Create(new
Rune
(ch), span);
System.Private.CoreLib (9)
src\libraries\Common\src\System\Number.Formatting.Common.cs (1)
879
var r = new
Rune
(ch);
src\libraries\System.Private.CoreLib\src\System\Char.cs (1)
193
new
Rune
(this).TryEncodeToUtf8(utf8Destination, out bytesWritten);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (1)
756
var r = new
Rune
(ch);
src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (1)
810
value = new
Rune
(b);
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (1)
691
value = new
Rune
(b);
src\libraries\System.Private.CoreLib\src\System\Text\Rune.cs (4)
146
public static explicit operator Rune(char ch) => new
Rune
(ch);
149
public static explicit operator Rune(uint value) => new
Rune
(value);
151
public static explicit operator Rune(int value) => new
Rune
(value);
1208
internal static Rune UnsafeCreate(uint scalarValue) => new
Rune
(scalarValue, false);
System.Private.Uri (1)
System\IriHelper.cs (1)
177
rune = new
Rune
(ch, ch2);
System.Runtime.Numerics (1)
src\libraries\Common\src\System\Number.Formatting.Common.cs (1)
879
var r = new
Rune
(ch);
System.Text.Encodings.Web (5)
System\Text\Encodings\Web\DefaultHtmlEncoder.cs (1)
54
=> !_innerEncoder.IsScalarValueAllowed(new
Rune
(unicodeScalar));
System\Text\Encodings\Web\DefaultJavaScriptEncoder.cs (1)
66
=> !_innerEncoder.IsScalarValueAllowed(new
Rune
(unicodeScalar));
System\Text\Encodings\Web\DefaultUrlEncoder.cs (1)
129
=> !_innerEncoder.IsScalarValueAllowed(new
Rune
(unicodeScalar));
System\Text\Encodings\Web\OptimizedInboxTextEncoder.Ascii.cs (1)
36
Rune rune = new
Rune
(i); // guaranteed to succeed
System\Text\Encodings\Web\OptimizedInboxTextEncoder.cs (1)
118
int innerCharsWritten = _scalarEscaper.EncodeUtf16(new
Rune
(unicodeScalar), destination);
System.Text.Json (1)
System\Text\Json\Reader\JsonReaderHelper.Unescaping.cs (1)
575
var rune = new
Rune
(scalar);
Test.Utilities (3)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (2)
167
result.Add(VirtualChar.Create(new
Rune
('"'), new TextSpan(offset + index, 2)));
176
result.Add(VirtualChar.Create(new
Rune
(tokenText[index]), span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
113
: VirtualChar.Create(new
Rune
(ch), span);
352 references to Rune
GenerateDocumentationAndConfigFiles (16)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
203
if (
Rune
.TryCreate(ch, out
var
rune))
210
Rune
.TryCreate(ch, info.Get(tokenText, index + 1), out rune))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (13)
32
/// cref="
Rune
.ReplacementChar"/>. The value of this character can be retrieved from
35
public readonly
Rune
Rune;
39
/// cref="Rune"/>. If <see cref="Rune"/> is not <see cref="
Rune
.ReplacementChar"/>, this will be <c>0</c>.
53
public static VirtualChar Create(
Rune
rune, TextSpan span)
59
/// value will be <see cref="
Rune
.ReplacementChar"/>.
66
return new VirtualChar(rune:
Rune
.ReplacementChar, surrogateChar, span);
69
private VirtualChar(
Rune
rune, char surrogateChar, TextSpan span)
71
Contract.ThrowIfFalse(surrogateChar == 0 || rune ==
Rune
.ReplacementChar,
90
=> SurrogateChar != 0 ? char.IsDigit(SurrogateChar) :
Rune
.IsDigit(Rune);
93
=> SurrogateChar != 0 ? char.IsLetter(SurrogateChar) :
Rune
.IsLetter(Rune);
96
=> SurrogateChar != 0 ? char.IsLetterOrDigit(SurrogateChar) :
Rune
.IsLetterOrDigit(Rune);
99
=> SurrogateChar != 0 ? char.IsWhiteSpace(SurrogateChar) :
Rune
.IsWhiteSpace(Rune);
101
/// <inheritdoc cref="
Rune
.Utf16SequenceLength" />
Microsoft.AspNetCore.Components (2)
src\Shared\UrlDecoder\UrlDecoder.cs (2)
524
if (!System.Text.
Rune
.TryCreate(currentDecodeBits, out
var
rune) || !rune.TryEncodeToUtf16(buffer.Slice(destinationIndex), out var charsWritten))
Microsoft.AspNetCore.Http.Abstractions (2)
src\Shared\UrlDecoder\UrlDecoder.cs (2)
524
if (!System.Text.
Rune
.TryCreate(currentDecodeBits, out
var
rune) || !rune.TryEncodeToUtf16(buffer.Slice(destinationIndex), out var charsWritten))
Microsoft.AspNetCore.Server.Kestrel.Core (2)
src\Shared\UrlDecoder\UrlDecoder.cs (2)
524
if (!System.Text.
Rune
.TryCreate(currentDecodeBits, out
var
rune) || !rune.TryEncodeToUtf16(buffer.Slice(destinationIndex), out var charsWritten))
Microsoft.AspNetCore.Shared.Tests (2)
src\Shared\UrlDecoder\UrlDecoder.cs (2)
524
if (!System.Text.
Rune
.TryCreate(currentDecodeBits, out
var
rune) || !rune.TryEncodeToUtf16(buffer.Slice(destinationIndex), out var charsWritten))
Microsoft.AspNetCore.WebUtilities (2)
src\Shared\UrlDecoder\UrlDecoder.cs (2)
524
if (!System.Text.
Rune
.TryCreate(currentDecodeBits, out
var
rune) || !rune.TryEncodeToUtf16(buffer.Slice(destinationIndex), out var charsWritten))
Microsoft.CodeAnalysis.CSharp.Features (6)
ConvertToRawString\ConvertToRawStringHelpers.cs (1)
124
var category =
Rune
.GetUnicodeCategory(ch.Rune);
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (5)
155
if (!TryGetNextRune(arrayCreationElements, i, out
var
rune, out var bytesConsumed) ||
181
static bool IsControlOrFormatRune(
Rune
rune)
182
=>
Rune
.GetUnicodeCategory(rune) is UnicodeCategory.Control or UnicodeCategory.Format
192
private static bool TryGetNextRune(ImmutableArray<IOperation> arrayCreationElements, int startIndex, out
Rune
rune, out int bytesConsumed)
213
return
Rune
.DecodeFromUtf8(array, out rune, out bytesConsumed) == System.Buffers.OperationStatus.Done;
Microsoft.CodeAnalysis.CSharp.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (3)
334
if (
Rune
.TryCreate(ch, out
var
rune))
345
if (
Rune
.TryCreate(ch, nextCh, out rune))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\RuneExtensions.cs (1)
15
public static bool TryGetEscapeCharacter(this
Rune
rune, out char escapedChar)
Microsoft.CodeAnalysis.Workspaces (16)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
203
if (
Rune
.TryCreate(ch, out
var
rune))
210
Rune
.TryCreate(ch, info.Get(tokenText, index + 1), out rune))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (13)
32
/// cref="
Rune
.ReplacementChar"/>. The value of this character can be retrieved from
35
public readonly
Rune
Rune;
39
/// cref="Rune"/>. If <see cref="Rune"/> is not <see cref="
Rune
.ReplacementChar"/>, this will be <c>0</c>.
53
public static VirtualChar Create(
Rune
rune, TextSpan span)
59
/// value will be <see cref="
Rune
.ReplacementChar"/>.
66
return new VirtualChar(rune:
Rune
.ReplacementChar, surrogateChar, span);
69
private VirtualChar(
Rune
rune, char surrogateChar, TextSpan span)
71
Contract.ThrowIfFalse(surrogateChar == 0 || rune ==
Rune
.ReplacementChar,
90
=> SurrogateChar != 0 ? char.IsDigit(SurrogateChar) :
Rune
.IsDigit(Rune);
93
=> SurrogateChar != 0 ? char.IsLetter(SurrogateChar) :
Rune
.IsLetter(Rune);
96
=> SurrogateChar != 0 ? char.IsLetterOrDigit(SurrogateChar) :
Rune
.IsLetterOrDigit(Rune);
99
=> SurrogateChar != 0 ? char.IsWhiteSpace(SurrogateChar) :
Rune
.IsWhiteSpace(Rune);
101
/// <inheritdoc cref="
Rune
.Utf16SequenceLength" />
Microsoft.ML.Tokenizers.Tests (2)
src\Microsoft.ML.Tokenizers\Utils\Helpers.netcoreapp.cs (2)
83
Rune
.DecodeFromUtf16(text.Slice(textIndex), out
Rune
rune, out int charsConsumed);
Microsoft.Net.Http.Headers (3)
ContentDispositionHeaderValue.cs (3)
645
Rune
.DecodeFromUtf16(remaining.Slice(i), out
Rune
rune, out var runeLength);
660
private static void EncodeToUtf8Hex(
Rune
rune, StringBuilder builder)
System.Collections.Immutable (1)
System\Collections\Frozen\Constants.cs (1)
65
typeof(T) == typeof(
Rune
) ||
System.Formats.Tar (1)
System\Formats\Tar\TarHeader.Write.cs (1)
1236
foreach (
Rune
rune in text.EnumerateRunes())
System.IO.Compression (1)
System\IO\Compression\ZipHelper.cs (1)
210
foreach (
Rune
rune in text.EnumerateRunes())
System.Private.CoreLib (224)
src\libraries\Common\src\System\Number.Formatting.Common.cs (1)
879
var
r = new Rune(ch);
src\libraries\System.Private.CoreLib\src\System\Char.cs (5)
237
if (
Rune
.DecodeFromUtf8(utf8Text, out
Rune
rune, out int bytesConsumed) != Buffers.OperationStatus.Done ||
254
if (
Rune
.DecodeFromUtf8(utf8Text, out
Rune
rune, out int bytesConsumed) != Buffers.OperationStatus.Done ||
1075
return
Rune
.UnsafeCreate((uint)utf32).ToString();
src\libraries\System.Private.CoreLib\src\System\Globalization\CharUnicodeInfo.cs (1)
169
internal static GraphemeClusterBreakType GetGraphemeClusterBreakType(
Rune
rune)
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.cs (11)
155
/// Indicates whether a specified <see cref="
Rune
"/> is sortable.
162
public static bool IsSortable(
Rune
value)
164
Span<char> valueAsUtf16 = stackalloc char[
Rune
.MaxUtf16CharsPerRune];
1022
/// Searches for the first occurrence of a <see cref="
Rune
"/> within a source string.
1025
/// <param name="value">The <see cref="
Rune
"/> to locate within <paramref name="source"/>.</param>
1034
public int IndexOf(ReadOnlySpan<char> source,
Rune
value, CompareOptions options = CompareOptions.None)
1036
Span<char> valueAsUtf16 = stackalloc char[
Rune
.MaxUtf16CharsPerRune];
1394
/// Searches for the last occurrence of a <see cref="
Rune
"/> within a source string.
1397
/// <param name="value">The <see cref="
Rune
"/> to locate within <paramref name="source"/>.</param>
1406
public unsafe int LastIndexOf(ReadOnlySpan<char> source,
Rune
value, CompareOptions options = CompareOptions.None)
1408
Span<char> valueAsUtf16 = stackalloc char[
Rune
.MaxUtf16CharsPerRune];
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (3)
828
if (
Rune
.DecodeFromUtf16(text, out
Rune
result, out int charsConsumed) != OperationStatus.Done)
833
UnicodeCategory category =
Rune
.GetUnicodeCategory(result);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (1)
756
var
r = new Rune(ch);
src\libraries\System.Private.CoreLib\src\System\Globalization\HebrewNumber.cs (2)
214
Rune
.DecodeLastFromUtf8(MemoryMarshal.AsBytes(outputBuffer.AsSpan()), out
Rune
value, out int bytesConsumed);
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.Utf8.cs (12)
66
OperationStatus statusA =
Rune
.DecodeFromUtf8(spanA, out
Rune
runeA, out int bytesConsumedA);
67
OperationStatus statusB =
Rune
.DecodeFromUtf8(spanB, out
Rune
runeB, out int bytesConsumedB);
77
if (
Rune
.ToUpperInvariant(runeA) !=
Rune
.ToUpperInvariant(runeB))
376
OperationStatus statusA =
Rune
.DecodeFromUtf8(spanA, out
Rune
runeA, out int bytesConsumedA);
377
OperationStatus statusB =
Rune
.DecodeFromUtf8(spanB, out
Rune
runeB, out int bytesConsumedB);
387
if (
Rune
.ToUpperInvariant(runeA) !=
Rune
.ToUpperInvariant(runeB))
src\libraries\System.Private.CoreLib\src\System\Guid.cs (6)
930
if (
Rune
.DecodeFromUtf8(srcUtf8Span.Slice(i), out
Rune
current, out int bytesConsumed) != Buffers.OperationStatus.Done)
936
if (!
Rune
.IsWhiteSpace(current))
961
if (
Rune
.DecodeFromUtf8(srcUtf8Span.Slice(i), out
Rune
current, out int bytesConsumed) != Buffers.OperationStatus.Done)
967
if (!
Rune
.IsWhiteSpace(current))
src\libraries\System.Private.CoreLib\src\System\IO\BinaryWriter.cs (2)
179
if (!
Rune
.TryCreate(ch, out
Rune
rune)) // optimistically assume UTF-8 code path (which uses Rune) will be hit
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Globalization.cs (4)
365
/// Returns an enumeration of <see cref="
Rune
"/> from the provided span.
368
/// Invalid sequences will be represented in the enumeration by <see cref="
Rune
.ReplacementChar"/>.
376
/// Returns an enumeration of <see cref="
Rune
"/> from the provided span.
379
/// Invalid sequences will be represented in the enumeration by <see cref="
Rune
.ReplacementChar"/>.
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Trim.Utf8.cs (14)
20
Debug.Assert(!
Rune
.IsWhiteSpace(
Rune
.ReplacementChar));
27
_ =
Rune
.DecodeFromUtf8(span, out
Rune
first, out int firstBytesConsumed);
29
if (
Rune
.IsWhiteSpace(first))
35
_ =
Rune
.DecodeLastFromUtf8(span, out
Rune
last, out int lastBytesConsumed);
37
if (
Rune
.IsWhiteSpace(last))
50
_ =
Rune
.DecodeFromUtf8(span, out
Rune
current, out int bytesConsumed);
52
if (!
Rune
.IsWhiteSpace(current))
62
_ =
Rune
.DecodeLastFromUtf8(span, out
Rune
current, out int bytesConsumed);
64
if (!
Rune
.IsWhiteSpace(current))
src\libraries\System.Private.CoreLib\src\System\Net\WebUtility.cs (2)
119
Rune
.TryCreate(ch, input[i + 1], out
Rune
rune))
src\libraries\System.Private.CoreLib\src\System\Reflection\AssemblyName.cs (3)
335
if (
Rune
.DecodeFromUtf16(stringToEscape, out
Rune
r, out int charsConsumed) != OperationStatus.Done)
337
r =
Rune
.ReplacementChar;
src\libraries\System.Private.CoreLib\src\System\String.cs (2)
605
/// Returns an enumeration of <see cref="
Rune
"/> from this string.
608
/// Invalid sequences will be represented in the enumeration by <see cref="
Rune
.ReplacementChar"/>.
src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (5)
764
internal sealed override bool TryGetByteCount(
Rune
value, out int byteCount)
778
internal sealed override OperationStatus EncodeRune(
Rune
value, Span<byte> bytes, out int bytesWritten)
801
internal sealed override OperationStatus DecodeFirstRune(ReadOnlySpan<byte> bytes, out
Rune
value, out int bytesConsumed)
818
value =
Rune
.ReplacementChar;
827
value =
Rune
.ReplacementChar;
src\libraries\System.Private.CoreLib\src\System\Text\DecoderFallback.cs (6)
231
private
Rune
GetNextRune()
239
if (!
Rune
.TryCreate(ch, out
Rune
rune) && !
Rune
.TryCreate(ch, GetNextChar(), out rune))
251
Rune
thisRune;
271
Rune
thisRune;
src\libraries\System.Private.CoreLib\src\System\Text\DecoderNLS.cs (2)
238
switch (_encoding.DecodeFirstRune(combinedBuffer, out
Rune
value, out int combinedBufferBytesConsumed))
296
switch (_encoding.DecodeFirstRune(combinedBuffer, out
Rune
value, out int combinedBufferBytesConsumed))
src\libraries\System.Private.CoreLib\src\System\Text\EncoderFallback.cs (6)
198
Rune
thisRune;
248
Rune
thisRune;
277
private
Rune
GetNextRune()
280
if (
Rune
.TryCreate(firstChar, out
Rune
value) ||
Rune
.TryCreate(firstChar, GetNextChar(), out value))
src\libraries\System.Private.CoreLib\src\System\Text\EncoderNLS.cs (4)
280
if (
Rune
.TryCreate(_charLeftOver, secondChar, out
Rune
rune))
355
if (
Rune
.TryCreate(charLeftOver, secondChar, out
Rune
rune))
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.Internal.cs (10)
73
internal virtual OperationStatus DecodeFirstRune(ReadOnlySpan<byte> bytes, out
Rune
value, out int bytesConsumed)
79
internal virtual OperationStatus EncodeRune(
Rune
value, Span<byte> bytes, out int bytesWritten)
95
/// Given a <see cref="
Rune
"/>, determines its byte count under the current <see cref="Encoding"/>.
96
/// Returns <see langword="false"/> if the <see cref="
Rune
"/> cannot be represented in the
99
internal virtual bool TryGetByteCount(
Rune
value, out int byteCount)
328
if (
Rune
.DecodeFromUtf16(chars, out
Rune
firstScalarValue, out int charsConsumedThisIteration) == OperationStatus.NeedMoreData
605
switch (
Rune
.DecodeFromUtf16(chars, out
Rune
firstScalarValue, out int charsConsumedThisIteration))
927
if (DecodeFirstRune(bytes, out
Rune
firstScalarValue, out int bytesConsumedThisIteration) == OperationStatus.NeedMoreData
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (4)
642
internal sealed override bool TryGetByteCount(
Rune
value, out int byteCount)
659
internal sealed override OperationStatus EncodeRune(
Rune
value, Span<byte> bytes, out int bytesWritten)
685
internal sealed override OperationStatus DecodeFirstRune(ReadOnlySpan<byte> bytes, out
Rune
value, out int bytesConsumed)
698
value =
Rune
.ReplacementChar;
src\libraries\System.Private.CoreLib\src\System\Text\Rune.cs (94)
22
/// assuming that the underlying <see cref="
Rune
"/> instance is well-formed.
30
readonly struct Rune : IComparable, IComparable<
Rune
>, IEquatable<
Rune
>
35
, IUtf8SpanParsable<
Rune
>
70
/// Creates a <see cref="
Rune
"/> from the provided UTF-16 code unit.
87
/// Creates a <see cref="
Rune
"/> from the provided UTF-16 surrogate pair.
99
/// Creates a <see cref="
Rune
"/> from the provided Unicode scalar value.
110
/// Creates a <see cref="
Rune
"/> from the provided Unicode scalar value.
132
public static bool operator ==(
Rune
left,
Rune
right) => left._value == right._value;
134
public static bool operator !=(
Rune
left,
Rune
right) => left._value != right._value;
136
public static bool operator <(
Rune
left,
Rune
right) => left._value < right._value;
138
public static bool operator <=(
Rune
left,
Rune
right) => left._value <= right._value;
140
public static bool operator >(
Rune
left,
Rune
right) => left._value > right._value;
142
public static bool operator >=(
Rune
left,
Rune
right) => left._value >= right._value;
146
public static explicit operator
Rune
(char ch) => new Rune(ch);
149
public static explicit operator
Rune
(uint value) => new Rune(value);
151
public static explicit operator
Rune
(int value) => new Rune(value);
181
/// A <see cref="
Rune
"/> instance that represents the Unicode replacement character U+FFFD.
183
public static
Rune
ReplacementChar => UnsafeCreate(UnicodeUtility.ReplacementChar);
225
private static
Rune
ChangeCaseCultureAware(
Rune
rune, TextInfo textInfo, bool toUpper)
295
public int CompareTo(
Rune
other) => this.Value - other.Value; // values don't span entire 32-bit domain; won't integer overflow
298
/// Decodes the <see cref="
Rune
"/> at the beginning of the provided UTF-16 source buffer.
303
/// and outs via <paramref name="result"/> the decoded <see cref="
Rune
"/> and via <paramref name="charsConsumed"/> the
304
/// number of <see langword="char"/>s used in the input buffer to encode the <see cref="
Rune
"/>.
323
public static OperationStatus DecodeFromUtf16(ReadOnlySpan<char> source, out
Rune
result, out int charsConsumed)
382
/// Decodes the <see cref="
Rune
"/> at the beginning of the provided UTF-8 source buffer.
387
/// and outs via <paramref name="result"/> the decoded <see cref="
Rune
"/> and via <paramref name="bytesConsumed"/> the
388
/// number of <see langword="byte"/>s used in the input buffer to encode the <see cref="
Rune
"/>.
407
public static OperationStatus DecodeFromUtf8(ReadOnlySpan<byte> source, out
Rune
result, out int bytesConsumed)
567
/// Decodes the <see cref="
Rune
"/> at the end of the provided UTF-16 source buffer.
570
/// This method is very similar to <see cref="DecodeFromUtf16(ReadOnlySpan{char}, out
Rune
, out int)"/>, but it allows
575
public static OperationStatus DecodeLastFromUtf16(ReadOnlySpan<char> source, out
Rune
result, out int charsConsumed)
627
/// Decodes the <see cref="
Rune
"/> at the end of the provided UTF-8 source buffer.
630
/// This method is very similar to <see cref="DecodeFromUtf8(ReadOnlySpan{byte}, out
Rune
, out int)"/>, but it allows
635
public static OperationStatus DecodeLastFromUtf8(ReadOnlySpan<byte> source, out
Rune
value, out int bytesConsumed)
712
OperationStatus operationStatus = DecodeFromUtf8(source, out
Rune
tempRune, out int tempBytesConsumed);
744
/// Encodes this <see cref="
Rune
"/> to a UTF-16 destination buffer.
762
/// Encodes this <see cref="
Rune
"/> to a UTF-8 destination buffer.
779
public override bool Equals([NotNullWhen(true)] object? obj) => (obj is
Rune
other) && Equals(other);
781
public bool Equals(
Rune
other) => this == other;
787
/// Gets the <see cref="
Rune
"/> which begins at index <paramref name="index"/> in
794
public static
Rune
GetRuneAt(string input, int index)
907
/// Returns a <see cref="string"/> representation of this <see cref="
Rune
"/> instance.
943
static bool IUtf8SpanParsable<
Rune
>.TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out
Rune
result)
959
static
Rune
IUtf8SpanParsable<
Rune
>.Parse(ReadOnlySpan<byte> utf8Text, System.IFormatProvider? provider)
961
if (DecodeFromUtf8(utf8Text, out
Rune
result, out int bytesConsumed) != OperationStatus.Done || bytesConsumed != utf8Text.Length)
973
/// Attempts to create a <see cref="
Rune
"/> from the provided input value.
975
public static bool TryCreate(char ch, out
Rune
result)
991
/// Attempts to create a <see cref="
Rune
"/> from the provided UTF-16 surrogate pair.
994
public static bool TryCreate(char highSurrogate, char lowSurrogate, out
Rune
result)
1021
/// Attempts to create a <see cref="
Rune
"/> from the provided input value.
1023
public static bool TryCreate(int value, out
Rune
result) => TryCreate((uint)value, out result);
1026
/// Attempts to create a <see cref="
Rune
"/> from the provided input value.
1029
public static bool TryCreate(uint value, out
Rune
result)
1044
/// Encodes this <see cref="
Rune
"/> to a UTF-16 destination buffer.
1063
private static bool TryEncodeToUtf16(
Rune
value, Span<char> destination, out int charsWritten)
1088
/// Encodes this <see cref="
Rune
"/> to a destination buffer as UTF-8 bytes.
1107
private static bool TryEncodeToUtf8(
Rune
value, Span<byte> destination, out int bytesWritten)
1165
/// Attempts to get the <see cref="
Rune
"/> which begins at index <paramref name="index"/> in
1173
public static bool TryGetRuneAt(string input, int index, out
Rune
value)
1205
/// Creates a <see cref="
Rune
"/> without performing validation on the input.
1208
internal static
Rune
UnsafeCreate(uint scalarValue) => new Rune(scalarValue, false);
1212
public static double GetNumericValue(
Rune
value)
1234
public static UnicodeCategory GetUnicodeCategory(
Rune
value)
1246
private static UnicodeCategory GetUnicodeCategoryNonAscii(
Rune
value)
1297
public static bool IsControl(
Rune
value)
1311
public static bool IsDigit(
Rune
value)
1323
public static bool IsLetter(
Rune
value)
1335
public static bool IsLetterOrDigit(
Rune
value)
1347
public static bool IsLower(
Rune
value)
1359
public static bool IsNumber(
Rune
value)
1371
public static bool IsPunctuation(
Rune
value)
1376
public static bool IsSeparator(
Rune
value)
1381
public static bool IsSymbol(
Rune
value)
1386
public static bool IsUpper(
Rune
value)
1398
public static bool IsWhiteSpace(
Rune
value)
1416
public static
Rune
ToLower(
Rune
value, CultureInfo culture)
1439
public static
Rune
ToLowerInvariant(
Rune
value)
1465
public static
Rune
ToUpper(
Rune
value, CultureInfo culture)
1488
public static
Rune
ToUpperInvariant(
Rune
value)
1522
if (obj is
Rune
other)
src\libraries\System.Private.CoreLib\src\System\Text\SpanRuneEnumerator.cs (6)
12
public ref struct SpanRuneEnumerator : IEnumerator<
Rune
>
15
private
Rune
_current;
23
public
Rune
Current => _current;
36
int scalarValue =
Rune
.ReadFirstRuneFromUtf16Buffer(_remaining);
40
scalarValue =
Rune
.ReplacementChar.Value;
49
_current =
Rune
.UnsafeCreate((uint)scalarValue);
src\libraries\System.Private.CoreLib\src\System\Text\StringRuneEnumerator.cs (8)
10
public struct StringRuneEnumerator : IEnumerable<
Rune
>, IEnumerator<
Rune
>
13
private
Rune
_current;
23
public
Rune
Current => _current;
36
if (!
Rune
.TryGetRuneAt(_string, _nextIndex, out _current))
39
_current =
Rune
.ReplacementChar;
61
IEnumerator<
Rune
> IEnumerable<
Rune
>.GetEnumerator() => this;
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\TextSegmentationUtility.cs (3)
19
private delegate OperationStatus DecodeFirstRune<T>(ReadOnlySpan<T> input, out
Rune
rune, out int elementsConsumed);
21
private static readonly DecodeFirstRune<char> _utf16Decoder =
Rune
.DecodeFromUtf16;
229
_decoder(_buffer.Slice(CurrentCodeUnitOffset), out
Rune
thisRune, out _codeUnitLengthOfCurrentScalar);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (2)
201
Rune
.DecodeFromUtf8(source, out _, out int bytesConsumedJustNow);
287
Rune
.DecodeFromUtf8(source, out _, out int bytesConsumedJustNow);
src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.cs (4)
769
internal sealed override bool TryGetByteCount(
Rune
value, out int byteCount)
777
internal sealed override OperationStatus EncodeRune(
Rune
value, Span<byte> bytes, out int bytesWritten)
785
internal sealed override OperationStatus DecodeFirstRune(ReadOnlySpan<byte> bytes, out
Rune
value, out int bytesConsumed)
787
return
Rune
.DecodeFromUtf8(bytes, out value, out bytesConsumed);
src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.Sealed.cs (1)
14
/// perform <see cref="
Rune
.ReplacementChar"/> substitution instead" semantics. This type allows for devirtualization
System.Private.Uri (12)
System\IriHelper.cs (5)
34
if (
Rune
.TryCreate(highSurr, lowSurr, out
Rune
rune))
174
Rune
rune;
179
else if (!
Rune
.TryCreate(ch, out rune))
181
rune =
Rune
.ReplacementChar;
System\PercentEncodingHelper.cs (2)
88
if (
Rune
.DecodeFromUtf8(new ReadOnlySpan<byte>(&temp, bytesLeftInBuffer), out
Rune
rune, out bytesConsumed) == OperationStatus.Done)
System\UriHelper.cs (3)
266
if (
Rune
.DecodeFromUtf16(stringToEscape, out
Rune
r, out int charsConsumed) != OperationStatus.Done)
268
r =
Rune
.ReplacementChar;
System\ValueStringBuilderExtensions.cs (2)
11
public void Append(
Rune
rune)
36
private void GrowAndAppend(
Rune
rune)
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
803
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Text.
Rune
))]
System.Runtime.Numerics (1)
src\libraries\Common\src\System\Number.Formatting.Common.cs (1)
879
var
r = new Rune(ch);
System.Text.Encodings.Web (33)
System\Text\Encodings\Web\AsciiByteMap.cs (1)
34
internal readonly bool TryLookup(
Rune
key, out byte value)
System\Text\Encodings\Web\DefaultHtmlEncoder.cs (2)
67
internal override int EncodeUtf8(
Rune
value, Span<byte> destination)
133
internal override int EncodeUtf16(
Rune
value, Span<char> destination)
System\Text\Encodings\Web\DefaultJavaScriptEncoder.cs (4)
113
internal override int EncodeUtf8(
Rune
value, Span<byte> destination)
129
static int TryEncodeScalarAsHex(object @this,
Rune
value, Span<byte> destination)
164
internal override int EncodeUtf16(
Rune
value, Span<char> destination)
180
static int TryEncodeScalarAsHex(object @this,
Rune
value, Span<char> destination)
System\Text\Encodings\Web\DefaultUrlEncoder.cs (2)
142
internal override int EncodeUtf8(
Rune
value, Span<byte> destination)
171
internal override int EncodeUtf16(
Rune
value, Span<char> destination)
System\Text\Encodings\Web\OptimizedInboxTextEncoder.Ascii.cs (2)
36
Rune
rune = new Rune(i); // guaranteed to succeed
37
if (!
Rune
.IsControl(rune) && allowedCodePointsBmp.IsCharAllowed((char)i))
System\Text\Encodings\Web\OptimizedInboxTextEncoder.cs (10)
187
if (!
Rune
.TryCreate(thisChar, out
Rune
scalarValue))
192
if (
Rune
.TryCreate(thisChar, source[srcIdxTemp], out scalarValue))
202
scalarValue =
Rune
.ReplacementChar; // fallback char
304
OperationStatus runeDecodeStatus =
Rune
.DecodeFromUtf8(source.Slice(srcIdx), out
Rune
scalarValue, out int bytesConsumedJustNow);
312
Debug.Assert(scalarValue ==
Rune
.ReplacementChar); // DecodeFromUtfXX should've set replacement character on failure
383
OperationStatus opStatus =
Rune
.DecodeFromUtf8(data, out
Rune
scalarValue, out int bytesConsumed);
468
public bool IsScalarValueAllowed(
Rune
value)
System\Text\Encodings\Web\ScalarEscaperBase.cs (2)
11
internal abstract int EncodeUtf16(
Rune
value, Span<char> destination);
12
internal abstract int EncodeUtf8(
Rune
value, Span<byte> destination);
System\Text\Encodings\Web\TextEncoder.cs (10)
67
if (
Rune
.DecodeFromUtf16(utf16ScratchBuffer, out
Rune
nextScalarValue, out int scalarUtf16CodeUnitCount) != OperationStatus.Done)
337
OperationStatus opStatus =
Rune
.DecodeFromUtf8(utf8Source, out
Rune
scalarValue, out int bytesConsumedJustNow);
345
Debug.Assert(scalarValue ==
Rune
.ReplacementChar); // DecodeFromUtf8 should've performed substitution
459
OperationStatus status =
Rune
.DecodeFromUtf16(source, out
Rune
scalarValue, out int charsConsumedJustNow);
467
Debug.Assert(scalarValue ==
Rune
.ReplacementChar); // should be replacement char
565
OperationStatus opStatus =
Rune
.DecodeFromUtf8(utf8Text, out
Rune
scalarValue, out int bytesConsumed);
System.Text.Json (3)
System\Text\Json\Reader\JsonReaderHelper.Unescaping.cs (1)
575
var
rune = new Rune(scalar);
System\Text\Json\Writer\Utf8JsonWriter.WriteValues.StringSegment.cs (2)
74
switch (
Rune
.DecodeFromUtf16(combinedBuffer, out _, out int charsConsumed))
242
switch (
Rune
.DecodeFromUtf8(combinedBuffer, out _, out int bytesConsumed))
System.Web.HttpUtility (2)
System\Web\Util\HttpEncoder.cs (2)
691
chars[i] = (char)
Rune
.ReplacementChar.Value;
701
chars[i] = (char)
Rune
.ReplacementChar.Value;
Test.Utilities (16)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
203
if (
Rune
.TryCreate(ch, out
var
rune))
210
Rune
.TryCreate(ch, info.Get(tokenText, index + 1), out rune))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (13)
32
/// cref="
Rune
.ReplacementChar"/>. The value of this character can be retrieved from
35
public readonly
Rune
Rune;
39
/// cref="Rune"/>. If <see cref="Rune"/> is not <see cref="
Rune
.ReplacementChar"/>, this will be <c>0</c>.
53
public static VirtualChar Create(
Rune
rune, TextSpan span)
59
/// value will be <see cref="
Rune
.ReplacementChar"/>.
66
return new VirtualChar(rune:
Rune
.ReplacementChar, surrogateChar, span);
69
private VirtualChar(
Rune
rune, char surrogateChar, TextSpan span)
71
Contract.ThrowIfFalse(surrogateChar == 0 || rune ==
Rune
.ReplacementChar,
90
=> SurrogateChar != 0 ? char.IsDigit(SurrogateChar) :
Rune
.IsDigit(Rune);
93
=> SurrogateChar != 0 ? char.IsLetter(SurrogateChar) :
Rune
.IsLetter(Rune);
96
=> SurrogateChar != 0 ? char.IsLetterOrDigit(SurrogateChar) :
Rune
.IsLetterOrDigit(Rune);
99
=> SurrogateChar != 0 ? char.IsWhiteSpace(SurrogateChar) :
Rune
.IsWhiteSpace(Rune);
101
/// <inheritdoc cref="
Rune
.Utf16SequenceLength" />