libcsem  0.2
csem_list.h File Reference
#include <stddef.h>
#include "csem_common.h"

Go to the source code of this file.

Defines

#define CSEM_NS_C_BEGIN
#define CSEM_NS_C_END

Typedefs

typedef typedefCSEM_NS_C_BEGIN
struct CSEM_List 
CSEM_List
 Array List.

Functions

CSEM_ListCSEM_List_Create (size_t initial_size)
 Create a list instance.
CSEM_Error CSEM_List_Add (CSEM_List *list, const void *data)
 Add a specified element into the list.
size_t CSEM_List_Size (const CSEM_List *list)
 Get a length of the list array.
void * CSEM_List_Get (const CSEM_List *list, int index)
 Get an element of the specified index.
CSEM_Bool CSEM_List_Contains (const CSEM_List *list, const void *data)
 Test whether the list contains the specified element or not.
int CSEM_List_IndexOf (const CSEM_List *list, const void *data)
 Get an index of the specified element.
CSEM_Bool CSEM_List_IsEmpty (const CSEM_List *list)
 Test whether the list is empty or not.
void * CSEM_List_Remove (CSEM_List *list, int index)
 Remove an element of the specified index.
void * CSEM_List_Replace (CSEM_List *list, int index, const void *data)
 Replace the specified index element with the specified new one.
void CSEM_List_Clear (CSEM_List *list, CSEM_Bool free)
 Clear all elements of the list.
void CSEM_List_Dispose (CSEM_List *list, CSEM_Bool free)
 Dispose the list instance.

Define Documentation

#define CSEM_NS_C_BEGIN
#define CSEM_NS_C_END

Typedef Documentation

typedef typedefCSEM_NS_C_BEGIN struct CSEM_List CSEM_List

Array List.


Function Documentation

CSEM_Error CSEM_List_Add ( CSEM_List list,
const void *  data 
)

Add a specified element into the list.

Parameters:
list[in]list instance
data[in]a element to be added
Returns:
error code
Examples:
sample_micro_search.c, and sample_rdfa_search.c.
void CSEM_List_Clear ( CSEM_List list,
CSEM_Bool  free 
)

Clear all elements of the list.

Parameters:
list[in]list instance
free[in]a flag to free the elements or not
CSEM_Bool CSEM_List_Contains ( const CSEM_List list,
const void *  data 
)

Test whether the list contains the specified element or not.

Parameters:
list[in]list instance
data[in]an element to be tested
Returns:
CSEM_TRUE if contains
CSEM_List* CSEM_List_Create ( size_t  initial_size)

Create a list instance.

Parameters:
initial_size[in]initial size of the array list
Returns:
a newly created array list
Examples:
sample_micro_search.c, and sample_rdfa_search.c.
void CSEM_List_Dispose ( CSEM_List list,
CSEM_Bool  free 
)

Dispose the list instance.

Parameters:
list[in]list instance to be freed
free[in]a flag to free the elements or not
Examples:
sample_micro_search.c, and sample_rdfa_search.c.
void* CSEM_List_Get ( const CSEM_List list,
int  index 
)

Get an element of the specified index.

Parameters:
list[in]list instance
index[in]index of the element
Returns:
the specified element
Examples:
sample_micro_search.c, sample_micro_stream.c, sample_micro_tree.c, sample_rdfa_search.c, sample_rdfa_stream.c, and sample_rdfa_tree.c.
int CSEM_List_IndexOf ( const CSEM_List list,
const void *  data 
)

Get an index of the specified element.

Parameters:
list[in]list instance
data[in]an element
Returns:
the index

Test whether the list is empty or not.

Parameters:
list[in]list instance
Returns:
CSEM_TRUE if the list doesn't have any elements
void* CSEM_List_Remove ( CSEM_List list,
int  index 
)

Remove an element of the specified index.

Parameters:
list[in]list instance
index[in]index of the element to be removed
Returns:
the removed element
void* CSEM_List_Replace ( CSEM_List list,
int  index,
const void *  data 
)

Replace the specified index element with the specified new one.

Parameters:
list[in]list instance
index[in]index of element to be replaced
data[in]an new element
Returns:
the replaced old element
size_t CSEM_List_Size ( const CSEM_List list)

Get a length of the list array.

Parameters:
list[in]list instance
Returns:
length
Examples:
sample_micro_search.c, sample_micro_stream.c, sample_micro_tree.c, sample_rdfa_search.c, sample_rdfa_stream.c, and sample_rdfa_tree.c.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines