RB.RefString

Fields

None

Methods

class

equal (ap, bp)

class

find (init)

class

hash (p)

class

new (init)

class

system_init ()

class

system_shutdown ()

get ()

get_folded ()

get_sort_key ()

ref ()

unref ()

Details

class RB.RefString
classmethod equal(ap, bp)
Parameters:
Returns:

True if the strings are the same

Return type:

bool

Key equality function suitable for use with GLib.HashTable. Equality checks for RB.RefString are just pointer comparisons, since there can only be one refstring for a given string.

classmethod find(init)
Parameters:

init (str) – string to find

Returns:

existing RB.RefString, or None

Return type:

RB.RefString

Returns an existing RB.RefString for init if one exists, otherwise returns None. If an existing refstring is found, its reference count is increased.

classmethod hash(p)
Parameters:

p (object or None) – an RB.RefString

Returns:

hash value for the string underlying p

Return type:

int

Hash function suitable for use with GHashTable.

classmethod new(init)
Parameters:

init (str) – string to intern

Returns:

RB.RefString for init

Return type:

RB.RefString

Returns an RB.RefString for the specified string. If one already exists, its reference count is incremented and it is returned. Otherwise, a new RB.RefString is created and returned.

classmethod system_init()

Sets up the refstring system. Called on startup.

classmethod system_shutdown()

Frees all data associated with the refstring system. Only called on shutdown.

get()
Returns:

underlying string, must not be freed

Return type:

str

Returns the actual string for a RB.RefString.

get_folded()
Returns:

case-folded string, must not be freed

Return type:

str

Returns the case-folded version of the string underlying self. The case-folded string is cached inside the RB.RefString for speed. See rb_search_fold for information on case-folding strings.

get_sort_key()
Returns:

sort key string, must not be freed.

Return type:

str

Returns the sort key version of the string underlying self. The sort key string is cached inside the RB.RefString for speed. Sort key strings are not generally human readable, so don’t display them anywhere. See g_utf8_collate_key_for_filename for information on sort keys.

ref()
Returns:

the same refstring

Return type:

RB.RefString

Increases the reference count for an existing RB.RefString. The refstring is returned for convenience.

unref()

Drops a reference to an RB.RefString. If this is the last reference, the string will be freed.