![]() |
![]() |
![]() |
Wocky Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
gboolean wocky_strdiff (const gchar *left
,const gchar *right
); gchar * wocky_normalise_jid (const gchar *jid
); gboolean wocky_decode_jid (const gchar *jid
,gchar **node
,gchar **domain
,gchar **resource
); gchar * wocky_compose_jid (const gchar *node
,const gchar *domain
,const gchar *resource
); GValue * wocky_g_value_slice_new (GType type
); GValue * wocky_g_value_slice_new_boolean (gboolean b
); GValue * wocky_g_value_slice_new_int (gint n
); GValue * wocky_g_value_slice_new_int64 (gint64 n
); GValue * wocky_g_value_slice_new_uint (guint n
); GValue * wocky_g_value_slice_new_uint64 (guint64 n
); GValue * wocky_g_value_slice_new_double (double d
); GValue * wocky_g_value_slice_new_string (const gchar *string
); GValue * wocky_g_value_slice_new_static_string (const gchar *string
); GValue * wocky_g_value_slice_new_take_string (gchar *string
); GValue * wocky_g_value_slice_new_boxed (GType type
,gconstpointer p
); GValue * wocky_g_value_slice_new_static_boxed (GType type
,gconstpointer p
); GValue * wocky_g_value_slice_new_take_boxed (GType type
,gpointer p
); void wocky_g_value_slice_free (GValue *value
); GValue * wocky_g_value_slice_dup (const GValue *value
); gboolean wocky_enum_from_nick (GType enum_type
,const gchar *nick
,gint *value
); const gchar * wocky_enum_to_nick (GType enum_type
,gint value
); gchar * wocky_absolutize_path (const gchar *path
); GList * wocky_list_deep_copy (GBoxedCopyFunc copy
,GList *items
); GString * wocky_g_string_dup (const GString *str
); void wocky_g_string_free (GString *str
); #define wocky_implement_finish_void (source, tag) #define wocky_implement_finish_copy_pointer (source, tag, copy_func, out_param) #define wocky_implement_finish_return_copy_pointer(source, tag, copy_func) #define wocky_implement_finish_return_pointer(source, tag)
gboolean wocky_strdiff (const gchar *left
,const gchar *right
);
Return TRUE
if the given strings are different. Unlike strcmp this
function will handle null pointers, treating them as distinct from any
string.
gchar * wocky_normalise_jid (const gchar *jid
);
|
a JID |
Returns : |
a normalised JID, using the same rules as wocky_decode_jid() ,
or NULL if the JID could not be sensibly decoded.
This value should be freed when you are done with it. |
gboolean wocky_decode_jid (const gchar *jid
,gchar **node
,gchar **domain
,gchar **resource
);
If jid
is valid, returns TRUE
and sets the caller's node
, domain
and
resource
pointers. node
and resource
will be set to NULL
if the
respective part is not present in jid
. If jid
is invalid, sets node
,
domain
and resource
to NULL
and returns FALSE
.
In theory, the returned parts will be normalised as specified in RFC 6122 (XMPP Address Format); in practice, Wocky does not fully implement the normalisation and validation algorithms. FIXME: Do nodeprep/resourceprep and length checking.
|
a JID |
|
address to store the normalised localpart of the JID. [allow-none] |
|
address to store the normalised domainpart of the JID. [allow-none] |
|
address to store the resourcepart of the JID |
Returns : |
TRUE if the JID is valid |
gchar * wocky_compose_jid (const gchar *node
,const gchar *domain
,const gchar *resource
);
Composes a JID from its parts. If node
is empty or NULL
, the '@'
separator is also omitted; if resource
is empty or NULL
, the '/' separator
is also omitted. node
and domain
are assumed to have already been
normalised.
GValue * wocky_g_value_slice_new (GType type
);
Slice-allocate an empty GValue. wocky_g_value_slice_new_boolean()
and similar
functions are likely to be more convenient to use for the types supported.
|
The type desired for the new GValue |
Returns : |
a newly allocated, newly initialized GValue, to be freed with
wocky_g_value_slice_free() or g_slice_free() . |
Since 0.5.14
GValue * wocky_g_value_slice_new_boolean (gboolean b
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
a boolean value |
Returns : |
a GValue of type G_TYPE_BOOLEAN with value b , to be freed with
wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
GValue * wocky_g_value_slice_new_int (gint n
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
an integer |
Returns : |
a GValue of type G_TYPE_INT with value n , to be freed with
wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
GValue * wocky_g_value_slice_new_int64 (gint64 n
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
a 64-bit integer |
Returns : |
a GValue of type G_TYPE_INT64 with value n , to be freed with
wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
GValue * wocky_g_value_slice_new_uint (guint n
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
an unsigned integer |
Returns : |
a GValue of type G_TYPE_UINT with value n , to be freed with
wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
GValue * wocky_g_value_slice_new_uint64 (guint64 n
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
a 64-bit unsigned integer |
Returns : |
a GValue of type G_TYPE_UINT64 with value n , to be freed with
wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
GValue * wocky_g_value_slice_new_double (double d
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
a number |
Returns : |
a GValue of type G_TYPE_DOUBLE with value n , to be freed with
wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
GValue * wocky_g_value_slice_new_string (const gchar *string
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
a string to be copied into the value |
Returns : |
a GValue of type G_TYPE_STRING whose value is a copy of string ,
to be freed with wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
GValue * wocky_g_value_slice_new_static_string
(const gchar *string
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
a static string which must remain valid forever, to be pointed to by the value |
Returns : |
a GValue of type G_TYPE_STRING whose value is string ,
to be freed with wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
GValue * wocky_g_value_slice_new_take_string (gchar *string
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
a string which will be freed with g_free() by the returned GValue
(the caller must own it before calling this function, but no longer owns
it after this function returns) |
Returns : |
a GValue of type G_TYPE_STRING whose value is string ,
to be freed with wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
GValue * wocky_g_value_slice_new_boxed (GType type
,gconstpointer p
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
a boxed type |
|
a pointer of type type , which will be copied |
Returns : |
a GValue of type type whose value is a copy of p ,
to be freed with wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
GValue * wocky_g_value_slice_new_static_boxed (GType type
,gconstpointer p
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
a boxed type |
|
a pointer of type type , which must remain valid forever |
Returns : |
a GValue of type type whose value is p ,
to be freed with wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
GValue * wocky_g_value_slice_new_take_boxed (GType type
,gpointer p
);
Slice-allocate and initialize a GValue. This function is convenient to use when constructing hash tables from string to GValue, for example.
|
a boxed type |
|
a pointer of type type which will be freed with g_boxed_free() by the
returned GValue (the caller must own it before calling this function, but
no longer owns it after this function returns) |
Returns : |
a GValue of type type whose value is p ,
to be freed with wocky_g_value_slice_free() or g_slice_free()
|
Since 0.7.27
void wocky_g_value_slice_free (GValue *value
);
Unset and free a slice-allocated GValue.
(GDestroyNotify) wocky_g_value_slice_free
can be used
as a destructor for values in a GHashTable, for example.
|
A GValue which was allocated with the g_slice API |
GValue * wocky_g_value_slice_dup (const GValue *value
);
|
A GValue |
Returns : |
a newly allocated copy of value , to be freed with
wocky_g_value_slice_free() or g_slice_free() . |
Since 0.5.14
gboolean wocky_enum_from_nick (GType enum_type
,const gchar *nick
,gint *value
);
|
the GType of a subtype of GEnum |
|
a non-NULL string purporting to be the nickname of a value of
enum_type
|
|
the address at which to store the value of enum_type corresponding
to nick if this functions returns TRUE ; if this function returns
FALSE , this variable will be left untouched. |
Returns : |
TRUE if nick is a member of enum_type , or FALSE otherwise |
const gchar * wocky_enum_to_nick (GType enum_type
,gint value
);
|
the GType of a subtype of GEnum |
|
a value of enum_type
|
Returns : |
the nickname of value , or NULL if it is not, in fact, a value of
enum_type
|
gchar * wocky_absolutize_path (const gchar *path
);
Return an absolute form of path
. This cleans up duplicate slashes, "." or
".." path segments, etc., and prepends g_get_current_dir()
if necessary, but
does not necessarily resolve symlinks.
#define wocky_implement_finish_copy_pointer(source, tag, copy_func, \ out_param)
#define wocky_implement_finish_return_copy_pointer(source, tag, \ copy_func)