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 |
GI.GLib.Structs.StringChunk
Description
An opaque data structure representing String Chunks. It should only be accessed by using the following functions.
- newtype StringChunk = StringChunk (ManagedPtr StringChunk)
- noStringChunk :: Maybe StringChunk
- data StringChunkClearMethodInfo
- stringChunkClear :: (HasCallStack, MonadIO m) => StringChunk -> m ()
- data StringChunkFreeMethodInfo
- stringChunkFree :: (HasCallStack, MonadIO m) => StringChunk -> m ()
- data StringChunkInsertMethodInfo
- stringChunkInsert :: (HasCallStack, MonadIO m) => StringChunk -> Text -> m Text
- data StringChunkInsertConstMethodInfo
- stringChunkInsertConst :: (HasCallStack, MonadIO m) => StringChunk -> Text -> m Text
- data StringChunkInsertLenMethodInfo
- stringChunkInsertLen :: (HasCallStack, MonadIO m) => StringChunk -> Text -> Int64 -> m Text
Exported types
newtype StringChunk #
Constructors
StringChunk (ManagedPtr StringChunk) |
Instances
WrappedPtr StringChunk # | |
((~) * info (ResolveStringChunkMethod t StringChunk), MethodInfo * info StringChunk p) => IsLabel t (StringChunk -> p) # | |
((~) * info (ResolveStringChunkMethod t StringChunk), MethodInfo * info StringChunk p) => IsLabelProxy t (StringChunk -> p) # | |
HasAttributeList * StringChunk # | |
((~) * signature (Text -> Int64 -> m Text), MonadIO m) => MethodInfo * StringChunkInsertLenMethodInfo StringChunk signature # | |
((~) * signature (Text -> m Text), MonadIO m) => MethodInfo * StringChunkInsertConstMethodInfo StringChunk signature # | |
((~) * signature (Text -> m Text), MonadIO m) => MethodInfo * StringChunkInsertMethodInfo StringChunk signature # | |
((~) * signature (m ()), MonadIO m) => MethodInfo * StringChunkFreeMethodInfo StringChunk signature # | |
((~) * signature (m ()), MonadIO m) => MethodInfo * StringChunkClearMethodInfo StringChunk signature # | |
type AttributeList StringChunk # | |
Methods
clear
data StringChunkClearMethodInfo #
Instances
((~) * signature (m ()), MonadIO m) => MethodInfo * StringChunkClearMethodInfo StringChunk signature # | |
Arguments
:: (HasCallStack, MonadIO m) | |
=> StringChunk |
|
-> m () |
Frees all strings contained within the StringChunk
.
After calling stringChunkClear
it is not safe to
access any of the strings which were contained within it.
Since: 2.14
free
data StringChunkFreeMethodInfo #
Instances
((~) * signature (m ()), MonadIO m) => MethodInfo * StringChunkFreeMethodInfo StringChunk signature # | |
Arguments
:: (HasCallStack, MonadIO m) | |
=> StringChunk |
|
-> m () |
Frees all memory allocated by the StringChunk
.
After calling stringChunkFree
it is not safe to
access any of the strings which were contained within it.
insert
data StringChunkInsertMethodInfo #
Instances
((~) * signature (Text -> m Text), MonadIO m) => MethodInfo * StringChunkInsertMethodInfo StringChunk signature # | |
Arguments
:: (HasCallStack, MonadIO m) | |
=> StringChunk |
|
-> Text |
|
-> m Text | Returns: a pointer to the copy of |
Adds a copy of string
to the StringChunk
.
It returns a pointer to the new copy of the string
in the StringChunk
. The characters in the string
can be changed, if necessary, though you should not
change anything after the end of the string.
Unlike stringChunkInsertConst
, this function
does not check for duplicates. Also strings added
with stringChunkInsert
will not be searched
by stringChunkInsertConst
when looking for
duplicates.
insertConst
data StringChunkInsertConstMethodInfo #
Instances
((~) * signature (Text -> m Text), MonadIO m) => MethodInfo * StringChunkInsertConstMethodInfo StringChunk signature # | |
Arguments
:: (HasCallStack, MonadIO m) | |
=> StringChunk |
|
-> Text |
|
-> m Text | Returns: a pointer to the new or existing copy of |
Adds a copy of string
to the StringChunk
, unless the same
string has already been added to the StringChunk
with
stringChunkInsertConst
.
This function is useful if you need to copy a large number of strings but do not want to waste space storing duplicates. But you must remember that there may be several pointers to the same string, and so any changes made to the strings should be done very carefully.
Note that stringChunkInsertConst
will not return a
pointer to a string added with stringChunkInsert
, even
if they do match.
insertLen
data StringChunkInsertLenMethodInfo #
Instances
((~) * signature (Text -> Int64 -> m Text), MonadIO m) => MethodInfo * StringChunkInsertLenMethodInfo StringChunk signature # | |
Arguments
:: (HasCallStack, MonadIO m) | |
=> StringChunk |
|
-> Text |
|
-> Int64 |
|
-> m Text | Returns: a pointer to the copy of |
Adds a copy of the first len
bytes of string
to the StringChunk
.
The copy is nul-terminated.
Since this function does not stop at nul bytes, it is the caller's
responsibility to ensure that string
has at least len
addressable
bytes.
The characters in the returned string can be changed, if necessary, though you should not change anything after the end of the string.
Since: 2.4