* @brief Returns true if the array contains an element equals to 'value' * @param siarray: array * @param value: value to search for * @param comparedNull: indicate if there was a null comparison during the array scan * @retval a boolean indicating whether value was found in siarray */
| 65 | * @retval a boolean indicating whether value was found in siarray |
| 66 | */ |
| 67 | bool SIArray_ContainsValue(SIValue siarray, SIValue value, bool *comparedNull) { |
| 68 | // indicate if there was a null comparison during the array scan |
| 69 | if(comparedNull) *comparedNull = false; |
| 70 | uint array_len = SIArray_Length(siarray); |
| 71 | for(uint i = 0; i < array_len; i++) { |
| 72 | int disjointOrNull = 0; |
| 73 | SIValue elem = siarray.array[i]; |
| 74 | int compareValue = SIValue_Compare(elem, value, &disjointOrNull); |
| 75 | if(disjointOrNull == COMPARED_NULL) { |
| 76 | if(comparedNull) *comparedNull = true; |
| 77 | continue; |
| 78 | } |
| 79 | if(compareValue == 0) return true; |
| 80 | } |
| 81 | return false; |
| 82 | } |
| 83 | |
| 84 | bool SIArray_AllOfType(SIValue siarray, SIType t) { |
| 85 | uint array_len = SIArray_Length(siarray); |
no test coverage detected