| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| 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 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 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
- type family ResolveCompletionMethod (t :: Symbol) o where ...
- data CompletionClearItemsMethodInfo
- completionClearItems :: (HasCallStack, MonadIO m) => Completion -> m ()
- data CompletionCompleteUtf8MethodInfo
- completionCompleteUtf8 :: (HasCallStack, MonadIO m) => Completion -> Text -> Text -> m [Text]
- data CompletionFreeMethodInfo
- completionFree :: (HasCallStack, MonadIO m) => Completion -> m ()
- clearCompletionCache :: MonadIO m => Completion -> m ()
- completion_cache :: AttrLabelProxy "cache"
- getCompletionCache :: MonadIO m => Completion -> m [Ptr ()]
- setCompletionCache :: MonadIO m => Completion -> Ptr (GList (Ptr ())) -> m ()
- clearCompletionFunc :: MonadIO m => Completion -> m ()
- completion_func :: AttrLabelProxy "func"
- getCompletionFunc :: MonadIO m => Completion -> m (Maybe CompletionFunc)
- setCompletionFunc :: MonadIO m => Completion -> FunPtr C_CompletionFunc -> m ()
- clearCompletionItems :: MonadIO m => Completion -> m ()
- completion_items :: AttrLabelProxy "items"
- getCompletionItems :: MonadIO m => Completion -> m [Ptr ()]
- setCompletionItems :: MonadIO m => Completion -> Ptr (GList (Ptr ())) -> m ()
- clearCompletionPrefix :: MonadIO m => Completion -> m ()
- completion_prefix :: AttrLabelProxy "prefix"
- getCompletionPrefix :: MonadIO m => Completion -> m (Maybe Text)
- setCompletionPrefix :: MonadIO m => Completion -> CString -> m ()
- clearCompletionStrncmpFunc :: MonadIO m => Completion -> m ()
- completion_strncmpFunc :: AttrLabelProxy "strncmpFunc"
- 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
newZeroCompletion :: MonadIO m => m Completion Source #
Construct a Completion struct initialized to zero.
Methods
Click to display all available methods, including inherited ones
type family ResolveCompletionMethod (t :: Symbol) o where ... Source #
Equations
| ResolveCompletionMethod "clearItems" o = CompletionClearItemsMethodInfo | |
| ResolveCompletionMethod "completeUtf8" o = CompletionCompleteUtf8MethodInfo | |
| ResolveCompletionMethod "free" o = CompletionFreeMethodInfo | |
| ResolveCompletionMethod l o = MethodResolutionFailed l o :: Type |
clearItems
data CompletionClearItemsMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod CompletionClearItemsMethodInfo Completion signature Source # | |
Defined in GI.GLib.Structs.Completion Methods overloadedMethod :: Completion -> signature # | |
| OverloadedMethodInfo CompletionClearItemsMethodInfo Completion Source # | |
Defined in GI.GLib.Structs.Completion Methods | |
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
data CompletionCompleteUtf8MethodInfo Source #
Instances
| (signature ~ (Text -> Text -> m [Text]), MonadIO m) => OverloadedMethod CompletionCompleteUtf8MethodInfo Completion signature Source # | |
Defined in GI.GLib.Structs.Completion Methods overloadedMethod :: Completion -> signature # | |
| OverloadedMethodInfo CompletionCompleteUtf8MethodInfo Completion Source # | |
Defined in GI.GLib.Structs.Completion Methods | |
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
data CompletionFreeMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod CompletionFreeMethodInfo Completion signature Source # | |
Defined in GI.GLib.Structs.Completion Methods overloadedMethod :: Completion -> signature # | |
| OverloadedMethodInfo CompletionFreeMethodInfo Completion Source # | |
Defined in GI.GLib.Structs.Completion Methods | |
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
completion_cache :: AttrLabelProxy "cache" Source #
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
completion_func :: AttrLabelProxy "func" Source #
getCompletionFunc :: MonadIO m => Completion -> m (Maybe CompletionFunc) 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
completion_items :: AttrLabelProxy "items" Source #
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
completion_prefix :: AttrLabelProxy "prefix" Source #
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
completion_strncmpFunc :: AttrLabelProxy "strncmpFunc" Source #
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 ]