| 713 | } |
| 714 | |
| 715 | void ObjectModel::ReportArrayLengthAsJson(OutputBuffer *buf, ObjectExplorationContext& context, const ExpressionValue& val) const noexcept |
| 716 | { |
| 717 | switch (val.GetType()) |
| 718 | { |
| 719 | case TypeCode::ObjectModelArray: |
| 720 | { |
| 721 | const ObjectModelArrayTableEntry *const entry = _ecv_not_null(val.omVal->GetObjectModelArrayEntry(val.param & 0xFF)); |
| 722 | buf->catf("%u", entry->GetNumElements(this, context)); |
| 723 | } |
| 724 | break; |
| 725 | |
| 726 | case TypeCode::HeapArray: |
| 727 | { |
| 728 | ReadLocker lock(Heap::heapLock); // must have a read lock on heapLock when calling GetNumElements or GetElement |
| 729 | buf->catf("%u", val.ahVal.GetNumElements()); |
| 730 | } |
| 731 | break; |
| 732 | |
| 733 | case TypeCode::Bitmap16: |
| 734 | case TypeCode::Bitmap32: |
| 735 | buf->catf("%u", Bitmap<uint32_t>::MakeFromRaw(val.uVal).CountSetBits()); |
| 736 | break; |
| 737 | |
| 738 | #if SUPPORT_BITMAP64 |
| 739 | case TypeCode::Bitmap64: |
| 740 | buf->catf("%u", Bitmap<uint64_t>::MakeFromRaw(val.Get56BitValue()).CountSetBits()); |
| 741 | break; |
| 742 | #endif |
| 743 | |
| 744 | case TypeCode::CString: |
| 745 | buf->catf("%u", strlen(val.sVal)); |
| 746 | break; |
| 747 | |
| 748 | case TypeCode::HeapString: |
| 749 | buf->catf("%u", val.shVal.GetLength()); |
| 750 | break; |
| 751 | |
| 752 | default: |
| 753 | buf->cat("null"); |
| 754 | break; |
| 755 | } |
| 756 | } |
| 757 | |
| 758 | // Function to report a value or object as JSON |
| 759 | // This function is recursive, so keep its stack usage low. |
nothing calls this directly
no test coverage detected