OHOS::List< T >

Overview

Related Modules:

Graphic

Description:

Defines a linked list template class, which implements the data structure of bidirectional linked list and provides basic functions such as adding, deleting, inserting, clearing, popping up, and obtaining the size of the linked list.

Since:

1.0

Version:

1.0

Summary

Public Member Functions

Public Member Function Name

Description

List ()

 

A default constructor used to create a List instance. The initial size is 0.

~List ()

virtual 

A destructor used to delete the List instance.

Front () const

const T 

Obtains the head node data of a linked list.

Back () const

const T 

Obtains the tail node data of a linked list.

PushBack (T data)

void 

Inserts data at the end of a linked list.

PushFront (T data)

void 

Inserts data at the start of a linked list.

PopBack ()

void 

Pops up a data record at the end of a linked list.

PopFront ()

void 

Pops up a data record at the start of a linked list.

Insert (ListNode< T > node, T data)

void 

Inserts data before a specified node, which follows the inserted data node.

Remove (ListNode< T > node)

void 

Deletes a data node.

Clear ()

void 

Deletes all nodes from a linked list.

Head () const

ListNode< T >  

Obtains the head node address of a linked list.

Tail () const

ListNode< T >  

Obtains the tail node address of a linked list.

Begin () const

ListNode< T >  

Obtains the head node address of a linked list.

End () const

const ListNode< T >  

Obtains the end node address of a linked list.

Next (const ListNode< T > node) const

ListNode< T >  

Obtains the address of the node following the specified node.

IsEmpty () const

bool 

Checks whether a linked list is empty.

Size () const

uint16_t 

Obtains the size of a linked list.

operator new (size_t size)

void  

Overrides the new function.

operator delete (void p)

void 

Overrides the delete function.