Dee.TermList¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
||
priv |
r |
Class Details¶
- class Dee.TermList(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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:
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:
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:
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:
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_add_term(term) virtual¶
- Parameters:
term (
str
) – The term to add- Returns:
Always returns self
- Return type:
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:
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:
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:
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
.