]> git.meshlink.io Git - catta/blobdiff - avahi-common/strlst.h
small fixes in mans and INSTALL
[catta] / avahi-common / strlst.h
index 4fde8eb8b7e4ebaf0fcaf3250fc7a88495bc1646..a4a4202a19c16ca9ca9f1962b3b10b60d85811e9 100644 (file)
 ***/
 
 #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
- * characters, include NUL bytes. An empty list is created by
+ * characters, including NUL bytes. An empty list is created by
  * assigning a NULL to a pointer to AvahiStringList. The string list
  * is stored in reverse order, so that appending to the string list is
  * effectively a prepending to the linked list.  This object is used
@@ -44,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);
 
@@ -52,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. */
@@ -83,5 +100,14 @@ 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