Repository navigation
Commit e12e3fe
authored
feat: add StringReference.GetValue/GetRaw (Python parity) (#34)
Closes HIGH convenience gap #4. Python's StringReference exposes
.value (decoded text) and .raw (bytes) (binaryview.py:510/:514); the
C# StringReference is a handle-less Type/Start/Length carrier, so
callers had to separately ReadData(Start, Length) and hand-decode per
StringType.
Add durable GetValue(this StringReference, BinaryView) and
GetRaw(this StringReference, BinaryView) extension methods with a
StringType -> Encoding table mirroring Python's _decodings
(Ascii->ASCII, Utf8->UTF8, Utf16->Unicode/UTF-16LE, Utf32->UTF32LE).
GetValue decodes with .NET's default replacement fallback, the
equivalent of Python errors='replace'. The view is a parameter because
StringReference does not own one (unlike Python); extending its shape
would force a FromNative signature change threaded through the
TakeStructArray pipelines, so composition-only extensions are cleaner.1 parent 6ab8a80 commit e12e3fe
1 file changed
Lines changed: 51 additions & 0 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
635 | 636 | | |
636 | 637 | | |
637 | 638 | | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
638 | 689 | | |
639 | 690 | | |
640 | 691 | | |
| |||
0 commit comments