| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
GI.GLib.Structs.Completion
Description
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 [funcgLib.Completion.new]. Target items are
added and removed with Completion.add_items(),
Completion.remove_items() and
completionClearItems. A completion attempt is requested with
Completion.complete() or completionCompleteUtf8.
When no longer needed, the GCompletion is freed with
completionFree.
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 [typegLib.CompletionFunc] in [funcgLib.Completion.new],
which retrieves the item’s string from the data structure. You can change
the way in which strings are compared by setting a different
[typegLib.CompletionStrncmpFunc] in Completion.set_compare().
GCompletion has been marked as deprecated, since this API is rarely
used and not very actively maintained.
Synopsis
- newtype Completion = Completion (ManagedPtr Completion)
- newZeroCompletion :: MonadIO m => m Completion
- completionClearItems :: (HasCallStack, MonadIO m) => Completion -> m ()
- completionCompleteUtf8 :: (HasCallStack, MonadIO m) => Completion -> Text -> Text -> m [Text]
- completionFree :: (HasCallStack, MonadIO m) => Completion -> m ()
- clearCompletionCache :: MonadIO m => Completion -> m ()
- getCompletionCache :: MonadIO m => Completion -> m [Ptr ()]
- setCompletionCache :: MonadIO m => Completion -> Ptr (GList (Ptr ())) -> m ()
- clearCompletionFunc :: MonadIO m => Completion -> m ()
- getCompletionFunc :: MonadIO m => Completion -> m (Maybe CompletionFunc_WithClosures)
- setCompletionFunc :: MonadIO m => Completion -> FunPtr C_CompletionFunc -> m ()
- clearCompletionItems :: MonadIO m => Completion -> m ()
- getCompletionItems :: MonadIO m => Completion -> m [Ptr ()]
- setCompletionItems :: MonadIO m => Completion -> Ptr (GList (Ptr ())) -> m ()
- clearCompletionPrefix :: MonadIO m => Completion -> m ()
- getCompletionPrefix :: MonadIO m => Completion -> m (Maybe Text)
- setCompletionPrefix :: MonadIO m => Completion -> CString -> m ()
- clearCompletionStrncmpFunc :: MonadIO m => Completion -> m ()
- getCompletionStrncmpFunc :: MonadIO m => Completion -> m (Maybe CompletionStrncmpFunc)
- setCompletionStrncmpFunc :: MonadIO m => Completion -> FunPtr C_CompletionStrncmpFunc -> m ()
Exported types
newtype Completion Source #
Memory-managed wrapper type.
Constructors
| Completion (ManagedPtr Completion) |
Instances
| Eq Completion Source # | |
Defined in GI.GLib.Structs.Completion | |
| BoxedPtr Completion Source # | |
Defined in GI.GLib.Structs.Completion | |
| CallocPtr Completion Source # | |
Defined in GI.GLib.Structs.Completion Methods boxedPtrCalloc :: IO (Ptr Completion) | |
| ManagedPtrNewtype Completion Source # | |
Defined in GI.GLib.Structs.Completion Methods toManagedPtr :: Completion -> ManagedPtr Completion | |
| tag ~ 'AttrSet => Constructible Completion tag Source # | |
Defined in GI.GLib.Structs.Completion Methods new :: MonadIO m => (ManagedPtr Completion -> Completion) -> [AttrOp Completion tag] -> m Completion | |
newZeroCompletion :: MonadIO m => m Completion Source #
Construct a Completion struct initialized to zero.
Methods
Click to display all available methods, including inherited ones
clearItems
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Completion |
|
| -> m () |
Deprecated: (Since version 2.26)Rarely used API
Removes all items from the Completion. The items are not freed, so if the
memory was dynamically allocated, it should be freed after calling this
function.
completeUtf8
completionCompleteUtf8 Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Completion |
|
| -> Text |
|
| -> Text |
|
| -> m [Text] | Returns: the list of items whose strings begin with |
Deprecated: (Since version 2.26)Rarely used API
Attempts to complete the string prefix using the Completion target 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.
Since: 2.4
free
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Completion |
|
| -> m () |
Deprecated: (Since version 2.26)Rarely used API
Frees all memory used by the Completion. The items are not freed, so if
the memory was dynamically allocated, it should be freed after calling this
function.
Properties
cache
the list of items which begin with prefix.
clearCompletionCache :: MonadIO m => Completion -> m () Source #
Set the value of the “cache” field to Nothing.
When overloading is enabled, this is equivalent to
clear #cache
getCompletionCache :: MonadIO m => Completion -> m [Ptr ()] Source #
Get the value of the “cache” field.
When overloading is enabled, this is equivalent to
get completion #cache
setCompletionCache :: MonadIO m => Completion -> Ptr (GList (Ptr ())) -> m () Source #
Set the value of the “cache” field.
When overloading is enabled, this is equivalent to
setcompletion [ #cache:=value ]
func
function which is called to get the string associated with a
target item. It is Nothing if the target items are strings.
clearCompletionFunc :: MonadIO m => Completion -> m () Source #
Set the value of the “func” field to Nothing.
When overloading is enabled, this is equivalent to
clear #func
getCompletionFunc :: MonadIO m => Completion -> m (Maybe CompletionFunc_WithClosures) Source #
Get the value of the “func” field.
When overloading is enabled, this is equivalent to
get completion #func
setCompletionFunc :: MonadIO m => Completion -> FunPtr C_CompletionFunc -> m () Source #
Set the value of the “func” field.
When overloading is enabled, this is equivalent to
setcompletion [ #func:=value ]
items
list of target items (strings or data structures).
clearCompletionItems :: MonadIO m => Completion -> m () Source #
Set the value of the “items” field to Nothing.
When overloading is enabled, this is equivalent to
clear #items
getCompletionItems :: MonadIO m => Completion -> m [Ptr ()] Source #
Get the value of the “items” field.
When overloading is enabled, this is equivalent to
get completion #items
setCompletionItems :: MonadIO m => Completion -> Ptr (GList (Ptr ())) -> m () Source #
Set the value of the “items” field.
When overloading is enabled, this is equivalent to
setcompletion [ #items:=value ]
prefix
the last prefix passed to g_completion_complete() or
completionCompleteUtf8.
clearCompletionPrefix :: MonadIO m => Completion -> m () Source #
Set the value of the “prefix” field to Nothing.
When overloading is enabled, this is equivalent to
clear #prefix
getCompletionPrefix :: MonadIO m => Completion -> m (Maybe Text) Source #
Get the value of the “prefix” field.
When overloading is enabled, this is equivalent to
get completion #prefix
setCompletionPrefix :: MonadIO m => Completion -> CString -> m () Source #
Set the value of the “prefix” field.
When overloading is enabled, this is equivalent to
setcompletion [ #prefix:=value ]
strncmpFunc
The function to use when comparing strings. Use
g_completion_set_compare() to modify this function.
clearCompletionStrncmpFunc :: MonadIO m => Completion -> m () Source #
Set the value of the “strncmp_func” field to Nothing.
When overloading is enabled, this is equivalent to
clear #strncmpFunc
getCompletionStrncmpFunc :: MonadIO m => Completion -> m (Maybe CompletionStrncmpFunc) Source #
Get the value of the “strncmp_func” field.
When overloading is enabled, this is equivalent to
get completion #strncmpFunc
setCompletionStrncmpFunc :: MonadIO m => Completion -> FunPtr C_CompletionStrncmpFunc -> m () Source #
Set the value of the “strncmp_func” field.
When overloading is enabled, this is equivalent to
setcompletion [ #strncmpFunc:=value ]