Safe Haskell | None |
---|---|
Language | Haskell2010 |
Network.Tox.C.Options
Synopsis
- data Options = Options {}
- defaultOptions :: Options
- logLevelName :: LogLevel -> Char
- logHandler :: LogCb
- data ErrOptionsNew = ErrOptionsNewMalloc
- tox_options_new :: CErr ErrOptionsNew -> IO OptionsPtr
- toxOptionsNew :: IO (Either ErrOptionsNew OptionsPtr)
- toxOptionsFree :: OptionsPtr -> IO ()
- withToxOptions :: (OptionsPtr -> IO r) -> IO (Either ErrOptionsNew r)
- peekToxOptions :: OptionsPtr -> IO Options
- withOptions :: Options -> (OptionsPtr -> IO r) -> IO (Either ErrOptionsNew r)
Documentation
Constructors
Options | |
Fields
|
Instances
logLevelName :: LogLevel -> Char Source #
logHandler :: LogCb Source #
data ErrOptionsNew Source #
Constructors
ErrOptionsNewMalloc |
Instances
tox_options_new :: CErr ErrOptionsNew -> IO OptionsPtr Source #
Allocates a new Tox_Options object and initialises it with the default options. This function can be used to preserve long term ABI compatibility by giving the responsibility of allocation and deallocation to the Tox library.
Objects returned from this function must be freed using the tox_options_free function.
@return A new OptionsPtr
with default options or nullPtr
on failure.
toxOptionsFree :: OptionsPtr -> IO () Source #
Releases all resources associated with an options objects.
Passing a pointer that was not returned by tox_options_new results in undefined behaviour.
withToxOptions :: (OptionsPtr -> IO r) -> IO (Either ErrOptionsNew r) Source #
peekToxOptions :: OptionsPtr -> IO Options Source #
Read Options
from an OptionsPtr
.
If the passed pointer is nullPtr
, the behaviour is undefined.
withOptions :: Options -> (OptionsPtr -> IO r) -> IO (Either ErrOptionsNew r) Source #
Allocate a new C options pointer, fills in the values from Options
,
calls the processor function, and deallocates the options pointer.
The OptionsPtr
passed to the processor function is never nullPtr
. If
allocation fails, the IO action evaluates to Left
with an appropriate
error code.