ArrayList::IndexOf(const Object& obj, int startIndex, int& index) const
{
SysTryReturnResult(NID_BASE_COL, startIndex >= 0 && startIndex < __count, E_OUT_OF_RANGE, "The startIndex(%d) MUST be greater than or equal to 0, and less than the number of elements(%d).", startIndex, __count);
-
return IndexOf(obj, startIndex, (__count - startIndex), index);
}
result
ArrayList::IndexOf(const Object& obj, int startIndex, int count, int& index) const
{
+ SysTryReturnResult(NID_BASE_COL, __count != 0, E_OBJ_NOT_FOUND, "The arraylist is empty.");
SysTryReturnResult(NID_BASE_COL, startIndex >= 0 && count >= 0, E_OUT_OF_RANGE, "Both of the startIndex(%d) and count(%d) MUST be greater than or equal to 0.", startIndex, count);
SysTryReturnResult(NID_BASE_COL, startIndex < __count, E_OUT_OF_RANGE,
"The startIndex(%d) MUST be less than the number of elements(%d).", startIndex, __count);
}
}
+ SysLogException(NID_BASE_COL, E_OBJ_NOT_FOUND, "The object is not in the list.");
return E_OBJ_NOT_FOUND;
}
{
int index = 0;
result r = IndexOf(obj, index);
- if (IsFailed(r))
- {
- return E_OBJ_NOT_FOUND;
- }
- else
- {
- return RemoveAt(index);
- }
-
+ SysTryReturnResult(NID_BASE_COL, r == E_SUCCESS, r, "Propagating.");
+ r = RemoveAt(index);
+ SysTryReturnResult(NID_BASE_COL, r == E_SUCCESS, r, "Propagating.")
+ return r;
}
result