Lines Matching refs:index

126 void UVector::setElementAt(void* obj, int32_t index) {
127 if (0 <= index && index < count) {
128 if (elements[index].pointer != nullptr && deleter != nullptr) {
129 (*deleter)(elements[index].pointer);
131 elements[index].pointer = obj;
133 /* index out of range */
140 void UVector::setElementAt(int32_t elem, int32_t index) {
142 if (0 <= index && index < count) {
143 elements[index].pointer = nullptr;
144 elements[index].integer = elem;
146 /* else index out of range */
149 void UVector::insertElementAt(void* obj, int32_t index, UErrorCode &status) {
151 if (0 <= index && index <= count) {
152 for (int32_t i=count; i>index; --i) {
155 elements[index].pointer = obj;
158 /* index out of range */
167 void UVector::insertElementAt(int32_t elem, int32_t index, UErrorCode &status) {
169 // must have 0 <= index <= count
171 if (0 <= index && index <= count) {
172 for (int32_t i=count; i>index; --i) {
175 elements[index].pointer = nullptr;
176 elements[index].integer = elem;
179 /* index out of range */
185 void* UVector::elementAt(int32_t index) const {
186 return (0 <= index && index < count) ? elements[index].pointer : 0;
189 int32_t UVector::elementAti(int32_t index) const {
190 return (0 <= index && index < count) ? elements[index].integer : 0;
235 void UVector::removeElementAt(int32_t index) {
236 void* e = orphanElementAt(index);
410 * Removes the element at the given index from this vector and
413 * at 'index' is removed, shifting all subsequent entries back by
414 * one index and shortening the size of the vector by one. If the
415 * index is out of range or if there is no item at the given index
418 void* UVector::orphanElementAt(int32_t index) {
420 if (0 <= index && index < count) {
421 e = elements[index].pointer;
422 for (int32_t i=index; i<count-1; ++i) {
427 /* else index out of range */