LangTag.List¶
Fields¶
None
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class LangTag.List¶
All the fields in the
LangTag.List
structure are private to theLangTag.List
implementation.- classmethod free(data)¶
- Parameters:
data (
object
) – aLangTag.List
.
Frees all of the memory used by a
LangTag.List
.
- classmethod new()¶
- Returns:
a newly allocated
LangTag.List
. it has to be freed withLangTag.List.unref
().- Return type:
Creates
LangTag.List
object. this function is protected and not supposed to use in applications directly. UseLangTag.List.append
() orLangTag.List.prepend
() withNone
as the first argument to newly allocate the object.
- append(data, func)¶
- Parameters:
data (
object
) – the data for the new elementfunc (
LangTag.DestroyFunc
) – the call back function to destroy data orNone
- Returns:
the new start of the
LangTag.List
.- Return type:
Adds a new element on to the end of the list.
- delete(data)¶
- Parameters:
data (
object
) – the data of the element to remove.- Returns:
the new start of the
LangTag.List
.- Return type:
Removes an element from a
LangTag.List
. If two elements contain the same data, only the first is removed. If none of the elements contain the data, theLangTag.List
is unchanged.
- delete_link(link_)¶
- Parameters:
link (
LangTag.List
) – node to delete from self- Returns:
the new head of self
- Return type:
Removes the node link_ from the self and frees it.
- find(data)¶
- Parameters:
data (
object
) – the element data to find- Returns:
the found
LangTag.List
element, orNone
if it’s not found- Return type:
Finds the element in a
LangTag.List
which contains the given data.
- find_custom(data, func)¶
- Parameters:
data (
object
) – the data passed to the functionfunc (
LangTag.CompareFunc
) – the function to call for each element. It should return 0 when the desired element is found
- Returns:
the found
LangTag.List
element, orNone
if it’s not found- Return type:
Finds an element in a
LangTag.List
, using a supplied function to find the desired element. It iterates over the list, calling the given function which should return 0 when the desired element is found. The function takes two const #LtPointer arguments, theLangTag.List
element’s data as the first argument and the given data.
- first()¶
- Returns:
the first element in the
LangTag.List
orNone
if theLangTag.List
has no elements.- Return type:
Gets the first element in a
LangTag.List
.
- last()¶
- Returns:
the last element in the
LangTag.List
orNone
if theLangTag.List
has no elements.- Return type:
Gets the last element in a
LangTag.List
.
- length()¶
- Returns:
the number of elements in the
LangTag.List
.- Return type:
Gets the number of elements in a
LangTag.List
.
- next()¶
- Returns:
the next element, or
None
if there are no more elements.- Return type:
Gets the next element in a
LangTag.List
.
- pop(data)¶
- Parameters:
data (
object
) – a pointer to set the data in the first element- Returns:
the new head of self.
- Return type:
Sets the data in the first element to data and drop the element.
- prepend(data, func)¶
- Parameters:
data (
object
) – the data for the new elementfunc (
LangTag.DestroyFunc
) – the call back function to destroy data orNone
- Returns:
the new start of the
LangTag.List
.- Return type:
Adds a new element on to the start of the list.
- previous()¶
- Returns:
the previous element, or
None
if there are no previous elements.- Return type:
Gets the previous element in a
LangTag.List
.
- ref()¶
- Returns:
the same self object.
- Return type:
Increases the reference count of self.
- remove(data)¶
- Parameters:
data (
object
) – the data of the element to remove.- Returns:
the new start of the
LangTag.List
.- Return type:
Removes an element from a
LangTag.List
. If two elements contain the same data, only the first is removed. If none of the elements contain the data, theLangTag.List
is unchanged. This works similar toLangTag.List.delete
() though, the difference is this won’t calls the finalizer to destroy the data in the element.
- sort(func)¶
- Parameters:
func (
LangTag.CompareFunc
) – the comparison function used to sort theLangTag.List
. This function is passed the data from 2 elements of theLangTag.List
and should return 0 if they are equal, a negative value if the first element comes before the second, or a positive value if the first element comes after the second.- Returns:
the start of the sorted
LangTag.List
- Return type:
Sorts a
LangTag.List
using the given comparison function.
- unref()¶
Decreases the reference count of self. when its reference count drops to 0, the object is finalized (i.e. its memory is freed).
- value()¶
- Returns:
a pointer to be set to the
LangTag.List
.- Return type:
Gets a value in a
LangTag.List
.