su  1.13.16
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 
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__));
51 
52 SU_DLL su_strlst_t *su_strlst_create_with_dup(su_home_t *, char const *, ...)
53  __attribute__((__malloc__));
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 
81 SU_DLL char const *su_slvprintf(su_strlst_t *self, char const *fmt, va_list ap);
82 
84 SU_DLL char const *su_strlst_item(su_strlst_t const *, usize_t i);
85 
87 SU_DLL char const *su_strlst_set_item(su_strlst_t *self, usize_t i,
88  char const *s);
89 
91 SU_DLL char const *su_strlst_remove(su_strlst_t *, usize_t i);
92 
94 SU_DLL char *su_strlst_join(su_strlst_t *s, su_home_t *home,
95  char const *sep)
96  __attribute__((__malloc__));
97 
99 SU_DLL su_strlst_t *su_strlst_split(su_home_t *, char *s, char const *sep)
100  __attribute__((__malloc__));
101 
103 SU_DLL su_strlst_t *su_strlst_dup_split(su_home_t *, char const *s,
104  char const *sep)
105  __attribute__((__malloc__));
106 
108 SU_DLL usize_t su_strlst_len(su_strlst_t const *l);
109 
110 #if SU_HAVE_INLINE
111 su_inline
112 su_home_t *su_strlst_home(su_strlst_t *s)
113 {
114  return (su_home_t *)s;
115 }
116 #else
117 #define su_strlst_home(s) ((su_home_t *)(s))
118 #endif
119 
121 SU_DLL char const **su_strlst_get_array(su_strlst_t *self)
122  __attribute__((__malloc__));
123 
125 SU_DLL void su_strlst_free_array(su_strlst_t *self, char const * array[]);
126 
127 SOFIA_END_DECLS
128 
129 #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
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_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_split(su_home_t *, char *s, char const *sep))
Split a string.
Definition: su_strlst.c:616
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
usize_t su_strlst_len(su_strlst_t const *l)
Get number of items in list.
Definition: su_strlst.c:666
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_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
void su_strlst_destroy(su_strlst_t *)
Destroy a string list.
Definition: su_strlst.c:314
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_vcreate_with(su_home_t *, char const *, va_list va))
Create a string list with initial values.
Definition: su_strlst.c:212
char const * su_slprintf(su_strlst_t *self, char const *fmt,...)
Append a formatted string to the list.
Definition: su_strlst.c:411
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_copy(su_home_t *home, su_strlst_t const *orig)
Shallow copy a string list.
Definition: su_strlst.c:298
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
void su_strlst_free_array(su_strlst_t *self, char const *array[])
Free a string array.
char const * su_strlst_item(su_strlst_t const *, usize_t i)
Get a numbered item from list.
Definition: su_strlst.c:459
char const * su_strlst_append(su_strlst_t *, char const *str)
Append a string to list.
Definition: su_strlst.c:385
char * su_strlst_dup_append(su_strlst_t *, char const *str)
Duplicate and append a string to list.
Definition: su_strlst.c:352
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
char const * su_strlst_remove(su_strlst_t *, usize_t i)
Remove a numbered item from list.
Definition: su_strlst.c:510

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