Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
No description available in the introspection data.
Synopsis
- newtype BuildableParseContext = BuildableParseContext (ManagedPtr BuildableParseContext)
- buildableParseContextGetElement :: (HasCallStack, MonadIO m) => BuildableParseContext -> m (Maybe Text)
- buildableParseContextGetElementStack :: (HasCallStack, MonadIO m) => BuildableParseContext -> m [Text]
- buildableParseContextGetPosition :: (HasCallStack, MonadIO m) => BuildableParseContext -> m (Int32, Int32)
- buildableParseContextPop :: (HasCallStack, MonadIO m) => BuildableParseContext -> m (Ptr ())
- buildableParseContextPush :: (HasCallStack, MonadIO m) => BuildableParseContext -> BuildableParser -> Ptr () -> m ()
Exported types
newtype BuildableParseContext Source #
Memory-managed wrapper type.
BuildableParseContext (ManagedPtr BuildableParseContext) |
Instances
Eq BuildableParseContext Source # | |
Defined in GI.Gtk.Structs.BuildableParseContext (==) :: BuildableParseContext -> BuildableParseContext -> Bool # (/=) :: BuildableParseContext -> BuildableParseContext -> Bool # | |
BoxedPtr BuildableParseContext Source # | |
Defined in GI.Gtk.Structs.BuildableParseContext | |
ManagedPtrNewtype BuildableParseContext Source # | |
Defined in GI.Gtk.Structs.BuildableParseContext toManagedPtr :: BuildableParseContext -> ManagedPtr BuildableParseContext |
Methods
Click to display all available methods, including inherited ones
getElement
buildableParseContextGetElement Source #
:: (HasCallStack, MonadIO m) | |
=> BuildableParseContext |
|
-> m (Maybe Text) | Returns: the name of the currently open element, or |
Retrieves the name of the currently open element.
If called from the start_element or end_element handlers this will
give the element_name as passed to those functions. For the parent
elements, see buildableParseContextGetElementStack
.
getElementStack
buildableParseContextGetElementStack Source #
:: (HasCallStack, MonadIO m) | |
=> BuildableParseContext |
|
-> m [Text] | Returns: the element stack, which must not be modified |
Retrieves the element stack from the internal state of the parser.
The returned PtrArray
is an array of strings where the last item is
the currently open tag (as would be returned by
buildableParseContextGetElement
) and the previous item is its
immediate parent.
This function is intended to be used in the start_element and
end_element handlers where buildableParseContextGetElement
would merely return the name of the element that is being
processed.
getPosition
buildableParseContextGetPosition Source #
:: (HasCallStack, MonadIO m) | |
=> BuildableParseContext |
|
-> m (Int32, Int32) |
Retrieves the current line number and the number of the character on that line. Intended for use in error messages; there are no strict semantics for what constitutes the "current" line number other than "the best number we could come up with for error messages."
pop
buildableParseContextPop Source #
:: (HasCallStack, MonadIO m) | |
=> BuildableParseContext |
|
-> m (Ptr ()) | Returns: the user data passed to |
Completes the process of a temporary sub-parser redirection.
This function exists to collect the user_data allocated by a
matching call to buildableParseContextPush
. It must be called
in the end_element handler corresponding to the start_element
handler during which buildableParseContextPush
was called.
You must not call this function from the error callback -- the
userData
is provided directly to the callback in that case.
This function is not intended to be directly called by users interested in invoking subparsers. Instead, it is intended to be used by the subparsers themselves to implement a higher-level interface.
push
buildableParseContextPush Source #
:: (HasCallStack, MonadIO m) | |
=> BuildableParseContext |
|
-> BuildableParser |
|
-> Ptr () |
|
-> m () |
Temporarily redirects markup data to a sub-parser.
This function may only be called from the start_element handler of
a BuildableParser
. It must be matched with a corresponding call to
buildableParseContextPop
in the matching end_element handler
(except in the case that the parser aborts due to an error).
All tags, text and other data between the matching tags is
redirected to the subparser given by parser
. userData
is used
as the user_data for that parser. userData
is also passed to the
error callback in the event that an error occurs. This includes
errors that occur in subparsers of the subparser.
The end tag matching the start tag for which this call was made is
handled by the previous parser (which is given its own user_data)
which is why buildableParseContextPop
is provided to allow "one
last access" to the userData
provided to this function. In the
case of error, the userData
provided here is passed directly to
the error callback of the subparser and buildableParseContextPop
should not be called. In either case, if userData
was allocated
then it ought to be freed from both of these locations.
This function is not intended to be directly called by users interested in invoking subparsers. Instead, it is intended to be used by the subparsers themselves to implement a higher-level interface.
For an example of how to use this, see markupParseContextPush
which
has the same kind of API.