| 777 | } |
| 778 | |
| 779 | bool sugoi_storage_t::match_group(const sugoi_filter_t& filter, const sugoi_meta_filter_t& meta, const sugoi_group_t* group) |
| 780 | { |
| 781 | using namespace sugoi; |
| 782 | fixed_stack_scope_t _(localStack); |
| 783 | bool filterShared = (filter.all_shared.length + filter.none_shared.length) != 0; |
| 784 | sugoi_meta_filter_t* validatedMeta = nullptr; |
| 785 | if (meta.all_meta.length > 0 || meta.any_meta.length > 0 || meta.none_meta.length > 0) |
| 786 | { |
| 787 | validatedMeta = localStack.allocate<sugoi_meta_filter_t>(); |
| 788 | auto data = (char*)localStack.allocate(data_size(meta)); |
| 789 | *validatedMeta = sugoi::clone(meta, data); |
| 790 | validate(validatedMeta->all_meta); |
| 791 | validate(validatedMeta->any_meta); |
| 792 | validate(validatedMeta->none_meta); |
| 793 | } |
| 794 | else |
| 795 | { |
| 796 | validatedMeta = (sugoi_meta_filter_t*)&meta; |
| 797 | } |
| 798 | bool filterMeta = (validatedMeta->all_meta.length + validatedMeta->any_meta.length + validatedMeta->none_meta.length) != 0; |
| 799 | if (filterShared) |
| 800 | { |
| 801 | fixed_stack_scope_t _(localStack); |
| 802 | sugoi_type_set_t shared; |
| 803 | shared.length = 0; |
| 804 | // todo: is 256 enough? |
| 805 | shared.data = localStack.allocate<sugoi_type_index_t>(256); |
| 806 | group->get_shared_type(shared, localStack.allocate<sugoi_type_index_t>(256)); |
| 807 | // check(shared.length < 256); |
| 808 | if (!match_group_shared(shared, filter)) |
| 809 | return false; |
| 810 | } |
| 811 | if (filterMeta) |
| 812 | { |
| 813 | if (!match_group_meta(group->type, *validatedMeta)) |
| 814 | return false; |
| 815 | } |
| 816 | return match_group_type(group->type, filter, group->archetype->withMask); |
| 817 | } |
| 818 | |
| 819 | void sugoi_storage_t::query(const sugoi_group_t* group, const sugoi_filter_t& filter, const sugoi_meta_filter_t& meta, sugoi_custom_filter_callback_t customFilter, void* u1, sugoi_view_callback_t callback, void* u) |
| 820 | { |
no test coverage detected