| 893 | template <typename Container, typename StructT, size_t Index, int8_t NodeIndex, |
| 894 | int8_t ElemNode> |
| 895 | Container read_configured_list_data(ReadContext &ctx) { |
| 896 | using Elem = element_type_t<Container>; |
| 897 | uint32_t length = ctx.read_var_uint32(ctx.error()); |
| 898 | Container result; |
| 899 | if (length == 0) { |
| 900 | return result; |
| 901 | } |
| 902 | if (FORY_PREDICT_FALSE(!reserve_collection(result, ctx, length))) { |
| 903 | return result; |
| 904 | } |
| 905 | uint8_t bitmap = ctx.read_uint8(ctx.error()); |
| 906 | if (FORY_PREDICT_FALSE(ctx.has_error())) { |
| 907 | return result; |
| 908 | } |
| 909 | const bool is_decl_type = (bitmap & COLL_DECL_ELEMENT_TYPE) != 0; |
| 910 | const bool is_same_type = (bitmap & COLL_IS_SAME_TYPE) != 0; |
| 911 | const bool track_ref = (bitmap & COLL_TRACKING_REF) != 0; |
| 912 | const bool has_null = (bitmap & COLL_HAS_NULL) != 0; |
| 913 | if (is_same_type && !is_decl_type) { |
| 914 | (void)ctx.read_any_type_info(ctx.error()); |
| 915 | if (FORY_PREDICT_FALSE(ctx.has_error())) { |
| 916 | return result; |
| 917 | } |
| 918 | } |
| 919 | const RefMode elem_ref_mode = |
| 920 | track_ref ? RefMode::Tracking |
| 921 | : (has_null ? RefMode::NullOnly : RefMode::None); |
| 922 | for (uint32_t i = 0; i < length; ++i) { |
| 923 | if constexpr (ElemNode >= 0) { |
| 924 | auto elem = read_configured_value<Elem, StructT, Index, ElemNode>( |
| 925 | ctx, elem_ref_mode, false); |
| 926 | collection_insert(result, std::move(elem)); |
| 927 | } else { |
| 928 | auto elem = Serializer<Elem>::read(ctx, elem_ref_mode, false); |
| 929 | collection_insert(result, std::move(elem)); |
| 930 | } |
| 931 | } |
| 932 | return result; |
| 933 | } |
| 934 | |
| 935 | template <typename Container, typename StructT, size_t Index, int8_t NodeIndex, |
| 936 | int8_t ElemNode> |
nothing calls this directly
no test coverage detected