Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
A GOptionEntry struct defines a single option. To have an effect, they
must be added to a OptionGroup
with optionContextAddMainEntries
or optionGroupAddEntries
.
Synopsis
- newtype OptionEntry = OptionEntry (ManagedPtr OptionEntry)
- newZeroOptionEntry :: MonadIO m => m OptionEntry
- noOptionEntry :: Maybe OptionEntry
- getOptionEntryArg :: MonadIO m => OptionEntry -> m OptionArg
- setOptionEntryArg :: MonadIO m => OptionEntry -> OptionArg -> m ()
- clearOptionEntryArgData :: MonadIO m => OptionEntry -> m ()
- getOptionEntryArgData :: MonadIO m => OptionEntry -> m (Ptr ())
- setOptionEntryArgData :: MonadIO m => OptionEntry -> Ptr () -> m ()
- clearOptionEntryArgDescription :: MonadIO m => OptionEntry -> m ()
- getOptionEntryArgDescription :: MonadIO m => OptionEntry -> m (Maybe Text)
- setOptionEntryArgDescription :: MonadIO m => OptionEntry -> CString -> m ()
- clearOptionEntryDescription :: MonadIO m => OptionEntry -> m ()
- getOptionEntryDescription :: MonadIO m => OptionEntry -> m (Maybe Text)
- setOptionEntryDescription :: MonadIO m => OptionEntry -> CString -> m ()
- getOptionEntryFlags :: MonadIO m => OptionEntry -> m Int32
- setOptionEntryFlags :: MonadIO m => OptionEntry -> Int32 -> m ()
- clearOptionEntryLongName :: MonadIO m => OptionEntry -> m ()
- getOptionEntryLongName :: MonadIO m => OptionEntry -> m (Maybe Text)
- setOptionEntryLongName :: MonadIO m => OptionEntry -> CString -> m ()
- getOptionEntryShortName :: MonadIO m => OptionEntry -> m Int8
- setOptionEntryShortName :: MonadIO m => OptionEntry -> Int8 -> m ()
Exported types
newtype OptionEntry Source #
Memory-managed wrapper type.
Instances
WrappedPtr OptionEntry Source # | |
Defined in GI.GLib.Structs.OptionEntry wrappedPtrCalloc :: IO (Ptr OptionEntry) # wrappedPtrCopy :: OptionEntry -> IO OptionEntry # wrappedPtrFree :: Maybe (FunPtr (Ptr OptionEntry -> IO ())) # | |
tag ~ AttrSet => Constructible OptionEntry tag Source # | |
Defined in GI.GLib.Structs.OptionEntry new :: MonadIO m => (ManagedPtr OptionEntry -> OptionEntry) -> [AttrOp OptionEntry tag] -> m OptionEntry # |
newZeroOptionEntry :: MonadIO m => m OptionEntry Source #
Construct a OptionEntry
struct initialized to zero.
noOptionEntry :: Maybe OptionEntry Source #
A convenience alias for Nothing
:: Maybe
OptionEntry
.
Properties
arg
The type of the option, as a OptionArg
getOptionEntryArg :: MonadIO m => OptionEntry -> m OptionArg Source #
Get the value of the “arg
” field.
When overloading is enabled, this is equivalent to
get
optionEntry #arg
setOptionEntryArg :: MonadIO m => OptionEntry -> OptionArg -> m () Source #
Set the value of the “arg
” field.
When overloading is enabled, this is equivalent to
set
optionEntry [ #arg:=
value ]
argData
If the arg
type is OptionArgCallback
, then argData
must point to a OptionArgFunc
callback function, which will be
called to handle the extra argument. Otherwise, argData
is a
pointer to a location to store the value, the required type of
the location depends on the arg
type:
- OptionArgNone
: gboolean
- OptionArgString
: gchar
*
- OptionArgInt
: gint
- OptionArgFilename
: gchar
*
- OptionArgStringArray
: gchar
**
- OptionArgFilenameArray
: gchar
**
- OptionArgDouble
: gdouble
If arg
type is OptionArgString
or OptionArgFilename
,
the location will contain a newly allocated string if the option
was given. That string needs to be freed by the callee using free
.
Likewise if arg
type is OptionArgStringArray
or
OptionArgFilenameArray
, the data should be freed using strfreev
.
clearOptionEntryArgData :: MonadIO m => OptionEntry -> m () Source #
Set the value of the “arg_data
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#argData
getOptionEntryArgData :: MonadIO m => OptionEntry -> m (Ptr ()) Source #
Get the value of the “arg_data
” field.
When overloading is enabled, this is equivalent to
get
optionEntry #argData
setOptionEntryArgData :: MonadIO m => OptionEntry -> Ptr () -> m () Source #
Set the value of the “arg_data
” field.
When overloading is enabled, this is equivalent to
set
optionEntry [ #argData:=
value ]
argDescription
The placeholder to use for the extra argument parsed
by the option in --help
output. The argDescription
is translated
using the translateFunc
of the group, see
optionGroupSetTranslationDomain
.
clearOptionEntryArgDescription :: MonadIO m => OptionEntry -> m () Source #
Set the value of the “arg_description
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#argDescription
getOptionEntryArgDescription :: MonadIO m => OptionEntry -> m (Maybe Text) Source #
Get the value of the “arg_description
” field.
When overloading is enabled, this is equivalent to
get
optionEntry #argDescription
setOptionEntryArgDescription :: MonadIO m => OptionEntry -> CString -> m () Source #
Set the value of the “arg_description
” field.
When overloading is enabled, this is equivalent to
set
optionEntry [ #argDescription:=
value ]
description
the description for the option in --help
output. The description
is translated using the translateFunc
of the group, see optionGroupSetTranslationDomain
.
clearOptionEntryDescription :: MonadIO m => OptionEntry -> m () Source #
Set the value of the “description
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#description
getOptionEntryDescription :: MonadIO m => OptionEntry -> m (Maybe Text) Source #
Get the value of the “description
” field.
When overloading is enabled, this is equivalent to
get
optionEntry #description
setOptionEntryDescription :: MonadIO m => OptionEntry -> CString -> m () Source #
Set the value of the “description
” field.
When overloading is enabled, this is equivalent to
set
optionEntry [ #description:=
value ]
flags
Flags from OptionFlags
getOptionEntryFlags :: MonadIO m => OptionEntry -> m Int32 Source #
Get the value of the “flags
” field.
When overloading is enabled, this is equivalent to
get
optionEntry #flags
setOptionEntryFlags :: MonadIO m => OptionEntry -> Int32 -> m () Source #
Set the value of the “flags
” field.
When overloading is enabled, this is equivalent to
set
optionEntry [ #flags:=
value ]
longName
The long name of an option can be used to specify it
in a commandline as --long_name
. Every option must have a
long name. To resolve conflicts if multiple option groups contain
the same long name, it is also possible to specify the option as
--groupname-long_name
.
clearOptionEntryLongName :: MonadIO m => OptionEntry -> m () Source #
Set the value of the “long_name
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#longName
getOptionEntryLongName :: MonadIO m => OptionEntry -> m (Maybe Text) Source #
Get the value of the “long_name
” field.
When overloading is enabled, this is equivalent to
get
optionEntry #longName
setOptionEntryLongName :: MonadIO m => OptionEntry -> CString -> m () Source #
Set the value of the “long_name
” field.
When overloading is enabled, this is equivalent to
set
optionEntry [ #longName:=
value ]
shortName
If an option has a short name, it can be specified
-short_name
in a commandline. shortName
must be a printable
ASCII character different from '-', or zero if the option has no
short name.
getOptionEntryShortName :: MonadIO m => OptionEntry -> m Int8 Source #
Get the value of the “short_name
” field.
When overloading is enabled, this is equivalent to
get
optionEntry #shortName
setOptionEntryShortName :: MonadIO m => OptionEntry -> Int8 -> m () Source #
Set the value of the “short_name
” field.
When overloading is enabled, this is equivalent to
set
optionEntry [ #shortName:=
value ]