------------------------------------------------------------------------------ Description: Return the index of attribute `name', if found. Return -1 otherwise.
| 164 | // Description: |
| 165 | // Return the index of attribute `name', if found. Return -1 otherwise. |
| 166 | int vtkGenericAttributeCollection::FindAttribute(const char* name) |
| 167 | { |
| 168 | assert("pre: name_exists:" && name != nullptr); |
| 169 | |
| 170 | int result = -1; |
| 171 | |
| 172 | const char* attributeName; |
| 173 | int numAtt = this->GetNumberOfAttributes(); |
| 174 | int i = 0; |
| 175 | |
| 176 | while ((i < numAtt) && (result == -1)) |
| 177 | { |
| 178 | attributeName = this->GetAttribute(i)->GetName(); |
| 179 | if (attributeName != nullptr) |
| 180 | { |
| 181 | if (strcmp(attributeName, name) == 0) |
| 182 | { |
| 183 | result = i; |
| 184 | } |
| 185 | } |
| 186 | ++i; |
| 187 | } |
| 188 | |
| 189 | assert("post: valid_result" && |
| 190 | ((result == -1) || ((result >= 0) && (result <= this->GetNumberOfAttributes())))); |
| 191 | |
| 192 | return result; |
| 193 | } |
| 194 | //------------------------------------------------------------------------------ |
| 195 | // Description: |
| 196 | // Return the index of the first component of attribute `i' in an array of |
no test coverage detected