Doubly Linked List v0.0.3
Loading...
Searching...
No Matches
DoublyLinkedList Class Reference

Klasa reprezentująca listę dwukierunkową. Klasa umożliwia dodawanie, usuwanie oraz przeglądanie elementów w obu kierunkach (przód i tył). More...

#include <doubly_linked_list.hpp>

Public Member Functions

void insertItemAtFront (int value)
 
void insertItemAtEnd (int value)
 
void insertItemAtIndex (int index, int value)
 
void removeFirstItem ()
 
void removeLastItem ()
 
void removeItemFromIndex (int index)
 
void removeAllItems ()
 
void displayAllItems () const
 
void displayAllItemsReversed () const
 
void displayNextItemFromIndex (int index) const
 
void displayPreviousItemFromIndex (int index) const
 
 DoublyLinkedList ()
 Domyślny konstruktor listy dwukierunkowej. Inicjalizuje pustą listę.
 
 ~DoublyLinkedList ()
 Destruktor listy dwukierunkowej. Usuwa wszystkie węzły i zwalnia pamięć.
 
void insertItemAtFront (int value)
 Dodaje nowy element na początku listy.
 
void insertItemAtEnd (int value)
 Dodaje nowy element na końcu listy.
 
void insertItemAtIndex (int index, int value)
 Wstawia nowy element na podaną pozycję.
 
void removeFirstItem ()
 Usuwa pierwszy element z listy.
 
void removeLastItem ()
 Usuwa ostatni element z listy.
 
void removeItemFromIndex (int index)
 Usuwa element na podanym indeksie.
 
void removeAllItems ()
 Usuwa wszystkie elementy z listy.
 
void displayAllItems () const
 Wyświetla zawartość listy w kolejności od pierwszego do ostatniego elementu.
 
void displayAllItemsReversed () const
 Wyświetla zawartość listy w odwrotnej kolejności (od ostatniego do pierwszego elementu).
 
void displayNextItemFromIndex (int index) const
 Wyświetla elementy listy, zaczynając od podanego indeksu, w kolejności do przodu.
 
void displayPreviousItemFromIndex (int index) const
 Wyświetla elementy listy, zaczynając od podanego indeksu, w kolejności do tyłu.
 
const int & operator[] (int index) const
 Przeciążenie operatora [] do dostępu do wartości na podanym indeksie.
 

Friends

std::ostream & operator<< (std::ostream &stream, const DoublyLinkedList &list)
 Przeciążenie operatora << do wyświetlania zawartości listy.
 
std::ostream & operator<< (std::ostream &stream, const DoublyLinkedList::Node *node)
 Przeciążenie operatora << do wyświetlania węzła.
 

Detailed Description

Klasa reprezentująca listę dwukierunkową. Klasa umożliwia dodawanie, usuwanie oraz przeglądanie elementów w obu kierunkach (przód i tył).

Member Function Documentation

◆ displayNextItemFromIndex()

void DoublyLinkedList::displayNextItemFromIndex ( int index) const

Wyświetla elementy listy, zaczynając od podanego indeksu, w kolejności do przodu.

Parameters
indexIndeks początkowy.

◆ displayPreviousItemFromIndex()

void DoublyLinkedList::displayPreviousItemFromIndex ( int index) const

Wyświetla elementy listy, zaczynając od podanego indeksu, w kolejności do tyłu.

Parameters
indexIndeks początkowy.

◆ insertItemAtEnd()

void DoublyLinkedList::insertItemAtEnd ( int value)

Dodaje nowy element na końcu listy.

Parameters
valueWartość elementu do dodania.

◆ insertItemAtFront()

void DoublyLinkedList::insertItemAtFront ( int value)

Dodaje nowy element na początku listy.

Parameters
valueWartość elementu do dodania.

◆ insertItemAtIndex()

void DoublyLinkedList::insertItemAtIndex ( int index,
int value )

Wstawia nowy element na podaną pozycję.

Parameters
valueWartość elementu do wstawienia.
indexIndeks, na którym element ma zostać wstawiony.

◆ operator[]()

const int & DoublyLinkedList::operator[] ( int index) const

Przeciążenie operatora [] do dostępu do wartości na podanym indeksie.

Parameters
indexIndeks elementu, do którego chcesz uzyskać dostęp.
Returns
Stała referencja do wartości elementu na podanym indeksie.

◆ removeItemFromIndex()

void DoublyLinkedList::removeItemFromIndex ( int index)

Usuwa element na podanym indeksie.

Parameters
indexPozycja elementu do usunięcia.

Friends And Related Symbol Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream & stream,
const DoublyLinkedList & list )
friend

Przeciążenie operatora << do wyświetlania zawartości listy.

Parameters
streamStrumień wyjściowy.
listLista do wyświetlenia.
Returns
Referencja do strumienia wyjściowego.

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream & stream,
const DoublyLinkedList::Node * node )
friend

Przeciążenie operatora << do wyświetlania węzła.

Parameters
streamStrumień wyjściowy.
nodeWskaźnik na węzeł do wyświetlenia.
Returns
Referencja do strumienia wyjściowego.
Parameters
streamStrumień wyjściowy.
nodeWskaźnik na węzeł, który ma być wyświetlony.
Returns
Referencja do strumienia wyjściowego.

The documentation for this class was generated from the following files: