static void testDoublyLinked() { DoublyLinkedList<TestItem, offsetof(TestItem, dlMembership)> list; unsigned i; for(i = 10; i > 0; --i) { TestItem *pItem = new TestItem; pItem->x = i; list.prepend(pItem); } TestItem *pItem; for(pItem = list.getLast(), i = 10; pItem; --i, pItem = list.getPrevious(pItem)) { assert(pItem->x == i); } assert(i == 0); // we saw them all }
// // At // TEST_F( SimplexSupportDoublyLinkedList, AtReturnsObjectAtSpecifiedIndex ) { MockStruct* m1 = new MockStruct(); MockStruct* m2 = new MockStruct(); MockStruct* m3 = new MockStruct(); DoublyLinkedList list; list.PushBack(m1); list.PushBack(m2); list.PushBack(m3); ASSERT_EQ(list.At(0)->Value, (MockStruct*)m1); ASSERT_EQ(list.At(1)->Value, (MockStruct*)m2); ASSERT_EQ(list.At(2)->Value, (MockStruct*)m3); delete(m1); delete(m2); delete(m3); }
// // Destructor // TEST_F( SimplexSupportDoublyLinkedList, DestructorDeallocatesNodes ) { MockStruct* m1 = new MockStruct(); MockStruct* m2 = new MockStruct(); MockStruct* m3 = new MockStruct(); DoublyLinkedList list; list.PushBack(m1); list.PushBack(m2); list.PushBack(m3); list.~DoublyLinkedList(); ASSERT_EQ(mAllocator->GetAllocationCount(), 0); delete(m1); delete(m2); delete(m3); }
net_protocol* l2cap_init_protocol(net_socket* socket) { L2capEndpoint* protocol = new(std::nothrow) L2capEndpoint(socket); if (protocol == NULL) return NULL; EndpointList.Add(protocol); debugf("Prococol created %p\n", protocol); return protocol; }
int main() { if(runTests()) { DoublyLinkedList<int> list; unsigned int numberOfPeople; unsigned int currentIndex; list.clear(); for (unsigned int count = 0; count < numberOfPeople; ++count) { list.pushBack(count + 1); } while(numberOfPeople > 1) { for (unsigned int skip = 0; skip < 33; ++skip) { currentIndex++; if( currentIndex > list.size() ) currentIndex = 1; } list.removeAt(currentIndex-1); numberOfPeople--; } cout << "Person number: " << list.popBack() << "is left" << endl; } return 0; }
//===================================================================// double* GetYMatrix(void){ DoublyLinkedList<Point> *list = Picker.GetPoints(); Node<Point> *currNode = list->getHead(); int n = list->getSize(); double *y = new double[n]; if(!y){ printf("Insufficient memory for the Y allocation!\n"); exit(0); } for(int i=0; i<n; i++){ y[i] = currNode->data[Y]; currNode = currNode->next; } return y; }
net_protocol* l2cap_init_protocol(net_socket* socket) { flowf("\n"); L2capEndpoint* protocol = new(std::nothrow) L2capEndpoint(socket); if (protocol == NULL) return NULL; EndpointList.Add(protocol); return protocol; }
status_t l2cap_uninit_protocol(net_protocol* protocol) { flowf("\n"); L2capEndpoint* endpoint = static_cast<L2capEndpoint*>(protocol); // TODO: Some more checkins / uninit EndpointList.Remove(endpoint); delete endpoint; return B_OK; }
void insert(double dd, int method) // 1: first; 2: last { if(!isFull()) { switch(method) { case 1: dll->insertFirst(dd); break; case 2: dll->insertLast(dd); break; default: cout << "Deque::insert(): unknown insertion method: insert first\n"; dll->insertFirst(dd); break; } // end switch nElems++; } // end if else cout << "Deque::insert(): cannot insert " << dd << ", deque is full\n"; } // end insert()
void main() { cout<<"\t\t\t\t>>SORTED<<\n\t\t\t>>Doubly Linked List<<\n\n"; int op; //variable to store choice of operation int value; //variable to store value into node char ext; //variable to exit loop int cnt; //variable to store count of nodes int search=2; //variable to store search results DoublyLinkedList<int> obj; //created object of Doubly linked list do { cout<<"\t\tWhat to do?\n1. Add Item\n2. Delete from Head\n3. Delete from Tail\n4. Search Data in List\n5. Delete Node with Specific Data\n6. Check Total Number of Nodes\n7. Print List\n\tYour Choice = "; cin>>op; if(op==1) { cout<<"Enter Value to be stored = "; cin>>value; obj.add_item(value); } else if(op==2) { obj.deletefromDLLhead(); } else if(op==3) { obj.deletefromDLLtail(); } else if(op==4) { cout<<"Enter Data to Search = "; cin>>value; search = obj.search_item(value); if(search==1) cout<<value<<" Found in LinkList!"; else if(search==0) cout<<"ERROR:: Value NOT Found!"; }
static bool isListPagedOut(double deadline, DoublyLinkedList<MarkedBlock>& list) { unsigned itersSinceLastTimeCheck = 0; MarkedBlock* block = list.head(); while (block) { block = block->next(); ++itersSinceLastTimeCheck; if (itersSinceLastTimeCheck >= Heap::s_timeCheckResolution) { double currentTime = WTF::monotonicallyIncreasingTime(); if (currentTime > deadline) return true; itersSinceLastTimeCheck = 0; } } return false; }
TEST_F( SimplexSupportDoublyLinkedList, LastReturnsLastAddedElement ) { MockStruct* m1 = new MockStruct(); MockStruct* m2 = new MockStruct(); MockStruct* m3 = new MockStruct(); DoublyLinkedList list; list.PushBack(m1); ASSERT_EQ(list.Last()->Value, (MockStruct*)m1); list.PushBack(m2); ASSERT_EQ(list.Last()->Value, (MockStruct*)m2); list.PushBack(m3); ASSERT_EQ(list.Last()->Value, (MockStruct*)m3); delete(m1); delete(m2); delete(m3); }
// // RemoveAt // TEST_F( SimplexSupportDoublyLinkedList, RemoveAtLeavesAConsistentList ) { MockStruct* m1 = new MockStruct(); MockStruct* m2 = new MockStruct(); MockStruct* m3 = new MockStruct(); DoublyLinkedList list; list.PushBack(m1); list.PushBack(m2); list.PushBack(m3); list.RemoveAt(1); ASSERT_EQ((MockStruct*)list.First()->Next->Value, m3); ASSERT_EQ((MockStruct*)list.Last()->Previous->Value, m1); delete(m1); delete(m2); delete(m3); }
// RemoveAttribute status_t Node::RemoveAttribute(Attribute *attribute) { status_t error = (attribute && attribute->GetNode() == this ? B_OK : B_BAD_VALUE); if (error == B_OK) { // move all iterators pointing to the attribute to the next attribute if (GetVolume()->IteratorLock()) { // set the iterators' current entry Attribute *nextAttr = fAttributes.GetNext(attribute); DoublyLinkedList<AttributeIterator> *iterators = attribute->GetAttributeIteratorList(); for (AttributeIterator *iterator = iterators->First(); iterator; iterator = iterators->GetNext(iterator)) { iterator->SetCurrent(nextAttr, true); } // Move the iterators from one list to the other, or just remove // them, if there is no next attribute. if (nextAttr) { DoublyLinkedList<AttributeIterator> *nextIterators = nextAttr->GetAttributeIteratorList(); nextIterators->MoveFrom(iterators); } else iterators->RemoveAll(); GetVolume()->IteratorUnlock(); } else error = B_ERROR; // remove the attribute if (error == B_OK) { error = GetVolume()->NodeAttributeRemoved(GetID(), attribute); if (error == B_OK) { fAttributes.Remove(attribute); attribute->SetNode(NULL); MarkModified(); } } } return error; }
int _tmain(int argc, _TCHAR* argv[]) { cout << "Lista Doblemente Enlazada de Int" << endl; DoublyLinkedList<int> l; l.insertarFinal(2); l.insertarFinal(4); l.insertarFinal(5); l.insertarInicio(6); l.insertar(8, 2); cout << l; cout << endl; l.remover(3); cout << l; cout << endl; cout << l.getElemento(2); cout << endl; cout <<"Inicia el iterador Preincremento"<< endl; // Probar Iteradores Iterador<int> it = l.begin(); while (it != l.end()) { cout << *it << endl; ++it; } cout << "Inicia el iterador Postincremento" << endl; // Probar Iteradores posincremento Iterador<int> itB = l.begin(); while (itB != l.end()) { cout << *(itB++) << endl; } cout << endl; cout << "Inicia el iterador Predecremento" << endl; // Probar Iteradores Iterador<int> itC = l.rBegin(); while (itC != l.rEnd()) { cout << *itC << endl; --itC; } cout << "Inicia el iterador Postdecremento" << endl; // Probar Iteradores posincremento Iterador<int> itD = l.rBegin(); while (itD != l.rEnd()) { cout << *(itD--) << endl; } cout << endl; cout << "Lista Doblemente Enlazada de Double" << endl; DoublyLinkedList<double> lD; lD.insertarFinal(2.5); lD.insertarFinal(6.4); lD.insertarFinal(7.5); lD.insertarInicio(6.1); lD.insertar(89.1, 2); cout << lD; cout << endl; cout << "Inicia el iterador Preincremento" << endl; // Probar Iteradores Iterador<double> it1 = lD.begin(); while (it1 != lD.end()) { cout << *it1 << endl; ++it1; } cout << "Inicia el iterador Postincremento" << endl; // Probar Iteradores posincremento Iterador<double> it2 = lD.begin(); while (it2 != lD.end()) { cout << *(it2++) << endl; } cout << endl; cout << "Inicia el iterador Predecremento" << endl; // Probar Iteradores Iterador<double> it3 = lD.rBegin(); while (it3 != lD.rEnd()) { cout << *it3 << endl; --it3; } cout << "Inicia el iterador Postdecremento" << endl; // Probar Iteradores posincremento Iterador<double> it4 = lD.rBegin(); while (it4 != lD.rEnd()) { cout << *(it4--) << endl; } cout << endl; cout << "Lista Doblemente Enlazada de Char" << endl; DoublyLinkedList<char> lC; lC.insertarFinal('a'); lC.insertarFinal('$'); lC.insertarFinal('r'); lC.insertarInicio('#'); lC.insertar('y', 2); cout << lC; cout << endl; cout << "Inicia el iterador Preincremento" << endl; // Probar Iteradores Iterador<char> it5 = lC.begin(); while (it5 != lC.end()) { cout << *it5 << endl; ++it5; } cout << "Inicia el iterador Postincremento" << endl; // Probar Iteradores posincremento Iterador<char> it6 = lC.begin(); while (it6 != lC.end()) { cout << *(it6++) << endl; } cout << endl; cout << "Inicia el iterador Predecremento" << endl; // Probar Iteradores Iterador<char> it7 = lC.rBegin(); while (it7 != lC.rEnd()) { cout << *it7 << endl; --it7; } cout << "Inicia el iterador Postdecremento" << endl; // Probar Iteradores posincremento Iterador<char> it8 = lC.rBegin(); while (it8 != lC.rEnd()) { cout << *(it8--) << endl; } cout << endl; cout << "Lista Doblemente Enlazada de Persona" << endl; DoublyLinkedList<Persona *> lP; lP.insertarFinal(new Persona(1,"Fabian")); lP.insertarFinal(new Persona(2, "Gabriela")); lP.insertarFinal(new Persona(3, "Laura")); lP.insertarInicio(new Persona(5, "Maria")); lP.insertar(new Persona(8, "Julio"), 2); cout << endl; cout << "Inicia el iterador Preincremento" << endl; // Probar Iteradores Iterador<Persona*> it9 = lP.begin(); while (it9 != lP.end()) { cout << **it9 << endl; ++it9; } cout << "Inicia el iterador Postincremento" << endl; // Probar Iteradores posincremento Iterador<Persona*> it10 = lP.begin(); while (it10 != lP.end()) { cout << **(it10++) << endl; } cout << endl; cout << "Inicia el iterador Predecremento" << endl; // Probar Iteradores Iterador<Persona*> it11 = lP.rBegin(); while (it11 != lP.rEnd()) { cout << **it11 << endl; --it11; } cout << "Inicia el iterador Postdecremento" << endl; // Probar Iteradores posincremento Iterador<Persona*> it12 = lP.rBegin(); while (it12 != lP.rEnd()) { cout << **(it12--) << endl; } cout << endl; cout << "Liberar Memoria de cada puntero a persona" << endl; // Probar Iteradores Iterador<Persona*> it13 = lP.begin(); while (it13 != lP.end()) { delete *(it13++) ; } system("pause"); return 0; }
inline TakeIfUnmarked::ReturnType TakeIfUnmarked::returnValue() { return m_empties.head(); }
double getFirst() { return dll->getFirst(); }
double getLast() { return dll->getLast(); }
void DeleteChildren() { while (Attribute* child = children.RemoveHead()) delete child; }
int main() { // Grab current cout flags, used for when the stream is altered and the user wants // to reset it to the default values: ios::fmtflags f( cout.flags() ); // Test 1: { SinglyLinkedList<char>* list = new SinglyLinkedList<char>(); char var = 'A'; for (int i = 1; i <= 10; i++) { list->pushBack(var); var++; } cout << endl << "Test 1 - Char list:" << endl << "\t"; list->print(); cout << endl; } // Reset cout stream flags: cout.flags(f); // Test 2: { DoublyLinkedList<myType>* list = new DoublyLinkedList<myType>(); myType var = 1; for (int i = 1; i <= 10; i++) { list->pushBack(var); var++; } cout << endl << "Test 2 - Int list:" << endl << "\t"; list->print(); cout << endl; } // Reset cout stream flags: cout.flags(f); // Test 3: { BinaryTree<int>* bt = new BinaryTree<int>(); // Insert a bunch of stuff: bt->insert(11); bt->insert(6); bt->insert(8); bt->insert(19); bt->insert(4); bt->insert(10); bt->insert(5); bt->insert(17); bt->insert(43); bt->insert(49); bt->insert(31); // Print tree preOrderTraversal: cout << endl << "Binary Tree PreOrderTravesal:" << endl << "\t"; bt->preOrderTraversal(); cout << endl; // Print tree inOrderTraversal: cout << endl << "Binary Tree InOrderTravesal:" << endl << "\t"; bt->inOrderTraversal(); cout << endl; // Print tree postOrderTraversal: cout << endl << "Binary Tree PostOrderTravesal:" << endl << "\t"; bt->postOrderTraversal(); cout << endl; } cout << endl; return 0; }
bool testDoublyLinkedListAuto() { DoublyLinkedList list; list.push_back(5.0); if (list.is_empty() || list.get_head()->get_value() != 5.0) { return false; } if (list.is_empty() || list.get_tail()->get_value() != 5.0) { return false; } list.push_front(2.3); if (list.is_empty() || list.get_head()->get_value() != 2.3) { return false; } if (list.is_empty() || list.get_tail()->get_value() != 5.0) { return false; } list.push_back(3.7); list.push_front(4.2); if (list.is_empty() || list.get_head()->get_value() != 4.2) { return false; } if (list.is_empty() || list.get_tail()->get_value() != 3.7) { return false; } list.print_list(); list.pop_front(); list.pop_front(); list.pop_front(); list.pop_front(); list.pop_front(); list.print_list(); list.push_back(6.66); if (list.is_empty() || list.get_head()->get_value() != 6.66) { return false; } if (list.is_empty() || list.get_tail()->get_value() != 6.66) { return false; } list.push_front(3.33); list.push_back(3.14); if (list.is_empty() || list.get_head()->get_value() != 3.33) { return false; } if (list.is_empty() || list.get_tail()->get_value() != 3.14) { return false; } list.print_list(); list.pop_back(); list.pop_back(); list.pop_back(); list.print_list(); return true; }
void TestDataStructures::DoubltLinkedListOperations(){ DoublyLinkedList* list = new DoublyLinkedList(); // Display list->Display(); std::cout << "Insert at beginning.\n"; // Insert at begining list->InsertAtBeginning(3); list->InsertAtBeginning(4); list->InsertAtBeginning(2); list->InsertAtBeginning(6); list->InsertAtBeginning(8); // Display list->Display(); std::cout << "Insert at End.\n"; // Insert at begining list->InsertAtEnd(33); list->InsertAtEnd(44); list->InsertAtEnd(22); list->InsertAtEnd(66); list->InsertAtEnd(88); // Display list->Display(); //list = new DoublyLinkedList(); std::cout << "Insert at Middle.\n"; // Insert at begining list->InsertInMiddle(13); list->InsertInMiddle(84); list->InsertInMiddle(12); list->InsertInMiddle(6); list->InsertInMiddle(18); // Display list->Display(); }
int main() { DoublyLinkedList *ls = new DoublyLinkedList(); ls->push_back(*(new ListNode("100"))); ListNode *n1 = new ListNode("5"); ls->push_front(*n1); ls->push_front(*(new ListNode("1"))); ls->push_front(*(new ListNode("3"))); ls->push_front(*(new ListNode("4"))); ls->push_front(*(new ListNode("0"))); ls->push_back(*(new ListNode("1sdsd"))); ls->print(); cout << "\n"; ls->print_bkw(); cout << "\nLink list size is equal to " << ls->size() << endl; cout << "\n"; cout << "Lets delete first and last nodes from list\n"; ls->pop_back(); ls->pop_front(); ls->print(); cout << "\nNow lets erase 4, 1 and 100: \n"; ls->erase("4"); ls->erase("1"); ls->erase("100"); ls->print(); cout << "\nLets insert '6' after '3' and '7' after '5': \n"; ls->insert_after("3", *(new ListNode("6"))); ls->insert_after("5", *(new ListNode("7"))); ls->print(); cout << "\nLets clear linked list (check this with 'isEmpty' method): \n"; ls->clear(); if (ls->isEmpty()) cout << "Our list is empty! \n"; cout << "\nLets get new list: \n"; ls->push_front(*(new ListNode("6"))); ls->push_front(*(new ListNode("31"))); ls->push_front(*(new ListNode("55"))); ls->push_front(*(new ListNode("4"))); ls->push_front(*(new ListNode("1"))); ls->push_front(*(new ListNode("3"))); ls->push_front(*(new ListNode("4"))); ls->push_front(*(new ListNode("8"))); ls->push_front(*(new ListNode("5"))); ls->push_front(*(new ListNode("0"))); ls->print(); cout << "\nOur new sorted list: \n"; ls->sort(); ls->print(); cout << "\nLets delete unique elements: \n"; ls->unique(); ls->print(); cout << "\nLets insert '0', '2', '7' and '9' preserving list ordering: \n"; ls->insert_ord(*(new ListNode("0"))); ls->insert_ord(*(new ListNode("2"))); ls->insert_ord(*(new ListNode("7"))); ls->insert_ord(*(new ListNode("9"))); ls->print(); cout << "\nLets get new list 'temp_ls': \n"; DoublyLinkedList *temp_ls = new DoublyLinkedList(); temp_ls->push_front(*(new ListNode("b"))); temp_ls->push_front(*(new ListNode("v"))); temp_ls->push_front(*(new ListNode("a"))); temp_ls->push_front(*(new ListNode("d"))); temp_ls->print(); cout << "\nLets 'merge' our lists (temp_ls in ls): \n"; ls->merge(*temp_ls); ls->print(); if (temp_ls->isEmpty()) cout << "Our 'temp_ls' list is empty! \n"; cout << "\nLets get new lists: \n"; ls->clear(); ls->push_front(*(new ListNode("6"))); ls->push_front(*(new ListNode("3"))); ls->push_front(*(new ListNode("5"))); ls->push_front(*(new ListNode("4"))); ls->push_front(*(new ListNode("1"))); cout << "New 'ls': "; ls->print(); temp_ls->push_front(*(new ListNode("b"))); temp_ls->push_front(*(new ListNode("v"))); temp_ls->push_front(*(new ListNode("a"))); temp_ls->push_front(*(new ListNode("d"))); cout << "New 'temp_ls': "; temp_ls->print(); cout << "\nLets assign 'ls' to 'temp_ls' from 1 to 3: \n"; ls->assign(*temp_ls, 1, 3); cout << "New 'ls': "; ls->print(); cout << "New 'temp_ls': "; temp_ls->print(); cout << "\nLets splice 'temp_ls' in 'ls' from index 3 with all list:\n "; ls->splice(3, *temp_ls); ls->print(); ls->clear(); temp_ls->clear(); ls->push_front(*(new ListNode("6"))); ls->push_front(*(new ListNode("3"))); ls->push_front(*(new ListNode("5"))); ls->push_front(*(new ListNode("4"))); ls->push_front(*(new ListNode("1"))); cout << "\nlets get new lists: \nNew 'ls': "; ls->print(); temp_ls->push_front(*(new ListNode("b"))); temp_ls->push_front(*(new ListNode("v"))); temp_ls->push_front(*(new ListNode("b"))); temp_ls->push_front(*(new ListNode("d"))); cout << "New 'temp_ls': "; temp_ls->print(); cout << "\nLets splice 'temp_ls' in 'ls' from index 2 from 1 to 2: "; ls->splice(2, *temp_ls, 1, 2); ls->print(); return 0; }
int main(int argc, char *argv[]) { cout << "[+] doubly linked list test program" << endl; DoublyLinkedList<int> dlist; test<bool>(dlist.empty(), true, "empty test1"); dlist.addFront(1); dlist.addFront(2); dlist.addBack(3); test<bool>(dlist.empty(), false, "empty test2"); test<int>(dlist.front(), 2, "front test"); test<int>(dlist.back(), 3, "back test"); dlist.removeBack(); test<int>(dlist.back(), 1, "remove test1"); dlist.removeFront(); test<int>(dlist.front(), 1, "remove test2"); dlist.clear(); test<bool>(dlist.empty(), true, "clear test"); return EXIT_SUCCESS; }
inline Free::ReturnType Free::returnValue() { return m_blocks.head(); }
DoublyLinkedList::DoublyLinkedList(const DoublyLinkedList& rhs) { for (int i=0; i<rhs.size_ ; i++) { insert_back(rhs.getNode(i)->value); } size_ = rhs.size_; }
int main(int argc, char const *argv[]) { DoublyLinkedList<FileInfo> d; FileInfo test; test.fileName[0] = '.'; test.fileName[1] = '_'; test.fileName[2] = '.'; test.fileName[3] = 'T'; test.fileName[4] = 'r'; test.fileName[5] = 'a'; test.fileName[6] = 's'; test.fileName[7] = 'h'; test.fileName[8] = 'e'; test.fileName[9] = 's'; test.fileName[10] = '\0'; test.index = 96; d.add(test); FileInfo test2; test2.fileName[0] = '.'; test2.fileName[1] = 'T'; test2.fileName[2] = 'r'; test2.fileName[3] = 'a'; test2.fileName[4] = 's'; test2.fileName[5] = 'h'; test2.fileName[6] = 'e'; test2.fileName[7] = 's'; test2.fileName[8] = '\0'; test2.index = 192; d.add(test2); FileInfo test3; test3.fileName[0] = '.'; test3.fileName[1] = 'S'; test3.fileName[2] = 'p'; test3.fileName[3] = 'o'; test3.fileName[4] = 't'; test3.fileName[5] = 'l'; test3.fileName[6] = 'i'; test3.fileName[7] = 'g'; test3.fileName[8] = 'h'; test3.fileName[9] = 't'; test3.fileName[10] = '-'; test3.fileName[11] = 'V'; test3.fileName[12] = '1'; test3.fileName[13] = '0'; test3.fileName[14] = '0'; test3.fileName[15] = '\0'; test3.index = 288; d.add(test3); FileInfo test4; test4.fileName[0] = '.'; test4.fileName[1] = 'f'; test4.fileName[2] = 's'; test4.fileName[3] = 'e'; test4.fileName[4] = 'v'; test4.fileName[5] = 'e'; test4.fileName[6] = 'n'; test4.fileName[7] = 't'; test4.fileName[8] = 's'; test4.fileName[9] = 'd'; test4.fileName[10] = '\0'; test4.index = 352; d.add(test4); FileInfo test5; test5.fileName[0] = 'L'; test5.fileName[1] = 'O'; test5.fileName[2] = 'S'; test5.fileName[3] = 'T'; test5.fileName[4] = '.'; test5.fileName[5] = 'D'; test5.fileName[6] = 'I'; test5.fileName[7] = 'R'; test5.fileName[8] = '\0'; test5.index = 384; d.add(test5); FileInfo test6; test6.fileName[0] = '.'; test6.fileName[1] = 'a'; test6.fileName[2] = 'n'; test6.fileName[3] = 'd'; test6.fileName[4] = 'r'; test6.fileName[5] = 'o'; test6.fileName[6] = 'i'; test6.fileName[7] = 'd'; test6.fileName[8] = '_'; test6.fileName[9] = 's'; test6.fileName[10] = 'e'; test6.fileName[11] = 'c'; test6.fileName[12] = 'u'; test6.fileName[13] = 'r'; test6.fileName[14] = 'e'; test6.fileName[15] = '\0'; test6.index = 480; d.add(test6); FileInfo test7; test7.fileName[0] = 'A'; test7.fileName[1] = 'n'; test7.fileName[2] = 'd'; test7.fileName[3] = 'r'; test7.fileName[4] = 'o'; test7.fileName[5] = 'i'; test7.fileName[6] = 'd'; test7.fileName[7] = '\0'; test7.index = 544; d.add(test7); FileInfo test8; test8.fileName[0] = 'S'; test8.fileName[1] = 'i'; test8.fileName[2] = 'z'; test8.fileName[3] = 'e'; test8.fileName[4] = 'T'; test8.fileName[5] = 'e'; test8.fileName[6] = 's'; test8.fileName[7] = 't'; test8.fileName[8] = '.'; test8.fileName[9] = 't'; test8.fileName[10] = 'x'; test8.fileName[11] = 't'; test8.fileName[12] = '\0'; test8.index = 608; d.add(test8); FileInfo test9; test9.fileName[0] = 'L'; test9.fileName[1] = 'G'; test9.fileName[2] = 'B'; test9.fileName[3] = 'a'; test9.fileName[4] = 'c'; test9.fileName[5] = 'k'; test9.fileName[6] = 'u'; test9.fileName[7] = 'p'; test9.fileName[8] = '\0'; test9.index = 672; d.add(test9); FileInfo test10; test10.fileName[0] = 'M'; test10.fileName[1] = 'u'; test10.fileName[2] = 's'; test10.fileName[3] = 'i'; test10.fileName[4] = 'c'; test10.fileName[5] = '\0'; test10.index = 736; d.add(test10); // ._.Trashes - 96 // .Trashes - 192 // .Spotlight-V100 - 288 // .fseventsd - 352 // LOST.DIR - 384 // .android_secure - 480 // Android - 544 // SizeTest.txt - 608 // LGBackup - 672 // Music - 736 // d.printList(); for(int i=0; i<d.getSize(); i++) { std::cout << i << " - "; std::cout << (d.getAt(i)->fileName); std::cout << (" - "); std::cout << (d.getAt(i)->index) << std::endl; } std::cout << std::endl; d.sort(); d.printList(); for(int i=0; i<d.getSize(); i++) { std::cout << i << " - "; std::cout << (d.getAt(i)->fileName); std::cout << (" - "); std::cout << (d.getAt(i)->index) << std::endl; } return 0; }
//===================================================================// int GetNumberOfPoints(void){ DoublyLinkedList<Point> *list = Picker.GetPoints(); return list->getSize(); }
void AddChild(Attribute* child) { children.Add(child); }