Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
Safe Haskell | None |
Language | Haskell2010 |
The Sequence
struct is an opaque data type representing a
[sequence][glib-Sequences] data type.
Synopsis
- newtype Sequence = Sequence (ManagedPtr Sequence)
- noSequence :: Maybe Sequence
- sequenceAppend :: (HasCallStack, MonadIO m) => Sequence -> Ptr () -> m SequenceIter
- sequenceFree :: (HasCallStack, MonadIO m) => Sequence -> m ()
- sequenceGet :: (HasCallStack, MonadIO m) => SequenceIter -> m (Ptr ())
- sequenceGetBeginIter :: (HasCallStack, MonadIO m) => Sequence -> m SequenceIter
- sequenceGetEndIter :: (HasCallStack, MonadIO m) => Sequence -> m SequenceIter
- sequenceGetIterAtPos :: (HasCallStack, MonadIO m) => Sequence -> Int32 -> m SequenceIter
- sequenceGetLength :: (HasCallStack, MonadIO m) => Sequence -> m Int32
- sequenceInsertBefore :: (HasCallStack, MonadIO m) => SequenceIter -> Ptr () -> m SequenceIter
- sequenceIsEmpty :: (HasCallStack, MonadIO m) => Sequence -> m Bool
- sequenceMove :: (HasCallStack, MonadIO m) => SequenceIter -> SequenceIter -> m ()
- sequenceMoveRange :: (HasCallStack, MonadIO m) => SequenceIter -> SequenceIter -> SequenceIter -> m ()
- sequencePrepend :: (HasCallStack, MonadIO m) => Sequence -> Ptr () -> m SequenceIter
- sequenceRangeGetMidpoint :: (HasCallStack, MonadIO m) => SequenceIter -> SequenceIter -> m SequenceIter
- sequenceRemove :: (HasCallStack, MonadIO m) => SequenceIter -> m ()
- sequenceRemoveRange :: (HasCallStack, MonadIO m) => SequenceIter -> SequenceIter -> m ()
- sequenceSet :: (HasCallStack, MonadIO m) => SequenceIter -> Ptr () -> m ()
- sequenceSwap :: (HasCallStack, MonadIO m) => SequenceIter -> SequenceIter -> m ()
Exported types
Memory-managed wrapper type.
Instances
WrappedPtr Sequence Source # | |
Defined in GI.GLib.Structs.Sequence wrappedPtrCalloc :: IO (Ptr Sequence) # wrappedPtrCopy :: Sequence -> IO Sequence # |
Methods
append
:: (HasCallStack, MonadIO m) | |
=> Sequence |
|
-> Ptr () |
|
-> m SequenceIter | Returns: an iterator pointing to the new item |
Adds a new item to the end of seq
.
Since: 2.14
free
:: (HasCallStack, MonadIO m) | |
=> Sequence |
|
-> m () |
Frees the memory allocated for seq
. If seq
has a data destroy
function associated with it, that function is called on all items
in seq
.
Since: 2.14
get
:: (HasCallStack, MonadIO m) | |
=> SequenceIter |
|
-> m (Ptr ()) | Returns: the data that |
Returns the data that iter
points to.
Since: 2.14
getBeginIter
:: (HasCallStack, MonadIO m) | |
=> Sequence |
|
-> m SequenceIter | Returns: the begin iterator for |
Returns the begin iterator for seq
.
Since: 2.14
getEndIter
:: (HasCallStack, MonadIO m) | |
=> Sequence |
|
-> m SequenceIter | Returns: the end iterator for |
Returns the end iterator for seg
Since: 2.14
getIterAtPos
:: (HasCallStack, MonadIO m) | |
=> Sequence |
|
-> Int32 |
|
-> m SequenceIter | Returns: The |
Returns the iterator at position pos
. If pos
is negative or larger
than the number of items in seq
, the end iterator is returned.
Since: 2.14
getLength
:: (HasCallStack, MonadIO m) | |
=> Sequence |
|
-> m Int32 | Returns: the length of |
Returns the length of seq
. Note that this method is O(h) where `h' is the
height of the tree. It is thus more efficient to use sequenceIsEmpty
when comparing the length to zero.
Since: 2.14
insertBefore
:: (HasCallStack, MonadIO m) | |
=> SequenceIter |
|
-> Ptr () |
|
-> m SequenceIter | Returns: an iterator pointing to the new item |
Inserts a new item just before the item pointed to by iter
.
Since: 2.14
isEmpty
:: (HasCallStack, MonadIO m) | |
=> Sequence |
|
-> m Bool |
Returns True
if the sequence contains zero items.
This function is functionally identical to checking the result of
sequenceGetLength
being equal to zero. However this function is
implemented in O(1) running time.
Since: 2.48
move
:: (HasCallStack, MonadIO m) | |
=> SequenceIter |
|
-> SequenceIter |
|
-> m () |
Moves the item pointed to by src
to the position indicated by dest
.
After calling this function dest
will point to the position immediately
after src
. It is allowed for src
and dest
to point into different
sequences.
Since: 2.14
moveRange
:: (HasCallStack, MonadIO m) | |
=> SequenceIter |
|
-> SequenceIter |
|
-> SequenceIter |
|
-> m () |
Inserts the (begin
, end
) range at the destination pointed to by dest
.
The begin
and end
iters must point into the same sequence. It is
allowed for dest
to point to a different sequence than the one pointed
into by begin
and end
.
If dest
is Nothing
, the range indicated by begin
and end
is
removed from the sequence. If dest
points to a place within
the (begin
, end
) range, the range does not move.
Since: 2.14
prepend
:: (HasCallStack, MonadIO m) | |
=> Sequence |
|
-> Ptr () |
|
-> m SequenceIter | Returns: an iterator pointing to the new item |
Adds a new item to the front of seq
Since: 2.14
rangeGetMidpoint
sequenceRangeGetMidpoint Source #
:: (HasCallStack, MonadIO m) | |
=> SequenceIter |
|
-> SequenceIter |
|
-> m SequenceIter | Returns: a |
Finds an iterator somewhere in the range (begin
, end
). This
iterator will be close to the middle of the range, but is not
guaranteed to be exactly in the middle.
The begin
and end
iterators must both point to the same sequence
and begin
must come before or be equal to end
in the sequence.
Since: 2.14
remove
:: (HasCallStack, MonadIO m) | |
=> SequenceIter |
|
-> m () |
Removes the item pointed to by iter
. It is an error to pass the
end iterator to this function.
If the sequence has a data destroy function associated with it, this function is called on the data for the removed item.
Since: 2.14
removeRange
:: (HasCallStack, MonadIO m) | |
=> SequenceIter |
|
-> SequenceIter |
|
-> m () |
Removes all items in the (begin
, end
) range.
If the sequence has a data destroy function associated with it, this function is called on the data for the removed items.
Since: 2.14
set
:: (HasCallStack, MonadIO m) | |
=> SequenceIter |
|
-> Ptr () |
|
-> m () |
Changes the data for the item pointed to by iter
to be data
. If
the sequence has a data destroy function associated with it, that
function is called on the existing data that iter
pointed to.
Since: 2.14
swap
:: (HasCallStack, MonadIO m) | |
=> SequenceIter |
|
-> SequenceIter |
|
-> m () |
Swaps the items pointed to by a
and b
. It is allowed for a
and b
to point into difference sequences.
Since: 2.14