Class Completion
- All Implemented Interfaces:
Proxy
GCompletion provides support for automatic completion of a string
using any group of target strings. It is typically used for file
name completion as is common in many UNIX shells.
A GCompletion is created using new_(org.gnome.glib.CompletionFunc). Target items are
added and removed with addItems(org.gnome.glib.List<java.lang.foreign.MemorySegment>),
removeItems(org.gnome.glib.List<java.lang.foreign.MemorySegment>) and
clearItems(). A completion attempt is requested with
complete(java.lang.String, java.lang.String[]) or completeUtf8(java.lang.String, java.lang.String[]).
When no longer needed, the GCompletion is freed with
free().
Items in the completion can be simple strings (e.g. filenames), or
pointers to arbitrary data structures. If data structures are used
you must provide a GLib.CompletionFunc in new_(org.gnome.glib.CompletionFunc),
which retrieves the item’s string from the data structure. You can change
the way in which strings are compared by setting a different
GLib.CompletionStrncmpFunc in setCompare(org.gnome.glib.CompletionStrncmpFunc).
GCompletion has been marked as deprecated, since this API is rarely
used and not very actively maintained.
-
Field Summary
Fields inherited from class org.javagi.base.ProxyInstance
address -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Allocate a new Completion.Completion(Arena arena) Deprecated.Allocate a new Completion.Completion(MemorySegment address) Deprecated.Create a Completion proxy instance for the provided memory address.Completion(List<MemorySegment> items, CompletionFunc func, String prefix, List<MemorySegment> cache, CompletionStrncmpFunc strncmpFunc) Deprecated.Allocate a new Completion with the fields set to the provided values.Completion(List<MemorySegment> items, CompletionFunc func, String prefix, List<MemorySegment> cache, CompletionStrncmpFunc strncmpFunc, Arena arena) Deprecated.Allocate a new Completion with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddItems(List<MemorySegment> items) Deprecated.Rarely used APIvoidDeprecated.Rarely used APIDeprecated.Rarely used APIcompleteUtf8(String prefix, String[] newPrefix) Deprecated.Rarely used APIvoidfree()Deprecated.Rarely used APIstatic MemoryLayoutDeprecated.The memory layout of the native struct.static Completionnew_(CompletionFunc func) Deprecated.Rarely used APIDeprecated.Read the value of the fieldcache.readFunc()Deprecated.Read the value of the fieldfunc.Deprecated.Read the value of the fielditems.Deprecated.Read the value of the fieldprefix.Deprecated.Read the value of the fieldstrncmp_func.voidremoveItems(List<MemorySegment> items) Deprecated.Rarely used APIvoidsetCompare(CompletionStrncmpFunc strncmpFunc) Deprecated.Rarely used APIvoidwriteCache(List<MemorySegment> cache) Deprecated.Write a value in the fieldcache.voidwriteFunc(CompletionFunc func, Arena _arena) Deprecated.Write a value in the fieldfunc.voidwriteItems(List<MemorySegment> items) Deprecated.Write a value in the fielditems.voidwritePrefix(String prefix, Arena _arena) Deprecated.Write a value in the fieldprefix.voidwriteStrncmpFunc(CompletionStrncmpFunc strncmpFunc, Arena _arena) Deprecated.Write a value in the fieldstrncmp_func.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Completion
Deprecated.Create a Completion proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Completion
Deprecated.Allocate a new Completion.- Parameters:
arena- to control the memory allocation scope
-
Completion
public Completion()Deprecated.Allocate a new Completion. The memory is allocated withArena.ofAuto(). -
Completion
public Completion(List<MemorySegment> items, CompletionFunc func, String prefix, List<MemorySegment> cache, CompletionStrncmpFunc strncmpFunc, Arena arena) Deprecated.Allocate a new Completion with the fields set to the provided values.- Parameters:
items- value for the fielditemsfunc- value for the fieldfuncprefix- value for the fieldprefixcache- value for the fieldcachestrncmpFunc- value for the fieldstrncmpFuncarena- to control the memory allocation scope
-
Completion
public Completion(List<MemorySegment> items, CompletionFunc func, String prefix, List<MemorySegment> cache, CompletionStrncmpFunc strncmpFunc) Deprecated.Allocate a new Completion with the fields set to the provided values. The memory is allocated withArena.ofAuto().- Parameters:
items- value for the fielditemsfunc- value for the fieldfuncprefix- value for the fieldprefixcache- value for the fieldcachestrncmpFunc- value for the fieldstrncmpFunc
-
-
Method Details
-
getMemoryLayout
Deprecated.The memory layout of the native struct.- Returns:
- the memory layout
-
readItems
Deprecated.Read the value of the fielditems.- Returns:
- The value of the field
items
-
writeItems
Deprecated.Write a value in the fielditems.- Parameters:
items- The new value for the fielditems
-
readFunc
Deprecated.Read the value of the fieldfunc.- Returns:
- The value of the field
func
-
writeFunc
Deprecated.Write a value in the fieldfunc.- Parameters:
func- The new value for the fieldfunc_arena- to control the memory allocation scope
-
readPrefix
Deprecated.Read the value of the fieldprefix.- Returns:
- The value of the field
prefix
-
writePrefix
-
readCache
Deprecated.Read the value of the fieldcache.- Returns:
- The value of the field
cache
-
writeCache
Deprecated.Write a value in the fieldcache.- Parameters:
cache- The new value for the fieldcache
-
readStrncmpFunc
Deprecated.Read the value of the fieldstrncmp_func.- Returns:
- The value of the field
strncmp_func
-
writeStrncmpFunc
Deprecated.Write a value in the fieldstrncmp_func.- Parameters:
strncmpFunc- The new value for the fieldstrncmp_func_arena- to control the memory allocation scope
-
new_
Deprecated.Rarely used APICreates a newGCompletion.- Parameters:
func- the function to be called to return the string representing an item in theGCompletion, ornullif strings are going to be used as theGCompletionitems.- Returns:
- the new
GCompletion.
-
addItems
Deprecated.Rarely used APIAdds items to theGCompletion.- Parameters:
items- the list of items to add.
-
clearItems
Deprecated.Rarely used APIRemoves all items from theGCompletion. The items are not freed, so if the memory was dynamically allocated, it should be freed after calling this function. -
complete
Deprecated.Rarely used APIAttempts to complete the stringprefixusing theGCompletiontarget items.- Parameters:
prefix- the prefix string, typically typed by the user, which is compared with each of the items.newPrefix- if non-null, returns the longest prefix which is common to all items that matchedprefix, ornullif no items matchedprefix. This string should be freed when no longer needed.- Returns:
- the list of items whose strings begin with
prefix. This should not be changed.
-
completeUtf8
Deprecated.Rarely used APIAttempts to complete the stringprefixusing theGCompletiontarget items. In contrast to g_completion_complete(), this function returns the largest common prefix that is a valid UTF-8 string, omitting a possible common partial character.You should use this function instead of g_completion_complete() if your items are UTF-8 strings.
- Parameters:
prefix- the prefix string, typically used by the user, which is compared with each of the itemsnewPrefix- if non-null, returns the longest prefix which is common to all items that matchedprefix, ornullif no items matchedprefix. This string should be freed when no longer needed.- Returns:
- the list of items whose strings begin with
prefix. This should not be changed. - Since:
- 2.4
-
free
Deprecated.Rarely used APIFrees all memory used by theGCompletion. The items are not freed, so if the memory was dynamically allocated, it should be freed after calling this function. -
removeItems
Deprecated.Rarely used APIRemoves items from aGCompletion. The items are not freed, so if the memory was dynamically allocated, freeitemswith g_list_free_full() after calling this function.- Parameters:
items- the items to remove.
-
setCompare
Deprecated.Rarely used APISets the function to use for string comparisons. The default string comparison function is strncmp().- Parameters:
strncmpFunc- the string comparison function.
-