* @brief Returns true if any of the types in 't' are contained in the array or its nested array children, if any * @param siarray: array * @param t: bitmap of types to search for * @retval a boolean indicating whether any types were matched */
| 43 | * @retval a boolean indicating whether any types were matched |
| 44 | */ |
| 45 | bool SIArray_ContainsType(SIValue siarray, SIType t) { |
| 46 | uint array_len = SIArray_Length(siarray); |
| 47 | for(uint i = 0; i < array_len; i++) { |
| 48 | SIValue elem = siarray.array[i]; |
| 49 | if(SI_TYPE(elem) & t) return true; |
| 50 | |
| 51 | // recursively check nested arrays |
| 52 | if(SI_TYPE(elem) == T_ARRAY) { |
| 53 | bool type_is_nested = SIArray_ContainsType(elem, t); |
| 54 | if(type_is_nested) return true; |
| 55 | } |
| 56 | } |
| 57 | return false; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * @brief Returns true if the array contains an element equals to 'value' |