su  1.12.11devel
 All Data Structures Files Functions Variables Typedefs Enumerator Macros Groups Pages
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
27 
35 #ifndef SU_ALLOC_H
36 #include <sofia-sip/su_alloc.h>
37 #endif
38 
39 SOFIA_BEGIN_DECLS
40 
41 typedef struct su_strlst_s su_strlst_t;
42 
44 SU_DLL su_strlst_t *su_strlst_create(su_home_t *home)
45  __attribute__((__malloc__));
47 SU_DLL void su_strlst_destroy(su_strlst_t *);
48 
49 SU_DLL su_strlst_t *su_strlst_create_with(su_home_t *, char const *, ...)
50  __attribute__((__malloc__, __sentinel__(0)));
51 
52 SU_DLL su_strlst_t *su_strlst_create_with_dup(su_home_t *, char const *, ...)
53  __attribute__((__malloc__, __sentinel__(0)));
54 
55 SU_DLL su_strlst_t *su_strlst_vcreate_with(su_home_t *,
56  char const *,
57  va_list va)
58  __attribute__((__malloc__));
59 
60 SU_DLL su_strlst_t *su_strlst_vcreate_with_dup(su_home_t *,
61  char const *,
62  va_list va)
63  __attribute__((__malloc__));
64 
66 SU_DLL su_strlst_t *su_strlst_copy(su_home_t *home, su_strlst_t const *orig);
67 
69 SU_DLL su_strlst_t *su_strlst_dup(su_home_t *home, su_strlst_t const *orig);
70 
72 SU_DLL char *su_strlst_dup_append(su_strlst_t *, char const *str);
73 
75 SU_DLL char const *su_strlst_append(su_strlst_t *, char const *str);
76 
78 SU_DLL char const *su_slprintf(su_strlst_t *self, char const *fmt, ...)
79  __attribute__ ((__format__ (printf, 2, 3)));
80 
82 SU_DLL char const *su_slvprintf(su_strlst_t *self, char const *fmt, va_list ap);
83 
85 SU_DLL char const *su_strlst_item(su_strlst_t const *, usize_t i);
86 
88 SU_DLL char const *su_strlst_set_item(su_strlst_t *self, usize_t i,
89  char const *s);
90 
92 SU_DLL char const *su_strlst_remove(su_strlst_t *, usize_t i);
93 
95 SU_DLL char *su_strlst_join(su_strlst_t *s, su_home_t *home,
96  char const *sep)
97  __attribute__((__malloc__));
98 
100 SU_DLL su_strlst_t *su_strlst_split(su_home_t *, char *s, char const *sep)
101  __attribute__((__malloc__));
102 
104 SU_DLL su_strlst_t *su_strlst_dup_split(su_home_t *, char const *s,
105  char const *sep)
106  __attribute__((__malloc__));
107 
109 SU_DLL usize_t su_strlst_len(su_strlst_t const *l);
110 
111 #if SU_HAVE_INLINE
112 su_inline
113 su_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 
122 SU_DLL char const **su_strlst_get_array(su_strlst_t *self)
123  __attribute__((__malloc__));
124 
126 SU_DLL void su_strlst_free_array(su_strlst_t *self, char const * array[]);
127 
128 SOFIA_END_DECLS
129 
130 #endif /* ! defined(SU_STRLST_H) */
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
SU_HOME_T su_home_t
Memory home type.
Definition: su_alloc.h:50
usize_t su_strlst_len(su_strlst_t const *l)
Get number of items in list.
Definition: su_strlst.c:666
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
#define su_inline
Define as suitable declarator static inline functions.
Definition: su_configure.h:90
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
char * su_strlst_dup_append(su_strlst_t *, char const *str)
Duplicate and append a string to list.
Definition: su_strlst.c:352
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
su_strlst_t * su_strlst_create(su_home_t *home))
Create a string list.
Definition: su_strlst.c:176
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
char const * su_slprintf(su_strlst_t *self, char const *fmt,...)))
Append a formatted string to the list.
Definition: su_strlst.c:411
void su_strlst_free_array(su_strlst_t *self, char const *array[])
Free a string array.
char const * su_strlst_remove(su_strlst_t *, usize_t i)
Remove a numbered item from list.
Definition: su_strlst.c:510
Description of array.
Definition: foo.c:51
char const * su_strlst_append(su_strlst_t *, char const *str)
Append a string to list.
Definition: su_strlst.c:385
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_create_with(su_home_t *, char const *,...)))
Create a string list with initial values.
Definition: su_strlst.c:194
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
Home-based memory management interface.
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
su_strlst_t * su_strlst_split(su_home_t *, char *s, char const *sep))
Split a string.
Definition: su_strlst.c:616
void su_strlst_destroy(su_strlst_t *)
Destroy a string list.
Definition: su_strlst.c:314
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_dup_split(su_home_t *, char const *s, char const *sep))
Duplicate and split a string.
Definition: su_strlst.c:641

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