gi-glib-2.0.24: GLib bindings

Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.GLib.Structs.OptionEntry

Contents

- Exported types
- Methods
  - Overloaded methods
- Properties
  - arg
  - argData
  - argDescription
  - description
  - flags
  - longName
  - shortName

Description

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
- 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.

Constructors

OptionEntry (ManagedPtr OptionEntry) |

#### Instances

Instances details

Eq OptionEntry Source # |
Instance details Defined in GI.GLib.Structs.OptionEntry Methods (==) :: OptionEntry -> OptionEntry -> Bool # (/=) :: OptionEntry -> OptionEntry -> Bool #
ManagedPtrNewtype OptionEntry Source # |
Instance details Defined in GI.GLib.Structs.OptionEntry Methods toManagedPtr :: OptionEntry -> ManagedPtr OptionEntry Source #
BoxedPtr OptionEntry Source # |
Instance details Defined in GI.GLib.Structs.OptionEntry Methods boxedPtrCopy :: OptionEntry -> IO OptionEntry Source # boxedPtrFree :: OptionEntry -> IO () Source #
CallocPtr OptionEntry Source # |
Instance details Defined in GI.GLib.Structs.OptionEntry Methods boxedPtrCalloc :: IO (Ptr OptionEntry) Source #
tag ~ 'AttrSet => Constructible OptionEntry tag Source # |
Instance details Defined in GI.GLib.Structs.OptionEntry Methods new :: MonadIO m => (ManagedPtr OptionEntry -> OptionEntry) -> [AttrOp OptionEntry tag] -> m OptionEntry Source #

newZeroOptionEntry :: MonadIO m => m OptionEntry Source #

Construct a `OptionEntry` struct initialized to zero.

# Methods

## Overloaded methods

# 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 ]