]> git.meshlink.io Git - catta/blobdiff - avahi-common/strlst.h
move rr.[ch] back to avahi-core/
[catta] / avahi-common / strlst.h
index 1d9ef34f961c40283b70668572b04e0e887b85f1..a4a4202a19c16ca9ca9f1962b3b10b60d85811e9 100644 (file)
@@ -25,6 +25,8 @@
 #include <glib.h>
 #include <avahi-common/cdecl.h>
 
+/** \file strlst.h Implementation of a data type to store lists of strings */
+
 AVAHI_C_DECL_BEGIN
 
 /** Linked list of strings that can contain any number of binary
@@ -47,6 +49,11 @@ AvahiStringList *avahi_string_list_new(const gchar *txt, ...);
 /** Same as avahi_string_list_new() but pass a va_list structure */
 AvahiStringList *avahi_string_list_new_va(va_list va);
 
+/** Create a new string list from a string array. The strings are
+ * copied using g_strdup(). length should contain the length of the
+ * array, or -1 if the array is NULL terminated*/
+AvahiStringList *avahi_string_list_new_from_array(const gchar **array, gint length);
+
 /** Free a string list */
 void avahi_string_list_free(AvahiStringList *l);
 
@@ -55,10 +62,17 @@ void avahi_string_list_free(AvahiStringList *l);
  * start. */
 AvahiStringList *avahi_string_list_add(AvahiStringList *l, const gchar *text);
 
-/** Append am arbitrary length byte string to the list. Returns the
+/** Append an arbitrary length byte string to the list. Returns the
  * new list start. */
 AvahiStringList *avahi_string_list_add_arbitrary(AvahiStringList *l, const guint8 *text, guint size);
 
+/** Append a new entry to the string list. The string is not filled
+with data. The caller should fill in string data afterwards by writing
+it to l->text, where l is the pointer returned by this function. This
+function exists solely to optimize a few operations where otherwise
+superfluous string copying would be necessary. */
+AvahiStringList*avahi_string_list_add_anonymous(AvahiStringList *l, guint size);
+
 /** Same as avahi_string_list_add(), but takes a variable number of
  * NUL terminated strings. The argument list must be terminated by a
  * NULL pointer. Returns the new list start. */
@@ -86,6 +100,13 @@ gboolean avahi_string_list_equal(const AvahiStringList *a, const AvahiStringList
 /** Copy a string list */
 AvahiStringList *avahi_string_list_copy(const AvahiStringList *l);
 
+/** Reverse the string list. */
+AvahiStringList* avahi_string_list_reverse(AvahiStringList *l);
+
+/** Return the number of elements in the string list */
+guint avahi_string_list_length(const AvahiStringList *l);
+
+
 AVAHI_C_DECL_END
 
 #endif