Camel.NameValueArray

Fields

None

Methods

class

new ()

class

new_sized (reserve_size)

append (name, value)

clear ()

copy ()

equal (array_b, compare_type)

free ()

get (index)

get_length ()

get_name (index)

get_named (compare_type, name)

get_value (index)

remove (index)

remove_named (compare_type, name, all_occurrences)

set (index, name, value)

set_name (index, name)

set_named (compare_type, name, value)

set_value (index, value)

Details

class Camel.NameValueArray

New in version 3.24.

classmethod new()
Returns:

A new Camel.NameValueArray.

See: Camel.NameValueArray.new_sized, Camel.NameValueArray.copy

Return type:

Camel.NameValueArray

Creates a new Camel.NameValueArray. The returned pointer should be freed with Camel.NameValueArray.free() when no longer needed.

New in version 3.24.

classmethod new_sized(reserve_size)
Parameters:

reserve_size (int) – an array size to reserve

Returns:

A new Camel.NameValueArray.

See: Camel.NameValueArray.new, Camel.NameValueArray.copy

Return type:

Camel.NameValueArray

Creates a new Camel.NameValueArray, which has reserved reserve_size elements. This value doesn’t influence the Camel.NameValueArray.get_length(), which returns zero on the array returned from this function. The returned pointer should be freed with Camel.NameValueArray.free() when no longer needed.

New in version 3.24.

append(name, value)
Parameters:
  • name (str) – a name

  • value (str) – a value

Appends a new element of the name name and the value value at the end of self.

See: Camel.NameValueArray.set_named

New in version 3.24.

clear()

Removes all elements of the self.

New in version 3.24.

copy()
Returns:

A new copy of the self.

See: Camel.NameValueArray.new, Camel.NameValueArray.new_sized

Return type:

Camel.NameValueArray

Creates a new copy of the self. The returned pointer should be freed with Camel.NameValueArray.free() when no longer needed.

New in version 3.24.

equal(array_b, compare_type)
Parameters:
Returns:

Whether the two Camel.NameValueArray have the same content.

Return type:

bool

Compares content of the two Camel.NameValueArray and returns whether they equal. Note this is an expensive operation for large arrays.

New in version 3.24.

free()

Frees the self, previously allocated by Camel.NameValueArray.new(), Camel.NameValueArray.new_sized() or Camel.NameValueArray.copy(). If the self is None, then does nothing.

New in version 3.24.

get(index)
Parameters:

index (int) – an index

Returns:

True on success, False otherwise.

See: Camel.NameValueArray.get_name, Camel.NameValueArray.get_value, Camel.NameValueArray.get_named

out_name:

A place to store the name of the element, or None

out_value:

A place to store the value of the element, or None

Return type:

(bool, out_name: str or None, out_value: str or None)

Returns the name and the value of the element at index index. Either of the out_name and out_value can be None, to not return that Camel.part.

New in version 3.24.

get_length()
Returns:

Length of the self, aka how many elements are stored in the self.

Return type:

int

New in version 3.24.

get_name(index)
Parameters:

index (int) – an index

Returns:

Name of the element at the given index, or None on error.

See: Camel.NameValueArray.get, Camel.NameValueArray.get_value

Return type:

str or None

Returns the name of the element at index index.

New in version 3.24.

get_named(compare_type, name)
Parameters:
Returns:

Value of the first element named name, or None.

See: Camel.NameValueArray.get, Camel.NameValueArray.get_name

Return type:

str or None

Returns the value of the first element named name, or None when there is no element of such name in the self. The compare_type determines how to compare the names.

New in version 3.24.

get_value(index)
Parameters:

index (int) – an index

Returns:

Value of the element at the given index, or None on error.

See: Camel.NameValueArray.get, Camel.NameValueArray.get_name

Return type:

str or None

Returns the value of the element at index index.

New in version 3.24.

remove(index)
Parameters:

index (int) – an index to remove

Returns:

Whether the element was removed.

Return type:

bool

Removes element at index index.

New in version 3.24.

remove_named(compare_type, name, all_occurrences)
Parameters:
Returns:

How many elements had been removed.

Return type:

int

Removes elements of the self with the given name. The compare_type determines hot to compare the names. If the all_occurrences is set to True, then every elements with the name are removed, otherwise only the first occurrence is removed.

New in version 3.24.

set(index, name, value)
Parameters:
  • index (int) – an index

  • name (str) – a name

  • value (str) – a value

Returns:

Whether the self changed.

See: Camel.NameValueArray.append, Camel.NameValueArray.set_name, Camel.NameValueArray.set_value

Return type:

bool

Sets both the name and the value of the element at index index.

New in version 3.24.

set_name(index, name)
Parameters:
  • index (int) – an index

  • name (str) – a name

Returns:

Whether the self changed.

See: Camel.NameValueArray.set, Camel.NameValueArray.set_value

Return type:

bool

Sets the name of the element at index index.

New in version 3.24.

set_named(compare_type, name, value)
Parameters:
Returns:

Whether the self changed.

See: Camel.NameValueArray.append, Camel.NameValueArray.set

Return type:

bool

Finds an element named name and sets its value to value, or appends a new element, in case no such named element exists in the self yet. In case there are more elements named with name only the first occurrence is changed. The compare_type determines how to compare the names.

New in version 3.24.

set_value(index, value)
Parameters:
  • index (int) – an index

  • value (str) – a value

Returns:

Whether the self changed.

See: Camel.NameValueArray.set, Camel.NameValueArray.set_name

Return type:

bool

Sets the value of the element at index index.

New in version 3.24.