Dee.TermList

g Dee.TermList Dee.TermList GObject.Object GObject.Object GObject.Object->Dee.TermList

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

add_term (term)

clear ()

clone ()

get_term (n)

num_terms ()

Virtual Methods

Inherited:

GObject.Object (7)

do_add_term (term)

do_clear ()

do_clone ()

do_get_term (n)

do_num_terms ()

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

priv

Dee.TermListPrivate

r

Class Details

class Dee.TermList(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Dee.TermListClass

All fields in the Dee.TermList structure are private and should never be accessed directly

add_term(term)
Parameters:

term (str) – The term to add

Returns:

Always returns self

Return type:

Dee.TermList

Add a term to the termlist. Note that it is possible to add a term multiple times. The effect of this is determined by the #DeeModelIndex consuming the Dee.TermList.

clear()
Returns:

Always returns self

Return type:

Dee.TermList

Remove all terms from a term list making it ready for reuse. Note that term list implementations will often have optimized memory allocation schemes so reuse is often more efficient than allocating a new term list each time you need it.

clone()
Returns:

A newly allocated term list. Free with GObject.Object.unref().

Return type:

Dee.TermList

Create a copy of self that shares the underlying string pool and containing a list of terms as currently set in self.

Subsequently freeing the original and keeping the clone around is not a problem. The clone works as a standalone term list. The only gotcha may be threading issues because of concurrent access to the shared string pool.

Creating a clone very efficient since only very little memory allocation is required. It’s advised that you use a clone instead a new instance whenever you work over a common corpus of strings.

It is also worth noting that terms obtained from the original term list and a clone can be compared directly as pointers (fx. with GLib.direct_equal()). This is because they share the underlying string pool.

get_term(n)
Parameters:

n (int) – The (zero based) offset into the term list

Returns:

The n th string held in the term list

Return type:

str

Get the n’th term in the list.

Note that in the default implementation it is guaranteed that the returned string is valid for the entire lifetime of the Dee.TermList.

num_terms()
Returns:

The number of terms in the term list

Return type:

int

do_add_term(term) virtual
Parameters:

term (str) – The term to add

Returns:

Always returns self

Return type:

Dee.TermList

Add a term to the termlist. Note that it is possible to add a term multiple times. The effect of this is determined by the #DeeModelIndex consuming the Dee.TermList.

do_clear() virtual
Returns:

Always returns self

Return type:

Dee.TermList

Remove all terms from a term list making it ready for reuse. Note that term list implementations will often have optimized memory allocation schemes so reuse is often more efficient than allocating a new term list each time you need it.

do_clone() virtual
Returns:

A newly allocated term list. Free with GObject.Object.unref().

Return type:

Dee.TermList

Create a copy of self that shares the underlying string pool and containing a list of terms as currently set in self.

Subsequently freeing the original and keeping the clone around is not a problem. The clone works as a standalone term list. The only gotcha may be threading issues because of concurrent access to the shared string pool.

Creating a clone very efficient since only very little memory allocation is required. It’s advised that you use a clone instead a new instance whenever you work over a common corpus of strings.

It is also worth noting that terms obtained from the original term list and a clone can be compared directly as pointers (fx. with GLib.direct_equal()). This is because they share the underlying string pool.

do_get_term(n) virtual
Parameters:

n (int) – The (zero based) offset into the term list

Returns:

The n th string held in the term list

Return type:

str

Get the n’th term in the list.

Note that in the default implementation it is guaranteed that the returned string is valid for the entire lifetime of the Dee.TermList.

do_num_terms() virtual
Returns:

The number of terms in the term list

Return type:

int