/* * Add before current item */ void MovieSequenceForm::addBeforeClicked() { int index = table->currentRow(); if (index < 0 || !mSegments->size()) return; addAtIndex(index); }
/* * Add after current item */ void MovieSequenceForm::addAfterClicked() { int index = B3DMAX(0, table->currentRow() + 1); if (!index && mSegments->size()) return; addAtIndex(index); }
int main() { LinkedList* ll = llCreate(); char* str = "hello"; char* str2 = "ping"; char* str3 = "pong"; char* str4 = "pinga"; char* str5 = "da"; char* str6 = "ponga"; char* str7 = "yup"; llAdd(&ll, str); llAdd(&ll, str); llAdd(&ll, str); llAdd(&ll, str4); llAdd(&ll, str); llAdd(&ll, str6); printf("LinkedList after adding a bunch of strings:\n"); llDisplay(ll); printf("Size: %d\n\n", size(ll)); int index = 4; printf("LinkedList after adding '%d' at index %d:\n", str7, index); addAtIndex(&ll, str7, index); llDisplay(ll); printf("Size: %d\n\n", size(ll)); index = 3; printf("LinkedList after removing the word at index %d:\n", index); removeAtIndex(&ll, index); llDisplay(ll); printf("Size: %d\n\n", size(ll)); printf("LinkedList after removing all instances of %d:\n", str); removeString(&ll, str); llDisplay(ll); printf("Size: %d\n\n", size(ll)); llAdd(&ll, str); llAdd(&ll, str); llAdd(&ll, str); llAdd(&ll, str4); llAdd(&ll, str); llAdd(&ll, str6); printf("LinkedList after repopulation:\n"); llDisplay(ll); llDelete(&ll); printf("Size: %d\n", size(ll)); }
void addSorted(const T & e) { size_t index(0); while (_arr[index] < e) { ++index; } addAtIndex(e, index); }