LangTag.List

Fields

None

Methods

class

free (data)

class

new ()

append (data, func)

delete (data)

delete_link (link_)

find (data)

find_custom (data, func)

first ()

last ()

length ()

next ()

pop (data)

prepend (data, func)

previous ()

ref ()

remove (data)

sort (func)

unref ()

value ()

Details

class LangTag.List

All the fields in the LangTag.List structure are private to the LangTag.List implementation.

classmethod free(data)
Parameters:

data (object) – a LangTag.List.

Frees all of the memory used by a LangTag.List.

classmethod new()
Returns:

a newly allocated LangTag.List. it has to be freed with LangTag.List.unref().

Return type:

LangTag.List

Creates LangTag.List object. this function is protected and not supposed to use in applications directly. Use LangTag.List.append() or LangTag.List.prepend() with None as the first argument to newly allocate the object.

append(data, func)
Parameters:
Returns:

the new start of the LangTag.List.

Return type:

LangTag.List

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:

LangTag.List

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, the LangTag.List is unchanged.

Parameters:

link (LangTag.List) – node to delete from self

Returns:

the new head of self

Return type:

LangTag.List

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, or None if it’s not found

Return type:

LangTag.List

Finds the element in a LangTag.List which contains the given data.

find_custom(data, func)
Parameters:
  • data (object) – the data passed to the function

  • func (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, or None if it’s not found

Return type:

LangTag.List

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, the LangTag.List element’s data as the first argument and the given data.

first()
Returns:

the first element in the LangTag.List or None if the LangTag.List has no elements.

Return type:

LangTag.List

Gets the first element in a LangTag.List.

last()
Returns:

the last element in the LangTag.List or None if the LangTag.List has no elements.

Return type:

LangTag.List

Gets the last element in a LangTag.List.

length()
Returns:

the number of elements in the LangTag.List.

Return type:

int

Gets the number of elements in a LangTag.List.

next()
Returns:

the next element, or None if there are no more elements.

Return type:

LangTag.List

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:

LangTag.List

Sets the data in the first element to data and drop the element.

prepend(data, func)
Parameters:
Returns:

the new start of the LangTag.List.

Return type:

LangTag.List

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:

LangTag.List

Gets the previous element in a LangTag.List.

ref()
Returns:

the same self object.

Return type:

LangTag.List

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:

LangTag.List

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, the LangTag.List is unchanged. This works similar to LangTag.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 the LangTag.List. This function is passed the data from 2 elements of the LangTag.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:

LangTag.List

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:

object

Gets a value in a LangTag.List.