Package ch.bailu.gtk.glib
Class UriParamsIter
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.glib.UriParamsIter
- All Implemented Interfaces:
PointerInterface
Many URI schemes include one or more attribute/value pairs as part of the URI
value. For example `scheme://server/path?query=string&is=there` has two
attributes – `query=string` and `is=there` – in its query part.
A #GUriParamsIter structure represents an iterator that can be used to
iterate over the attribute/value pairs of a URI query string. #GUriParamsIter
structures are typically allocated on the stack and then initialized with
g_uri_params_iter_init(). See the documentation for g_uri_params_iter_init()
for a usage example.
value. For example `scheme://server/path?query=string&is=there` has two
attributes – `query=string` and `is=there` – in its query part.
A #GUriParamsIter structure represents an iterator that can be used to
iterate over the attribute/value pairs of a URI query string. #GUriParamsIter
structures are typically allocated on the stack and then initialized with
g_uri_params_iter_init(). See the documentation for g_uri_params_iter_init()
for a usage example.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClassHandler
int
void
Initializes an attribute/value pair iterator.void
Initializes an attribute/value pair iterator.Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
DUMMY0
- See Also:
-
DUMMY1
- See Also:
-
DUMMY2
- See Also:
-
-
Constructor Details
-
UriParamsIter
-
-
Method Details
-
getClassHandler
-
getFieldDummy0
public int getFieldDummy0() -
getFieldDummy1
-
getFieldDummy2
-
init
Initializes an attribute/value pair iterator.
The iterator keeps pointers to the @params and @separators arguments, those
variables must thus outlive the iterator and not be modified during the
iteration.
If %G_URI_PARAMS_WWW_FORM is passed in @flags, `+` characters in the param
string will be replaced with spaces in the output. For example, `foo=bar+baz`
will give attribute `foo` with value `bar baz`. This is commonly used on the
web (the `https` and `http` schemes only), but is deprecated in favour of
the equivalent of encoding spaces as `%20`.
Unlike with g_uri_parse_params(), %G_URI_PARAMS_CASE_INSENSITIVE has no
effect if passed to @flags for g_uri_params_iter_init(). The caller is
responsible for doing their own case-insensitive comparisons.
<!-- language="C" --> GUriParamsIter iter; GError *error = NULL; gchar *unowned_attr, *unowned_value; g_uri_params_iter_init (&iter, "foo=bar&baz=bar&Foo=frob&baz=bar2", -1, "&", G_URI_PARAMS_NONE); while (g_uri_params_iter_next (&iter, &unowned_attr, &unowned_value, &error)) { g_autofree gchar *attr = g_steal_pointer (&unowned_attr); g_autofree gchar *value = g_steal_pointer (&unowned_value); // do something with attr and value; this code will be called 4 times // for the params string in this example: once with attr=foo and value=bar, // then with baz/bar, then Foo/frob, then baz/bar2. } if (error) // handle parsing error
- Parameters:
params
- a `%`-encoded string containing `attribute=value` parameterslength
- the length of @params, or `-1` if it is nul-terminatedseparators
- the separator byte character set between parameters. (usually `&`, but sometimes `;` or both `&;`). Note that this function works on bytes not characters, so it can't be used to delimit UTF-8 strings for anything but ASCII characters. You may pass an empty set, in which case no splitting will occur.flags
- flags to modify the way the parameters are handled.
-
init
Initializes an attribute/value pair iterator.
The iterator keeps pointers to the @params and @separators arguments, those
variables must thus outlive the iterator and not be modified during the
iteration.
If %G_URI_PARAMS_WWW_FORM is passed in @flags, `+` characters in the param
string will be replaced with spaces in the output. For example, `foo=bar+baz`
will give attribute `foo` with value `bar baz`. This is commonly used on the
web (the `https` and `http` schemes only), but is deprecated in favour of
the equivalent of encoding spaces as `%20`.
Unlike with g_uri_parse_params(), %G_URI_PARAMS_CASE_INSENSITIVE has no
effect if passed to @flags for g_uri_params_iter_init(). The caller is
responsible for doing their own case-insensitive comparisons.
<!-- language="C" --> GUriParamsIter iter; GError *error = NULL; gchar *unowned_attr, *unowned_value; g_uri_params_iter_init (&iter, "foo=bar&baz=bar&Foo=frob&baz=bar2", -1, "&", G_URI_PARAMS_NONE); while (g_uri_params_iter_next (&iter, &unowned_attr, &unowned_value, &error)) { g_autofree gchar *attr = g_steal_pointer (&unowned_attr); g_autofree gchar *value = g_steal_pointer (&unowned_value); // do something with attr and value; this code will be called 4 times // for the params string in this example: once with attr=foo and value=bar, // then with baz/bar, then Foo/frob, then baz/bar2. } if (error) // handle parsing error
- Parameters:
params
- a `%`-encoded string containing `attribute=value` parameterslength
- the length of @params, or `-1` if it is nul-terminatedseparators
- the separator byte character set between parameters. (usually `&`, but sometimes `;` or both `&;`). Note that this function works on bytes not characters, so it can't be used to delimit UTF-8 strings for anything but ASCII characters. You may pass an empty set, in which case no splitting will occur.flags
- flags to modify the way the parameters are handled.
-