su 1.12.11devel
Loading...
Searching...
No Matches
su_strlst.h
Go to the documentation of this file.
1/*
2 * This file is part of the Sofia-SIP package
3 *
4 * Copyright (C) 2006 Nokia Corporation.
5 *
6 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25#ifndef SU_STRLST_H
26#define SU_STRLST_H
35#ifndef SU_ALLOC_H
36#include <sofia-sip/su_alloc.h>
37#endif
38
39SOFIA_BEGIN_DECLS
40
41typedef struct su_strlst_s su_strlst_t;
42
44SU_DLL su_strlst_t *su_strlst_create(su_home_t *home)
45 __attribute__((__malloc__));
47SU_DLL void su_strlst_destroy(su_strlst_t *);
48
49SU_DLL su_strlst_t *su_strlst_create_with(su_home_t *, char const *, ...)
50 __attribute__((__malloc__, __sentinel__(0)));
51
52SU_DLL su_strlst_t *su_strlst_create_with_dup(su_home_t *, char const *, ...)
53 __attribute__((__malloc__, __sentinel__(0)));
54
55SU_DLL su_strlst_t *su_strlst_vcreate_with(su_home_t *,
56 char const *,
57 va_list va)
58 __attribute__((__malloc__));
59
60SU_DLL su_strlst_t *su_strlst_vcreate_with_dup(su_home_t *,
61 char const *,
62 va_list va)
63 __attribute__((__malloc__));
64
66SU_DLL su_strlst_t *su_strlst_copy(su_home_t *home, su_strlst_t const *orig);
67
69SU_DLL su_strlst_t *su_strlst_dup(su_home_t *home, su_strlst_t const *orig);
70
72SU_DLL char *su_strlst_dup_append(su_strlst_t *, char const *str);
73
75SU_DLL char const *su_strlst_append(su_strlst_t *, char const *str);
76
78SU_DLL char const *su_slprintf(su_strlst_t *self, char const *fmt, ...)
79 __attribute__ ((__format__ (printf, 2, 3)));
80
82SU_DLL char const *su_slvprintf(su_strlst_t *self, char const *fmt, va_list ap);
83
85SU_DLL char const *su_strlst_item(su_strlst_t const *, usize_t i);
86
88SU_DLL char const *su_strlst_set_item(su_strlst_t *self, usize_t i,
89 char const *s);
90
92SU_DLL char const *su_strlst_remove(su_strlst_t *, usize_t i);
93
95SU_DLL char *su_strlst_join(su_strlst_t *s, su_home_t *home,
96 char const *sep)
97 __attribute__((__malloc__));
98
100SU_DLL su_strlst_t *su_strlst_split(su_home_t *, char *s, char const *sep)
101 __attribute__((__malloc__));
102
104SU_DLL su_strlst_t *su_strlst_dup_split(su_home_t *, char const *s,
105 char const *sep)
106 __attribute__((__malloc__));
107
109SU_DLL usize_t su_strlst_len(su_strlst_t const *l);
110
111#if SU_HAVE_INLINE
113su_home_t *su_strlst_home(su_strlst_t *s)
114{
115 return (su_home_t *)s;
116}
117#else
118#define su_strlst_home(s) ((su_home_t *)(s))
119#endif
120
122SU_DLL char const **su_strlst_get_array(su_strlst_t *self)
123 __attribute__((__malloc__));
124
126SU_DLL void su_strlst_free_array(su_strlst_t *self, char const * array[]);
127
128SOFIA_END_DECLS
129
130#endif /* ! defined(SU_STRLST_H) */
Description of array.
Definition foo.c:52
Home-based memory management interface.
SU_HOME_T su_home_t
Memory home type.
Definition su_alloc.h:50
#define su_inline
Define as suitable declarator static inline functions.
Definition su_configure.h:90
su_strlst_t * su_strlst_vcreate_with_dup(su_home_t *, char const *, va_list va))
Create a string list with duplicates of initial values.
Definition su_strlst.c:243
char * su_strlst_dup_append(su_strlst_t *, char const *str)
Duplicate and append a string to list.
Definition su_strlst.c:352
char const * su_strlst_remove(su_strlst_t *, usize_t i)
Remove a numbered item from list.
Definition su_strlst.c:510
su_strlst_t * su_strlst_create(su_home_t *home))
Create a string list.
Definition su_strlst.c:176
char const * su_strlst_set_item(su_strlst_t *self, usize_t i, char const *s)
Set a numbered item to list.
Definition su_strlst.c:479
usize_t su_strlst_len(su_strlst_t const *l)
Get number of items in list.
Definition su_strlst.c:666
char * su_strlst_join(su_strlst_t *s, su_home_t *home, char const *sep))
Concatenate list of strings to one string.
Definition su_strlst.c:547
char const * su_strlst_item(su_strlst_t const *, usize_t i)
Get a numbered item from list.
Definition su_strlst.c:459
void su_strlst_destroy(su_strlst_t *)
Destroy a string list.
Definition su_strlst.c:314
char const * su_slvprintf(su_strlst_t *self, char const *fmt, va_list ap)
Append a formatted string to the list.
Definition su_strlst.c:435
su_strlst_t * su_strlst_create_with(su_home_t *, char const *,...)))
Create a string list with initial values.
Definition su_strlst.c:194
char const ** su_strlst_get_array(su_strlst_t *self))
Get a string array from list.
Definition su_strlst.c:682
su_strlst_t * su_strlst_dup(su_home_t *home, su_strlst_t const *orig)
Deep copy a string list.
Definition su_strlst.c:304
char const * su_slprintf(su_strlst_t *self, char const *fmt,...)))
Append a formatted string to the list.
Definition su_strlst.c:411
su_strlst_t * su_strlst_copy(su_home_t *home, su_strlst_t const *orig)
Shallow copy a string list.
Definition su_strlst.c:298
void su_strlst_free_array(su_strlst_t *self, char const *array[])
Free a string array.
su_strlst_t * su_strlst_dup_split(su_home_t *, char const *s, char const *sep))
Duplicate and split a string.
Definition su_strlst.c:641
su_strlst_t * su_strlst_vcreate_with(su_home_t *, char const *, va_list va))
Create a string list with initial values.
Definition su_strlst.c:212
su_strlst_t * su_strlst_create_with_dup(su_home_t *, char const *,...)))
Create a string list with duplicatedd initial values.
Definition su_strlst.c:225
su_strlst_t * su_strlst_split(su_home_t *, char *s, char const *sep))
Split a string.
Definition su_strlst.c:616
char const * su_strlst_append(su_strlst_t *, char const *str)
Append a string to list.
Definition su_strlst.c:385

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.