Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

KList.h File Reference

Linked list structure. More...

#include "ktypes.h"

Data Structures

struct  _KList
 Linked list structure. More...

Defines

#define KList_new()   _KList_new (__K_FILE__, __K_LINE__)
 Creates an empty list.
#define KList_create(data, next)   _KList_create (data, next, __K_FILE__, __K_LINE__)
 Creates a link and initializes it.
#define KList_clone(list)   _KList_clone (list, __K_FILE__, __K_LINE__)
 Clones a list.
#define KList_append(klist, data)   _KList_append (klist, data, __K_FILE__, __K_LINE__)
 Adds an element at the end of the list.

Typedefs

typedef _KList KList
 Linked list structure.

Functions

KTL_API KList_KList_new (KString file, KInt32 line)
 Creates an empty list.
KTL_API KBool KList_init (KList *klist, KPtr data, KList *next)
 Initializes a link of the list.
KTL_API KList_KList_create (KPtr data, KList *next, KString file, KInt32 line)
 Creates a link and initializes it.
KTL_API KList_KList_clone (KList *list, KString file, KInt32 line)
 Clones a list.
KTL_API void KList_delete (KList **klist)
 Deletes a list and all its elements.
KTL_API KList_KList_append (KList *klist, KPtr data, KString file, KInt32 line)
 Adds an element at the end of the list.
KTL_API KListKList_remove_link (KList *klist, KList *link)
 Removes a link of the list.
KTL_API KListKList_remove_data (KList *klist, KPtr data)
 Removes an element of the list.
KTL_API KBool KList_contains (KList *klist, KCPtr data)
 Searches of an element in a list.
KTL_API KListKList_insert (KList *klist, KInt idx, KPtr data)
 Inserts an element at a given position in a list.
KTL_API KUInt32 KList_size (KList *klist)
 Returns the number of element of a list.
KTL_API KListKList_concat (KList *l1, KList *l2)
 Concatenates two list.
KTL_API void KList_print_str (KList *list)
 Writes to the standard output all the elements of a list (Used only for the string).
KTL_API KListKList_insert_order (KList *list, KPtr value, KFunc_cmp *cmp_func)
 Inserts an element to a list in ascending order regarding the comparison function.
KTL_API KListKList_remove_at (KList *list, KInt n)
 Removes at a given position an element from a list.
KTL_API KPtr KList_data_at (KList *list, KInt n)
 Returned an element at a given position in a list.
KTL_API KInt32 KList_indexOf (KList *list, KCPtr data)
 Returns the index of an element.


Detailed Description

Linked list structure.

Version:
KToolLib-1.0
Author:
Fabien Gallot
Date:
28/10/2008
Note:
Copyright © 2008-2010 iKlax Media SAS (www.iklaxmedia.com). All rights reserved.

Define Documentation

#define KList_append klist,
data   )     _KList_append (klist, data, __K_FILE__, __K_LINE__)
 

Adds an element at the end of the list.

Parameters:
klist the pointer to the list where element should be added
data the element to be added
Returns:
the pointer to the list with the element added if successful otherwise knull

#define KList_clone list   )     _KList_clone (list, __K_FILE__, __K_LINE__)
 

Clones a list.

Parameters:
list the pointer to the list to be cloned
Returns:
the cloned list if successful otherwise knull

#define KList_create data,
next   )     _KList_create (data, next, __K_FILE__, __K_LINE__)
 

Creates a link and initializes it.

Parameters:
data the data of the link
next the pointer to the next link of the list
Returns:
the list created if successful otherwise knull

 
#define KList_new  )     _KList_new (__K_FILE__, __K_LINE__)
 

Creates an empty list.

Returns:
the pointer to the created list if successful otherwise knull


Function Documentation

KTL_API KList* _KList_append KList klist,
KPtr  data,
KString  file,
KInt32  line
 

Adds an element at the end of the list.

Parameters:
klist the pointer to the list where element be added
data the data of the added element
file the name of the file where this function is called
line the line number where this function is called
Returns:
the pointer to the list with the element added if successful otherwise knull

KTL_API KList* _KList_clone KList list,
KString  file,
KInt32  line
 

Clones a list.

Parameters:
list the pointer to the list to be cloned
file the name of the file where this function is called
line the line number where this function is called
Returns:
the cloned list if successful otherwise knull

KTL_API KList* _KList_create KPtr  data,
KList next,
KString  file,
KInt32  line
 

Creates a link and initializes it.

Parameters:
data the data of the link
next the pointer to the next link of the list
file the name of the file where this function is called
line the line number where this function is called
Returns:
the list created if successful otherwise knull

KTL_API KList* _KList_new KString  file,
KInt32  line
 

Creates an empty list.

Parameters:
file the file name where this function is called
line the line number where this function is called
Returns:
the pointer to the created list if successful otherwise knull

KTL_API KList* KList_concat KList l1,
KList l2
 

Concatenates two list.

Parameters:
l1 the pointer to the first list
l2 the pointer to the second list
Returns:
the pointer to the concatenated list

KTL_API KBool KList_contains KList klist,
KCPtr  data
 

Searches of an element in a list.

Parameters:
klist the pointer to the list where element should be searched
data the element to be searched
Returns:
ktrue if the element is found otherwise kfalse

KTL_API KPtr KList_data_at KList list,
KInt  n
 

Returned an element at a given position in a list.

Parameters:
list the pointer to the list
n the position of the element to be returned
Returns:
the pointer to the returned element if successful otherwise knull

KTL_API void KList_delete KList **  klist  ) 
 

Deletes a list and all its elements.

Parameters:
klist the pointers to the list to be deleted

KTL_API KInt32 KList_indexOf KList list,
KCPtr  data
 

Returns the index of an element.

Parameters:
list the pointer to the list
data the pointer to the element of which index is searched
Returns:
the index of the element if it found otherwise -1

KTL_API KBool KList_init KList klist,
KPtr  data,
KList next
 

Initializes a link of the list.

Parameters:
klist the pointer to the list to be initialized
data the data of the first link
next the pointer to the next link of the list
Returns:
ktrue if successful otherwise kfalse

KTL_API KList* KList_insert KList klist,
KInt  idx,
KPtr  data
 

Inserts an element at a given position in a list.

Parameters:
klist the pointer to the list where element should be inserted
idx the position of the inserted element
data the element to be inserted
Returns:
the pointer to the list where element is inserted if successful otherwise knull

KTL_API KList* KList_insert_order KList list,
KPtr  value,
KFunc_cmp cmp_func
 

Inserts an element to a list in ascending order regarding the comparison function.

Parameters:
list the pointer to the list where element should be inserted
value the value used by the comparison function
cmp_func the pointer to the comparison function
Returns:
the pointer to the list where the element is inserted if successful otherwise knull

KTL_API void KList_print_str KList list  ) 
 

Writes to the standard output all the elements of a list (Used only for the string).

Parameters:
list the pointer to the list to be displayed

KTL_API KList* KList_remove_at KList list,
KInt  n
 

Removes at a given position an element from a list.

Parameters:
list the pointer to the list where element should be removed
n the position of the element to be removed
Returns:
the pointer to the list where the element is removed if successful otherwise knull

KTL_API KList* KList_remove_data KList klist,
KPtr  data
 

Removes an element of the list.

Parameters:
klist the pointer to the list where element should be removed
data the element to be removed
Returns:
the pointer to the list where element is removed if successful otherwise knull

KTL_API KList* KList_remove_link KList klist,
KList link
 

Removes a link of the list.

Parameters:
klist the pointer to the list where link should be removed
link the link to be removed
Returns:
the pointer to the list where link is removed if successful otherwise knull

KTL_API KUInt32 KList_size KList klist  ) 
 

Returns the number of element of a list.

Parameters:
klist the pointer to the list
Returns:
the size of the list if successful otherwise 0


Generated on Tue Mar 9 10:49:30 2010 for iKlax Tools Library (KToolLib) by doxygen 1.3.8