Top | ![]() |
![]() |
![]() |
![]() |
NkFormatString * nk_format_string_parse (gchar *string
,gunichar identifier
,GError **error
);
Parses string
NkFormatString * nk_format_string_parse_enum (gchar *string
,gunichar identifier
,const gchar * const *tokens
,guint64 size
,guint64 *used_tokens
,GError **error
);
Parses string
as nk_format_string_parse()
.
Once parsed, each reference is checked against tokens
If used_tokens
is non-NULL
, size
must be inferior or equal to 64.
If the function returns an NkFormatString, used_tokens
is filled with a bitfield
corresponding to all used tokens. Each bit set to 1 at position x
(1 << x
)
means the token x
was used.
If the function returns NULL
, used_tokens
is left untouched.
NkFormatString *
nk_format_string_ref (NkFormatString *format_string
);
Increments the reference counter of format_string
.
void
nk_format_string_unref (NkFormatString *format_string
);
Decrements the reference counter of format_string
.
If it reaches 0, free format_string
.
GVariant * (*NkFormatStringReplaceReferenceCallback) (const gchar *name
,guint64 value
,gpointer user_data
);
Retrieve the data referenced in the format string.
The function should return a GVariant containing the data referenced by name or value.
If the return value is a floating reference (see g_variant_ref_sink()
),
the NkFormatString takes ownership of it.
name |
the reference name |
|
value |
the reference value (for enum-based NkFormatString only) |
|
user_data |
user_data passed to |
gchar * nk_format_string_replace (const NkFormatString *format_string
,NkFormatStringReplaceReferenceCallback callback
,gpointer user_data
);
Replaces all references in format_string
by data retrieved by callback
.
See NkFormatStringReplaceReferenceCallback.
format_string |
||
callback |
an NkFormatStringReplaceReferenceCallback used to retrieve replacement data |
|
user_data |
user_data for |
typedef struct _NkFormatString NkFormatString;
An opaque structure holding the format string.
Wrong index value in |
||
Unknown modifier in |
||
Error in |
||
Error in |
||
Error in |
||
Wrong regex in |
||
Unknown token in enum-based format list |