A separated list of strings. More...
#include "config.h"
#include <stddef.h>
#include "config/types.h"
#include "slist.h"
#include "buffer.h"
#include "list.h"
#include "memory.h"
#include "queue.h"
#include "string2.h"
Go to the source code of this file.
Functions | |
struct Slist * | slist_new (uint32_t flags) |
Create a new string list. | |
struct Slist * | slist_add_string (struct Slist *list, const char *str) |
Add a string to a list. | |
bool | slist_equal (const struct Slist *a, const struct Slist *b) |
Compare two string lists. | |
struct Slist * | slist_dup (const struct Slist *list) |
Create a copy of an Slist object. | |
void | slist_free (struct Slist **ptr) |
Free an Slist object. | |
bool | slist_is_empty (const struct Slist *list) |
Is the slist empty? | |
bool | slist_is_member (const struct Slist *list, const char *str) |
Is a string a member of a list? | |
struct Slist * | slist_parse (const char *str, uint32_t flags) |
Parse a list of strings into a list. | |
struct Slist * | slist_remove_string (struct Slist *list, const char *str) |
Remove a string from a list. | |
int | slist_to_buffer (const struct Slist *list, struct Buffer *buf) |
Export an Slist to a Buffer. | |
A separated list of strings.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file slist.c.
struct Slist * slist_new | ( | uint32_t | flags | ) |
Create a new string list.
flags | Flag to set, e.g. D_SLIST_SEP_COMMA |
ptr | New string list |
Definition at line 51 of file slist.c.
Add a string to a list.
list | List to modify |
str | String to add |
ptr | Modified list |
Definition at line 66 of file slist.c.
Compare two string lists.
a | First list |
b | Second list |
true | They are identical |
Definition at line 89 of file slist.c.
Create a copy of an Slist object.
list | Slist to duplicate |
ptr | New Slist object |
Definition at line 106 of file slist.c.
void slist_free | ( | struct Slist ** | ptr | ) |
Free an Slist object.
ptr | Slist to free |
Definition at line 122 of file slist.c.
bool slist_is_empty | ( | const struct Slist * | list | ) |
bool slist_is_member | ( | const struct Slist * | list, |
const char * | str | ||
) |
Is a string a member of a list?
list | List to modify |
str | String to find |
true | String is in the list |
Definition at line 152 of file slist.c.
struct Slist * slist_parse | ( | const char * | str, |
uint32_t | flags | ||
) |
Parse a list of strings into a list.
str | String of strings |
flags | Flags, e.g. D_SLIST_ALLOW_EMPTY |
ptr | New Slist object |
Definition at line 175 of file slist.c.
Remove a string from a list.
list | List to modify |
str | String to remove |
ptr | Modified list |
Definition at line 233 of file slist.c.
list | List to export |
buf | Buffer for the results |
num | Number of strings written to Buffer |
Definition at line 267 of file slist.c.