GDAL
Classes | Typedefs | Functions
cpl_list.h File Reference

Simplest list implementation. More...

#include "cpl_port.h"

Go to the source code of this file.

Classes

struct  _CPLList
 List element structure. More...
 

Typedefs

typedef struct _CPLList CPLList
 List element structure. More...
 

Functions

CPLListCPLListAppend (CPLList *psList, void *pData)
 Append an object list and return a pointer to the modified list. More...
 
CPLListCPLListInsert (CPLList *psList, void *pData, int nPosition)
 Insert an object into list at specified position (zero based). More...
 
CPLListCPLListGetLast (CPLList *psList)
 Return the pointer to last element in a list. More...
 
CPLListCPLListGet (CPLList *const psList, int nPosition)
 Return the pointer to the specified element in a list. More...
 
int CPLListCount (const CPLList *psList)
 Return the number of elements in a list. More...
 
CPLListCPLListRemove (CPLList *psList, int nPosition)
 Remove the element from the specified position (zero based) in a list. More...
 
void CPLListDestroy (CPLList *psList)
 Destroy a list. More...
 
CPLListCPLListGetNext (const CPLList *psElement)
 Return the pointer to next element in a list. More...
 
void * CPLListGetData (const CPLList *psElement)
 Return pointer to the data object contained in given list element. More...
 

Detailed Description

Simplest list implementation.

List contains only pointers to stored objects, not objects itself. All operations regarding allocation and freeing memory for objects should be performed by the caller.

Typedef Documentation

◆ CPLList

typedef struct _CPLList CPLList

List element structure.

Function Documentation

◆ CPLListAppend()

CPLList* CPLListAppend ( CPLList psList,
void *  pData 
)

Append an object list and return a pointer to the modified list.

If the input list is NULL, then a new list is created.

Parameters
psListpointer to list head.
pDatapointer to inserted data object. May be NULL.
Returns
pointer to the head of modified list.

◆ CPLListCount()

int CPLListCount ( const CPLList psList)

Return the number of elements in a list.

Parameters
psListpointer to list head.
Returns
number of elements in a list.

◆ CPLListDestroy()

void CPLListDestroy ( CPLList psList)

Destroy a list.

Caller responsible for freeing data objects contained in list elements.

Parameters
psListpointer to list head.

◆ CPLListGet()

CPLList* CPLListGet ( CPLList psList,
int  nPosition 
)

Return the pointer to the specified element in a list.

Parameters
psListpointer to list head.
nPositionthe index of the element in the list, 0 being the first element.
Returns
pointer to the specified element in a list.

◆ CPLListGetData()

void* CPLListGetData ( const CPLList psElement)

Return pointer to the data object contained in given list element.

Parameters
psElementpointer to list element.
Returns
pointer to the data object contained in given list element.

◆ CPLListGetLast()

CPLList* CPLListGetLast ( CPLList *const  psList)

Return the pointer to last element in a list.

Parameters
psListpointer to list head.
Returns
pointer to last element in a list.

◆ CPLListGetNext()

CPLList* CPLListGetNext ( const CPLList psElement)

Return the pointer to next element in a list.

Parameters
psElementpointer to list element.
Returns
pointer to the list element preceded by the given element.

◆ CPLListInsert()

CPLList* CPLListInsert ( CPLList psList,
void *  pData,
int  nPosition 
)

Insert an object into list at specified position (zero based).

If the input list is NULL, then a new list is created.

Parameters
psListpointer to list head.
pDatapointer to inserted data object. May be NULL.
nPositionposition number to insert an object.
Returns
pointer to the head of modified list.

◆ CPLListRemove()

CPLList* CPLListRemove ( CPLList psList,
int  nPosition 
)

Remove the element from the specified position (zero based) in a list.

Data object contained in removed element must be freed by the caller first.

Parameters
psListpointer to list head.
nPositionposition number to delete an element.
Returns
pointer to the head of modified list.

Generated for GDAL by doxygen 1.8.13.