Libecoli 0.11.1
Extensible COmmand LIne library
Loading...
Searching...
No Matches
strvec.h
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2016, Olivier MATZ <zer0@droids-corp.org>
3 */
4
15
16#pragma once
17#include <stdio.h>
18
20struct ec_strvec;
21
28struct ec_strvec *ec_strvec(void);
29
39#define EC_STRVEC(args...) \
40 ({ \
41 const char *_arr[] = {args}; \
42 ec_strvec_from_array(_arr, EC_COUNT_OF(_arr)); \
43 })
44
57struct ec_strvec *ec_strvec_from_array(const char *const *strarr, size_t n);
58
74
80#define EC_STRVEC_ATTR_START "start"
82#define EC_STRVEC_ATTR_END "end"
83
98struct ec_strvec *
99ec_strvec_sh_lex_str(const char *str, ec_strvec_flag_t flags, char *unclosed_quote);
100
113int ec_strvec_set(struct ec_strvec *strvec, size_t idx, const char *s);
114
125int ec_strvec_add(struct ec_strvec *strvec, const char *s);
126
135int ec_strvec_del_last(struct ec_strvec *strvec);
136
147struct ec_strvec *ec_strvec_dup(const struct ec_strvec *strvec);
148
163struct ec_strvec *ec_strvec_ndup(const struct ec_strvec *strvec, size_t off, size_t len);
164
171void ec_strvec_free(struct ec_strvec *strvec);
172
181size_t ec_strvec_len(const struct ec_strvec *strvec);
182
194const char *ec_strvec_val(const struct ec_strvec *strvec, size_t idx);
195
207const struct ec_dict *ec_strvec_get_attrs(const struct ec_strvec *strvec, size_t idx);
208
222int ec_strvec_set_attrs(struct ec_strvec *strvec, size_t idx, struct ec_dict *attrs);
223
234int ec_strvec_cmp(const struct ec_strvec *strvec1, const struct ec_strvec *strvec2);
235
246void ec_strvec_sort(struct ec_strvec *strvec, int (*str_cmp)(const char *s1, const char *s2));
247
256void ec_strvec_dump(FILE *out, const struct ec_strvec *strvec);
257
struct ec_dict * ec_dict(void)
int ec_strvec_set(struct ec_strvec *strvec, size_t idx, const char *s)
int ec_strvec_cmp(const struct ec_strvec *strvec1, const struct ec_strvec *strvec2)
struct ec_strvec * ec_strvec_from_array(const char *const *strarr, size_t n)
struct ec_strvec * ec_strvec_sh_lex_str(const char *str, ec_strvec_flag_t flags, char *unclosed_quote)
struct ec_strvec * ec_strvec_ndup(const struct ec_strvec *strvec, size_t off, size_t len)
void ec_strvec_free(struct ec_strvec *strvec)
int ec_strvec_set_attrs(struct ec_strvec *strvec, size_t idx, struct ec_dict *attrs)
const char * ec_strvec_val(const struct ec_strvec *strvec, size_t idx)
void ec_strvec_sort(struct ec_strvec *strvec, int(*str_cmp)(const char *s1, const char *s2))
int ec_strvec_del_last(struct ec_strvec *strvec)
void ec_strvec_dump(FILE *out, const struct ec_strvec *strvec)
ec_strvec_flag_t
Definition strvec.h:62
struct ec_strvec * ec_strvec(void)
int ec_strvec_add(struct ec_strvec *strvec, const char *s)
const struct ec_dict * ec_strvec_get_attrs(const struct ec_strvec *strvec, size_t idx)
struct ec_strvec * ec_strvec_dup(const struct ec_strvec *strvec)
size_t ec_strvec_len(const struct ec_strvec *strvec)
@ EC_STRVEC_STRICT
Definition strvec.h:67
@ EC_STRVEC_TRAILSP
Definition strvec.h:72